-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowserify-frog-min.js
8 lines (8 loc) · 246 KB
/
browserify-frog-min.js
1
2
3
4
5
6
7
8
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){window.FrogJS=FrogJS=require("./index.js")},{"./index.js":2}],2:[function(require,module,exports){module.exports={crypto:require("./lib/transactions/crypto.js"),dapp:require("./lib/transactions/dapp.js"),transfer:require("./lib/transactions/transfer.js"),delegate:require("./lib/transactions/delegate.js"),transaction:require("./lib/transactions/transaction.js"),vote:require("./lib/transactions/vote.js"),uia:require("./lib/transactions/uia.js"),storage:require("./lib/transactions/storage.js"),options:require("./lib/options.js"),utils:{slots:require("./lib/time/slots.js"),format:require("./lib/time/format.js")}}},{"./lib/options.js":7,"./lib/time/format.js":8,"./lib/time/slots.js":9,"./lib/transactions/crypto.js":10,"./lib/transactions/dapp.js":11,"./lib/transactions/delegate.js":12,"./lib/transactions/storage.js":13,"./lib/transactions/transaction.js":14,"./lib/transactions/transfer.js":15,"./lib/transactions/uia.js":16,"./lib/transactions/vote.js":17}],3:[function(require,module,exports){(function(Buffer){var sha256=require("fast-sha256");var RIPEMD160=require("ripemd160");var base58check=require("./base58check");const NORMAL_PREFIX="SG";module.exports={isAddress:function(address){return this.isBase58CheckAddress(address)},isBase58CheckAddress:function(address){if(typeof address!=="string"){return false}if(!base58check.decodeUnsafe(address.slice(1))){return false}return[NORMAL_PREFIX].indexOf(address[0])!==-1},generateBase58CheckAddress:function(publicKey){if(typeof publicKey==="string"){publicKey=Buffer.from(publicKey,"hex")}var h1=sha256.hash(publicKey);var h2=(new RIPEMD160).update(Buffer.from(h1)).digest();return NORMAL_PREFIX+base58check.encode(h2)}}}).call(this,require("buffer").Buffer)},{"./base58check":6,buffer:20,"fast-sha256":24,ripemd160:46}],4:[function(require,module,exports){(function(Buffer){module.exports=function base(ALPHABET){var ALPHABET_MAP={};var BASE=ALPHABET.length;var LEADER=ALPHABET.charAt(0);for(var z=0;z<ALPHABET.length;z++){var x=ALPHABET.charAt(z);if(ALPHABET_MAP[x]!==undefined)throw new TypeError(x+" is ambiguous");ALPHABET_MAP[x]=z}function encode(source){if(source.length===0)return"";var digits=[0];for(var i=0;i<source.length;++i){for(var j=0,carry=source[i];j<digits.length;++j){carry+=digits[j]<<8;digits[j]=carry%BASE;carry=carry/BASE|0}while(carry>0){digits.push(carry%BASE);carry=carry/BASE|0}}var string="";for(var k=0;source[k]===0&&k<source.length-1;++k)string+=ALPHABET[0];for(var q=digits.length-1;q>=0;--q)string+=ALPHABET[digits[q]];return string}function decodeUnsafe(string){if(string.length===0)return Buffer.allocUnsafe(0);var bytes=[0];for(var i=0;i<string.length;i++){var value=ALPHABET_MAP[string[i]];if(value===undefined)return;for(var j=0,carry=value;j<bytes.length;++j){carry+=bytes[j]*BASE;bytes[j]=carry&255;carry>>=8}while(carry>0){bytes.push(carry&255);carry>>=8}}for(var k=0;string[k]===LEADER&&k<string.length-1;++k){bytes.push(0)}return Buffer.from(bytes.reverse())}function decode(string){var buffer=decodeUnsafe(string);if(buffer)return buffer;throw new Error("Non-base"+BASE+" character")}return{encode:encode,decodeUnsafe:decodeUnsafe,decode:decode}}}).call(this,require("buffer").Buffer)},{buffer:20}],5:[function(require,module,exports){var basex=require("./base-x.js");var ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";module.exports=basex(ALPHABET)},{"./base-x.js":4}],6:[function(require,module,exports){(function(Buffer){"use strict";var sha256=require("fast-sha256");var base58=require("./bs58.js");function sha256x2(buffer){return Buffer.from(sha256.hash(sha256.hash(buffer)))}function encode(payload){var checksum=sha256x2(payload);return base58.encode(Buffer.concat([payload,checksum],payload.length+4))}function decodeRaw(buffer){var payload=buffer.slice(0,-4);var checksum=buffer.slice(-4);var newChecksum=sha256x2(payload);if(checksum[0]^newChecksum[0]|checksum[1]^newChecksum[1]|checksum[2]^newChecksum[2]|checksum[3]^newChecksum[3])return;return payload}function decodeUnsafe(string){var buffer=base58.decodeUnsafe(string);if(!buffer)return;return decodeRaw(buffer)}function decode(string){var buffer=base58.decode(string);var payload=decodeRaw(buffer);if(!payload)throw new Error("Invalid checksum");return payload}module.exports={encode:encode,decode:decode,decodeUnsafe:decodeUnsafe}}).call(this,require("buffer").Buffer)},{"./bs58.js":5,buffer:20,"fast-sha256":24}],7:[function(require,module,exports){var optionMap={clientDriftSeconds:5};module.exports={set:function(key,val){optionMap[key]=val},get:function(key){return optionMap[key]},getAll:function(){return optionMap}}},{}],8:[function(require,module,exports){var slots=require("./slots.js");function timeAgo(time){var d=slots.beginEpochTime();var t=parseInt(d.getTime()/1e3);time=new Date((time+t)*1e3);var currentTime=(new Date).getTime();var diffTime=(currentTime-time.getTime())/1e3;if(diffTime<60){return Math.floor(diffTime)+" sec ago"}if(Math.floor(diffTime/60)<=1){return Math.floor(diffTime/60)+" min ago"}if(diffTime/60<60){return Math.floor(diffTime/60)+" mins ago"}if(Math.floor(diffTime/60/60)<=1){return Math.floor(diffTime/60/60)+" hour ago"}if(diffTime/60/60<24){return Math.floor(diffTime/60/60)+" hours ago"}if(Math.floor(diffTime/60/60/24)<=1){return Math.floor(diffTime/60/60/24)+" day ago"}if(diffTime/60/60/24<30){return Math.floor(diffTime/60/60/24)+" days ago"}if(Math.floor(diffTime/60/60/24/30)<=1){return Math.floor(diffTime/60/60/24/30)+" month ago"}if(diffTime/60/60/24/30<12){return Math.floor(diffTime/60/60/24/30)+" months ago"}if(Math.floor(diffTime/60/60/24/30/12)<=1){return Math.floor(diffTime/60/60/24/30/12)+" year ago"}return Math.floor(diffTime/60/60/24/30/12)+" years ago"}function fullTimestamp(time){var d=slots.beginEpochTime();var t=parseInt(d.getTime()/1e3);d=new Date((time+t)*1e3);var month=d.getMonth()+1;if(month<10){month="0"+month}var day=d.getDate();if(day<10){day="0"+day}var h=d.getHours();var m=d.getMinutes();var s=d.getSeconds();if(h<10){h="0"+h}if(m<10){m="0"+m}if(s<10){s="0"+s}return d.getFullYear()+"/"+month+"/"+day+" "+h+":"+m+":"+s}module.exports={timeAgo:timeAgo,fullTimestamp:fullTimestamp}},{"./slots.js":9}],9:[function(require,module,exports){function getEpochTime(time){if(time===undefined){time=(new Date).getTime()}var d=beginEpochTime();var t=d.getTime();return Math.floor((time-t)/1e3)}function beginEpochTime(){var d=new Date(Date.UTC(2017,12,1,12,0,0,0));return d}var interval=10,delegates=101;function getTime(time){return getEpochTime(time)}function getRealTime(epochTime){if(epochTime===undefined){epochTime=getTime()}var d=beginEpochTime();var t=Math.floor(d.getTime()/1e3)*1e3;return t+epochTime*1e3}function getSlotNumber(epochTime){if(epochTime===undefined){epochTime=getTime()}return Math.floor(epochTime/interval)}function getSlotTime(slot){return slot*interval}function getNextSlot(){var slot=getSlotNumber();return slot+1}function getLastSlot(nextSlot){return nextSlot+delegates}module.exports={interval:interval,delegates:delegates,getTime:getTime,getRealTime:getRealTime,getSlotNumber:getSlotNumber,getSlotTime:getSlotTime,getNextSlot:getNextSlot,getLastSlot:getLastSlot,beginEpochTime:beginEpochTime}},{}],10:[function(require,module,exports){(function(Buffer){var sha256=require("fast-sha256");var addressHelper=require("../address.js");if(typeof Buffer==="undefined"){Buffer=require("buffer/").Buffer}var ByteBuffer=require("bytebuffer");var nacl=require("tweetnacl");var fixedPoint=Math.pow(10,8);function getSignatureBytes(signature){var bb=new ByteBuffer(32,true);var publicKeyBuffer=new Buffer(signature.publicKey,"hex");for(var i=0;i<publicKeyBuffer.length;i++){bb.writeByte(publicKeyBuffer[i])}bb.flip();return new Uint8Array(bb.toArrayBuffer())}function toLocalBuffer(buf){if(typeof window!=="undefined"){return new Uint8Array(buf.toArrayBuffer())}else{return buf.toBuffer()}}function sha256Bytes(data){return Buffer.from(sha256.hash(data))}function sha256Hex(data){return Buffer.from(sha256.hash(data)).toString("hex")}function getDAppBytes(dapp){try{var buf=new Buffer([]);var nameBuf=new Buffer(dapp.name,"utf8");buf=Buffer.concat([buf,nameBuf]);if(dapp.description){var descriptionBuf=new Buffer(dapp.description,"utf8");buf=Buffer.concat([buf,descriptionBuf])}if(dapp.tags){var tagsBuf=new Buffer(dapp.tags,"utf8");buf=Buffer.concat([buf,tagsBuf])}if(dapp.link){buf=Buffer.concat([buf,new Buffer(dapp.link,"utf8")])}if(dapp.icon){buf=Buffer.concat([buf,new Buffer(dapp.icon,"utf8")])}var bb=new ByteBuffer(1,true);bb.writeInt(dapp.type);bb.writeInt(dapp.category);bb.writeString(dapp.delegates.join(","));bb.writeInt(dapp.unlockDelegates);bb.flip();buf=Buffer.concat([buf,bb.toBuffer()])}catch(e){throw Error(e.toString())}return buf}function getInTransferBytes(inTransfer){try{var buf=new Buffer([]);var dappId=new Buffer(inTransfer.dappId,"utf8");var currency=new Buffer(inTransfer.currency,"utf8");buf=Buffer.concat([buf,dappId,currency]);if(inTransfer.currency!=="XAS"){var amount=new Buffer(inTransfer.amount,"utf8");buf=Buffer.concat([buf,amount])}}catch(e){throw Error(e.toString())}return buf}function getOutTransferBytes(outTransfer){try{var buf=new Buffer([]);var dappIdBuf=new Buffer(outTransfer.dappId,"utf8");var transactionIdBuff=new Buffer(outTransfer.transactionId,"utf8");var currencyBuff=new Buffer(outTransfer.currency,"utf8");var amountBuff=new Buffer(outTransfer.amount,"utf8");buf=Buffer.concat([buf,dappIdBuf,transactionIdBuff,currencyBuff,amountBuff])}catch(e){throw Error(e.toString())}return buf}function getBytes(transaction,skipSignature,skipSecondSignature){var assetSize=0,assetBytes=null;switch(transaction.type){case 1:assetBytes=getSignatureBytes(transaction.asset.signature);break;case 2:assetBytes=new Buffer(transaction.asset.delegate.username,"utf8");break;case 3:assetBytes=new Buffer(transaction.asset.vote.votes.join(""),"utf8");break;case 4:var keysgroupBuffer=new Buffer(transaction.asset.multisignature.keysgroup.join(""),"utf8");var bb=new ByteBuffer(1+1+keysgroupBuffer.length,true);bb.writeByte(transaction.asset.multisignature.min);bb.writeByte(transaction.asset.multisignature.lifetime);for(var i=0;i<keysgroupBuffer.length;i++){bb.writeByte(keysgroupBuffer[i])}bb.flip();assetBytes=bb.toBuffer();break;case 5:assetBytes=getDAppBytes(transaction.asset.dapp);break;case 6:assetBytes=getInTransferBytes(transaction.asset.inTransfer);break;case 7:assetBytes=getOutTransferBytes(transaction.asset.outTransfer);break;case 8:assetBytes=toLocalBuffer(ByteBuffer.fromHex(transaction.asset.storage.content));break;case 9:var bb=new ByteBuffer(1,true);var asset=transaction.asset.uiaIssuer;bb.writeString(asset.name);bb.writeString(asset.desc);bb.flip();assetBytes=toLocalBuffer(bb);break;case 10:var bb=new ByteBuffer(1,true);var asset=transaction.asset.uiaAsset;bb.writeString(asset.name);bb.writeString(asset.desc);bb.writeString(asset.maximum);bb.writeByte(asset.precision);if(typeof asset.strategy==="string"&&asset.strategy.length>0){bb.writeString(asset.strategy)}bb.writeByte(asset.allowWriteoff);bb.writeByte(asset.allowWhitelist);bb.writeByte(asset.allowBlacklist);bb.flip();assetBytes=toLocalBuffer(bb);break;case 11:var bb=new ByteBuffer(1,true);var asset=transaction.asset.uiaFlags;bb.writeString(asset.currency);bb.writeByte(asset.flagType);bb.writeByte(asset.flag);bb.flip();assetBytes=toLocalBuffer(bb);break;case 12:var bb=new ByteBuffer(1,true);var asset=transaction.asset.uiaAcl;bb.writeString(asset.currency);bb.writeString(asset.operator);bb.writeByte(asset.flag);for(var i=0;i<asset.list.length;++i){bb.writeString(asset.list[i])}bb.flip();assetBytes=toLocalBuffer(bb);break;case 13:var bb=new ByteBuffer(1,true);var asset=transaction.asset.uiaIssue;bb.writeString(asset.currency);bb.writeString(asset.amount);bb.flip();assetBytes=toLocalBuffer(bb);break;case 14:var bb=new ByteBuffer(1,true);var asset=transaction.asset.uiaTransfer;bb.writeString(asset.currency);bb.writeString(asset.amount);bb.flip();assetBytes=toLocalBuffer(bb);break}if(transaction.__assetBytes__){assetBytes=transaction.__assetBytes__}if(assetBytes)assetSize=assetBytes.length;if(transaction.requesterPublicKey){assetSize+=32}var bb=new ByteBuffer(1,true);bb.writeByte(transaction.type);bb.writeInt(transaction.timestamp);var senderPublicKeyBuffer=new Buffer(transaction.senderPublicKey,"hex");for(var i=0;i<senderPublicKeyBuffer.length;i++){bb.writeByte(senderPublicKeyBuffer[i])}if(transaction.requesterPublicKey){var requesterPublicKey=new Buffer(transaction.requesterPublicKey,"hex");for(var i=0;i<requesterPublicKey.length;i++){bb.writeByte(requesterPublicKey[i])}}if(transaction.recipientId){bb.writeString(transaction.recipientId)}else{for(var i=0;i<8;i++){bb.writeByte(0)}}if(transaction.message)bb.writeString(transaction.message);if(transaction.args){var args=transaction.args;for(var i=0;i<args.length;++i){bb.writeString(args[i])}}if(assetSize>0){for(var i=0;i<assetSize;i++){bb.writeByte(assetBytes[i])}}if(!skipSignature&&transaction.signature){var signatureBuffer=new Buffer(transaction.signature,"hex");for(var i=0;i<signatureBuffer.length;i++){bb.writeByte(signatureBuffer[i])}}if(!skipSecondSignature&&transaction.signSignature){var signSignatureBuffer=new Buffer(transaction.signSignature,"hex");for(var i=0;i<signSignatureBuffer.length;i++){bb.writeByte(signSignatureBuffer[i])}}bb.flip();var arrayBuffer=new Uint8Array(bb.toArrayBuffer());var buffer=[];for(var i=0;i<arrayBuffer.length;i++){buffer[i]=arrayBuffer[i]}return new Buffer(buffer)}function getId(transaction){return sha256Hex(getBytes(transaction))}function getHash(transaction,skipSignature,skipSecondSignature){return sha256Bytes(getBytes(transaction,skipSignature,skipSecondSignature))}function getFee(transaction){return 0}function sign(transaction,keys){var hash=getHash(transaction,true,true);var signature=nacl.sign.detached(hash,new Buffer(keys.privateKey,"hex"));if(!transaction.signature){transaction.signature=new Buffer(signature).toString("hex")}else{return new Buffer(signature).toString("hex")}}function secondSign(transaction,keys){var hash=getHash(transaction);var signature=nacl.sign.detached(hash,new Buffer(keys.privateKey,"hex"));transaction.signSignature=new Buffer(signature).toString("hex")}function signBytes(bytes,keys){var hash=sha256Bytes(new Buffer(bytes,"hex"));var signature=nacl.sign.detached(hash,new Buffer(keys.privateKey,"hex"));return new Buffer(signature).toString("hex")}function verify(transaction){var remove=64;if(transaction.signSignature){remove=128}var bytes=getBytes(transaction);var data2=new Buffer(bytes.length-remove);for(var i=0;i<data2.length;i++){data2[i]=bytes[i]}var hash=sha256Bytes(data2);var signatureBuffer=new Buffer(transaction.signature,"hex");var senderPublicKeyBuffer=new Buffer(transaction.senderPublicKey,"hex");return nacl.sign.detached.verify(hash,signatureBuffer,senderPublicKeyBuffer)}function verifySecondSignature(transaction,publicKey){var bytes=getBytes(transaction);var data2=new Buffer(bytes.length-64);for(var i=0;i<data2.length;i++){data2[i]=bytes[i]}var hash=sha256Bytes(data2);var signSignatureBuffer=new Buffer(transaction.signSignature,"hex");var publicKeyBuffer=new Buffer(publicKey,"hex");return nacl.sign.detached.verify(hash,signSignatureBuffer,publicKeyBuffer)}function verifyBytes(bytes,signature,publicKey){var hash=sha256Bytes(new Buffer(bytes,"hex"));var signatureBuffer=new Buffer(signature,"hex");var publicKeyBuffer=new Buffer(publicKey,"hex");return nacl.sign.detached.verify(hash,signatureBuffer,publicKeyBuffer)}function getKeys(secret){var hash=sha256Bytes(new Buffer(secret));var keypair=nacl.sign.keyPair.fromSeed(hash);return{publicKey:new Buffer(keypair.publicKey).toString("hex"),privateKey:new Buffer(keypair.secretKey).toString("hex")}}function getAddress(publicKey){return addressHelper.generateBase58CheckAddress(publicKey)}module.exports={getBytes:getBytes,getHash:getHash,getId:getId,getFee:getFee,sign:sign,secondSign:secondSign,getKeys:getKeys,getAddress:getAddress,verify:verify,verifySecondSignature:verifySecondSignature,fixedPoint:fixedPoint,signBytes:signBytes,toLocalBuffer:toLocalBuffer,verifyBytes:verifyBytes,isAddress:addressHelper.isAddress,isBase58CheckAddress:addressHelper.isBase58CheckAddress}}).call(this,require("buffer").Buffer)},{"../address.js":3,buffer:20,"buffer/":20,bytebuffer:21,"fast-sha256":24,tweetnacl:50}],11:[function(require,module,exports){(function(Buffer){var ByteBuffer=require("bytebuffer");var crypto=require("./crypto.js");var slots=require("../time/slots.js");var globalOptions=require("../options.js");function createDApp(options,secret,witnessSecret){var keys=crypto.getKeys(secret);var transaction={type:5,recipientId:null,senderPublicKey:keys.publicKey,timestamp:slots.getTime()-globalOptions.get("clientDriftSeconds"),asset:{dapp:{category:options.category,name:options.name,description:options.description,tags:options.tags,type:options.type,link:options.link,icon:options.icon,delegates:options.delegates,unlockDelegates:options.unlockDelegates}}};crypto.sign(transaction,keys);if(witnessSecret){var secondKeys=crypto.getKeys(witnessSecret);transaction["witnessId"]=crypto.getAddress(secondKeys.publicKey);crypto.secondSign(transaction,secondKeys)}transaction.id=crypto.getId(transaction);return transaction}function getDAppTransactionBytes(trs,skipSignature){var bb=new ByteBuffer(1,true);bb.writeInt(trs.timestamp);var senderPublicKeyBuffer=new Buffer(trs.senderPublicKey,"hex");for(var i=0;i<senderPublicKeyBuffer.length;i++){bb.writeByte(senderPublicKeyBuffer[i])}bb.writeInt(trs.type);if(trs.args)bb.writeString(trs.args);if(!skipSignature&&trs.signature){var signatureBuffer=new Buffer(trs.signature,"hex");for(var i=0;i<signatureBuffer.length;i++){bb.writeByte(signatureBuffer[i])}}bb.flip();return bb.toBuffer()}function createInnerTransaction(options,secret){var keys=crypto.getKeys(secret);var args=options.args;if(args instanceof Array)args=JSON.stringify(args);var trs={timestamp:slots.getTime()-globalOptions.get("clientDriftSeconds"),senderPublicKey:keys.publicKey,type:options.type,args:args};trs.signature=crypto.signBytes(getDAppTransactionBytes(trs),keys);return trs}module.exports={createDApp:createDApp,createInnerTransaction:createInnerTransaction}}).call(this,require("buffer").Buffer)},{"../options.js":7,"../time/slots.js":9,"./crypto.js":10,buffer:20,bytebuffer:21}],12:[function(require,module,exports){var crypto=require("./crypto.js");var slots=require("../time/slots.js");var options=require("../options");function createDelegate(username,secret,genesisSecret){var keys=crypto.getKeys(secret);var transaction={type:2,recipientId:null,senderPublicKey:keys.publicKey,timestamp:slots.getTime()-options.get("clientDriftSeconds"),asset:{delegate:{username:username,publicKey:keys.publicKey}}};crypto.sign(transaction,keys);if(genesisSecret){var secondKeys=crypto.getKeys(genesisSecret);transaction["witnessId"]=crypto.getAddress(secondKeys.publicKey);crypto.secondSign(transaction,secondKeys)}transaction.id=crypto.getId(transaction);return transaction}module.exports={createDelegate:createDelegate}},{"../options":7,"../time/slots.js":9,"./crypto.js":10}],13:[function(require,module,exports){var ByteBuffer=require("bytebuffer");var crypto=require("./crypto.js");var slots=require("../time/slots.js");var options=require("../options");function createStorage(content,secret,witnessSecret){var keys=crypto.getKeys(secret);var bytes=null;try{bytes=crypto.toLocalBuffer(ByteBuffer.fromHex(content))}catch(e){throw new Error("Content must be hex format")}if(!bytes||bytes.length===0){throw new Error("Invalid content format")}var transaction={type:8,recipientId:null,senderPublicKey:keys.publicKey,timestamp:slots.getTime()-options.get("clientDriftSeconds"),asset:{storage:{content:content}},__assetBytes__:bytes};crypto.sign(transaction,keys);if(witnessSecret){var secondKeys=crypto.getKeys(witnessSecret);transaction["witnessId"]=crypto.getAddress(secondKeys.publicKey);crypto.secondSign(transaction,secondKeys)}delete transaction.__assetBytes__;transaction.id=crypto.getId(transaction);return transaction}module.exports={createStorage:createStorage}},{"../options":7,"../time/slots.js":9,"./crypto.js":10,bytebuffer:21}],14:[function(require,module,exports){var crypto=require("./crypto.js");var slots=require("../time/slots.js");var options=require("../options");function createTransaction(recipientId,message,secret,witnessSecret){var transaction={type:0,recipientId:recipientId,message:message,timestamp:slots.getTime()-options.get("clientDriftSeconds"),asset:{}};var keys=crypto.getKeys(secret);transaction.senderPublicKey=keys.publicKey;crypto.sign(transaction,keys);if(witnessSecret){var secondKeys=crypto.getKeys(witnessSecret);transaction["witnessId"]=crypto.getAddress(secondKeys.publicKey);crypto.secondSign(transaction,secondKeys)}transaction.id=crypto.getId(transaction);return transaction}module.exports={createTransaction:createTransaction}},{"../options":7,"../time/slots.js":9,"./crypto.js":10}],15:[function(require,module,exports){var crypto=require("./crypto.js");var slots=require("../time/slots.js");var options=require("../options");function createInTransfer(dappId,currency,amount,secret,witnessSecret){var keys=crypto.getKeys(secret);var transaction={type:6,recipientId:null,senderPublicKey:keys.publicKey,timestamp:slots.getTime()-options.get("clientDriftSeconds"),asset:{inTransfer:{dappId:dappId,currency:currency}}};if(currency==="XAS"){transaction.amount=Number(amount)}else{transaction.asset.inTransfer.amount=String(amount)}crypto.sign(transaction,keys);if(witnessSecret){var secondKeys=crypto.getKeys(witnessSecret);transaction["witnessId"]=crypto.getAddress(secondKeys.publicKey);crypto.secondSign(transaction,secondKeys)}transaction.id=crypto.getId(transaction);return transaction}function createOutTransfer(recipientId,dappId,transactionId,currency,amount,secret,witnessSecret){var keys=crypto.getKeys(secret);var transaction={type:7,recipientId:recipientId,senderPublicKey:keys.publicKey,timestamp:slots.getTime()-options.get("clientDriftSeconds"),asset:{outTransfer:{dappId:dappId,transactionId:transactionId,currency:currency,amount:amount}}};crypto.sign(transaction,keys);if(witnessSecret){var secondKeys=crypto.getKeys(witnessSecret);transaction["witnessId"]=crypto.getAddress(secondKeys.publicKey);crypto.secondSign(transaction,secondKeys)}transaction.id=crypto.getId(transaction);return transaction}function signOutTransfer(transaction,secret){var keys=crypto.getKeys(secret);return crypto.sign(transaction,keys)}module.exports={createInTransfer:createInTransfer,createOutTransfer:createOutTransfer,signOutTransfer:signOutTransfer}},{"../options":7,"../time/slots.js":9,"./crypto.js":10}],16:[function(require,module,exports){var crypto=require("./crypto.js");var slots=require("../time/slots.js");var options=require("../options");function getClientFixedTime(){return slots.getTime()-options.get("clientDriftSeconds")}function createTransaction(asset,type,recipientId,message,secret,witnessSecret){var keys=crypto.getKeys(secret);var transaction={type:type,recipientId:recipientId,senderPublicKey:keys.publicKey,timestamp:getClientFixedTime(),message:message,asset:asset};crypto.sign(transaction,keys);if(witnessSecret){var secondKeys=crypto.getKeys(witnessSecret);transaction["witnessId"]=crypto.getAddress(secondKeys.publicKey);crypto.secondSign(transaction,secondKeys)}transaction.id=crypto.getId(transaction);return transaction}module.exports={createIssuer:function(name,desc,secret,witnessSecret){var asset={uiaIssuer:{name:name,desc:desc}};return createTransaction(asset,9,null,null,secret,witnessSecret)},createAsset:function(name,desc,maximum,precision,strategy,allowWriteoff,allowWhitelist,allowBlacklist,secret,witnessSecret){var asset={uiaAsset:{name:name,desc:desc,maximum:maximum,precision:precision,strategy:strategy,allowBlacklist:allowBlacklist,allowWhitelist:allowWhitelist,allowWriteoff:allowWriteoff}};return createTransaction(asset,10,null,null,secret,witnessSecret)},createFlags:function(currency,flagType,flag,secret,witnessSecret){var asset={uiaFlags:{currency:currency,flagType:flagType,flag:flag}};return createTransaction(asset,11,null,null,secret,witnessSecret)},createAcl:function(currency,operator,flag,list,secret,witnessSecret){var asset={uiaAcl:{currency:currency,operator:operator,flag:flag,list:list}};return createTransaction(asset,12,null,null,secret,witnessSecret)},createIssue:function(currency,amount,secret,witnessSecret){var asset={uiaIssue:{currency:currency,amount:amount}};return createTransaction(asset,13,null,null,secret,witnessSecret)},createTransfer:function(currency,amount,recipientId,message,secret,witnessSecret){var asset={uiaTransfer:{currency:currency,amount:amount}};return createTransaction(asset,14,recipientId,message,secret,witnessSecret)}}},{"../options":7,"../time/slots.js":9,"./crypto.js":10}],17:[function(require,module,exports){var crypto=require("./crypto.js");var slots=require("../time/slots.js");var options=require("../options");function createVote(keyList,secret){var keys=crypto.getKeys(secret);var transaction={type:3,recipientId:null,senderPublicKey:keys.publicKey,timestamp:slots.getTime()-options.get("clientDriftSeconds"),asset:{vote:{votes:keyList}}};crypto.sign(transaction,keys);transaction.id=crypto.getId(transaction);return transaction}module.exports={createVote:createVote}},{"../options":7,"../time/slots.js":9,"./crypto.js":10}],18:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63;function placeHoldersCount(b64){var len=b64.length;if(len%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return b64[len-2]==="="?2:b64[len-1]==="="?1:0}function byteLength(b64){return b64.length*3/4-placeHoldersCount(b64)}function toByteArray(b64){var i,l,tmp,placeHolders,arr;var len=b64.length;placeHolders=placeHoldersCount(b64);arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0;i<l;i+=4){tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)];arr[L++]=tmp>>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;i<end;i+=3){tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output.push(tripletToBase64(tmp))}return output.join("")}function fromByteArray(uint8){var tmp;var len=uint8.length;var extraBytes=len%3;var output="";var parts=[];var maxChunkLength=16383;for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}},{}],19:[function(require,module,exports){},{}],20:[function(require,module,exports){(function(global){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("isarray");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();exports.kMaxLength=kMaxLength();function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42&&typeof arr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){return false}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()<length){throw new RangeError("Invalid typed array length")}if(Buffer.TYPED_ARRAY_SUPPORT){that=new Uint8Array(length);that.__proto__=Buffer.prototype}else{if(that===null){that=new Buffer(length)}that.length=length}return that}function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length)}if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return allocUnsafe(this,arg)}return from(this,arg,encodingOrOffset,length)}Buffer.poolSize=8192;Buffer._augment=function(arr){arr.__proto__=Buffer.prototype;return arr};function from(that,value,encodingOrOffset,length){if(typeof value==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&value instanceof ArrayBuffer){return fromArrayBuffer(that,value,encodingOrOffset,length)}if(typeof value==="string"){return fromString(that,value,encodingOrOffset)}return fromObject(that,value)}Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)};if(Buffer.TYPED_ARRAY_SUPPORT){Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;if(typeof Symbol!=="undefined"&&Symbol.species&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true})}}function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be a number')}else if(size<0){throw new RangeError('"size" argument must not be negative')}}function alloc(that,size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(that,size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill)}return createBuffer(that,size)}Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)};function allocUnsafe(that,size){assertSize(size);that=createBuffer(that,size<0?0:checked(size)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<size;++i){that[i]=0}}return that}Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)};function fromString(that,string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError('"encoding" must be a valid string encoding')}var length=byteLength(string,encoding)|0;that=createBuffer(that,length);var actual=that.write(string,encoding);if(actual!==length){that=that.slice(0,actual)}return that}function fromArrayLike(that,array){var length=array.length<0?0:checked(array.length)|0;that=createBuffer(that,length);for(var i=0;i<length;i+=1){that[i]=array[i]&255}return that}function fromArrayBuffer(that,array,byteOffset,length){array.byteLength;if(byteOffset<0||array.byteLength<byteOffset){throw new RangeError("'offset' is out of bounds")}
if(array.byteLength<byteOffset+(length||0)){throw new RangeError("'length' is out of bounds")}if(byteOffset===undefined&&length===undefined){array=new Uint8Array(array)}else if(length===undefined){array=new Uint8Array(array,byteOffset)}else{array=new Uint8Array(array,byteOffset,length)}if(Buffer.TYPED_ARRAY_SUPPORT){that=array;that.__proto__=Buffer.prototype}else{that=fromArrayLike(that,array)}return that}function fromObject(that,obj){if(Buffer.isBuffer(obj)){var len=checked(obj.length)|0;that=createBuffer(that,len);if(that.length===0){return that}obj.copy(that,0,0,len);return that}if(obj){if(typeof ArrayBuffer!=="undefined"&&obj.buffer instanceof ArrayBuffer||"length"in obj){if(typeof obj.length!=="number"||isnan(obj.length)){return createBuffer(that,0)}return fromArrayLike(that,obj)}if(obj.type==="Buffer"&&isArray(obj.data)){return fromArrayLike(that,obj.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(length){if(length>=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len;++i){if(a[i]!==b[i]){x=a[i];y=b[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function isEncoding(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function concat(list,length){if(!isArray(list)){throw new TypeError('"list" argument must be an Array of Buffers')}if(list.length===0){return Buffer.alloc(0)}var i;if(length===undefined){length=0;for(i=0;i<list.length;++i){length+=list[i].length}}var buffer=Buffer.allocUnsafe(length);var pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf)){throw new TypeError('"list" argument must be an Array of Buffers')}buf.copy(buffer,pos);pos+=buf.length}return buffer};function byteLength(string,encoding){if(Buffer.isBuffer(string)){return string.length}if(typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer)){return string.byteLength}if(typeof string!=="string"){string=""+string}var len=string.length;if(len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case undefined:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i<len;i+=2){swap(this,i,i+1)}return this};Buffer.prototype.swap32=function swap32(){var len=this.length;if(len%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var i=0;i<len;i+=4){swap(this,i,i+3);swap(this,i+1,i+2)}return this};Buffer.prototype.swap64=function swap64(){var len=this.length;if(len%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var i=0;i<len;i+=8){swap(this,i,i+7);swap(this,i+1,i+6);swap(this,i+2,i+5);swap(this,i+3,i+4)}return this};Buffer.prototype.toString=function toString(){var length=this.length|0;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i<len;++i){if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i];y=targetCopy[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(buffer.length===0)return-1;if(typeof byteOffset==="string"){encoding=byteOffset;byteOffset=0}else if(byteOffset>2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(isNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++){if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1)foundIndex=i;if(i-foundIndex+1===valLength)return foundIndex*indexSize}else{if(foundIndex!==-1)i-=i-foundIndex;foundIndex=-1}}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;j<valLength;j++){if(read(arr,i+j)!==read(val,j)){found=false;break}}if(found)return i}}return-1}Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,true)};Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,false)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;++i){var parsed=parseInt(string.substr(i*2,2),16);if(isNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}Buffer.prototype.write=function write(string,offset,length,encoding){if(offset===undefined){encoding="utf8";length=this.length;offset=0}else if(length===undefined&&typeof offset==="string"){encoding=offset;length=this.length;offset=0}else if(isFinite(offset)){offset=offset|0;if(isFinite(length)){length=length|0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i<end){var firstByte=buf[i];var codePoint=null;var bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(i<len){res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH))}return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]&127)}return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;++i){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function slice(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=this.subarray(start,end);newBuf.__proto__=Buffer.prototype}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined);for(var i=0;i<sliceLen;++i){newBuf[i]=this[i+start]}}return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}return val};Buffer.prototype.readUIntBE=function readUIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;++i){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;++i){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){if(value<0&&sub===0&&this[offset+i-1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||this.length===0)return 0;if(targetStart<0){throw new RangeError("targetStart out of bounds")}if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart<end-start){end=target.length-targetStart+start}var len=end-start;var i;if(this===target&&start<targetStart&&targetStart<end){for(i=len-1;i>=0;--i){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i<len;++i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(val.length===1){var code=val.charCodeAt(0);if(code<256){val=code}}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}}else if(typeof val==="number"){val=val&255}if(start<0||this.length<start||this.length<end){throw new RangeError("Out of range index")}if(end<=start){return this}start=start>>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i<end;++i){this[i]=val}}else{var bytes=Buffer.isBuffer(val)?val:utf8ToBytes(new Buffer(val,encoding).toString());var len=bytes.length;for(i=0;i<end-start;++i){this[i+start]=bytes[i%len]}}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];for(var i=0;i<length;++i){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;++i){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":18,ieee754:26,isarray:29}],21:[function(require,module,exports){(function(global,factory){if(typeof define==="function"&&define["amd"])define(["long"],factory);else if(typeof require==="function"&&typeof module==="object"&&module&&module["exports"])module["exports"]=function(){var Long;try{Long=require("long")}catch(e){}return factory(Long)}();else(global["dcodeIO"]=global["dcodeIO"]||{})["ByteBuffer"]=factory(global["dcodeIO"]["Long"])})(this,function(Long){"use strict";var ByteBuffer=function(capacity,littleEndian,noAssert){if(typeof capacity==="undefined")capacity=ByteBuffer.DEFAULT_CAPACITY;if(typeof littleEndian==="undefined")littleEndian=ByteBuffer.DEFAULT_ENDIAN;if(typeof noAssert==="undefined")noAssert=ByteBuffer.DEFAULT_NOASSERT;if(!noAssert){capacity=capacity|0;if(capacity<0)throw RangeError("Illegal capacity");littleEndian=!!littleEndian;noAssert=!!noAssert}this.buffer=capacity===0?EMPTY_BUFFER:new ArrayBuffer(capacity);this.view=capacity===0?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=capacity;this.littleEndian=littleEndian;this.noAssert=noAssert};ByteBuffer.VERSION="5.0.1";ByteBuffer.LITTLE_ENDIAN=true;ByteBuffer.BIG_ENDIAN=false;ByteBuffer.DEFAULT_CAPACITY=16;ByteBuffer.DEFAULT_ENDIAN=ByteBuffer.BIG_ENDIAN;ByteBuffer.DEFAULT_NOASSERT=false;ByteBuffer.Long=Long||null;var ByteBufferPrototype=ByteBuffer.prototype;ByteBufferPrototype.__isByteBuffer__;Object.defineProperty(ByteBufferPrototype,"__isByteBuffer__",{value:true,enumerable:false,configurable:false});var EMPTY_BUFFER=new ArrayBuffer(0);var stringFromCharCode=String.fromCharCode;function stringSource(s){var i=0;return function(){return i<s.length?s.charCodeAt(i++):null}}function stringDestination(){var cs=[],ps=[];return function(){if(arguments.length===0)return ps.join("")+stringFromCharCode.apply(String,cs);if(cs.length+arguments.length>1024)ps.push(stringFromCharCode.apply(String,cs)),cs.length=0;Array.prototype.push.apply(cs,arguments)}}ByteBuffer.accessor=function(){return Uint8Array};ByteBuffer.allocate=function(capacity,littleEndian,noAssert){return new ByteBuffer(capacity,littleEndian,noAssert)};ByteBuffer.concat=function(buffers,encoding,littleEndian,noAssert){if(typeof encoding==="boolean"||typeof encoding!=="string"){noAssert=littleEndian;littleEndian=encoding;encoding=undefined}var capacity=0;for(var i=0,k=buffers.length,length;i<k;++i){if(!ByteBuffer.isByteBuffer(buffers[i]))buffers[i]=ByteBuffer.wrap(buffers[i],encoding);length=buffers[i].limit-buffers[i].offset;if(length>0)capacity+=length}if(capacity===0)return new ByteBuffer(0,littleEndian,noAssert);var bb=new ByteBuffer(capacity,littleEndian,noAssert),bi;i=0;while(i<k){bi=buffers[i++];length=bi.limit-bi.offset;if(length<=0)continue;bb.view.set(bi.view.subarray(bi.offset,bi.limit),bb.offset);bb.offset+=length}bb.limit=bb.offset;bb.offset=0;return bb};ByteBuffer.isByteBuffer=function(bb){return(bb&&bb["__isByteBuffer__"])===true};ByteBuffer.type=function(){return ArrayBuffer};ByteBuffer.wrap=function(buffer,encoding,littleEndian,noAssert){if(typeof encoding!=="string"){noAssert=littleEndian;littleEndian=encoding;encoding=undefined}if(typeof buffer==="string"){if(typeof encoding==="undefined")encoding="utf8";switch(encoding){case"base64":return ByteBuffer.fromBase64(buffer,littleEndian);case"hex":return ByteBuffer.fromHex(buffer,littleEndian);case"binary":return ByteBuffer.fromBinary(buffer,littleEndian);case"utf8":
return ByteBuffer.fromUTF8(buffer,littleEndian);case"debug":return ByteBuffer.fromDebug(buffer,littleEndian);default:throw Error("Unsupported encoding: "+encoding)}}if(buffer===null||typeof buffer!=="object")throw TypeError("Illegal buffer");var bb;if(ByteBuffer.isByteBuffer(buffer)){bb=ByteBufferPrototype.clone.call(buffer);bb.markedOffset=-1;return bb}if(buffer instanceof Uint8Array){bb=new ByteBuffer(0,littleEndian,noAssert);if(buffer.length>0){bb.buffer=buffer.buffer;bb.offset=buffer.byteOffset;bb.limit=buffer.byteOffset+buffer.byteLength;bb.view=new Uint8Array(buffer.buffer)}}else if(buffer instanceof ArrayBuffer){bb=new ByteBuffer(0,littleEndian,noAssert);if(buffer.byteLength>0){bb.buffer=buffer;bb.offset=0;bb.limit=buffer.byteLength;bb.view=buffer.byteLength>0?new Uint8Array(buffer):null}}else if(Object.prototype.toString.call(buffer)==="[object Array]"){bb=new ByteBuffer(buffer.length,littleEndian,noAssert);bb.limit=buffer.length;for(var i=0;i<buffer.length;++i)bb.view[i]=buffer[i]}else throw TypeError("Illegal buffer");return bb};ByteBufferPrototype.writeBitSet=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(!(value instanceof Array))throw TypeError("Illegal BitSet: Not an array");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var start=offset,bits=value.length,bytes=bits>>3,bit=0,k;offset+=this.writeVarint32(bits,offset);while(bytes--){k=!!value[bit++]&1|(!!value[bit++]&1)<<1|(!!value[bit++]&1)<<2|(!!value[bit++]&1)<<3|(!!value[bit++]&1)<<4|(!!value[bit++]&1)<<5|(!!value[bit++]&1)<<6|(!!value[bit++]&1)<<7;this.writeByte(k,offset++)}if(bit<bits){var m=0;k=0;while(bit<bits)k=k|(!!value[bit++]&1)<<m++;this.writeByte(k,offset++)}if(relative){this.offset=offset;return this}return offset-start};ByteBufferPrototype.readBitSet=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;var ret=this.readVarint32(offset),bits=ret.value,bytes=bits>>3,bit=0,value=[],k;offset+=ret.length;while(bytes--){k=this.readByte(offset++);value[bit++]=!!(k&1);value[bit++]=!!(k&2);value[bit++]=!!(k&4);value[bit++]=!!(k&8);value[bit++]=!!(k&16);value[bit++]=!!(k&32);value[bit++]=!!(k&64);value[bit++]=!!(k&128)}if(bit<bits){var m=0;k=this.readByte(offset++);while(bit<bits)value[bit++]=!!(k>>m++&1)}if(relative){this.offset=offset}return value};ByteBufferPrototype.readBytes=function(length,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+length>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength)}var slice=this.slice(offset,offset+length);if(relative)this.offset+=length;return slice};ByteBufferPrototype.writeBytes=ByteBufferPrototype.append;ByteBufferPrototype.writeInt8=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=1;var capacity0=this.buffer.byteLength;if(offset>capacity0)this.resize((capacity0*=2)>offset?capacity0:offset);offset-=1;this.view[offset]=value;if(relative)this.offset+=1;return this};ByteBufferPrototype.writeByte=ByteBufferPrototype.writeInt8;ByteBufferPrototype.readInt8=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var value=this.view[offset];if((value&128)===128)value=-(255-value+1);if(relative)this.offset+=1;return value};ByteBufferPrototype.readByte=ByteBufferPrototype.readInt8;ByteBufferPrototype.writeUint8=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value>>>=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=1;var capacity1=this.buffer.byteLength;if(offset>capacity1)this.resize((capacity1*=2)>offset?capacity1:offset);offset-=1;this.view[offset]=value;if(relative)this.offset+=1;return this};ByteBufferPrototype.writeUInt8=ByteBufferPrototype.writeUint8;ByteBufferPrototype.readUint8=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var value=this.view[offset];if(relative)this.offset+=1;return value};ByteBufferPrototype.readUInt8=ByteBufferPrototype.readUint8;ByteBufferPrototype.writeInt16=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=2;var capacity2=this.buffer.byteLength;if(offset>capacity2)this.resize((capacity2*=2)>offset?capacity2:offset);offset-=2;if(this.littleEndian){this.view[offset+1]=(value&65280)>>>8;this.view[offset]=value&255}else{this.view[offset]=(value&65280)>>>8;this.view[offset+1]=value&255}if(relative)this.offset+=2;return this};ByteBufferPrototype.writeShort=ByteBufferPrototype.writeInt16;ByteBufferPrototype.readInt16=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset];value|=this.view[offset+1]<<8}else{value=this.view[offset]<<8;value|=this.view[offset+1]}if((value&32768)===32768)value=-(65535-value+1);if(relative)this.offset+=2;return value};ByteBufferPrototype.readShort=ByteBufferPrototype.readInt16;ByteBufferPrototype.writeUint16=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value>>>=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=2;var capacity3=this.buffer.byteLength;if(offset>capacity3)this.resize((capacity3*=2)>offset?capacity3:offset);offset-=2;if(this.littleEndian){this.view[offset+1]=(value&65280)>>>8;this.view[offset]=value&255}else{this.view[offset]=(value&65280)>>>8;this.view[offset+1]=value&255}if(relative)this.offset+=2;return this};ByteBufferPrototype.writeUInt16=ByteBufferPrototype.writeUint16;ByteBufferPrototype.readUint16=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset];value|=this.view[offset+1]<<8}else{value=this.view[offset]<<8;value|=this.view[offset+1]}if(relative)this.offset+=2;return value};ByteBufferPrototype.readUInt16=ByteBufferPrototype.readUint16;ByteBufferPrototype.writeInt32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=4;var capacity4=this.buffer.byteLength;if(offset>capacity4)this.resize((capacity4*=2)>offset?capacity4:offset);offset-=4;if(this.littleEndian){this.view[offset+3]=value>>>24&255;this.view[offset+2]=value>>>16&255;this.view[offset+1]=value>>>8&255;this.view[offset]=value&255}else{this.view[offset]=value>>>24&255;this.view[offset+1]=value>>>16&255;this.view[offset+2]=value>>>8&255;this.view[offset+3]=value&255}if(relative)this.offset+=4;return this};ByteBufferPrototype.writeInt=ByteBufferPrototype.writeInt32;ByteBufferPrototype.readInt32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset+2]<<16;value|=this.view[offset+1]<<8;value|=this.view[offset];value+=this.view[offset+3]<<24>>>0}else{value=this.view[offset+1]<<16;value|=this.view[offset+2]<<8;value|=this.view[offset+3];value+=this.view[offset]<<24>>>0}value|=0;if(relative)this.offset+=4;return value};ByteBufferPrototype.readInt=ByteBufferPrototype.readInt32;ByteBufferPrototype.writeUint32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value>>>=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=4;var capacity5=this.buffer.byteLength;if(offset>capacity5)this.resize((capacity5*=2)>offset?capacity5:offset);offset-=4;if(this.littleEndian){this.view[offset+3]=value>>>24&255;this.view[offset+2]=value>>>16&255;this.view[offset+1]=value>>>8&255;this.view[offset]=value&255}else{this.view[offset]=value>>>24&255;this.view[offset+1]=value>>>16&255;this.view[offset+2]=value>>>8&255;this.view[offset+3]=value&255}if(relative)this.offset+=4;return this};ByteBufferPrototype.writeUInt32=ByteBufferPrototype.writeUint32;ByteBufferPrototype.readUint32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset+2]<<16;value|=this.view[offset+1]<<8;value|=this.view[offset];value+=this.view[offset+3]<<24>>>0}else{value=this.view[offset+1]<<16;value|=this.view[offset+2]<<8;value|=this.view[offset+3];value+=this.view[offset]<<24>>>0}if(relative)this.offset+=4;return value};ByteBufferPrototype.readUInt32=ByteBufferPrototype.readUint32;if(Long){ByteBufferPrototype.writeInt64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);offset+=8;var capacity6=this.buffer.byteLength;if(offset>capacity6)this.resize((capacity6*=2)>offset?capacity6:offset);offset-=8;var lo=value.low,hi=value.high;if(this.littleEndian){this.view[offset+3]=lo>>>24&255;this.view[offset+2]=lo>>>16&255;this.view[offset+1]=lo>>>8&255;this.view[offset]=lo&255;offset+=4;this.view[offset+3]=hi>>>24&255;this.view[offset+2]=hi>>>16&255;this.view[offset+1]=hi>>>8&255;this.view[offset]=hi&255}else{this.view[offset]=hi>>>24&255;this.view[offset+1]=hi>>>16&255;this.view[offset+2]=hi>>>8&255;this.view[offset+3]=hi&255;offset+=4;this.view[offset]=lo>>>24&255;this.view[offset+1]=lo>>>16&255;this.view[offset+2]=lo>>>8&255;this.view[offset+3]=lo&255}if(relative)this.offset+=8;return this};ByteBufferPrototype.writeLong=ByteBufferPrototype.writeInt64;ByteBufferPrototype.readInt64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength)}var lo=0,hi=0;if(this.littleEndian){lo=this.view[offset+2]<<16;lo|=this.view[offset+1]<<8;lo|=this.view[offset];lo+=this.view[offset+3]<<24>>>0;offset+=4;hi=this.view[offset+2]<<16;hi|=this.view[offset+1]<<8;hi|=this.view[offset];hi+=this.view[offset+3]<<24>>>0}else{hi=this.view[offset+1]<<16;hi|=this.view[offset+2]<<8;hi|=this.view[offset+3];hi+=this.view[offset]<<24>>>0;offset+=4;lo=this.view[offset+1]<<16;lo|=this.view[offset+2]<<8;lo|=this.view[offset+3];lo+=this.view[offset]<<24>>>0}var value=new Long(lo,hi,false);if(relative)this.offset+=8;return value};ByteBufferPrototype.readLong=ByteBufferPrototype.readInt64;ByteBufferPrototype.writeUint64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);offset+=8;var capacity7=this.buffer.byteLength;if(offset>capacity7)this.resize((capacity7*=2)>offset?capacity7:offset);offset-=8;var lo=value.low,hi=value.high;if(this.littleEndian){this.view[offset+3]=lo>>>24&255;this.view[offset+2]=lo>>>16&255;this.view[offset+1]=lo>>>8&255;this.view[offset]=lo&255;offset+=4;this.view[offset+3]=hi>>>24&255;this.view[offset+2]=hi>>>16&255;this.view[offset+1]=hi>>>8&255;this.view[offset]=hi&255}else{this.view[offset]=hi>>>24&255;this.view[offset+1]=hi>>>16&255;this.view[offset+2]=hi>>>8&255;this.view[offset+3]=hi&255;offset+=4;this.view[offset]=lo>>>24&255;this.view[offset+1]=lo>>>16&255;this.view[offset+2]=lo>>>8&255;this.view[offset+3]=lo&255}if(relative)this.offset+=8;return this};ByteBufferPrototype.writeUInt64=ByteBufferPrototype.writeUint64;ByteBufferPrototype.readUint64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength)}var lo=0,hi=0;if(this.littleEndian){lo=this.view[offset+2]<<16;lo|=this.view[offset+1]<<8;lo|=this.view[offset];lo+=this.view[offset+3]<<24>>>0;offset+=4;hi=this.view[offset+2]<<16;hi|=this.view[offset+1]<<8;hi|=this.view[offset];hi+=this.view[offset+3]<<24>>>0}else{hi=this.view[offset+1]<<16;hi|=this.view[offset+2]<<8;hi|=this.view[offset+3];hi+=this.view[offset]<<24>>>0;offset+=4;lo=this.view[offset+1]<<16;lo|=this.view[offset+2]<<8;lo|=this.view[offset+3];lo+=this.view[offset]<<24>>>0}var value=new Long(lo,hi,true);if(relative)this.offset+=8;return value};ByteBufferPrototype.readUInt64=ByteBufferPrototype.readUint64}function ieee754_read(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)}function ieee754_write(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}ByteBufferPrototype.writeFloat32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number")throw TypeError("Illegal value: "+value+" (not a number)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=4;var capacity8=this.buffer.byteLength;if(offset>capacity8)this.resize((capacity8*=2)>offset?capacity8:offset);offset-=4;ieee754_write(this.view,value,offset,this.littleEndian,23,4);if(relative)this.offset+=4;return this};ByteBufferPrototype.writeFloat=ByteBufferPrototype.writeFloat32;ByteBufferPrototype.readFloat32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var value=ieee754_read(this.view,offset,this.littleEndian,23,4);if(relative)this.offset+=4;return value};ByteBufferPrototype.readFloat=ByteBufferPrototype.readFloat32;ByteBufferPrototype.writeFloat64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number")throw TypeError("Illegal value: "+value+" (not a number)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=8;var capacity9=this.buffer.byteLength;if(offset>capacity9)this.resize((capacity9*=2)>offset?capacity9:offset);offset-=8;ieee754_write(this.view,value,offset,this.littleEndian,52,8);if(relative)this.offset+=8;return this};ByteBufferPrototype.writeDouble=ByteBufferPrototype.writeFloat64;ByteBufferPrototype.readFloat64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength)}var value=ieee754_read(this.view,offset,this.littleEndian,52,8);if(relative)this.offset+=8;return value};ByteBufferPrototype.readDouble=ByteBufferPrototype.readFloat64;ByteBuffer.MAX_VARINT32_BYTES=5;ByteBuffer.calculateVarint32=function(value){value=value>>>0;if(value<1<<7)return 1;else if(value<1<<14)return 2;else if(value<1<<21)return 3;else if(value<1<<28)return 4;else return 5};ByteBuffer.zigZagEncode32=function(n){return((n|=0)<<1^n>>31)>>>0};ByteBuffer.zigZagDecode32=function(n){return n>>>1^-(n&1)|0};ByteBufferPrototype.writeVarint32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var size=ByteBuffer.calculateVarint32(value),b;offset+=size;var capacity10=this.buffer.byteLength;if(offset>capacity10)this.resize((capacity10*=2)>offset?capacity10:offset);offset-=size;value>>>=0;while(value>=128){b=value&127|128;this.view[offset++]=b;value>>>=7}this.view[offset++]=value;if(relative){this.offset=offset;return this}return size};ByteBufferPrototype.writeVarint32ZigZag=function(value,offset){return this.writeVarint32(ByteBuffer.zigZagEncode32(value),offset)};ByteBufferPrototype.readVarint32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var c=0,value=0>>>0,b;do{if(!this.noAssert&&offset>this.limit){var err=Error("Truncated");err["truncated"]=true;throw err}b=this.view[offset++];if(c<5)value|=(b&127)<<7*c;++c}while((b&128)!==0);value|=0;if(relative){this.offset=offset;return value}return{value:value,length:c}};ByteBufferPrototype.readVarint32ZigZag=function(offset){var val=this.readVarint32(offset);if(typeof val==="object")val["value"]=ByteBuffer.zigZagDecode32(val["value"]);else val=ByteBuffer.zigZagDecode32(val);return val};if(Long){ByteBuffer.MAX_VARINT64_BYTES=10;ByteBuffer.calculateVarint64=function(value){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);var part0=value.toInt()>>>0,part1=value.shiftRightUnsigned(28).toInt()>>>0,part2=value.shiftRightUnsigned(56).toInt()>>>0;if(part2==0){if(part1==0){if(part0<1<<14)return part0<1<<7?1:2;else return part0<1<<21?3:4}else{if(part1<1<<14)return part1<1<<7?5:6;else return part1<1<<21?7:8}}else return part2<1<<7?9:10};ByteBuffer.zigZagEncode64=function(value){if(typeof value==="number")value=Long.fromNumber(value,false);else if(typeof value==="string")value=Long.fromString(value,false);else if(value.unsigned!==false)value=value.toSigned();return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned()};ByteBuffer.zigZagDecode64=function(value){if(typeof value==="number")value=Long.fromNumber(value,false);else if(typeof value==="string")value=Long.fromString(value,false);else if(value.unsigned!==false)value=value.toSigned();return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned()};ByteBufferPrototype.writeVarint64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(typeof value==="number")value=Long.fromNumber(value,false);else if(typeof value==="string")value=Long.fromString(value,false);else if(value.unsigned!==false)value=value.toSigned();var size=ByteBuffer.calculateVarint64(value),part0=value.toInt()>>>0,part1=value.shiftRightUnsigned(28).toInt()>>>0,part2=value.shiftRightUnsigned(56).toInt()>>>0;offset+=size;var capacity11=this.buffer.byteLength;if(offset>capacity11)this.resize((capacity11*=2)>offset?capacity11:offset);offset-=size;switch(size){case 10:this.view[offset+9]=part2>>>7&1;case 9:this.view[offset+8]=size!==9?part2|128:part2&127;case 8:this.view[offset+7]=size!==8?part1>>>21|128:part1>>>21&127;case 7:this.view[offset+6]=size!==7?part1>>>14|128:part1>>>14&127;case 6:this.view[offset+5]=size!==6?part1>>>7|128:part1>>>7&127;case 5:this.view[offset+4]=size!==5?part1|128:part1&127;case 4:this.view[offset+3]=size!==4?part0>>>21|128:part0>>>21&127;case 3:this.view[offset+2]=size!==3?part0>>>14|128:part0>>>14&127;case 2:this.view[offset+1]=size!==2?part0>>>7|128:part0>>>7&127;case 1:this.view[offset]=size!==1?part0|128:part0&127}if(relative){this.offset+=size;return this}else{return size}};ByteBufferPrototype.writeVarint64ZigZag=function(value,offset){return this.writeVarint64(ByteBuffer.zigZagEncode64(value),offset)};ByteBufferPrototype.readVarint64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var start=offset,part0=0,part1=0,part2=0,b=0;b=this.view[offset++];part0=b&127;if(b&128){b=this.view[offset++];part0|=(b&127)<<7;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part0|=(b&127)<<14;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part0|=(b&127)<<21;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1=b&127;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1|=(b&127)<<7;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1|=(b&127)<<14;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1|=(b&127)<<21;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part2=b&127;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part2|=(b&127)<<7;if(b&128||this.noAssert&&typeof b==="undefined"){throw Error("Buffer overrun")}}}}}}}}}}var value=Long.fromBits(part0|part1<<28,part1>>>4|part2<<24,false);if(relative){this.offset=offset;return value}else{return{value:value,length:offset-start}}};ByteBufferPrototype.readVarint64ZigZag=function(offset){var val=this.readVarint64(offset);if(val&&val["value"]instanceof Long)val["value"]=ByteBuffer.zigZagDecode64(val["value"]);else val=ByteBuffer.zigZagDecode64(val);return val}}ByteBufferPrototype.writeCString=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;var i,k=str.length;if(!this.noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");for(i=0;i<k;++i){if(str.charCodeAt(i)===0)throw RangeError("Illegal str: Contains NULL-characters")}if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}k=utfx.calculateUTF16asUTF8(stringSource(str))[1];offset+=k+1;var capacity12=this.buffer.byteLength;if(offset>capacity12)this.resize((capacity12*=2)>offset?capacity12:offset);offset-=k+1;utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));this.view[offset++]=0;if(relative){this.offset=offset;return this}return k};ByteBufferPrototype.readCString=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var start=offset,temp;var sd,b=-1;utfx.decodeUTF8toUTF16(function(){if(b===0)return null;if(offset>=this.limit)throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);b=this.view[offset++];return b===0?null:b}.bind(this),sd=stringDestination(),true);if(relative){this.offset=offset;return sd()}else{return{string:sd(),length:offset-start}}};ByteBufferPrototype.writeIString=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var start=offset,k;k=utfx.calculateUTF16asUTF8(stringSource(str),this.noAssert)[1];offset+=4+k;var capacity13=this.buffer.byteLength;if(offset>capacity13)this.resize((capacity13*=2)>offset?capacity13:offset);offset-=4+k;if(this.littleEndian){this.view[offset+3]=k>>>24&255;this.view[offset+2]=k>>>16&255;this.view[offset+1]=k>>>8&255;this.view[offset]=k&255}else{this.view[offset]=k>>>24&255;this.view[offset+1]=k>>>16&255;this.view[offset+2]=k>>>8&255;this.view[offset+3]=k&255}offset+=4;utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));if(offset!==start+4+k)throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));if(relative){this.offset=offset;return this}return offset-start};ByteBufferPrototype.readIString=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var start=offset;var len=this.readUint32(offset);var str=this.readUTF8String(len,ByteBuffer.METRICS_BYTES,offset+=4);offset+=str["length"];if(relative){this.offset=offset;return str["string"]}else{return{string:str["string"],length:offset-start}}}
;ByteBuffer.METRICS_CHARS="c";ByteBuffer.METRICS_BYTES="b";ByteBufferPrototype.writeUTF8String=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var k;var start=offset;k=utfx.calculateUTF16asUTF8(stringSource(str))[1];offset+=k;var capacity14=this.buffer.byteLength;if(offset>capacity14)this.resize((capacity14*=2)>offset?capacity14:offset);offset-=k;utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));if(relative){this.offset=offset;return this}return offset-start};ByteBufferPrototype.writeString=ByteBufferPrototype.writeUTF8String;ByteBuffer.calculateUTF8Chars=function(str){return utfx.calculateUTF16asUTF8(stringSource(str))[0]};ByteBuffer.calculateUTF8Bytes=function(str){return utfx.calculateUTF16asUTF8(stringSource(str))[1]};ByteBuffer.calculateString=ByteBuffer.calculateUTF8Bytes;ByteBufferPrototype.readUTF8String=function(length,metrics,offset){if(typeof metrics==="number"){offset=metrics;metrics=undefined}var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(typeof metrics==="undefined")metrics=ByteBuffer.METRICS_CHARS;if(!this.noAssert){if(typeof length!=="number"||length%1!==0)throw TypeError("Illegal length: "+length+" (not an integer)");length|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var i=0,start=offset,sd;if(metrics===ByteBuffer.METRICS_CHARS){sd=stringDestination();utfx.decodeUTF8(function(){return i<length&&offset<this.limit?this.view[offset++]:null}.bind(this),function(cp){++i;utfx.UTF8toUTF16(cp,sd)});if(i!==length)throw RangeError("Illegal range: Truncated data, "+i+" == "+length);if(relative){this.offset=offset;return sd()}else{return{string:sd(),length:offset-start}}}else if(metrics===ByteBuffer.METRICS_BYTES){if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+length>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength)}var k=offset+length;utfx.decodeUTF8toUTF16(function(){return offset<k?this.view[offset++]:null}.bind(this),sd=stringDestination(),this.noAssert);if(offset!==k)throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);if(relative){this.offset=offset;return sd()}else{return{string:sd(),length:offset-start}}}else throw TypeError("Unsupported metrics: "+metrics)};ByteBufferPrototype.readString=ByteBufferPrototype.readUTF8String;ByteBufferPrototype.writeVString=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var start=offset,k,l;k=utfx.calculateUTF16asUTF8(stringSource(str),this.noAssert)[1];l=ByteBuffer.calculateVarint32(k);offset+=l+k;var capacity15=this.buffer.byteLength;if(offset>capacity15)this.resize((capacity15*=2)>offset?capacity15:offset);offset-=l+k;offset+=this.writeVarint32(k,offset);utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));if(offset!==start+k+l)throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));if(relative){this.offset=offset;return this}return offset-start};ByteBufferPrototype.readVString=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var start=offset;var len=this.readVarint32(offset);var str=this.readUTF8String(len["value"],ByteBuffer.METRICS_BYTES,offset+=len["length"]);offset+=str["length"];if(relative){this.offset=offset;return str["string"]}else{return{string:str["string"],length:offset-start}}};ByteBufferPrototype.append=function(source,encoding,offset){if(typeof encoding==="number"||typeof encoding!=="string"){offset=encoding;encoding=undefined}var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(!(source instanceof ByteBuffer))source=ByteBuffer.wrap(source,encoding);var length=source.limit-source.offset;if(length<=0)return this;offset+=length;var capacity16=this.buffer.byteLength;if(offset>capacity16)this.resize((capacity16*=2)>offset?capacity16:offset);offset-=length;this.view.set(source.view.subarray(source.offset,source.limit),offset);source.offset+=length;if(relative)this.offset+=length;return this};ByteBufferPrototype.appendTo=function(target,offset){target.append(this,offset);return this};ByteBufferPrototype.assert=function(assert){this.noAssert=!assert;return this};ByteBufferPrototype.capacity=function(){return this.buffer.byteLength};ByteBufferPrototype.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};ByteBufferPrototype.clone=function(copy){var bb=new ByteBuffer(0,this.littleEndian,this.noAssert);if(copy){bb.buffer=new ArrayBuffer(this.buffer.byteLength);bb.view=new Uint8Array(bb.buffer)}else{bb.buffer=this.buffer;bb.view=this.view}bb.offset=this.offset;bb.markedOffset=this.markedOffset;bb.limit=this.limit;return bb};ByteBufferPrototype.compact=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin===0&&end===this.buffer.byteLength)return this;var len=end-begin;if(len===0){this.buffer=EMPTY_BUFFER;this.view=null;if(this.markedOffset>=0)this.markedOffset-=begin;this.offset=0;this.limit=0;return this}var buffer=new ArrayBuffer(len);var view=new Uint8Array(buffer);view.set(this.view.subarray(begin,end));this.buffer=buffer;this.view=view;if(this.markedOffset>=0)this.markedOffset-=begin;this.offset=0;this.limit=len;return this};ByteBufferPrototype.copy=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin===end)return new ByteBuffer(0,this.littleEndian,this.noAssert);var capacity=end-begin,bb=new ByteBuffer(capacity,this.littleEndian,this.noAssert);bb.offset=0;bb.limit=capacity;if(bb.markedOffset>=0)bb.markedOffset-=begin;this.copyTo(bb,0,begin,end);return bb};ByteBufferPrototype.copyTo=function(target,targetOffset,sourceOffset,sourceLimit){var relative,targetRelative;if(!this.noAssert){if(!ByteBuffer.isByteBuffer(target))throw TypeError("Illegal target: Not a ByteBuffer")}targetOffset=(targetRelative=typeof targetOffset==="undefined")?target.offset:targetOffset|0;sourceOffset=(relative=typeof sourceOffset==="undefined")?this.offset:sourceOffset|0;sourceLimit=typeof sourceLimit==="undefined"?this.limit:sourceLimit|0;if(targetOffset<0||targetOffset>target.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);if(sourceOffset<0||sourceLimit>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);var len=sourceLimit-sourceOffset;if(len===0)return target;target.ensureCapacity(targetOffset+len);target.view.set(this.view.subarray(sourceOffset,sourceLimit),targetOffset);if(relative)this.offset+=len;if(targetRelative)target.offset+=len;return this};ByteBufferPrototype.ensureCapacity=function(capacity){var current=this.buffer.byteLength;if(current<capacity)return this.resize((current*=2)>capacity?current:capacity);return this};ByteBufferPrototype.fill=function(value,begin,end){var relative=typeof begin==="undefined";if(relative)begin=this.offset;if(typeof value==="string"&&value.length>0)value=value.charCodeAt(0);if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin>=end)return this;while(begin<end)this.view[begin++]=value;if(relative)this.offset=begin;return this};ByteBufferPrototype.flip=function(){this.limit=this.offset;this.offset=0;return this};ByteBufferPrototype.mark=function(offset){offset=typeof offset==="undefined"?this.offset:offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}this.markedOffset=offset;return this};ByteBufferPrototype.order=function(littleEndian){if(!this.noAssert){if(typeof littleEndian!=="boolean")throw TypeError("Illegal littleEndian: Not a boolean")}this.littleEndian=!!littleEndian;return this};ByteBufferPrototype.LE=function(littleEndian){this.littleEndian=typeof littleEndian!=="undefined"?!!littleEndian:true;return this};ByteBufferPrototype.BE=function(bigEndian){this.littleEndian=typeof bigEndian!=="undefined"?!bigEndian:false;return this};ByteBufferPrototype.prepend=function(source,encoding,offset){if(typeof encoding==="number"||typeof encoding!=="string"){offset=encoding;encoding=undefined}var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(!(source instanceof ByteBuffer))source=ByteBuffer.wrap(source,encoding);var len=source.limit-source.offset;if(len<=0)return this;var diff=len-offset;if(diff>0){var buffer=new ArrayBuffer(this.buffer.byteLength+diff);var view=new Uint8Array(buffer);view.set(this.view.subarray(offset,this.buffer.byteLength),len);this.buffer=buffer;this.view=view;this.offset+=diff;if(this.markedOffset>=0)this.markedOffset+=diff;this.limit+=diff;offset+=diff}else{var arrayView=new Uint8Array(this.buffer)}this.view.set(source.view.subarray(source.offset,source.limit),offset-len);source.offset=source.limit;if(relative)this.offset-=len;return this};ByteBufferPrototype.prependTo=function(target,offset){target.prepend(this,offset);return this};ByteBufferPrototype.printDebug=function(out){if(typeof out!=="function")out=console.log.bind(console);out(this.toString()+"\n"+"-------------------------------------------------------------------\n"+this.toDebug(true))};ByteBufferPrototype.remaining=function(){return this.limit-this.offset};ByteBufferPrototype.reset=function(){if(this.markedOffset>=0){this.offset=this.markedOffset;this.markedOffset=-1}else{this.offset=0}return this};ByteBufferPrototype.resize=function(capacity){if(!this.noAssert){if(typeof capacity!=="number"||capacity%1!==0)throw TypeError("Illegal capacity: "+capacity+" (not an integer)");capacity|=0;if(capacity<0)throw RangeError("Illegal capacity: 0 <= "+capacity)}if(this.buffer.byteLength<capacity){var buffer=new ArrayBuffer(capacity);var view=new Uint8Array(buffer);view.set(this.view);this.buffer=buffer;this.view=view}return this};ByteBufferPrototype.reverse=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin===end)return this;Array.prototype.reverse.call(this.view.subarray(begin,end));return this};ByteBufferPrototype.skip=function(length){if(!this.noAssert){if(typeof length!=="number"||length%1!==0)throw TypeError("Illegal length: "+length+" (not an integer)");length|=0}var offset=this.offset+length;if(!this.noAssert){if(offset<0||offset>this.buffer.byteLength)throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength)}this.offset=offset;return this};ByteBufferPrototype.slice=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var bb=this.clone();bb.offset=begin;bb.limit=end;return bb};ByteBufferPrototype.toBuffer=function(forceCopy){var offset=this.offset,limit=this.limit;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: Not an integer");offset>>>=0;if(typeof limit!=="number"||limit%1!==0)throw TypeError("Illegal limit: Not an integer");limit>>>=0;if(offset<0||offset>limit||limit>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength)}if(!forceCopy&&offset===0&&limit===this.buffer.byteLength)return this.buffer;if(offset===limit)return EMPTY_BUFFER;var buffer=new ArrayBuffer(limit-offset);new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset,limit),0);return buffer};ByteBufferPrototype.toArrayBuffer=ByteBufferPrototype.toBuffer;ByteBufferPrototype.toString=function(encoding,begin,end){if(typeof encoding==="undefined")return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";if(typeof encoding==="number")encoding="utf8",begin=encoding,end=begin;switch(encoding){case"utf8":return this.toUTF8(begin,end);case"base64":return this.toBase64(begin,end);case"hex":return this.toHex(begin,end);case"binary":return this.toBinary(begin,end);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+encoding)}};var lxiv=function(){"use strict";var lxiv={};var aout=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47];var ain=[];for(var i=0,k=aout.length;i<k;++i)ain[aout[i]]=i;lxiv.encode=function(src,dst){var b,t;while((b=src())!==null){dst(aout[b>>2&63]);t=(b&3)<<4;if((b=src())!==null){t|=b>>4&15;dst(aout[(t|b>>4&15)&63]);t=(b&15)<<2;if((b=src())!==null)dst(aout[(t|b>>6&3)&63]),dst(aout[b&63]);else dst(aout[t&63]),dst(61)}else dst(aout[t&63]),dst(61),dst(61)}};lxiv.decode=function(src,dst){var c,t1,t2;function fail(c){throw Error("Illegal character code: "+c)}while((c=src())!==null){t1=ain[c];if(typeof t1==="undefined")fail(c);if((c=src())!==null){t2=ain[c];if(typeof t2==="undefined")fail(c);dst(t1<<2>>>0|(t2&48)>>4);if((c=src())!==null){t1=ain[c];if(typeof t1==="undefined")if(c===61)break;else fail(c);dst((t2&15)<<4>>>0|(t1&60)>>2);if((c=src())!==null){t2=ain[c];if(typeof t2==="undefined")if(c===61)break;else fail(c);dst((t1&3)<<6>>>0|t2)}}}}};lxiv.test=function(str){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(str)};return lxiv}();ByteBufferPrototype.toBase64=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;begin=begin|0;end=end|0;if(begin<0||end>this.capacity||begin>end)throw RangeError("begin, end");var sd;lxiv.encode(function(){return begin<end?this.view[begin++]:null}.bind(this),sd=stringDestination());return sd()};ByteBuffer.fromBase64=function(str,littleEndian){if(typeof str!=="string")throw TypeError("str");var bb=new ByteBuffer(str.length/4*3,littleEndian),i=0;lxiv.decode(stringSource(str),function(b){bb.view[i++]=b});bb.limit=i;return bb};ByteBuffer.btoa=function(str){return ByteBuffer.fromBinary(str).toBase64()};ByteBuffer.atob=function(b64){return ByteBuffer.fromBase64(b64).toBinary()};ByteBufferPrototype.toBinary=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;begin|=0;end|=0;if(begin<0||end>this.capacity()||begin>end)throw RangeError("begin, end");if(begin===end)return"";var chars=[],parts=[];while(begin<end){chars.push(this.view[begin++]);if(chars.length>=1024)parts.push(String.fromCharCode.apply(String,chars)),chars=[]}return parts.join("")+String.fromCharCode.apply(String,chars)};ByteBuffer.fromBinary=function(str,littleEndian){if(typeof str!=="string")throw TypeError("str");var i=0,k=str.length,charCode,bb=new ByteBuffer(k,littleEndian);while(i<k){charCode=str.charCodeAt(i);if(charCode>255)throw RangeError("illegal char code: "+charCode);bb.view[i++]=charCode}bb.limit=k;return bb};ByteBufferPrototype.toDebug=function(columns){var i=-1,k=this.buffer.byteLength,b,hex="",asc="",out="";while(i<k){if(i!==-1){b=this.view[i];if(b<16)hex+="0"+b.toString(16).toUpperCase();else hex+=b.toString(16).toUpperCase();if(columns)asc+=b>32&&b<127?String.fromCharCode(b):"."}++i;if(columns){if(i>0&&i%16===0&&i!==k){while(hex.length<3*16+3)hex+=" ";out+=hex+asc+"\n";hex=asc=""}}if(i===this.offset&&i===this.limit)hex+=i===this.markedOffset?"!":"|";else if(i===this.offset)hex+=i===this.markedOffset?"[":"<";else if(i===this.limit)hex+=i===this.markedOffset?"]":">";else hex+=i===this.markedOffset?"'":columns||i!==0&&i!==k?" ":""}if(columns&&hex!==" "){while(hex.length<3*16+3)hex+=" ";out+=hex+asc+"\n"}return columns?out:hex};ByteBuffer.fromDebug=function(str,littleEndian,noAssert){var k=str.length,bb=new ByteBuffer((k+1)/3|0,littleEndian,noAssert);var i=0,j=0,ch,b,rs=false,ho=false,hm=false,hl=false,fail=false;while(i<k){switch(ch=str.charAt(i++)){case"!":if(!noAssert){if(ho||hm||hl){fail=true;break}ho=hm=hl=true}bb.offset=bb.markedOffset=bb.limit=j;rs=false;break;case"|":if(!noAssert){if(ho||hl){fail=true;break}ho=hl=true}bb.offset=bb.limit=j;rs=false;break;case"[":if(!noAssert){if(ho||hm){fail=true;break}ho=hm=true}bb.offset=bb.markedOffset=j;rs=false;break;case"<":if(!noAssert){if(ho){fail=true;break}ho=true}bb.offset=j;rs=false;break;case"]":if(!noAssert){if(hl||hm){fail=true;break}hl=hm=true}bb.limit=bb.markedOffset=j;rs=false;break;case">":if(!noAssert){if(hl){fail=true;break}hl=true}bb.limit=j;rs=false;break;case"'":if(!noAssert){if(hm){fail=true;break}hm=true}bb.markedOffset=j;rs=false;break;case" ":rs=false;break;default:if(!noAssert){if(rs){fail=true;break}}b=parseInt(ch+str.charAt(i++),16);if(!noAssert){if(isNaN(b)||b<0||b>255)throw TypeError("Illegal str: Not a debug encoded string")}bb.view[j++]=b;rs=true}if(fail)throw TypeError("Illegal str: Invalid symbol at "+i)}if(!noAssert){if(!ho||!hl)throw TypeError("Illegal str: Missing offset or limit");if(j<bb.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k)}return bb};ByteBufferPrototype.toHex=function(begin,end){begin=typeof begin==="undefined"?this.offset:begin;end=typeof end==="undefined"?this.limit:end;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var out=new Array(end-begin),b;while(begin<end){b=this.view[begin++];if(b<16)out.push("0",b.toString(16));else out.push(b.toString(16))}return out.join("")};ByteBuffer.fromHex=function(str,littleEndian,noAssert){if(!noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");if(str.length%2!==0)throw TypeError("Illegal str: Length not a multiple of 2")}var k=str.length,bb=new ByteBuffer(k/2|0,littleEndian),b;for(var i=0,j=0;i<k;i+=2){b=parseInt(str.substring(i,i+2),16);if(!noAssert)if(!isFinite(b)||b<0||b>255)throw TypeError("Illegal str: Contains non-hex characters");bb.view[j++]=b}bb.limit=j;return bb};var utfx=function(){"use strict";var utfx={};utfx.MAX_CODEPOINT=1114111;utfx.encodeUTF8=function(src,dst){var cp=null;if(typeof src==="number")cp=src,src=function(){return null};while(cp!==null||(cp=src())!==null){if(cp<128)dst(cp&127);else if(cp<2048)dst(cp>>6&31|192),dst(cp&63|128);else if(cp<65536)dst(cp>>12&15|224),dst(cp>>6&63|128),dst(cp&63|128);else dst(cp>>18&7|240),dst(cp>>12&63|128),dst(cp>>6&63|128),dst(cp&63|128);cp=null}};utfx.decodeUTF8=function(src,dst){var a,b,c,d,fail=function(b){b=b.slice(0,b.indexOf(null));var err=Error(b.toString());err.name="TruncatedError";err["bytes"]=b;throw err};while((a=src())!==null){if((a&128)===0)dst(a);else if((a&224)===192)(b=src())===null&&fail([a,b]),dst((a&31)<<6|b&63);else if((a&240)===224)((b=src())===null||(c=src())===null)&&fail([a,b,c]),dst((a&15)<<12|(b&63)<<6|c&63);else if((a&248)===240)((b=src())===null||(c=src())===null||(d=src())===null)&&fail([a,b,c,d]),dst((a&7)<<18|(b&63)<<12|(c&63)<<6|d&63);else throw RangeError("Illegal starting byte: "+a)}};utfx.UTF16toUTF8=function(src,dst){var c1,c2=null;while(true){if((c1=c2!==null?c2:src())===null)break;if(c1>=55296&&c1<=57343){if((c2=src())!==null){if(c2>=56320&&c2<=57343){dst((c1-55296)*1024+c2-56320+65536);c2=null;continue}}}dst(c1)}if(c2!==null)dst(c2)};utfx.UTF8toUTF16=function(src,dst){var cp=null;if(typeof src==="number")cp=src,src=function(){return null};while(cp!==null||(cp=src())!==null){if(cp<=65535)dst(cp);else cp-=65536,dst((cp>>10)+55296),dst(cp%1024+56320);cp=null}};utfx.encodeUTF16toUTF8=function(src,dst){utfx.UTF16toUTF8(src,function(cp){utfx.encodeUTF8(cp,dst)})};utfx.decodeUTF8toUTF16=function(src,dst){utfx.decodeUTF8(src,function(cp){utfx.UTF8toUTF16(cp,dst)})};utfx.calculateCodePoint=function(cp){return cp<128?1:cp<2048?2:cp<65536?3:4};utfx.calculateUTF8=function(src){var cp,l=0;while((cp=src())!==null)l+=cp<128?1:cp<2048?2:cp<65536?3:4;return l};utfx.calculateUTF16asUTF8=function(src){var n=0,l=0;utfx.UTF16toUTF8(src,function(cp){++n;l+=cp<128?1:cp<2048?2:cp<65536?3:4});return[n,l]};return utfx}();ByteBufferPrototype.toUTF8=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var sd;try{utfx.decodeUTF8toUTF16(function(){return begin<end?this.view[begin++]:null}.bind(this),sd=stringDestination())}catch(e){if(begin!==end)throw RangeError("Illegal range: Truncated data, "+begin+" != "+end)}return sd()};ByteBuffer.fromUTF8=function(str,littleEndian,noAssert){if(!noAssert)if(typeof str!=="string")throw TypeError("Illegal str: Not a string");var bb=new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str),true)[1],littleEndian,noAssert),i=0;utfx.encodeUTF16toUTF8(stringSource(str),function(b){bb.view[i++]=b});bb.limit=i;return bb};return ByteBuffer})},{long:30}],22:[function(require,module,exports){(function(Buffer){function isArray(arg){if(Array.isArray){return Array.isArray(arg)}return objectToString(arg)==="[object Array]"}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return objectToString(e)==="[object Error]"||e instanceof Error}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":28}],23:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Uncaught, unspecified "error" event. ('+er+")");err.context=er;throw err}}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1);handler.apply(this,args)}}else if(isObject(handler)){args=Array.prototype.slice.call(arguments,1);listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-- >0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else if(listeners){while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;else if(evlistener)return evlistener.length}return 0};EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],24:[function(require,module,exports){(function(root,factory){var exports={};factory(exports);var sha256=exports["default"];for(var k in exports){sha256[k]=exports[k]}if(typeof module==="object"&&typeof module.exports==="object"){module.exports=sha256}else if(typeof define==="function"&&define.amd){define(function(){return sha256})}else{root.sha256=sha256}})(this,function(exports){"use strict";exports.__esModule=true;exports.digestLength=32;exports.blockSize=64
;var K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function hashBlocks(w,v,p,pos,len){var a,b,c,d,e,f,g,h,u,i,j,t1,t2;while(len>=64){a=v[0];b=v[1];c=v[2];d=v[3];e=v[4];f=v[5];g=v[6];h=v[7];for(i=0;i<16;i++){j=pos+i*4;w[i]=(p[j]&255)<<24|(p[j+1]&255)<<16|(p[j+2]&255)<<8|p[j+3]&255}for(i=16;i<64;i++){u=w[i-2];t1=(u>>>17|u<<32-17)^(u>>>19|u<<32-19)^u>>>10;u=w[i-15];t2=(u>>>7|u<<32-7)^(u>>>18|u<<32-18)^u>>>3;w[i]=(t1+w[i-7]|0)+(t2+w[i-16]|0)}for(i=0;i<64;i++){t1=(((e>>>6|e<<32-6)^(e>>>11|e<<32-11)^(e>>>25|e<<32-25))+(e&f^~e&g)|0)+(h+(K[i]+w[i]|0)|0)|0;t2=((a>>>2|a<<32-2)^(a>>>13|a<<32-13)^(a>>>22|a<<32-22))+(a&b^a&c^b&c)|0;h=g;g=f;f=e;e=d+t1|0;d=c;c=b;b=a;a=t1+t2|0}v[0]+=a;v[1]+=b;v[2]+=c;v[3]+=d;v[4]+=e;v[5]+=f;v[6]+=g;v[7]+=h;pos+=64;len-=64}return pos}var Hash=function(){function Hash(){this.digestLength=exports.digestLength;this.blockSize=exports.blockSize;this.state=new Int32Array(8);this.temp=new Int32Array(64);this.buffer=new Uint8Array(128);this.bufferLength=0;this.bytesHashed=0;this.finished=false;this.reset()}Hash.prototype.reset=function(){this.state[0]=1779033703;this.state[1]=3144134277;this.state[2]=1013904242;this.state[3]=2773480762;this.state[4]=1359893119;this.state[5]=2600822924;this.state[6]=528734635;this.state[7]=1541459225;this.bufferLength=0;this.bytesHashed=0;this.finished=false;return this};Hash.prototype.clean=function(){for(var i=0;i<this.buffer.length;i++){this.buffer[i]=0}for(var i=0;i<this.temp.length;i++){this.temp[i]=0}this.reset()};Hash.prototype.update=function(data,dataLength){if(dataLength===void 0){dataLength=data.length}if(this.finished){throw new Error("SHA256: can't update because hash was finished.")}var dataPos=0;this.bytesHashed+=dataLength;if(this.bufferLength>0){while(this.bufferLength<64&&dataLength>0){this.buffer[this.bufferLength++]=data[dataPos++];dataLength--}if(this.bufferLength===64){hashBlocks(this.temp,this.state,this.buffer,0,64);this.bufferLength=0}}if(dataLength>=64){dataPos=hashBlocks(this.temp,this.state,data,dataPos,dataLength);dataLength%=64}while(dataLength>0){this.buffer[this.bufferLength++]=data[dataPos++];dataLength--}return this};Hash.prototype.finish=function(out){if(!this.finished){var bytesHashed=this.bytesHashed;var left=this.bufferLength;var bitLenHi=bytesHashed/536870912|0;var bitLenLo=bytesHashed<<3;var padLength=bytesHashed%64<56?64:128;this.buffer[left]=128;for(var i=left+1;i<padLength-8;i++){this.buffer[i]=0}this.buffer[padLength-8]=bitLenHi>>>24&255;this.buffer[padLength-7]=bitLenHi>>>16&255;this.buffer[padLength-6]=bitLenHi>>>8&255;this.buffer[padLength-5]=bitLenHi>>>0&255;this.buffer[padLength-4]=bitLenLo>>>24&255;this.buffer[padLength-3]=bitLenLo>>>16&255;this.buffer[padLength-2]=bitLenLo>>>8&255;this.buffer[padLength-1]=bitLenLo>>>0&255;hashBlocks(this.temp,this.state,this.buffer,0,padLength);this.finished=true}for(var i=0;i<8;i++){out[i*4+0]=this.state[i]>>>24&255;out[i*4+1]=this.state[i]>>>16&255;out[i*4+2]=this.state[i]>>>8&255;out[i*4+3]=this.state[i]>>>0&255}return this};Hash.prototype.digest=function(){var out=new Uint8Array(this.digestLength);this.finish(out);return out};Hash.prototype._saveState=function(out){for(var i=0;i<this.state.length;i++){out[i]=this.state[i]}};Hash.prototype._restoreState=function(from,bytesHashed){for(var i=0;i<this.state.length;i++){this.state[i]=from[i]}this.bytesHashed=bytesHashed;this.finished=false;this.bufferLength=0};return Hash}();exports.Hash=Hash;var HMAC=function(){function HMAC(key){this.inner=new Hash;this.outer=new Hash;this.blockSize=this.inner.blockSize;this.digestLength=this.inner.digestLength;var pad=new Uint8Array(this.blockSize);if(key.length>this.blockSize){(new Hash).update(key).finish(pad).clean()}else{for(var i=0;i<key.length;i++){pad[i]=key[i]}}for(var i=0;i<pad.length;i++){pad[i]^=54}this.inner.update(pad);for(var i=0;i<pad.length;i++){pad[i]^=54^92}this.outer.update(pad);this.istate=new Uint32Array(8);this.ostate=new Uint32Array(8);this.inner._saveState(this.istate);this.outer._saveState(this.ostate);for(var i=0;i<pad.length;i++){pad[i]=0}}HMAC.prototype.reset=function(){this.inner._restoreState(this.istate,this.inner.blockSize);this.outer._restoreState(this.ostate,this.outer.blockSize);return this};HMAC.prototype.clean=function(){for(var i=0;i<this.istate.length;i++){this.ostate[i]=this.istate[i]=0}this.inner.clean();this.outer.clean()};HMAC.prototype.update=function(data){this.inner.update(data);return this};HMAC.prototype.finish=function(out){if(this.outer.finished){this.outer.finish(out)}else{this.inner.finish(out);this.outer.update(out,this.digestLength).finish(out)}return this};HMAC.prototype.digest=function(){var out=new Uint8Array(this.digestLength);this.finish(out);return out};return HMAC}();exports.HMAC=HMAC;function hash(data){var h=(new Hash).update(data);var digest=h.digest();h.clean();return digest}exports.hash=hash;exports["default"]=hash;function hmac(key,data){var h=new HMAC(key).update(data);var digest=h.digest();h.clean();return digest}exports.hmac=hmac;function pbkdf2(password,salt,iterations,dkLen){var prf=new HMAC(password);var len=prf.digestLength;var ctr=new Uint8Array(4);var t=new Uint8Array(len);var u=new Uint8Array(len);var dk=new Uint8Array(dkLen);for(var i=0;i*len<dkLen;i++){var c=i+1;ctr[0]=c>>>24&255;ctr[1]=c>>>16&255;ctr[2]=c>>>8&255;ctr[3]=c>>>0&255;prf.reset();prf.update(salt);prf.update(ctr);prf.finish(u);for(var j=0;j<len;j++){t[j]=u[j]}for(var j=2;j<=iterations;j++){prf.reset();prf.update(u).finish(u);for(var k=0;k<len;k++){t[k]^=u[k]}}for(var j=0;j<len&&i*len+j<dkLen;j++){dk[i*len+j]=t[j]}}for(var i=0;i<len;i++){t[i]=u[i]=0}for(var i=0;i<4;i++){ctr[i]=0}prf.clean();return dk}exports.pbkdf2=pbkdf2})},{}],25:[function(require,module,exports){(function(Buffer){"use strict";var Transform=require("stream").Transform;var inherits=require("inherits");function HashBase(blockSize){Transform.call(this);this._block=new Buffer(blockSize);this._blockSize=blockSize;this._blockOffset=0;this._length=[0,0,0,0];this._finalized=false}inherits(HashBase,Transform);HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{if(encoding!=="buffer")chunk=new Buffer(chunk,encoding);this.update(chunk)}catch(err){error=err}callback(error)};HashBase.prototype._flush=function(callback){var error=null;try{this.push(this._digest())}catch(err){error=err}callback(error)};HashBase.prototype.update=function(data,encoding){if(!Buffer.isBuffer(data)&&typeof data!=="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");if(!Buffer.isBuffer(data))data=new Buffer(data,encoding||"binary");var block=this._block;var offset=0;while(this._blockOffset+data.length-offset>=this._blockSize){for(var i=this._blockOffset;i<this._blockSize;)block[i++]=data[offset++];this._update();this._blockOffset=0}while(offset<data.length)block[this._blockOffset++]=data[offset++];for(var j=0,carry=data.length*8;carry>0;++j){this._length[j]+=carry;carry=this._length[j]/4294967296|0;if(carry>0)this._length[j]-=4294967296*carry}return this};HashBase.prototype._update=function(data){throw new Error("_update is not implemented")};HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=true;var digest=this._digest();if(encoding!==undefined)digest=digest.toString(encoding);return digest};HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")};module.exports=HashBase}).call(this,require("buffer").Buffer)},{buffer:20,inherits:27,stream:48}],26:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],27:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],28:[function(require,module,exports){module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isBuffer(obj.slice(0,0))}},{}],29:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],30:[function(require,module,exports){(function(global,factory){if(typeof define==="function"&&define["amd"])define([],factory);else if(typeof require==="function"&&typeof module==="object"&&module&&module["exports"])module["exports"]=factory();else(global["dcodeIO"]=global["dcodeIO"]||{})["Long"]=factory()})(this,function(){"use strict";function Long(low,high,unsigned){this.low=low|0;this.high=high|0;this.unsigned=!!unsigned}Long.prototype.__isLong__;Object.defineProperty(Long.prototype,"__isLong__",{value:true,enumerable:false,configurable:false});function isLong(obj){return(obj&&obj["__isLong__"])===true}Long.isLong=isLong;var INT_CACHE={};var UINT_CACHE={};function fromInt(value,unsigned){var obj,cachedObj,cache;if(unsigned){value>>>=0;if(cache=0<=value&&value<256){cachedObj=UINT_CACHE[value];if(cachedObj)return cachedObj}obj=fromBits(value,(value|0)<0?-1:0,true);if(cache)UINT_CACHE[value]=obj;return obj}else{value|=0;if(cache=-128<=value&&value<128){cachedObj=INT_CACHE[value];if(cachedObj)return cachedObj}obj=fromBits(value,value<0?-1:0,false);if(cache)INT_CACHE[value]=obj;return obj}}Long.fromInt=fromInt;function fromNumber(value,unsigned){if(isNaN(value)||!isFinite(value))return unsigned?UZERO:ZERO;if(unsigned){if(value<0)return UZERO;if(value>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(value<=-TWO_PWR_63_DBL)return MIN_VALUE;if(value+1>=TWO_PWR_63_DBL)return MAX_VALUE}if(value<0)return fromNumber(-value,unsigned).neg();return fromBits(value%TWO_PWR_32_DBL|0,value/TWO_PWR_32_DBL|0,unsigned)}Long.fromNumber=fromNumber;function fromBits(lowBits,highBits,unsigned){return new Long(lowBits,highBits,unsigned)}Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(str,unsigned,radix){if(str.length===0)throw Error("empty string");if(str==="NaN"||str==="Infinity"||str==="+Infinity"||str==="-Infinity")return ZERO;if(typeof unsigned==="number"){radix=unsigned,unsigned=false}else{unsigned=!!unsigned}radix=radix||10;if(radix<2||36<radix)throw RangeError("radix");var p;if((p=str.indexOf("-"))>0)throw Error("interior hyphen");else if(p===0){return fromString(str.substring(1),unsigned,radix).neg()}var radixToPower=fromNumber(pow_dbl(radix,8));var result=ZERO;for(var i=0;i<str.length;i+=8){var size=Math.min(8,str.length-i),value=parseInt(str.substring(i,i+size),radix);if(size<8){var power=fromNumber(pow_dbl(radix,size));result=result.mul(power).add(fromNumber(value))}else{result=result.mul(radixToPower);result=result.add(fromNumber(value))}}result.unsigned=unsigned;return result}Long.fromString=fromString;function fromValue(val){if(val instanceof Long)return val;if(typeof val==="number")return fromNumber(val);if(typeof val==="string")return fromString(val);return fromBits(val.low,val.high,val.unsigned)}Long.fromValue=fromValue;var TWO_PWR_16_DBL=1<<16;var TWO_PWR_24_DBL=1<<24;var TWO_PWR_32_DBL=TWO_PWR_16_DBL*TWO_PWR_16_DBL;var TWO_PWR_64_DBL=TWO_PWR_32_DBL*TWO_PWR_32_DBL;var TWO_PWR_63_DBL=TWO_PWR_64_DBL/2;var TWO_PWR_24=fromInt(TWO_PWR_24_DBL);var ZERO=fromInt(0);Long.ZERO=ZERO;var UZERO=fromInt(0,true);Long.UZERO=UZERO;var ONE=fromInt(1);Long.ONE=ONE;var UONE=fromInt(1,true);Long.UONE=UONE;var NEG_ONE=fromInt(-1);Long.NEG_ONE=NEG_ONE;var MAX_VALUE=fromBits(4294967295|0,2147483647|0,false);Long.MAX_VALUE=MAX_VALUE;var MAX_UNSIGNED_VALUE=fromBits(4294967295|0,4294967295|0,true);Long.MAX_UNSIGNED_VALUE=MAX_UNSIGNED_VALUE;var MIN_VALUE=fromBits(0,2147483648|0,false);Long.MIN_VALUE=MIN_VALUE;var LongPrototype=Long.prototype;LongPrototype.toInt=function toInt(){return this.unsigned?this.low>>>0:this.low};LongPrototype.toNumber=function toNumber(){if(this.unsigned)return(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0);return this.high*TWO_PWR_32_DBL+(this.low>>>0)};LongPrototype.toString=function toString(radix){radix=radix||10;if(radix<2||36<radix)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(MIN_VALUE)){var radixLong=fromNumber(radix),div=this.div(radixLong),rem1=div.mul(radixLong).sub(this);return div.toString(radix)+rem1.toInt().toString(radix)}else return"-"+this.neg().toString(radix)}var radixToPower=fromNumber(pow_dbl(radix,6),this.unsigned),rem=this;var result="";while(true){var remDiv=rem.div(radixToPower),intval=rem.sub(remDiv.mul(radixToPower)).toInt()>>>0,digits=intval.toString(radix);rem=remDiv;if(rem.isZero())return digits+result;else{while(digits.length<6)digits="0"+digits;result=""+digits+result}}};LongPrototype.getHighBits=function getHighBits(){return this.high};LongPrototype.getHighBitsUnsigned=function getHighBitsUnsigned(){return this.high>>>0};LongPrototype.getLowBits=function getLowBits(){return this.low};LongPrototype.getLowBitsUnsigned=function getLowBitsUnsigned(){return this.low>>>0};LongPrototype.getNumBitsAbs=function getNumBitsAbs(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();var val=this.high!=0?this.high:this.low;for(var bit=31;bit>0;bit--)if((val&1<<bit)!=0)break;return this.high!=0?bit+33:bit+1};LongPrototype.isZero=function isZero(){return this.high===0&&this.low===0};LongPrototype.isNegative=function isNegative(){return!this.unsigned&&this.high<0};LongPrototype.isPositive=function isPositive(){return this.unsigned||this.high>=0};LongPrototype.isOdd=function isOdd(){return(this.low&1)===1};LongPrototype.isEven=function isEven(){return(this.low&1)===0};LongPrototype.equals=function equals(other){if(!isLong(other))other=fromValue(other);if(this.unsigned!==other.unsigned&&this.high>>>31===1&&other.high>>>31===1)return false;return this.high===other.high&&this.low===other.low};LongPrototype.eq=LongPrototype.equals;LongPrototype.notEquals=function notEquals(other){return!this.eq(other)};LongPrototype.neq=LongPrototype.notEquals;LongPrototype.lessThan=function lessThan(other){return this.comp(other)<0};LongPrototype.lt=LongPrototype.lessThan;LongPrototype.lessThanOrEqual=function lessThanOrEqual(other){return this.comp(other)<=0};LongPrototype.lte=LongPrototype.lessThanOrEqual;LongPrototype.greaterThan=function greaterThan(other){return this.comp(other)>0};LongPrototype.gt=LongPrototype.greaterThan;LongPrototype.greaterThanOrEqual=function greaterThanOrEqual(other){return this.comp(other)>=0};LongPrototype.gte=LongPrototype.greaterThanOrEqual;LongPrototype.compare=function compare(other){if(!isLong(other))other=fromValue(other);if(this.eq(other))return 0;var thisNeg=this.isNegative(),otherNeg=other.isNegative();if(thisNeg&&!otherNeg)return-1;if(!thisNeg&&otherNeg)return 1;if(!this.unsigned)return this.sub(other).isNegative()?-1:1;return other.high>>>0>this.high>>>0||other.high===this.high&&other.low>>>0>this.low>>>0?-1:1};LongPrototype.comp=LongPrototype.compare;LongPrototype.negate=function negate(){if(!this.unsigned&&this.eq(MIN_VALUE))return MIN_VALUE;return this.not().add(ONE)};LongPrototype.neg=LongPrototype.negate;LongPrototype.add=function add(addend){if(!isLong(addend))addend=fromValue(addend);var a48=this.high>>>16;var a32=this.high&65535;var a16=this.low>>>16;var a00=this.low&65535;var b48=addend.high>>>16;var b32=addend.high&65535;var b16=addend.low>>>16;var b00=addend.low&65535;var c48=0,c32=0,c16=0,c00=0;c00+=a00+b00;c16+=c00>>>16;c00&=65535;c16+=a16+b16;c32+=c16>>>16;c16&=65535;c32+=a32+b32;c48+=c32>>>16;c32&=65535;c48+=a48+b48;c48&=65535;return fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)};LongPrototype.subtract=function subtract(subtrahend){if(!isLong(subtrahend))subtrahend=fromValue(subtrahend);return this.add(subtrahend.neg())};LongPrototype.sub=LongPrototype.subtract;LongPrototype.multiply=function multiply(multiplier){if(this.isZero())return ZERO;if(!isLong(multiplier))multiplier=fromValue(multiplier);if(multiplier.isZero())return ZERO;if(this.eq(MIN_VALUE))return multiplier.isOdd()?MIN_VALUE:ZERO;if(multiplier.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO;if(this.isNegative()){if(multiplier.isNegative())return this.neg().mul(multiplier.neg());else return this.neg().mul(multiplier).neg()}else if(multiplier.isNegative())return this.mul(multiplier.neg()).neg();if(this.lt(TWO_PWR_24)&&multiplier.lt(TWO_PWR_24))return fromNumber(this.toNumber()*multiplier.toNumber(),this.unsigned);var a48=this.high>>>16;var a32=this.high&65535;var a16=this.low>>>16;var a00=this.low&65535;var b48=multiplier.high>>>16;var b32=multiplier.high&65535;var b16=multiplier.low>>>16;var b00=multiplier.low&65535;var c48=0,c32=0,c16=0,c00=0;c00+=a00*b00;c16+=c00>>>16;c00&=65535;c16+=a16*b00;c32+=c16>>>16;c16&=65535;c16+=a00*b16;c32+=c16>>>16;c16&=65535;c32+=a32*b00;c48+=c32>>>16;c32&=65535;c32+=a16*b16;c48+=c32>>>16;c32&=65535;c32+=a00*b32;c48+=c32>>>16;c32&=65535;c48+=a48*b00+a32*b16+a16*b32+a00*b48;c48&=65535;return fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)};LongPrototype.mul=LongPrototype.multiply;LongPrototype.divide=function divide(divisor){if(!isLong(divisor))divisor=fromValue(divisor);if(divisor.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?UZERO:ZERO;var approx,rem,res;if(!this.unsigned){if(this.eq(MIN_VALUE)){if(divisor.eq(ONE)||divisor.eq(NEG_ONE))return MIN_VALUE;else if(divisor.eq(MIN_VALUE))return ONE;else{var halfThis=this.shr(1);approx=halfThis.div(divisor).shl(1);if(approx.eq(ZERO)){return divisor.isNegative()?ONE:NEG_ONE}else{rem=this.sub(divisor.mul(approx));res=approx.add(rem.div(divisor));return res}}}else if(divisor.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO;if(this.isNegative()){if(divisor.isNegative())return this.neg().div(divisor.neg());return this.neg().div(divisor).neg()}else if(divisor.isNegative())return this.div(divisor.neg()).neg();res=ZERO}else{if(!divisor.unsigned)divisor=divisor.toUnsigned();if(divisor.gt(this))return UZERO;if(divisor.gt(this.shru(1)))return UONE;res=UZERO}rem=this;while(rem.gte(divisor)){approx=Math.max(1,Math.floor(rem.toNumber()/divisor.toNumber()));var log2=Math.ceil(Math.log(approx)/Math.LN2),delta=log2<=48?1:pow_dbl(2,log2-48),approxRes=fromNumber(approx),approxRem=approxRes.mul(divisor);while(approxRem.isNegative()||approxRem.gt(rem)){approx-=delta;approxRes=fromNumber(approx,this.unsigned);approxRem=approxRes.mul(divisor)}if(approxRes.isZero())approxRes=ONE;res=res.add(approxRes);rem=rem.sub(approxRem)}return res};LongPrototype.div=LongPrototype.divide;LongPrototype.modulo=function modulo(divisor){if(!isLong(divisor))divisor=fromValue(divisor);return this.sub(this.div(divisor).mul(divisor))};LongPrototype.mod=LongPrototype.modulo;LongPrototype.not=function not(){return fromBits(~this.low,~this.high,this.unsigned)};LongPrototype.and=function and(other){if(!isLong(other))other=fromValue(other);return fromBits(this.low&other.low,this.high&other.high,this.unsigned)};LongPrototype.or=function or(other){if(!isLong(other))other=fromValue(other);return fromBits(this.low|other.low,this.high|other.high,this.unsigned)};LongPrototype.xor=function xor(other){if(!isLong(other))other=fromValue(other);return fromBits(this.low^other.low,this.high^other.high,this.unsigned)};LongPrototype.shiftLeft=function shiftLeft(numBits){if(isLong(numBits))numBits=numBits.toInt();if((numBits&=63)===0)return this;else if(numBits<32)return fromBits(this.low<<numBits,this.high<<numBits|this.low>>>32-numBits,this.unsigned);else return fromBits(0,this.low<<numBits-32,this.unsigned)};LongPrototype.shl=LongPrototype.shiftLeft;LongPrototype.shiftRight=function shiftRight(numBits){if(isLong(numBits))numBits=numBits.toInt();if((numBits&=63)===0)return this;else if(numBits<32)return fromBits(this.low>>>numBits|this.high<<32-numBits,this.high>>numBits,this.unsigned);else return fromBits(this.high>>numBits-32,this.high>=0?0:-1,this.unsigned)};LongPrototype.shr=LongPrototype.shiftRight;LongPrototype.shiftRightUnsigned=function shiftRightUnsigned(numBits){if(isLong(numBits))numBits=numBits.toInt();numBits&=63;if(numBits===0)return this;else{var high=this.high;if(numBits<32){var low=this.low;return fromBits(low>>>numBits|high<<32-numBits,high>>>numBits,this.unsigned)}else if(numBits===32)return fromBits(high,0,this.unsigned);else return fromBits(high>>>numBits-32,0,this.unsigned)}};LongPrototype.shru=LongPrototype.shiftRightUnsigned;LongPrototype.toSigned=function toSigned(){if(!this.unsigned)return this;return fromBits(this.low,this.high,false)};LongPrototype.toUnsigned=function toUnsigned(){if(this.unsigned)return this;return fromBits(this.low,this.high,true)};LongPrototype.toBytes=function(le){return le?this.toBytesLE():this.toBytesBE()};LongPrototype.toBytesLE=function(){var hi=this.high,lo=this.low;return[lo&255,lo>>>8&255,lo>>>16&255,lo>>>24&255,hi&255,hi>>>8&255,hi>>>16&255,hi>>>24&255]};LongPrototype.toBytesBE=function(){var hi=this.high,lo=this.low;return[hi>>>24&255,hi>>>16&255,hi>>>8&255,hi&255,lo>>>24&255,lo>>>16&255,lo>>>8&255,lo&255]};return Long})},{}],31:[function(require,module,exports){(function(process){"use strict";if(!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){module.exports=nextTick}else{module.exports=process.nextTick}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=="function"){throw new TypeError('"callback" argument must be a function')}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function afterTickOne(){fn.call(null,arg1)});case 3:return process.nextTick(function afterTickTwo(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function afterTickThree(){fn.call(null,arg1,arg2,arg3)});default:args=new Array(len-1);i=0;while(i<args.length){args[i++]=arguments[i]}return process.nextTick(function afterTick(){fn.apply(null,args)})}}}).call(this,require("_process"))},{_process:32}],32:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],33:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":34}],34:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args");var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){keys.push(key)}return keys};module.exports=Duplex;var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable");var Writable=require("./_stream_writable");util.inherits(Duplex,Readable);var keys=objectKeys(Writable.prototype);for(var v=0;v<keys.length;v++){var method=keys[v];if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;processNextTick(onEndNT,this)}function onEndNT(self){self.end()}Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){if(this._readableState===undefined||this._writableState===undefined){return false}return this._readableState.destroyed&&this._writableState.destroyed},set:function(value){if(this._readableState===undefined||this._writableState===undefined){return}this._readableState.destroyed=value;this._writableState.destroyed=value}});Duplex.prototype._destroy=function(err,cb){this.push(null);this.end();processNextTick(cb,err)};function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}},{"./_stream_readable":36,"./_stream_writable":38,"core-util-is":22,inherits:27,"process-nextick-args":31}],35:[function(require,module,exports){"use strict";module.exports=PassThrough;var Transform=require("./_stream_transform");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":37,"core-util-is":22,inherits:27}],36:[function(require,module,exports){(function(process,global){"use strict";var processNextTick=require("process-nextick-args");module.exports=Readable;var isArray=require("isarray");var Duplex;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;var EElistenerCount=function(emitter,type){return emitter.listeners(type).length};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var util=require("core-util-is");util.inherits=require("inherits");var debugUtil=require("util");var debug=void 0;if(debugUtil&&debugUtil.debuglog){debug=debugUtil.debuglog("stream")}else{debug=function(){}}var BufferList=require("./internal/streams/BufferList");var destroyImpl=require("./internal/streams/destroy");var StringDecoder;util.inherits(Readable,Stream);var kProxyEvents=["error","close","destroy","pause","resume"];function prependListener(emitter,event,fn){if(typeof emitter.prependListener==="function"){return emitter.prependListener(event,fn)}else{if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(isArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]]}}function ReadableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.readableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.buffer=new BufferList;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.destroyed=false;this.defaultEncoding=options.defaultEncoding||"utf8";this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}
function Readable(options){Duplex=Duplex||require("./_stream_duplex");if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;if(options){if(typeof options.read==="function")this._read=options.read;if(typeof options.destroy==="function")this._destroy=options.destroy}Stream.call(this)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){if(this._readableState===undefined){return false}return this._readableState.destroyed},set:function(value){if(!this._readableState){return}this._readableState.destroyed=value}});Readable.prototype.destroy=destroyImpl.destroy;Readable.prototype._undestroy=destroyImpl.undestroy;Readable.prototype._destroy=function(err,cb){this.push(null);cb(err)};Readable.prototype.push=function(chunk,encoding){var state=this._readableState;var skipChunkCheck;if(!state.objectMode){if(typeof chunk==="string"){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=Buffer.from(chunk,encoding);encoding=""}skipChunkCheck=true}}else{skipChunkCheck=true}return readableAddChunk(this,chunk,encoding,false,skipChunkCheck)};Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,true,false)};function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){var state=stream._readableState;if(chunk===null){state.reading=false;onEofChunk(stream,state)}else{var er;if(!skipChunkCheck)er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(state.objectMode||chunk&&chunk.length>0){if(typeof chunk!=="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer.prototype){chunk=_uint8ArrayToBuffer(chunk)}if(addToFront){if(state.endEmitted)stream.emit("error",new Error("stream.unshift() after end event"));else addChunk(stream,state,chunk,true)}else if(state.ended){stream.emit("error",new Error("stream.push() after EOF"))}else{state.reading=false;if(state.decoder&&!encoding){chunk=state.decoder.write(chunk);if(state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,false);else maybeReadMore(stream,state)}else{addChunk(stream,state,chunk,false)}}}else if(!addToFront){state.reading=false}}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;if(!_isUint8Array(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.isPaused=function(){return this._readableState.flowing===false};Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc;return this};var MAX_HWM=8388608;function computeNewHighWaterMark(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n<state.highWaterMark){doRead=true;debug("length less than watermark",doRead)}if(state.ended||state.reading){doRead=false;debug("reading or ended",doRead)}else if(doRead){debug("do read");state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false;if(!state.reading)n=howMuchToRead(nOrig,state)}var ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){debug("maybeReadMore read 0");stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("_read() is not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:unpipe;if(state.endEmitted)processNextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable,unpipeInfo){debug("onunpipe");if(readable===src){if(unpipeInfo&&unpipeInfo.hasUnpiped===false){unpipeInfo.hasUnpiped=true;cleanup()}}}function onend(){debug("onend");dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=false;function cleanup(){debug("cleanup");dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",unpipe);src.removeListener("data",ondata);cleanedUp=true;if(state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain))ondrain()}var increasedAwaitDrain=false;src.on("data",ondata);function ondata(chunk){debug("ondata");increasedAwaitDrain=false;var ret=dest.write(chunk);if(false===ret&&!increasedAwaitDrain){if((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;var unpipeInfo={hasUnpiped:false};if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this,unpipeInfo);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var i=0;i<len;i++){dests[i].emit("unpipe",this,unpipeInfo)}return this}var index=indexOf(state.pipes,dest);if(index===-1)return this;state.pipes.splice(index,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this,unpipeInfo);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"){if(this._readableState.flowing!==false)this.resume()}else if(ev==="readable"){var state=this._readableState;if(!state.endEmitted&&!state.readableListening){state.readableListening=state.needReadable=true;state.emittedReadable=false;if(!state.reading){processNextTick(nReadingNextTick,this)}else if(state.length){emitReadable(this)}}}return res};Readable.prototype.addListener=Readable.prototype.on;function nReadingNextTick(self){debug("readable nexttick read 0");self.read(0)}Readable.prototype.resume=function(){var state=this._readableState;if(!state.flowing){debug("resume");state.flowing=true;resume(this,state)}return this};function resume(stream,state){if(!state.resumeScheduled){state.resumeScheduled=true;processNextTick(resume_,stream,state)}}function resume_(stream,state){if(!state.reading){debug("resume read 0");stream.read(0)}state.resumeScheduled=false;state.awaitDrain=0;stream.emit("resume");flow(stream);if(state.flowing&&!state.reading)stream.read(0)}Readable.prototype.pause=function(){debug("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){debug("pause");this._readableState.flowing=false;this.emit("pause")}return this};function flow(stream){var state=stream._readableState;debug("flow",state.flowing);while(state.flowing&&stream.read()!==null){}}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){debug("wrapped end");if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){debug("wrapped data");if(state.decoder)chunk=state.decoder.write(chunk);if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(this[i]===undefined&&typeof stream[i]==="function"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}for(var n=0;n<kProxyEvents.length;n++){stream.on(kProxyEvents[n],self.emit.bind(self,kProxyEvents[n]))}self._read=function(n){debug("wrapped _read",n);if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){if(state.length===0)return null;var ret;if(state.objectMode)ret=state.buffer.shift();else if(!n||n>=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(n<list.head.data.length){ret=list.head.data.slice(0,n);list.head.data=list.head.data.slice(n)}else if(n===list.head.data.length){ret=list.shift()}else{ret=hasStrings?copyFromBufferString(n,list):copyFromBuffer(n,list)}return ret}function copyFromBufferString(n,list){var p=list.head;var c=1;var ret=p.data;n-=ret.length;while(p=p.next){var str=p.data;var nb=n>str.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;processNextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./_stream_duplex":34,"./internal/streams/BufferList":39,"./internal/streams/destroy":40,"./internal/streams/stream":41,_process:32,"core-util-is":22,events:23,inherits:27,isarray:29,"process-nextick-args":31,"safe-buffer":47,"string_decoder/":49,util:19}],37:[function(require,module,exports){"use strict";module.exports=Transform;var Duplex=require("./_stream_duplex");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(Transform,Duplex);function TransformState(stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null;this.writeencoding=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb){return stream.emit("error",new Error("write callback called multiple times"))}ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);this._transformState=new TransformState(this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;if(options){if(typeof options.transform==="function")this._transform=options.transform;if(typeof options.flush==="function")this._flush=options.flush}this.once("prefinish",function(){if(typeof this._flush==="function")this._flush(function(er,data){done(stream,er,data)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("_transform() is not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};Transform.prototype._destroy=function(err,cb){var _this=this;Duplex.prototype._destroy.call(this,err,function(err2){cb(err2);_this.emit("close")})};function done(stream,er,data){if(er)return stream.emit("error",er);if(data!==null&&data!==undefined)stream.push(data);var ws=stream._writableState;var ts=stream._transformState;if(ws.length)throw new Error("Calling transform done when ws.length != 0");if(ts.transforming)throw new Error("Calling transform done when still transforming");return stream.push(null)}},{"./_stream_duplex":34,"core-util-is":22,inherits:27}],38:[function(require,module,exports){(function(process,global){"use strict";var processNextTick=require("process-nextick-args");module.exports=Writable;function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null}function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state)}}var asyncWrite=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:processNextTick;var Duplex;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream);function nop(){}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(_){}})();var realHasInstance;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){realHasInstance=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){if(realHasInstance.call(this,object))return true;return object&&object._writableState instanceof WritableState}})}else{realHasInstance=function(object){return object instanceof this}}function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!realHasInstance.call(Writable,this)&&!(this instanceof Duplex)){return new Writable(options)}this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.final==="function")this._final=options.final}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);processNextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);processNextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;var isBuf=_isUint8Array(chunk)&&!state.objectMode;if(isBuf&&!Buffer.isBuffer(chunk)){chunk=_uint8ArrayToBuffer(chunk)}if(typeof encoding==="function"){cb=encoding;encoding=null}if(isBuf)encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(isBuf||validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=Buffer.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);if(chunk!==newChunk){isBuf=true;encoding="buffer";chunk=newChunk}}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(!ret)state.needDrain=true;if(state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest={chunk:chunk,encoding:encoding,isBuf:isBuf,callback:cb,next:null};if(last){last.next=state.lastBufferedRequest}else{state.bufferedRequest=state.lastBufferedRequest}state.bufferedRequestCount+=1}else{doWrite(stream,state,false,len,chunk,encoding,cb)}return ret}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;if(writev)stream._writev(chunk,state.onwrite);else stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){--state.pendingcb;if(sync){processNextTick(cb,er);processNextTick(finishMaybe,stream,state);stream._writableState.errorEmitted=true;stream.emit("error",er)}else{cb(er);stream._writableState.errorEmitted=true;stream.emit("error",er);finishMaybe(stream,state)}}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(state);if(!finished&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest){clearBuffer(stream,state)}if(sync){asyncWrite(afterWrite,stream,state,finished,cb)}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);state.pendingcb--;cb();finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount;var buffer=new Array(l);var holder=state.corkedRequestsFree;holder.entry=entry;var count=0;var allBuffers=true;while(entry){buffer[count]=entry;if(!entry.isBuf)allBuffers=false;entry=entry.next;count+=1}buffer.allBuffers=allBuffers;doWrite(stream,state,true,state.length,buffer,"",holder.finish);state.pendingcb++;state.lastBufferedRequest=null;if(holder.next){state.corkedRequestsFree=holder.next;holder.next=null}else{state.corkedRequestsFree=new CorkedRequest(state)}}else{while(entry){var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,false,len,chunk,encoding,cb);entry=entry.next;if(state.writing){break}}if(entry===null)state.lastBufferedRequest=null}state.bufferedRequestCount=0;state.bufferedRequest=entry;state.bufferProcessing=false}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("_write() is not implemented"))};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(chunk!==null&&chunk!==undefined)this.write(chunk,encoding);if(state.corked){state.corked=1;this.uncork()}if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing}function callFinal(stream,state){stream._final(function(err){state.pendingcb--;if(err){stream.emit("error",err)}state.prefinished=true;stream.emit("prefinish");finishMaybe(stream,state)})}function prefinish(stream,state){if(!state.prefinished&&!state.finalCalled){if(typeof stream._final==="function"){state.pendingcb++;state.finalCalled=true;processNextTick(callFinal,stream,state)}else{state.prefinished=true;stream.emit("prefinish")}}}function finishMaybe(stream,state){var need=needFinish(state);if(need){prefinish(stream,state);if(state.pendingcb===0){state.finished=true;stream.emit("finish")}}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)processNextTick(cb);else stream.once("finish",cb)}state.ended=true;stream.writable=false}function onCorkedFinish(corkReq,state,err){var entry=corkReq.entry;corkReq.entry=null;while(entry){var cb=entry.callback;state.pendingcb--;cb(err);entry=entry.next}if(state.corkedRequestsFree){state.corkedRequestsFree.next=corkReq}else{state.corkedRequestsFree=corkReq}}Object.defineProperty(Writable.prototype,"destroyed",{get:function(){if(this._writableState===undefined){return false}return this._writableState.destroyed},set:function(value){if(!this._writableState){return}this._writableState.destroyed=value}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){this.end();cb(err)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./_stream_duplex":34,"./internal/streams/destroy":40,"./internal/streams/stream":41,_process:32,"core-util-is":22,inherits:27,"process-nextick-args":31,"safe-buffer":47,"util-deprecate":51}],39:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Buffer=require("safe-buffer").Buffer;function copyBuffer(src,target,offset){src.copy(target,offset)}module.exports=function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0}BufferList.prototype.push=function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function clear(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function join(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function concat(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next}return ret};return BufferList}()},{"safe-buffer":47}],40:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args");function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err)}else if(err&&(!this._writableState||!this._writableState.errorEmitted)){processNextTick(emitErrorNT,this,err)}return}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(err||null,function(err){if(!cb&&err){processNextTick(emitErrorNT,_this,err);if(_this._writableState){_this._writableState.errorEmitted=true}}else if(cb){cb(err)}})}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":31}],41:[function(require,module,exports){module.exports=require("events").EventEmitter},{events:23}],42:[function(require,module,exports){module.exports=require("./readable").PassThrough},{"./readable":43}],43:[function(require,module,exports){exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=exports;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":34,"./lib/_stream_passthrough.js":35,"./lib/_stream_readable.js":36,"./lib/_stream_transform.js":37,"./lib/_stream_writable.js":38}],44:[function(require,module,exports){module.exports=require("./readable").Transform},{"./readable":43}],45:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":38}],46:[function(require,module,exports){(function(Buffer){"use strict";var inherits=require("inherits");var HashBase=require("hash-base");function RIPEMD160(){HashBase.call(this,64);this._a=1732584193;this._b=4023233417;this._c=2562383102;this._d=271733878;this._e=3285377520}inherits(RIPEMD160,HashBase);RIPEMD160.prototype._update=function(){var m=new Array(16);for(var i=0;i<16;++i)m[i]=this._block.readInt32LE(i*4);var al=this._a;var bl=this._b;var cl=this._c;var dl=this._d;var el=this._e;al=fn1(al,bl,cl,dl,el,m[0],0,11);cl=rotl(cl,10);el=fn1(el,al,bl,cl,dl,m[1],0,14);bl=rotl(bl,10);dl=fn1(dl,el,al,bl,cl,m[2],0,15);al=rotl(al,10);cl=fn1(cl,dl,el,al,bl,m[3],0,12);el=rotl(el,10);bl=fn1(bl,cl,dl,el,al,m[4],0,5);dl=rotl(dl,10);al=fn1(al,bl,cl,dl,el,m[5],0,8);cl=rotl(cl,10);el=fn1(el,al,bl,cl,dl,m[6],0,7);bl=rotl(bl,10);dl=fn1(dl,el,al,bl,cl,m[7],0,9)
;al=rotl(al,10);cl=fn1(cl,dl,el,al,bl,m[8],0,11);el=rotl(el,10);bl=fn1(bl,cl,dl,el,al,m[9],0,13);dl=rotl(dl,10);al=fn1(al,bl,cl,dl,el,m[10],0,14);cl=rotl(cl,10);el=fn1(el,al,bl,cl,dl,m[11],0,15);bl=rotl(bl,10);dl=fn1(dl,el,al,bl,cl,m[12],0,6);al=rotl(al,10);cl=fn1(cl,dl,el,al,bl,m[13],0,7);el=rotl(el,10);bl=fn1(bl,cl,dl,el,al,m[14],0,9);dl=rotl(dl,10);al=fn1(al,bl,cl,dl,el,m[15],0,8);cl=rotl(cl,10);el=fn2(el,al,bl,cl,dl,m[7],1518500249,7);bl=rotl(bl,10);dl=fn2(dl,el,al,bl,cl,m[4],1518500249,6);al=rotl(al,10);cl=fn2(cl,dl,el,al,bl,m[13],1518500249,8);el=rotl(el,10);bl=fn2(bl,cl,dl,el,al,m[1],1518500249,13);dl=rotl(dl,10);al=fn2(al,bl,cl,dl,el,m[10],1518500249,11);cl=rotl(cl,10);el=fn2(el,al,bl,cl,dl,m[6],1518500249,9);bl=rotl(bl,10);dl=fn2(dl,el,al,bl,cl,m[15],1518500249,7);al=rotl(al,10);cl=fn2(cl,dl,el,al,bl,m[3],1518500249,15);el=rotl(el,10);bl=fn2(bl,cl,dl,el,al,m[12],1518500249,7);dl=rotl(dl,10);al=fn2(al,bl,cl,dl,el,m[0],1518500249,12);cl=rotl(cl,10);el=fn2(el,al,bl,cl,dl,m[9],1518500249,15);bl=rotl(bl,10);dl=fn2(dl,el,al,bl,cl,m[5],1518500249,9);al=rotl(al,10);cl=fn2(cl,dl,el,al,bl,m[2],1518500249,11);el=rotl(el,10);bl=fn2(bl,cl,dl,el,al,m[14],1518500249,7);dl=rotl(dl,10);al=fn2(al,bl,cl,dl,el,m[11],1518500249,13);cl=rotl(cl,10);el=fn2(el,al,bl,cl,dl,m[8],1518500249,12);bl=rotl(bl,10);dl=fn3(dl,el,al,bl,cl,m[3],1859775393,11);al=rotl(al,10);cl=fn3(cl,dl,el,al,bl,m[10],1859775393,13);el=rotl(el,10);bl=fn3(bl,cl,dl,el,al,m[14],1859775393,6);dl=rotl(dl,10);al=fn3(al,bl,cl,dl,el,m[4],1859775393,7);cl=rotl(cl,10);el=fn3(el,al,bl,cl,dl,m[9],1859775393,14);bl=rotl(bl,10);dl=fn3(dl,el,al,bl,cl,m[15],1859775393,9);al=rotl(al,10);cl=fn3(cl,dl,el,al,bl,m[8],1859775393,13);el=rotl(el,10);bl=fn3(bl,cl,dl,el,al,m[1],1859775393,15);dl=rotl(dl,10);al=fn3(al,bl,cl,dl,el,m[2],1859775393,14);cl=rotl(cl,10);el=fn3(el,al,bl,cl,dl,m[7],1859775393,8);bl=rotl(bl,10);dl=fn3(dl,el,al,bl,cl,m[0],1859775393,13);al=rotl(al,10);cl=fn3(cl,dl,el,al,bl,m[6],1859775393,6);el=rotl(el,10);bl=fn3(bl,cl,dl,el,al,m[13],1859775393,5);dl=rotl(dl,10);al=fn3(al,bl,cl,dl,el,m[11],1859775393,12);cl=rotl(cl,10);el=fn3(el,al,bl,cl,dl,m[5],1859775393,7);bl=rotl(bl,10);dl=fn3(dl,el,al,bl,cl,m[12],1859775393,5);al=rotl(al,10);cl=fn4(cl,dl,el,al,bl,m[1],2400959708,11);el=rotl(el,10);bl=fn4(bl,cl,dl,el,al,m[9],2400959708,12);dl=rotl(dl,10);al=fn4(al,bl,cl,dl,el,m[11],2400959708,14);cl=rotl(cl,10);el=fn4(el,al,bl,cl,dl,m[10],2400959708,15);bl=rotl(bl,10);dl=fn4(dl,el,al,bl,cl,m[0],2400959708,14);al=rotl(al,10);cl=fn4(cl,dl,el,al,bl,m[8],2400959708,15);el=rotl(el,10);bl=fn4(bl,cl,dl,el,al,m[12],2400959708,9);dl=rotl(dl,10);al=fn4(al,bl,cl,dl,el,m[4],2400959708,8);cl=rotl(cl,10);el=fn4(el,al,bl,cl,dl,m[13],2400959708,9);bl=rotl(bl,10);dl=fn4(dl,el,al,bl,cl,m[3],2400959708,14);al=rotl(al,10);cl=fn4(cl,dl,el,al,bl,m[7],2400959708,5);el=rotl(el,10);bl=fn4(bl,cl,dl,el,al,m[15],2400959708,6);dl=rotl(dl,10);al=fn4(al,bl,cl,dl,el,m[14],2400959708,8);cl=rotl(cl,10);el=fn4(el,al,bl,cl,dl,m[5],2400959708,6);bl=rotl(bl,10);dl=fn4(dl,el,al,bl,cl,m[6],2400959708,5);al=rotl(al,10);cl=fn4(cl,dl,el,al,bl,m[2],2400959708,12);el=rotl(el,10);bl=fn5(bl,cl,dl,el,al,m[4],2840853838,9);dl=rotl(dl,10);al=fn5(al,bl,cl,dl,el,m[0],2840853838,15);cl=rotl(cl,10);el=fn5(el,al,bl,cl,dl,m[5],2840853838,5);bl=rotl(bl,10);dl=fn5(dl,el,al,bl,cl,m[9],2840853838,11);al=rotl(al,10);cl=fn5(cl,dl,el,al,bl,m[7],2840853838,6);el=rotl(el,10);bl=fn5(bl,cl,dl,el,al,m[12],2840853838,8);dl=rotl(dl,10);al=fn5(al,bl,cl,dl,el,m[2],2840853838,13);cl=rotl(cl,10);el=fn5(el,al,bl,cl,dl,m[10],2840853838,12);bl=rotl(bl,10);dl=fn5(dl,el,al,bl,cl,m[14],2840853838,5);al=rotl(al,10);cl=fn5(cl,dl,el,al,bl,m[1],2840853838,12);el=rotl(el,10);bl=fn5(bl,cl,dl,el,al,m[3],2840853838,13);dl=rotl(dl,10);al=fn5(al,bl,cl,dl,el,m[8],2840853838,14);cl=rotl(cl,10);el=fn5(el,al,bl,cl,dl,m[11],2840853838,11);bl=rotl(bl,10);dl=fn5(dl,el,al,bl,cl,m[6],2840853838,8);al=rotl(al,10);cl=fn5(cl,dl,el,al,bl,m[15],2840853838,5);el=rotl(el,10);bl=fn5(bl,cl,dl,el,al,m[13],2840853838,6);dl=rotl(dl,10);var ar=this._a;var br=this._b;var cr=this._c;var dr=this._d;var er=this._e;ar=fn5(ar,br,cr,dr,er,m[5],1352829926,8);cr=rotl(cr,10);er=fn5(er,ar,br,cr,dr,m[14],1352829926,9);br=rotl(br,10);dr=fn5(dr,er,ar,br,cr,m[7],1352829926,9);ar=rotl(ar,10);cr=fn5(cr,dr,er,ar,br,m[0],1352829926,11);er=rotl(er,10);br=fn5(br,cr,dr,er,ar,m[9],1352829926,13);dr=rotl(dr,10);ar=fn5(ar,br,cr,dr,er,m[2],1352829926,15);cr=rotl(cr,10);er=fn5(er,ar,br,cr,dr,m[11],1352829926,15);br=rotl(br,10);dr=fn5(dr,er,ar,br,cr,m[4],1352829926,5);ar=rotl(ar,10);cr=fn5(cr,dr,er,ar,br,m[13],1352829926,7);er=rotl(er,10);br=fn5(br,cr,dr,er,ar,m[6],1352829926,7);dr=rotl(dr,10);ar=fn5(ar,br,cr,dr,er,m[15],1352829926,8);cr=rotl(cr,10);er=fn5(er,ar,br,cr,dr,m[8],1352829926,11);br=rotl(br,10);dr=fn5(dr,er,ar,br,cr,m[1],1352829926,14);ar=rotl(ar,10);cr=fn5(cr,dr,er,ar,br,m[10],1352829926,14);er=rotl(er,10);br=fn5(br,cr,dr,er,ar,m[3],1352829926,12);dr=rotl(dr,10);ar=fn5(ar,br,cr,dr,er,m[12],1352829926,6);cr=rotl(cr,10);er=fn4(er,ar,br,cr,dr,m[6],1548603684,9);br=rotl(br,10);dr=fn4(dr,er,ar,br,cr,m[11],1548603684,13);ar=rotl(ar,10);cr=fn4(cr,dr,er,ar,br,m[3],1548603684,15);er=rotl(er,10);br=fn4(br,cr,dr,er,ar,m[7],1548603684,7);dr=rotl(dr,10);ar=fn4(ar,br,cr,dr,er,m[0],1548603684,12);cr=rotl(cr,10);er=fn4(er,ar,br,cr,dr,m[13],1548603684,8);br=rotl(br,10);dr=fn4(dr,er,ar,br,cr,m[5],1548603684,9);ar=rotl(ar,10);cr=fn4(cr,dr,er,ar,br,m[10],1548603684,11);er=rotl(er,10);br=fn4(br,cr,dr,er,ar,m[14],1548603684,7);dr=rotl(dr,10);ar=fn4(ar,br,cr,dr,er,m[15],1548603684,7);cr=rotl(cr,10);er=fn4(er,ar,br,cr,dr,m[8],1548603684,12);br=rotl(br,10);dr=fn4(dr,er,ar,br,cr,m[12],1548603684,7);ar=rotl(ar,10);cr=fn4(cr,dr,er,ar,br,m[4],1548603684,6);er=rotl(er,10);br=fn4(br,cr,dr,er,ar,m[9],1548603684,15);dr=rotl(dr,10);ar=fn4(ar,br,cr,dr,er,m[1],1548603684,13);cr=rotl(cr,10);er=fn4(er,ar,br,cr,dr,m[2],1548603684,11);br=rotl(br,10);dr=fn3(dr,er,ar,br,cr,m[15],1836072691,9);ar=rotl(ar,10);cr=fn3(cr,dr,er,ar,br,m[5],1836072691,7);er=rotl(er,10);br=fn3(br,cr,dr,er,ar,m[1],1836072691,15);dr=rotl(dr,10);ar=fn3(ar,br,cr,dr,er,m[3],1836072691,11);cr=rotl(cr,10);er=fn3(er,ar,br,cr,dr,m[7],1836072691,8);br=rotl(br,10);dr=fn3(dr,er,ar,br,cr,m[14],1836072691,6);ar=rotl(ar,10);cr=fn3(cr,dr,er,ar,br,m[6],1836072691,6);er=rotl(er,10);br=fn3(br,cr,dr,er,ar,m[9],1836072691,14);dr=rotl(dr,10);ar=fn3(ar,br,cr,dr,er,m[11],1836072691,12);cr=rotl(cr,10);er=fn3(er,ar,br,cr,dr,m[8],1836072691,13);br=rotl(br,10);dr=fn3(dr,er,ar,br,cr,m[12],1836072691,5);ar=rotl(ar,10);cr=fn3(cr,dr,er,ar,br,m[2],1836072691,14);er=rotl(er,10);br=fn3(br,cr,dr,er,ar,m[10],1836072691,13);dr=rotl(dr,10);ar=fn3(ar,br,cr,dr,er,m[0],1836072691,13);cr=rotl(cr,10);er=fn3(er,ar,br,cr,dr,m[4],1836072691,7);br=rotl(br,10);dr=fn3(dr,er,ar,br,cr,m[13],1836072691,5);ar=rotl(ar,10);cr=fn2(cr,dr,er,ar,br,m[8],2053994217,15);er=rotl(er,10);br=fn2(br,cr,dr,er,ar,m[6],2053994217,5);dr=rotl(dr,10);ar=fn2(ar,br,cr,dr,er,m[4],2053994217,8);cr=rotl(cr,10);er=fn2(er,ar,br,cr,dr,m[1],2053994217,11);br=rotl(br,10);dr=fn2(dr,er,ar,br,cr,m[3],2053994217,14);ar=rotl(ar,10);cr=fn2(cr,dr,er,ar,br,m[11],2053994217,14);er=rotl(er,10);br=fn2(br,cr,dr,er,ar,m[15],2053994217,6);dr=rotl(dr,10);ar=fn2(ar,br,cr,dr,er,m[0],2053994217,14);cr=rotl(cr,10);er=fn2(er,ar,br,cr,dr,m[5],2053994217,6);br=rotl(br,10);dr=fn2(dr,er,ar,br,cr,m[12],2053994217,9);ar=rotl(ar,10);cr=fn2(cr,dr,er,ar,br,m[2],2053994217,12);er=rotl(er,10);br=fn2(br,cr,dr,er,ar,m[13],2053994217,9);dr=rotl(dr,10);ar=fn2(ar,br,cr,dr,er,m[9],2053994217,12);cr=rotl(cr,10);er=fn2(er,ar,br,cr,dr,m[7],2053994217,5);br=rotl(br,10);dr=fn2(dr,er,ar,br,cr,m[10],2053994217,15);ar=rotl(ar,10);cr=fn2(cr,dr,er,ar,br,m[14],2053994217,8);er=rotl(er,10);br=fn1(br,cr,dr,er,ar,m[12],0,8);dr=rotl(dr,10);ar=fn1(ar,br,cr,dr,er,m[15],0,5);cr=rotl(cr,10);er=fn1(er,ar,br,cr,dr,m[10],0,12);br=rotl(br,10);dr=fn1(dr,er,ar,br,cr,m[4],0,9);ar=rotl(ar,10);cr=fn1(cr,dr,er,ar,br,m[1],0,12);er=rotl(er,10);br=fn1(br,cr,dr,er,ar,m[5],0,5);dr=rotl(dr,10);ar=fn1(ar,br,cr,dr,er,m[8],0,14);cr=rotl(cr,10);er=fn1(er,ar,br,cr,dr,m[7],0,6);br=rotl(br,10);dr=fn1(dr,er,ar,br,cr,m[6],0,8);ar=rotl(ar,10);cr=fn1(cr,dr,er,ar,br,m[2],0,13);er=rotl(er,10);br=fn1(br,cr,dr,er,ar,m[13],0,6);dr=rotl(dr,10);ar=fn1(ar,br,cr,dr,er,m[14],0,5);cr=rotl(cr,10);er=fn1(er,ar,br,cr,dr,m[0],0,15);br=rotl(br,10);dr=fn1(dr,er,ar,br,cr,m[3],0,13);ar=rotl(ar,10);cr=fn1(cr,dr,er,ar,br,m[9],0,11);er=rotl(er,10);br=fn1(br,cr,dr,er,ar,m[11],0,11);dr=rotl(dr,10);var t=this._b+cl+dr|0;this._b=this._c+dl+er|0;this._c=this._d+el+ar|0;this._d=this._e+al+br|0;this._e=this._a+bl+cr|0;this._a=t};RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128;if(this._blockOffset>56){this._block.fill(0,this._blockOffset,64);this._update();this._blockOffset=0}this._block.fill(0,this._blockOffset,56);this._block.writeUInt32LE(this._length[0],56);this._block.writeUInt32LE(this._length[1],60);this._update();var buffer=new Buffer(20);buffer.writeInt32LE(this._a,0);buffer.writeInt32LE(this._b,4);buffer.writeInt32LE(this._c,8);buffer.writeInt32LE(this._d,12);buffer.writeInt32LE(this._e,16);return buffer};function rotl(x,n){return x<<n|x>>>32-n}function fn1(a,b,c,d,e,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+e|0}function fn2(a,b,c,d,e,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+e|0}function fn3(a,b,c,d,e,m,k,s){return rotl(a+((b|~c)^d)+m+k|0,s)+e|0}function fn4(a,b,c,d,e,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+e|0}function fn5(a,b,c,d,e,m,k,s){return rotl(a+(b^(c|~d))+m+k|0,s)+e|0}module.exports=RIPEMD160}).call(this,require("buffer").Buffer)},{buffer:20,"hash-base":25,inherits:27}],47:[function(require,module,exports){var buffer=require("buffer");var Buffer=buffer.Buffer;function copyProps(src,dst){for(var key in src){dst[key]=src[key]}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer}else{copyProps(buffer,exports);exports.Buffer=SafeBuffer}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length)}copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==="number"){throw new TypeError("Argument must not be a number")}return Buffer(arg,encodingOrOffset,length)};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==="string"){buf.fill(fill,encoding)}else{buf.fill(fill)}}else{buf.fill(0)}return buf};SafeBuffer.allocUnsafe=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return Buffer(size)};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return buffer.SlowBuffer(size)}},{buffer:20}],48:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:23,inherits:27,"readable-stream/duplex.js":33,"readable-stream/passthrough.js":42,"readable-stream/readable.js":43,"readable-stream/transform.js":44,"readable-stream/writable.js":45}],49:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var isEncoding=Buffer.isEncoding||function(encoding){encoding=""+encoding;switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(enc){if(!enc)return"utf8";var retried;while(true){switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase();retried=true}}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=="string"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;nb=4;break;case"utf8":this.fillLast=utf8FillLast;nb=4;break;case"base64":this.text=base64Text;this.end=base64End;nb=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=Buffer.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r;var i;if(this.lastNeed){r=this.fillLast(buf);if(r===undefined)return"";i=this.lastNeed;this.lastNeed=0}else{i=0}if(i<buf.length)return r?r+this.text(buf,i):this.text(buf,i);return r||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length){buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length);this.lastNeed-=buf.length};function utf8CheckByte(byte){if(byte<=127)return 0;else if(byte>>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return-1}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return"�".repeat(p)}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return"�".repeat(p+1)}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return"�".repeat(p+2)}}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"�".repeat(this.lastTotal-this.lastNeed);return r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString("base64",i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1]}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1]}return buf.toString("base64",i,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}},{"safe-buffer":47}],50:[function(require,module,exports){(function(nacl){"use strict";var gf=function(init){var i,r=new Float64Array(16);if(init)for(i=0;i<init.length;i++)r[i]=init[i];return r};var randombytes=function(){throw new Error("no PRNG")};var _0=new Uint8Array(16);var _9=new Uint8Array(32);_9[0]=9;var gf0=gf(),gf1=gf([1]),_121665=gf([56129,1]),D=gf([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),D2=gf([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),X=gf([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Y=gf([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),I=gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function ts64(x,i,h,l){x[i]=h>>24&255;x[i+1]=h>>16&255;x[i+2]=h>>8&255;x[i+3]=h&255;x[i+4]=l>>24&255;x[i+5]=l>>16&255;x[i+6]=l>>8&255;x[i+7]=l&255}function vn(x,xi,y,yi,n){var i,d=0;for(i=0;i<n;i++)d|=x[xi+i]^y[yi+i];return(1&d-1>>>8)-1}function crypto_verify_16(x,xi,y,yi){return vn(x,xi,y,yi,16)}function crypto_verify_32(x,xi,y,yi){return vn(x,xi,y,yi,32)}function core_salsa20(o,p,k,c){var j0=c[0]&255|(c[1]&255)<<8|(c[2]&255)<<16|(c[3]&255)<<24,j1=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,j2=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,j3=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,j4=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,j5=c[4]&255|(c[5]&255)<<8|(c[6]&255)<<16|(c[7]&255)<<24,j6=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,j7=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,j8=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,j9=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,j10=c[8]&255|(c[9]&255)<<8|(c[10]&255)<<16|(c[11]&255)<<24,j11=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,j12=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,j13=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,j14=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,j15=c[12]&255|(c[13]&255)<<8|(c[14]&255)<<16|(c[15]&255)<<24;var x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,u;for(var i=0;i<20;i+=2){u=x0+x12|0;x4^=u<<7|u>>>32-7;u=x4+x0|0;x8^=u<<9|u>>>32-9;u=x8+x4|0;x12^=u<<13|u>>>32-13;u=x12+x8|0;x0^=u<<18|u>>>32-18;u=x5+x1|0;x9^=u<<7|u>>>32-7;u=x9+x5|0;x13^=u<<9|u>>>32-9;u=x13+x9|0;x1^=u<<13|u>>>32-13;u=x1+x13|0;x5^=u<<18|u>>>32-18;u=x10+x6|0;x14^=u<<7|u>>>32-7;u=x14+x10|0;x2^=u<<9|u>>>32-9;u=x2+x14|0;x6^=u<<13|u>>>32-13;u=x6+x2|0;x10^=u<<18|u>>>32-18;u=x15+x11|0;x3^=u<<7|u>>>32-7;u=x3+x15|0;x7^=u<<9|u>>>32-9;u=x7+x3|0;x11^=u<<13|u>>>32-13;u=x11+x7|0;x15^=u<<18|u>>>32-18;u=x0+x3|0;x1^=u<<7|u>>>32-7;u=x1+x0|0;x2^=u<<9|u>>>32-9;u=x2+x1|0;x3^=u<<13|u>>>32-13;u=x3+x2|0;x0^=u<<18|u>>>32-18;u=x5+x4|0;x6^=u<<7|u>>>32-7;u=x6+x5|0;x7^=u<<9|u>>>32-9;u=x7+x6|0;x4^=u<<13|u>>>32-13;u=x4+x7|0;x5^=u<<18|u>>>32-18;u=x10+x9|0;x11^=u<<7|u>>>32-7;u=x11+x10|0;x8^=u<<9|u>>>32-9;u=x8+x11|0;x9^=u<<13|u>>>32-13;u=x9+x8|0;x10^=u<<18|u>>>32-18;u=x15+x14|0;x12^=u<<7|u>>>32-7;u=x12+x15|0;x13^=u<<9|u>>>32-9;u=x13+x12|0;x14^=u<<13|u>>>32-13;u=x14+x13|0;x15^=u<<18|u>>>32-18}x0=x0+j0|0;x1=x1+j1|0;x2=x2+j2|0;x3=x3+j3|0;x4=x4+j4|0;x5=x5+j5|0;x6=x6+j6|0;x7=x7+j7|0;x8=x8+j8|0;x9=x9+j9|0;x10=x10+j10|0;x11=x11+j11|0;x12=x12+j12|0;x13=x13+j13|0;x14=x14+j14|0;x15=x15+j15|0;o[0]=x0>>>0&255;o[1]=x0>>>8&255;o[2]=x0>>>16&255;o[3]=x0>>>24&255;o[4]=x1>>>0&255;o[5]=x1>>>8&255;o[6]=x1>>>16&255;o[7]=x1>>>24&255;o[8]=x2>>>0&255;o[9]=x2>>>8&255;o[10]=x2>>>16&255;o[11]=x2>>>24&255;o[12]=x3>>>0&255;o[13]=x3>>>8&255;o[14]=x3>>>16&255;o[15]=x3>>>24&255;o[16]=x4>>>0&255;o[17]=x4>>>8&255;o[18]=x4>>>16&255;o[19]=x4>>>24&255;o[20]=x5>>>0&255;o[21]=x5>>>8&255;o[22]=x5>>>16&255;o[23]=x5>>>24&255;o[24]=x6>>>0&255;o[25]=x6>>>8&255;o[26]=x6>>>16&255;o[27]=x6>>>24&255;o[28]=x7>>>0&255;o[29]=x7>>>8&255;o[30]=x7>>>16&255;o[31]=x7>>>24&255;o[32]=x8>>>0&255;o[33]=x8>>>8&255;o[34]=x8>>>16&255;o[35]=x8>>>24&255;o[36]=x9>>>0&255;o[37]=x9>>>8&255;o[38]=x9>>>16&255;o[39]=x9>>>24&255;o[40]=x10>>>0&255;o[41]=x10>>>8&255;o[42]=x10>>>16&255;o[43]=x10>>>24&255;o[44]=x11>>>0&255;o[45]=x11>>>8&255;o[46]=x11>>>16&255;o[47]=x11>>>24&255;o[48]=x12>>>0&255;o[49]=x12>>>8&255;o[50]=x12>>>16&255;o[51]=x12>>>24&255;o[52]=x13>>>0&255;o[53]=x13>>>8&255;o[54]=x13>>>16&255;o[55]=x13>>>24&255;o[56]=x14>>>0&255;o[57]=x14>>>8&255;o[58]=x14>>>16&255;o[59]=x14>>>24&255;o[60]=x15>>>0&255;o[61]=x15>>>8&255;o[62]=x15>>>16&255;o[63]=x15>>>24&255}function core_hsalsa20(o,p,k,c){var j0=c[0]&255|(c[1]&255)<<8|(c[2]&255)<<16|(c[3]&255)<<24,j1=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,j2=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,j3=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,j4=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,j5=c[4]&255|(c[5]&255)<<8|(c[6]&255)<<16|(c[7]&255)<<24,j6=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,j7=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,j8=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,j9=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,j10=c[8]&255|(c[9]&255)<<8|(c[10]&255)<<16|(c[11]&255)<<24,j11=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,j12=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,j13=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,j14=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,j15=c[12]&255|(c[13]&255)<<8|(c[14]&255)<<16|(c[15]&255)<<24;var x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,u;for(var i=0;i<20;i+=2){u=x0+x12|0;x4^=u<<7|u>>>32-7;u=x4+x0|0;x8^=u<<9|u>>>32-9;u=x8+x4|0;x12^=u<<13|u>>>32-13;u=x12+x8|0;x0^=u<<18|u>>>32-18;u=x5+x1|0;x9^=u<<7|u>>>32-7;u=x9+x5|0;x13^=u<<9|u>>>32-9;u=x13+x9|0;x1^=u<<13|u>>>32-13;u=x1+x13|0;x5^=u<<18|u>>>32-18;u=x10+x6|0;x14^=u<<7|u>>>32-7;u=x14+x10|0;x2^=u<<9|u>>>32-9;u=x2+x14|0;x6^=u<<13|u>>>32-13;u=x6+x2|0;x10^=u<<18|u>>>32-18;u=x15+x11|0;x3^=u<<7|u>>>32-7;u=x3+x15|0;x7^=u<<9|u>>>32-9;u=x7+x3|0;x11^=u<<13|u>>>32-13;u=x11+x7|0;x15^=u<<18|u>>>32-18;u=x0+x3|0;x1^=u<<7|u>>>32-7;u=x1+x0|0;x2^=u<<9|u>>>32-9;u=x2+x1|0;x3^=u<<13|u>>>32-13;u=x3+x2|0;x0^=u<<18|u>>>32-18;u=x5+x4|0;x6^=u<<7|u>>>32-7;u=x6+x5|0;x7^=u<<9|u>>>32-9;u=x7+x6|0;x4^=u<<13|u>>>32-13;u=x4+x7|0;x5^=u<<18|u>>>32-18;u=x10+x9|0;x11^=u<<7|u>>>32-7;u=x11+x10|0;x8^=u<<9|u>>>32-9;u=x8+x11|0;x9^=u<<13|u>>>32-13;u=x9+x8|0;x10^=u<<18|u>>>32-18;u=x15+x14|0;x12^=u<<7|u>>>32-7;u=x12+x15|0;x13^=u<<9|u>>>32-9;u=x13+x12|0;x14^=u<<13|u>>>32-13;u=x14+x13|0;x15^=u<<18|u>>>32-18}o[0]=x0>>>0&255;o[1]=x0>>>8&255;o[2]=x0>>>16&255;o[3]=x0>>>24&255;o[4]=x5>>>0&255;o[5]=x5>>>8&255;o[6]=x5>>>16&255;o[7]=x5>>>24&255;o[8]=x10>>>0&255;o[9]=x10>>>8&255;o[10]=x10>>>16&255;o[11]=x10>>>24&255;o[12]=x15>>>0&255;o[13]=x15>>>8&255;o[14]=x15>>>16&255;o[15]=x15>>>24&255;o[16]=x6>>>0&255;o[17]=x6>>>8&255;o[18]=x6>>>16&255;o[19]=x6>>>24&255;o[20]=x7>>>0&255;o[21]=x7>>>8&255;o[22]=x7>>>16&255;o[23]=x7>>>24&255;o[24]=x8>>>0&255;o[25]=x8>>>8&255;o[26]=x8>>>16&255;o[27]=x8>>>24&255;o[28]=x9>>>0&255;o[29]=x9>>>8&255;o[30]=x9>>>16&255;o[31]=x9>>>24&255}function crypto_core_salsa20(out,inp,k,c){core_salsa20(out,inp,k,c)}function crypto_core_hsalsa20(out,inp,k,c){core_hsalsa20(out,inp,k,c)}var sigma=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k){var z=new Uint8Array(16),x=new Uint8Array(64);var u,i;for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];while(b>=64){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<64;i++)c[cpos+i]=m[mpos+i]^x[i];u=1;for(i=8;i<16;i++){u=u+(z[i]&255)|0;z[i]=u&255;u>>>=8}b-=64;cpos+=64;mpos+=64}if(b>0){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<b;i++)c[cpos+i]=m[mpos+i]^x[i]}return 0}function crypto_stream_salsa20(c,cpos,b,n,k){var z=new Uint8Array(16),x=new Uint8Array(64);var u,i;for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];while(b>=64){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<64;i++)c[cpos+i]=x[i];u=1;for(i=8;i<16;i++){u=u+(z[i]&255)|0;z[i]=u&255;u>>>=8}b-=64;cpos+=64}if(b>0){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<b;i++)c[cpos+i]=x[i]}return 0}function crypto_stream(c,cpos,d,n,k){var s=new Uint8Array(32);crypto_core_hsalsa20(s,n,k,sigma);var sn=new Uint8Array(8);for(var i=0;i<8;i++)sn[i]=n[i+16];return crypto_stream_salsa20(c,cpos,d,sn,s)}function crypto_stream_xor(c,cpos,m,mpos,d,n,k){var s=new Uint8Array(32);crypto_core_hsalsa20(s,n,k,sigma);var sn=new Uint8Array(8);for(var i=0;i<8;i++)sn[i]=n[i+16];return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s)}var poly1305=function(key){this.buffer=new Uint8Array(16);this.r=new Uint16Array(10);this.h=new Uint16Array(10);this.pad=new Uint16Array(8);this.leftover=0;this.fin=0;var t0,t1,t2,t3,t4,t5,t6,t7;t0=key[0]&255|(key[1]&255)<<8;this.r[0]=t0&8191;t1=key[2]&255|(key[3]&255)<<8;this.r[1]=(t0>>>13|t1<<3)&8191;t2=key[4]&255|(key[5]&255)<<8;this.r[2]=(t1>>>10|t2<<6)&7939;t3=key[6]&255|(key[7]&255)<<8;this.r[3]=(t2>>>7|t3<<9)&8191;t4=key[8]&255|(key[9]&255)<<8;this.r[4]=(t3>>>4|t4<<12)&255;this.r[5]=t4>>>1&8190;t5=key[10]&255|(key[11]&255)<<8;this.r[6]=(t4>>>14|t5<<2)&8191;t6=key[12]&255|(key[13]&255)<<8;this.r[7]=(t5>>>11|t6<<5)&8065;t7=key[14]&255|(key[15]&255)<<8;this.r[8]=(t6>>>8|t7<<8)&8191;this.r[9]=t7>>>5&127;this.pad[0]=key[16]&255|(key[17]&255)<<8;this.pad[1]=key[18]&255|(key[19]&255)<<8;this.pad[2]=key[20]&255|(key[21]&255)<<8;this.pad[3]=key[22]&255|(key[23]&255)<<8;this.pad[4]=key[24]&255|(key[25]&255)<<8;this.pad[5]=key[26]&255|(key[27]&255)<<8;this.pad[6]=key[28]&255|(key[29]&255)<<8;this.pad[7]=key[30]&255|(key[31]&255)<<8};poly1305.prototype.blocks=function(m,mpos,bytes){var hibit=this.fin?0:1<<11;var t0,t1,t2,t3,t4,t5,t6,t7,c;var d0,d1,d2,d3,d4,d5,d6,d7,d8,d9;var h0=this.h[0],h1=this.h[1],h2=this.h[2],h3=this.h[3],h4=this.h[4],h5=this.h[5],h6=this.h[6],h7=this.h[7],h8=this.h[8],h9=this.h[9];var r0=this.r[0],r1=this.r[1],r2=this.r[2],r3=this.r[3],r4=this.r[4],r5=this.r[5],r6=this.r[6],r7=this.r[7],r8=this.r[8],r9=this.r[9];while(bytes>=16){t0=m[mpos+0]&255|(m[mpos+1]&255)<<8;h0+=t0&8191;t1=m[mpos+2]&255|(m[mpos+3]&255)<<8;h1+=(t0>>>13|t1<<3)&8191;t2=m[mpos+4]&255|(m[mpos+5]&255)<<8;h2+=(t1>>>10|t2<<6)&8191;t3=m[mpos+6]&255|(m[mpos+7]&255)<<8;h3+=(t2>>>7|t3<<9)&8191;t4=m[mpos+8]&255|(m[mpos+9]&255)<<8;h4+=(t3>>>4|t4<<12)&8191;h5+=t4>>>1&8191;t5=m[mpos+10]&255|(m[mpos+11]&255)<<8;h6+=(t4>>>14|t5<<2)&8191;t6=m[mpos+12]&255|(m[mpos+13]&255)<<8;h7+=(t5>>>11|t6<<5)&8191;t7=m[mpos+14]&255|(m[mpos+15]&255)<<8;h8+=(t6>>>8|t7<<8)&8191;h9+=t7>>>5|hibit;c=0;d0=c;d0+=h0*r0;d0+=h1*(5*r9);d0+=h2*(5*r8);d0+=h3*(5*r7);d0+=h4*(5*r6);c=d0>>>13;d0&=8191;d0+=h5*(5*r5);d0+=h6*(5*r4);d0+=h7*(5*r3);d0+=h8*(5*r2);d0+=h9*(5*r1);c+=d0>>>13;d0&=8191;d1=c;d1+=h0*r1;d1+=h1*r0;d1+=h2*(5*r9);d1+=h3*(5*r8);d1+=h4*(5*r7);c=d1>>>13;d1&=8191;d1+=h5*(5*r6);d1+=h6*(5*r5);d1+=h7*(5*r4);d1+=h8*(5*r3);d1+=h9*(5*r2);c+=d1>>>13;d1&=8191;d2=c;d2+=h0*r2;d2+=h1*r1;d2+=h2*r0;d2+=h3*(5*r9);d2+=h4*(5*r8);c=d2>>>13;d2&=8191;d2+=h5*(5*r7);d2+=h6*(5*r6);d2+=h7*(5*r5);d2+=h8*(5*r4);d2+=h9*(5*r3);c+=d2>>>13;d2&=8191;d3=c;d3+=h0*r3;d3+=h1*r2;d3+=h2*r1;d3+=h3*r0;d3+=h4*(5*r9);c=d3>>>13;d3&=8191;d3+=h5*(5*r8);d3+=h6*(5*r7);d3+=h7*(5*r6);d3+=h8*(5*r5);d3+=h9*(5*r4);c+=d3>>>13;d3&=8191;d4=c;d4+=h0*r4;d4+=h1*r3;d4+=h2*r2;d4+=h3*r1;d4+=h4*r0;c=d4>>>13;d4&=8191;d4+=h5*(5*r9);d4+=h6*(5*r8);d4+=h7*(5*r7);d4+=h8*(5*r6);d4+=h9*(5*r5);c+=d4>>>13;d4&=8191;d5=c;d5+=h0*r5;d5+=h1*r4;d5+=h2*r3;d5+=h3*r2;d5+=h4*r1;c=d5>>>13;d5&=8191;d5+=h5*r0;d5+=h6*(5*r9);d5+=h7*(5*r8);d5+=h8*(5*r7);d5+=h9*(5*r6);c+=d5>>>13;d5&=8191;d6=c;d6+=h0*r6;d6+=h1*r5;d6+=h2*r4;d6+=h3*r3;d6+=h4*r2;c=d6>>>13;d6&=8191;d6+=h5*r1;d6+=h6*r0;d6+=h7*(5*r9);d6+=h8*(5*r8);d6+=h9*(5*r7);c+=d6>>>13;d6&=8191;d7=c;d7+=h0*r7;d7+=h1*r6;d7+=h2*r5;d7+=h3*r4;d7+=h4*r3;c=d7>>>13;d7&=8191;d7+=h5*r2;d7+=h6*r1;d7+=h7*r0;d7+=h8*(5*r9);d7+=h9*(5*r8);c+=d7>>>13;d7&=8191;d8=c;d8+=h0*r8;d8+=h1*r7;d8+=h2*r6;d8+=h3*r5;d8+=h4*r4;c=d8>>>13;d8&=8191;d8+=h5*r3;d8+=h6*r2;d8+=h7*r1;d8+=h8*r0;d8+=h9*(5*r9);c+=d8>>>13;d8&=8191;d9=c;d9+=h0*r9;d9+=h1*r8;d9+=h2*r7;d9+=h3*r6;d9+=h4*r5;c=d9>>>13;d9&=8191;d9+=h5*r4;d9+=h6*r3;d9+=h7*r2;d9+=h8*r1;d9+=h9*r0;c+=d9>>>13;d9&=8191;c=(c<<2)+c|0;c=c+d0|0;d0=c&8191;c=c>>>13;d1+=c;h0=d0;h1=d1;h2=d2;h3=d3;h4=d4;h5=d5;h6=d6;h7=d7;h8=d8;h9=d9;mpos+=16;bytes-=16}this.h[0]=h0;this.h[1]=h1;this.h[2]=h2;this.h[3]=h3;this.h[4]=h4;this.h[5]=h5;this.h[6]=h6;this.h[7]=h7;this.h[8]=h8;this.h[9]=h9};poly1305.prototype.finish=function(mac,macpos){var g=new Uint16Array(10);var c,mask,f,i;if(this.leftover){i=this.leftover;this.buffer[i++]=1;for(;i<16;i++)this.buffer[i]=0;this.fin=1;this.blocks(this.buffer,0,16)}c=this.h[1]>>>13;this.h[1]&=8191;for(i=2;i<10;i++){this.h[i]+=c;c=this.h[i]>>>13;this.h[i]&=8191}this.h[0]+=c*5;c=this.h[0]>>>13;this.h[0]&=8191;this.h[1]+=c;c=this.h[1]>>>13;this.h[1]&=8191;this.h[2]+=c;g[0]=this.h[0]+5;c=g[0]>>>13;g[0]&=8191;for(i=1;i<10;i++){g[i]=this.h[i]+c;c=g[i]>>>13;g[i]&=8191}g[9]-=1<<13;mask=(c^1)-1;for(i=0;i<10;i++)g[i]&=mask;mask=~mask;for(i=0;i<10;i++)this.h[i]=this.h[i]&mask|g[i];this.h[0]=(this.h[0]|this.h[1]<<13)&65535;this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535;this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535;this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535;this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535;this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535;this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535;this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535;f=this.h[0]+this.pad[0];this.h[0]=f&65535;for(i=1;i<8;i++){f=(this.h[i]+this.pad[i]|0)+(f>>>16)|0;this.h[i]=f&65535}mac[macpos+0]=this.h[0]>>>0&255;mac[macpos+1]=this.h[0]>>>8&255;mac[macpos+2]=this.h[1]>>>0&255;mac[macpos+3]=this.h[1]>>>8&255;mac[macpos+4]=this.h[2]>>>0&255;mac[macpos+5]=this.h[2]>>>8&255;mac[macpos+6]=this.h[3]>>>0&255;mac[macpos+7]=this.h[3]>>>8&255;mac[macpos+8]=this.h[4]>>>0&255;mac[macpos+9]=this.h[4]>>>8&255;mac[macpos+10]=this.h[5]>>>0&255;mac[macpos+11]=this.h[5]>>>8&255;mac[macpos+12]=this.h[6]>>>0&255;mac[macpos+13]=this.h[6]>>>8&255;mac[macpos+14]=this.h[7]>>>0&255;mac[macpos+15]=this.h[7]>>>8&255};poly1305.prototype.update=function(m,mpos,bytes){var i,want;if(this.leftover){want=16-this.leftover;if(want>bytes)want=bytes;for(i=0;i<want;i++)this.buffer[this.leftover+i]=m[mpos+i];bytes-=want;mpos+=want;this.leftover+=want;if(this.leftover<16)return;this.blocks(this.buffer,0,16);this.leftover=0}if(bytes>=16){want=bytes-bytes%16;this.blocks(m,mpos,want);mpos+=want;bytes-=want}if(bytes){for(i=0;i<bytes;i++)this.buffer[this.leftover+i]=m[mpos+i];this.leftover+=bytes}}
;function crypto_onetimeauth(out,outpos,m,mpos,n,k){var s=new poly1305(k);s.update(m,mpos,n);s.finish(out,outpos);return 0}function crypto_onetimeauth_verify(h,hpos,m,mpos,n,k){var x=new Uint8Array(16);crypto_onetimeauth(x,0,m,mpos,n,k);return crypto_verify_16(h,hpos,x,0)}function crypto_secretbox(c,m,d,n,k){var i;if(d<32)return-1;crypto_stream_xor(c,0,m,0,d,n,k);crypto_onetimeauth(c,16,c,32,d-32,c);for(i=0;i<16;i++)c[i]=0;return 0}function crypto_secretbox_open(m,c,d,n,k){var i;var x=new Uint8Array(32);if(d<32)return-1;crypto_stream(x,0,32,n,k);if(crypto_onetimeauth_verify(c,16,c,32,d-32,x)!==0)return-1;crypto_stream_xor(m,0,c,0,d,n,k);for(i=0;i<32;i++)m[i]=0;return 0}function set25519(r,a){var i;for(i=0;i<16;i++)r[i]=a[i]|0}function car25519(o){var i,v,c=1;for(i=0;i<16;i++){v=o[i]+c+65535;c=Math.floor(v/65536);o[i]=v-c*65536}o[0]+=c-1+37*(c-1)}function sel25519(p,q,b){var t,c=~(b-1);for(var i=0;i<16;i++){t=c&(p[i]^q[i]);p[i]^=t;q[i]^=t}}function pack25519(o,n){var i,j,b;var m=gf(),t=gf();for(i=0;i<16;i++)t[i]=n[i];car25519(t);car25519(t);car25519(t);for(j=0;j<2;j++){m[0]=t[0]-65517;for(i=1;i<15;i++){m[i]=t[i]-65535-(m[i-1]>>16&1);m[i-1]&=65535}m[15]=t[15]-32767-(m[14]>>16&1);b=m[15]>>16&1;m[14]&=65535;sel25519(t,m,1-b)}for(i=0;i<16;i++){o[2*i]=t[i]&255;o[2*i+1]=t[i]>>8}}function neq25519(a,b){var c=new Uint8Array(32),d=new Uint8Array(32);pack25519(c,a);pack25519(d,b);return crypto_verify_32(c,0,d,0)}function par25519(a){var d=new Uint8Array(32);pack25519(d,a);return d[0]&1}function unpack25519(o,n){var i;for(i=0;i<16;i++)o[i]=n[2*i]+(n[2*i+1]<<8);o[15]&=32767}function A(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]+b[i]}function Z(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]-b[i]}function M(o,a,b){var v,c,t0=0,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0,t9=0,t10=0,t11=0,t12=0,t13=0,t14=0,t15=0,t16=0,t17=0,t18=0,t19=0,t20=0,t21=0,t22=0,t23=0,t24=0,t25=0,t26=0,t27=0,t28=0,t29=0,t30=0,b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8],b9=b[9],b10=b[10],b11=b[11],b12=b[12],b13=b[13],b14=b[14],b15=b[15];v=a[0];t0+=v*b0;t1+=v*b1;t2+=v*b2;t3+=v*b3;t4+=v*b4;t5+=v*b5;t6+=v*b6;t7+=v*b7;t8+=v*b8;t9+=v*b9;t10+=v*b10;t11+=v*b11;t12+=v*b12;t13+=v*b13;t14+=v*b14;t15+=v*b15;v=a[1];t1+=v*b0;t2+=v*b1;t3+=v*b2;t4+=v*b3;t5+=v*b4;t6+=v*b5;t7+=v*b6;t8+=v*b7;t9+=v*b8;t10+=v*b9;t11+=v*b10;t12+=v*b11;t13+=v*b12;t14+=v*b13;t15+=v*b14;t16+=v*b15;v=a[2];t2+=v*b0;t3+=v*b1;t4+=v*b2;t5+=v*b3;t6+=v*b4;t7+=v*b5;t8+=v*b6;t9+=v*b7;t10+=v*b8;t11+=v*b9;t12+=v*b10;t13+=v*b11;t14+=v*b12;t15+=v*b13;t16+=v*b14;t17+=v*b15;v=a[3];t3+=v*b0;t4+=v*b1;t5+=v*b2;t6+=v*b3;t7+=v*b4;t8+=v*b5;t9+=v*b6;t10+=v*b7;t11+=v*b8;t12+=v*b9;t13+=v*b10;t14+=v*b11;t15+=v*b12;t16+=v*b13;t17+=v*b14;t18+=v*b15;v=a[4];t4+=v*b0;t5+=v*b1;t6+=v*b2;t7+=v*b3;t8+=v*b4;t9+=v*b5;t10+=v*b6;t11+=v*b7;t12+=v*b8;t13+=v*b9;t14+=v*b10;t15+=v*b11;t16+=v*b12;t17+=v*b13;t18+=v*b14;t19+=v*b15;v=a[5];t5+=v*b0;t6+=v*b1;t7+=v*b2;t8+=v*b3;t9+=v*b4;t10+=v*b5;t11+=v*b6;t12+=v*b7;t13+=v*b8;t14+=v*b9;t15+=v*b10;t16+=v*b11;t17+=v*b12;t18+=v*b13;t19+=v*b14;t20+=v*b15;v=a[6];t6+=v*b0;t7+=v*b1;t8+=v*b2;t9+=v*b3;t10+=v*b4;t11+=v*b5;t12+=v*b6;t13+=v*b7;t14+=v*b8;t15+=v*b9;t16+=v*b10;t17+=v*b11;t18+=v*b12;t19+=v*b13;t20+=v*b14;t21+=v*b15;v=a[7];t7+=v*b0;t8+=v*b1;t9+=v*b2;t10+=v*b3;t11+=v*b4;t12+=v*b5;t13+=v*b6;t14+=v*b7;t15+=v*b8;t16+=v*b9;t17+=v*b10;t18+=v*b11;t19+=v*b12;t20+=v*b13;t21+=v*b14;t22+=v*b15;v=a[8];t8+=v*b0;t9+=v*b1;t10+=v*b2;t11+=v*b3;t12+=v*b4;t13+=v*b5;t14+=v*b6;t15+=v*b7;t16+=v*b8;t17+=v*b9;t18+=v*b10;t19+=v*b11;t20+=v*b12;t21+=v*b13;t22+=v*b14;t23+=v*b15;v=a[9];t9+=v*b0;t10+=v*b1;t11+=v*b2;t12+=v*b3;t13+=v*b4;t14+=v*b5;t15+=v*b6;t16+=v*b7;t17+=v*b8;t18+=v*b9;t19+=v*b10;t20+=v*b11;t21+=v*b12;t22+=v*b13;t23+=v*b14;t24+=v*b15;v=a[10];t10+=v*b0;t11+=v*b1;t12+=v*b2;t13+=v*b3;t14+=v*b4;t15+=v*b5;t16+=v*b6;t17+=v*b7;t18+=v*b8;t19+=v*b9;t20+=v*b10;t21+=v*b11;t22+=v*b12;t23+=v*b13;t24+=v*b14;t25+=v*b15;v=a[11];t11+=v*b0;t12+=v*b1;t13+=v*b2;t14+=v*b3;t15+=v*b4;t16+=v*b5;t17+=v*b6;t18+=v*b7;t19+=v*b8;t20+=v*b9;t21+=v*b10;t22+=v*b11;t23+=v*b12;t24+=v*b13;t25+=v*b14;t26+=v*b15;v=a[12];t12+=v*b0;t13+=v*b1;t14+=v*b2;t15+=v*b3;t16+=v*b4;t17+=v*b5;t18+=v*b6;t19+=v*b7;t20+=v*b8;t21+=v*b9;t22+=v*b10;t23+=v*b11;t24+=v*b12;t25+=v*b13;t26+=v*b14;t27+=v*b15;v=a[13];t13+=v*b0;t14+=v*b1;t15+=v*b2;t16+=v*b3;t17+=v*b4;t18+=v*b5;t19+=v*b6;t20+=v*b7;t21+=v*b8;t22+=v*b9;t23+=v*b10;t24+=v*b11;t25+=v*b12;t26+=v*b13;t27+=v*b14;t28+=v*b15;v=a[14];t14+=v*b0;t15+=v*b1;t16+=v*b2;t17+=v*b3;t18+=v*b4;t19+=v*b5;t20+=v*b6;t21+=v*b7;t22+=v*b8;t23+=v*b9;t24+=v*b10;t25+=v*b11;t26+=v*b12;t27+=v*b13;t28+=v*b14;t29+=v*b15;v=a[15];t15+=v*b0;t16+=v*b1;t17+=v*b2;t18+=v*b3;t19+=v*b4;t20+=v*b5;t21+=v*b6;t22+=v*b7;t23+=v*b8;t24+=v*b9;t25+=v*b10;t26+=v*b11;t27+=v*b12;t28+=v*b13;t29+=v*b14;t30+=v*b15;t0+=38*t16;t1+=38*t17;t2+=38*t18;t3+=38*t19;t4+=38*t20;t5+=38*t21;t6+=38*t22;t7+=38*t23;t8+=38*t24;t9+=38*t25;t10+=38*t26;t11+=38*t27;t12+=38*t28;t13+=38*t29;t14+=38*t30;c=1;v=t0+c+65535;c=Math.floor(v/65536);t0=v-c*65536;v=t1+c+65535;c=Math.floor(v/65536);t1=v-c*65536;v=t2+c+65535;c=Math.floor(v/65536);t2=v-c*65536;v=t3+c+65535;c=Math.floor(v/65536);t3=v-c*65536;v=t4+c+65535;c=Math.floor(v/65536);t4=v-c*65536;v=t5+c+65535;c=Math.floor(v/65536);t5=v-c*65536;v=t6+c+65535;c=Math.floor(v/65536);t6=v-c*65536;v=t7+c+65535;c=Math.floor(v/65536);t7=v-c*65536;v=t8+c+65535;c=Math.floor(v/65536);t8=v-c*65536;v=t9+c+65535;c=Math.floor(v/65536);t9=v-c*65536;v=t10+c+65535;c=Math.floor(v/65536);t10=v-c*65536;v=t11+c+65535;c=Math.floor(v/65536);t11=v-c*65536;v=t12+c+65535;c=Math.floor(v/65536);t12=v-c*65536;v=t13+c+65535;c=Math.floor(v/65536);t13=v-c*65536;v=t14+c+65535;c=Math.floor(v/65536);t14=v-c*65536;v=t15+c+65535;c=Math.floor(v/65536);t15=v-c*65536;t0+=c-1+37*(c-1);c=1;v=t0+c+65535;c=Math.floor(v/65536);t0=v-c*65536;v=t1+c+65535;c=Math.floor(v/65536);t1=v-c*65536;v=t2+c+65535;c=Math.floor(v/65536);t2=v-c*65536;v=t3+c+65535;c=Math.floor(v/65536);t3=v-c*65536;v=t4+c+65535;c=Math.floor(v/65536);t4=v-c*65536;v=t5+c+65535;c=Math.floor(v/65536);t5=v-c*65536;v=t6+c+65535;c=Math.floor(v/65536);t6=v-c*65536;v=t7+c+65535;c=Math.floor(v/65536);t7=v-c*65536;v=t8+c+65535;c=Math.floor(v/65536);t8=v-c*65536;v=t9+c+65535;c=Math.floor(v/65536);t9=v-c*65536;v=t10+c+65535;c=Math.floor(v/65536);t10=v-c*65536;v=t11+c+65535;c=Math.floor(v/65536);t11=v-c*65536;v=t12+c+65535;c=Math.floor(v/65536);t12=v-c*65536;v=t13+c+65535;c=Math.floor(v/65536);t13=v-c*65536;v=t14+c+65535;c=Math.floor(v/65536);t14=v-c*65536;v=t15+c+65535;c=Math.floor(v/65536);t15=v-c*65536;t0+=c-1+37*(c-1);o[0]=t0;o[1]=t1;o[2]=t2;o[3]=t3;o[4]=t4;o[5]=t5;o[6]=t6;o[7]=t7;o[8]=t8;o[9]=t9;o[10]=t10;o[11]=t11;o[12]=t12;o[13]=t13;o[14]=t14;o[15]=t15}function S(o,a){M(o,a,a)}function inv25519(o,i){var c=gf();var a;for(a=0;a<16;a++)c[a]=i[a];for(a=253;a>=0;a--){S(c,c);if(a!==2&&a!==4)M(c,c,i)}for(a=0;a<16;a++)o[a]=c[a]}function pow2523(o,i){var c=gf();var a;for(a=0;a<16;a++)c[a]=i[a];for(a=250;a>=0;a--){S(c,c);if(a!==1)M(c,c,i)}for(a=0;a<16;a++)o[a]=c[a]}function crypto_scalarmult(q,n,p){var z=new Uint8Array(32);var x=new Float64Array(80),r,i;var a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf();for(i=0;i<31;i++)z[i]=n[i];z[31]=n[31]&127|64;z[0]&=248;unpack25519(x,p);for(i=0;i<16;i++){b[i]=x[i];d[i]=a[i]=c[i]=0}a[0]=d[0]=1;for(i=254;i>=0;--i){r=z[i>>>3]>>>(i&7)&1;sel25519(a,b,r);sel25519(c,d,r);A(e,a,c);Z(a,a,c);A(c,b,d);Z(b,b,d);S(d,e);S(f,a);M(a,c,a);M(c,b,e);A(e,a,c);Z(a,a,c);S(b,a);Z(c,d,f);M(a,c,_121665);A(a,a,d);M(c,c,a);M(a,d,f);M(d,b,x);S(b,e);sel25519(a,b,r);sel25519(c,d,r)}for(i=0;i<16;i++){x[i+16]=a[i];x[i+32]=c[i];x[i+48]=b[i];x[i+64]=d[i]}var x32=x.subarray(32);var x16=x.subarray(16);inv25519(x32,x32);M(x16,x16,x32);pack25519(q,x16);return 0}function crypto_scalarmult_base(q,n){return crypto_scalarmult(q,n,_9)}function crypto_box_keypair(y,x){randombytes(x,32);return crypto_scalarmult_base(y,x)}function crypto_box_beforenm(k,y,x){var s=new Uint8Array(32);crypto_scalarmult(s,x,y);return crypto_core_hsalsa20(k,_0,s,sigma)}var crypto_box_afternm=crypto_secretbox;var crypto_box_open_afternm=crypto_secretbox_open;function crypto_box(c,m,d,n,y,x){var k=new Uint8Array(32);crypto_box_beforenm(k,y,x);return crypto_box_afternm(c,m,d,n,k)}function crypto_box_open(m,c,d,n,y,x){var k=new Uint8Array(32);crypto_box_beforenm(k,y,x);return crypto_box_open_afternm(m,c,d,n,k)}var K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function crypto_hashblocks_hl(hh,hl,m,n){var wh=new Int32Array(16),wl=new Int32Array(16),bh0,bh1,bh2,bh3,bh4,bh5,bh6,bh7,bl0,bl1,bl2,bl3,bl4,bl5,bl6,bl7,th,tl,i,j,h,l,a,b,c,d;var ah0=hh[0],ah1=hh[1],ah2=hh[2],ah3=hh[3],ah4=hh[4],ah5=hh[5],ah6=hh[6],ah7=hh[7],al0=hl[0],al1=hl[1],al2=hl[2],al3=hl[3],al4=hl[4],al5=hl[5],al6=hl[6],al7=hl[7];var pos=0;while(n>=128){for(i=0;i<16;i++){j=8*i+pos;wh[i]=m[j+0]<<24|m[j+1]<<16|m[j+2]<<8|m[j+3];wl[i]=m[j+4]<<24|m[j+5]<<16|m[j+6]<<8|m[j+7]}for(i=0;i<80;i++){bh0=ah0;bh1=ah1;bh2=ah2;bh3=ah3;bh4=ah4;bh5=ah5;bh6=ah6;bh7=ah7;bl0=al0;bl1=al1;bl2=al2;bl3=al3;bl4=al4;bl5=al5;bl6=al6;bl7=al7;h=ah7;l=al7;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=(ah4>>>14|al4<<32-14)^(ah4>>>18|al4<<32-18)^(al4>>>41-32|ah4<<32-(41-32));l=(al4>>>14|ah4<<32-14)^(al4>>>18|ah4<<32-18)^(ah4>>>41-32|al4<<32-(41-32));a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;h=ah4&ah5^~ah4&ah6;l=al4&al5^~al4&al6;a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;h=K[i*2];l=K[i*2+1];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;h=wh[i%16];l=wl[i%16];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;th=c&65535|d<<16;tl=a&65535|b<<16;h=th;l=tl;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=(ah0>>>28|al0<<32-28)^(al0>>>34-32|ah0<<32-(34-32))^(al0>>>39-32|ah0<<32-(39-32));l=(al0>>>28|ah0<<32-28)^(ah0>>>34-32|al0<<32-(34-32))^(ah0>>>39-32|al0<<32-(39-32));a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;h=ah0&ah1^ah0&ah2^ah1&ah2;l=al0&al1^al0&al2^al1&al2;a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;bh7=c&65535|d<<16;bl7=a&65535|b<<16;h=bh3;l=bl3;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=th;l=tl;a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;bh3=c&65535|d<<16;bl3=a&65535|b<<16;ah1=bh0;ah2=bh1;ah3=bh2;ah4=bh3;ah5=bh4;ah6=bh5;ah7=bh6;ah0=bh7;al1=bl0;al2=bl1;al3=bl2;al4=bl3;al5=bl4;al6=bl5;al7=bl6;al0=bl7;if(i%16===15){for(j=0;j<16;j++){h=wh[j];l=wl[j];a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=wh[(j+9)%16];l=wl[(j+9)%16];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;th=wh[(j+1)%16];tl=wl[(j+1)%16];h=(th>>>1|tl<<32-1)^(th>>>8|tl<<32-8)^th>>>7;l=(tl>>>1|th<<32-1)^(tl>>>8|th<<32-8)^(tl>>>7|th<<32-7);a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;th=wh[(j+14)%16];tl=wl[(j+14)%16];h=(th>>>19|tl<<32-19)^(tl>>>61-32|th<<32-(61-32))^th>>>6;l=(tl>>>19|th<<32-19)^(th>>>61-32|tl<<32-(61-32))^(tl>>>6|th<<32-6);a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;wh[j]=c&65535|d<<16;wl[j]=a&65535|b<<16}}}h=ah0;l=al0;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[0];l=hl[0];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[0]=ah0=c&65535|d<<16;hl[0]=al0=a&65535|b<<16;h=ah1;l=al1;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[1];l=hl[1];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[1]=ah1=c&65535|d<<16;hl[1]=al1=a&65535|b<<16;h=ah2;l=al2;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[2];l=hl[2];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[2]=ah2=c&65535|d<<16;hl[2]=al2=a&65535|b<<16;h=ah3;l=al3;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[3];l=hl[3];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[3]=ah3=c&65535|d<<16;hl[3]=al3=a&65535|b<<16;h=ah4;l=al4;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[4];l=hl[4];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[4]=ah4=c&65535|d<<16;hl[4]=al4=a&65535|b<<16;h=ah5;l=al5;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[5];l=hl[5];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[5]=ah5=c&65535|d<<16;hl[5]=al5=a&65535|b<<16;h=ah6;l=al6;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[6];l=hl[6];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[6]=ah6=c&65535|d<<16;hl[6]=al6=a&65535|b<<16;h=ah7;l=al7;a=l&65535;b=l>>>16;c=h&65535;d=h>>>16;h=hh[7];l=hl[7];a+=l&65535;b+=l>>>16;c+=h&65535;d+=h>>>16;b+=a>>>16;c+=b>>>16;d+=c>>>16;hh[7]=ah7=c&65535|d<<16;hl[7]=al7=a&65535|b<<16;pos+=128;n-=128}return n}function crypto_hash(out,m,n){var hh=new Int32Array(8),hl=new Int32Array(8),x=new Uint8Array(256),i,b=n;hh[0]=1779033703;hh[1]=3144134277;hh[2]=1013904242;hh[3]=2773480762;hh[4]=1359893119;hh[5]=2600822924;hh[6]=528734635;hh[7]=1541459225;hl[0]=4089235720;hl[1]=2227873595;hl[2]=4271175723;hl[3]=1595750129;hl[4]=2917565137;hl[5]=725511199;hl[6]=4215389547;hl[7]=327033209;crypto_hashblocks_hl(hh,hl,m,n);n%=128;for(i=0;i<n;i++)x[i]=m[b-n+i];x[n]=128;n=256-128*(n<112?1:0);x[n-9]=0;ts64(x,n-8,b/536870912|0,b<<3);crypto_hashblocks_hl(hh,hl,x,n);for(i=0;i<8;i++)ts64(out,8*i,hh[i],hl[i]);return 0}function add(p,q){var a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf(),g=gf(),h=gf(),t=gf();Z(a,p[1],p[0]);Z(t,q[1],q[0]);M(a,a,t);A(b,p[0],p[1]);A(t,q[0],q[1]);M(b,b,t);M(c,p[3],q[3]);M(c,c,D2);M(d,p[2],q[2]);A(d,d,d);Z(e,b,a);Z(f,d,c);A(g,d,c);A(h,b,a);M(p[0],e,f);M(p[1],h,g);M(p[2],g,f);M(p[3],e,h)}function cswap(p,q,b){var i;for(i=0;i<4;i++){sel25519(p[i],q[i],b)}}function pack(r,p){var tx=gf(),ty=gf(),zi=gf();inv25519(zi,p[2]);M(tx,p[0],zi);M(ty,p[1],zi);pack25519(r,ty);r[31]^=par25519(tx)<<7}function scalarmult(p,q,s){var b,i;set25519(p[0],gf0);set25519(p[1],gf1);set25519(p[2],gf1);set25519(p[3],gf0);for(i=255;i>=0;--i){b=s[i/8|0]>>(i&7)&1;cswap(p,q,b);add(q,p);add(p,p);cswap(p,q,b)}}function scalarbase(p,s){var q=[gf(),gf(),gf(),gf()];set25519(q[0],X);set25519(q[1],Y);set25519(q[2],gf1);M(q[3],X,Y);scalarmult(p,q,s)}function crypto_sign_keypair(pk,sk,seeded){var d=new Uint8Array(64);var p=[gf(),gf(),gf(),gf()];var i;if(!seeded)randombytes(sk,32);crypto_hash(d,sk,32);d[0]&=248;d[31]&=127;d[31]|=64;scalarbase(p,d);pack(pk,p);for(i=0;i<32;i++)sk[i+32]=pk[i];return 0}var L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function modL(r,x){var carry,i,j,k;for(i=63;i>=32;--i){carry=0;for(j=i-32,k=i-12;j<k;++j){x[j]+=carry-16*x[i]*L[j-(i-32)];carry=x[j]+128>>8;x[j]-=carry*256}x[j]+=carry;x[i]=0}carry=0;for(j=0;j<32;j++){x[j]+=carry-(x[31]>>4)*L[j];carry=x[j]>>8;x[j]&=255}for(j=0;j<32;j++)x[j]-=carry*L[j];for(i=0;i<32;i++){x[i+1]+=x[i]>>8;r[i]=x[i]&255}}function reduce(r){var x=new Float64Array(64),i;for(i=0;i<64;i++)x[i]=r[i];for(i=0;i<64;i++)r[i]=0;modL(r,x)}function crypto_sign(sm,m,n,sk){var d=new Uint8Array(64),h=new Uint8Array(64),r=new Uint8Array(64);var i,j,x=new Float64Array(64);var p=[gf(),gf(),gf(),gf()];crypto_hash(d,sk,32);d[0]&=248;d[31]&=127;d[31]|=64;var smlen=n+64;for(i=0;i<n;i++)sm[64+i]=m[i];for(i=0;i<32;i++)sm[32+i]=d[32+i];crypto_hash(r,sm.subarray(32),n+32);reduce(r);scalarbase(p,r);pack(sm,p);for(i=32;i<64;i++)sm[i]=sk[i];crypto_hash(h,sm,n+64);reduce(h);for(i=0;i<64;i++)x[i]=0;for(i=0;i<32;i++)x[i]=r[i];for(i=0;i<32;i++){for(j=0;j<32;j++){x[i+j]+=h[i]*d[j]}}modL(sm.subarray(32),x);return smlen}function unpackneg(r,p){var t=gf(),chk=gf(),num=gf(),den=gf(),den2=gf(),den4=gf(),den6=gf();set25519(r[2],gf1);unpack25519(r[1],p);S(num,r[1]);M(den,num,D);Z(num,num,r[2]);A(den,r[2],den);S(den2,den);S(den4,den2);M(den6,den4,den2);M(t,den6,num);M(t,t,den);pow2523(t,t);M(t,t,num);M(t,t,den);M(t,t,den);M(r[0],t,den);S(chk,r[0]);M(chk,chk,den);if(neq25519(chk,num))M(r[0],r[0],I);S(chk,r[0]);M(chk,chk,den);if(neq25519(chk,num))return-1;if(par25519(r[0])===p[31]>>7)Z(r[0],gf0,r[0]);M(r[3],r[0],r[1]);return 0}function crypto_sign_open(m,sm,n,pk){var i,mlen;var t=new Uint8Array(32),h=new Uint8Array(64);var p=[gf(),gf(),gf(),gf()],q=[gf(),gf(),gf(),gf()];mlen=-1;if(n<64)return-1;if(unpackneg(q,pk))return-1;for(i=0;i<n;i++)m[i]=sm[i];for(i=0;i<32;i++)m[i+32]=pk[i];crypto_hash(h,m,n);reduce(h);scalarmult(p,q,h);scalarbase(q,sm.subarray(32));add(p,q);pack(t,p);n-=64;if(crypto_verify_32(sm,0,t,0)){for(i=0;i<n;i++)m[i]=0;return-1}for(i=0;i<n;i++)m[i]=sm[i+64];mlen=n;return mlen}var crypto_secretbox_KEYBYTES=32,crypto_secretbox_NONCEBYTES=24,crypto_secretbox_ZEROBYTES=32,crypto_secretbox_BOXZEROBYTES=16,crypto_scalarmult_BYTES=32,crypto_scalarmult_SCALARBYTES=32,crypto_box_PUBLICKEYBYTES=32,crypto_box_SECRETKEYBYTES=32,crypto_box_BEFORENMBYTES=32,crypto_box_NONCEBYTES=crypto_secretbox_NONCEBYTES,crypto_box_ZEROBYTES=crypto_secretbox_ZEROBYTES,crypto_box_BOXZEROBYTES=crypto_secretbox_BOXZEROBYTES,crypto_sign_BYTES=64,crypto_sign_PUBLICKEYBYTES=32,crypto_sign_SECRETKEYBYTES=64,crypto_sign_SEEDBYTES=32,crypto_hash_BYTES=64;nacl.lowlevel={crypto_core_hsalsa20:crypto_core_hsalsa20,crypto_stream_xor:crypto_stream_xor,crypto_stream:crypto_stream,crypto_stream_salsa20_xor:crypto_stream_salsa20_xor,crypto_stream_salsa20:crypto_stream_salsa20,crypto_onetimeauth:crypto_onetimeauth,crypto_onetimeauth_verify:crypto_onetimeauth_verify,crypto_verify_16:crypto_verify_16,crypto_verify_32:crypto_verify_32,crypto_secretbox:crypto_secretbox,crypto_secretbox_open:crypto_secretbox_open,crypto_scalarmult:crypto_scalarmult,crypto_scalarmult_base:crypto_scalarmult_base,crypto_box_beforenm:crypto_box_beforenm,crypto_box_afternm:crypto_box_afternm,crypto_box:crypto_box,crypto_box_open:crypto_box_open,crypto_box_keypair:crypto_box_keypair,crypto_hash:crypto_hash,crypto_sign:crypto_sign,crypto_sign_keypair:crypto_sign_keypair,crypto_sign_open:crypto_sign_open,crypto_secretbox_KEYBYTES:crypto_secretbox_KEYBYTES,crypto_secretbox_NONCEBYTES:crypto_secretbox_NONCEBYTES,crypto_secretbox_ZEROBYTES:crypto_secretbox_ZEROBYTES,crypto_secretbox_BOXZEROBYTES:crypto_secretbox_BOXZEROBYTES,crypto_scalarmult_BYTES:crypto_scalarmult_BYTES,crypto_scalarmult_SCALARBYTES:crypto_scalarmult_SCALARBYTES,crypto_box_PUBLICKEYBYTES:crypto_box_PUBLICKEYBYTES,crypto_box_SECRETKEYBYTES:crypto_box_SECRETKEYBYTES,crypto_box_BEFORENMBYTES:crypto_box_BEFORENMBYTES,crypto_box_NONCEBYTES:crypto_box_NONCEBYTES,crypto_box_ZEROBYTES:crypto_box_ZEROBYTES,crypto_box_BOXZEROBYTES:crypto_box_BOXZEROBYTES,crypto_sign_BYTES:crypto_sign_BYTES,crypto_sign_PUBLICKEYBYTES:crypto_sign_PUBLICKEYBYTES,crypto_sign_SECRETKEYBYTES:crypto_sign_SECRETKEYBYTES,crypto_sign_SEEDBYTES:crypto_sign_SEEDBYTES,crypto_hash_BYTES:crypto_hash_BYTES};function checkLengths(k,n){if(k.length!==crypto_secretbox_KEYBYTES)throw new Error("bad key size");if(n.length!==crypto_secretbox_NONCEBYTES)throw new Error("bad nonce size")}function checkBoxLengths(pk,sk){if(pk.length!==crypto_box_PUBLICKEYBYTES)throw new Error("bad public key size");if(sk.length!==crypto_box_SECRETKEYBYTES)throw new Error("bad secret key size")}function checkArrayTypes(){for(var i=0;i<arguments.length;i++){if(!(arguments[i]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}}function cleanup(arr){for(var i=0;i<arr.length;i++)arr[i]=0}nacl.randomBytes=function(n){var b=new Uint8Array(n);randombytes(b,n);return b};nacl.secretbox=function(msg,nonce,key){checkArrayTypes(msg,nonce,key);checkLengths(key,nonce);var m=new Uint8Array(crypto_secretbox_ZEROBYTES+msg.length);var c=new Uint8Array(m.length);for(var i=0;i<msg.length;i++)m[i+crypto_secretbox_ZEROBYTES]=msg[i];crypto_secretbox(c,m,m.length,nonce,key);return c.subarray(crypto_secretbox_BOXZEROBYTES)};nacl.secretbox.open=function(box,nonce,key){checkArrayTypes(box,nonce,key);checkLengths(key,nonce);var c=new Uint8Array(crypto_secretbox_BOXZEROBYTES+box.length);var m=new Uint8Array(c.length);for(var i=0;i<box.length;i++)c[i+crypto_secretbox_BOXZEROBYTES]=box[i];if(c.length<32)return null;if(crypto_secretbox_open(m,c,c.length,nonce,key)!==0)return null;return m.subarray(crypto_secretbox_ZEROBYTES)};nacl.secretbox.keyLength=crypto_secretbox_KEYBYTES;nacl.secretbox.nonceLength=crypto_secretbox_NONCEBYTES;nacl.secretbox.overheadLength=crypto_secretbox_BOXZEROBYTES;nacl.scalarMult=function(n,p){checkArrayTypes(n,p);if(n.length!==crypto_scalarmult_SCALARBYTES)throw new Error("bad n size");if(p.length!==crypto_scalarmult_BYTES)throw new Error("bad p size");var q=new Uint8Array(crypto_scalarmult_BYTES);crypto_scalarmult(q,n,p);return q};nacl.scalarMult.base=function(n){checkArrayTypes(n);if(n.length!==crypto_scalarmult_SCALARBYTES)throw new Error("bad n size");var q=new Uint8Array(crypto_scalarmult_BYTES);crypto_scalarmult_base(q,n);return q};nacl.scalarMult.scalarLength=crypto_scalarmult_SCALARBYTES;nacl.scalarMult.groupElementLength=crypto_scalarmult_BYTES;nacl.box=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox(msg,nonce,k)};nacl.box.before=function(publicKey,secretKey){checkArrayTypes(publicKey,secretKey);checkBoxLengths(publicKey,secretKey);var k=new Uint8Array(crypto_box_BEFORENMBYTES);crypto_box_beforenm(k,publicKey,secretKey);return k};nacl.box.after=nacl.secretbox;nacl.box.open=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox.open(msg,nonce,k)};nacl.box.open.after=nacl.secretbox.open;nacl.box.keyPair=function(){var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES);var sk=new Uint8Array(crypto_box_SECRETKEYBYTES);crypto_box_keypair(pk,sk);return{publicKey:pk,secretKey:sk}};nacl.box.keyPair.fromSecretKey=function(secretKey){checkArrayTypes(secretKey);if(secretKey.length!==crypto_box_SECRETKEYBYTES)throw new Error("bad secret key size");var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES);crypto_scalarmult_base(pk,secretKey);return{publicKey:pk,secretKey:new Uint8Array(secretKey)}};nacl.box.publicKeyLength=crypto_box_PUBLICKEYBYTES;nacl.box.secretKeyLength=crypto_box_SECRETKEYBYTES;nacl.box.sharedKeyLength=crypto_box_BEFORENMBYTES;nacl.box.nonceLength=crypto_box_NONCEBYTES;nacl.box.overheadLength=nacl.secretbox.overheadLength;nacl.sign=function(msg,secretKey){checkArrayTypes(msg,secretKey);if(secretKey.length!==crypto_sign_SECRETKEYBYTES)throw new Error("bad secret key size");var signedMsg=new Uint8Array(crypto_sign_BYTES+msg.length);crypto_sign(signedMsg,msg,msg.length,secretKey);return signedMsg};nacl.sign.open=function(signedMsg,publicKey){checkArrayTypes(signedMsg,publicKey);if(publicKey.length!==crypto_sign_PUBLICKEYBYTES)throw new Error("bad public key size");var tmp=new Uint8Array(signedMsg.length);var mlen=crypto_sign_open(tmp,signedMsg,signedMsg.length,publicKey);if(mlen<0)return null;var m=new Uint8Array(mlen);for(var i=0;i<m.length;i++)m[i]=tmp[i];return m};nacl.sign.detached=function(msg,secretKey){var signedMsg=nacl.sign(msg,secretKey);var sig=new Uint8Array(crypto_sign_BYTES);for(var i=0;i<sig.length;i++)sig[i]=signedMsg[i];return sig};nacl.sign.detached.verify=function(msg,sig,publicKey){checkArrayTypes(msg,sig,publicKey);if(sig.length!==crypto_sign_BYTES)throw new Error("bad signature size");if(publicKey.length!==crypto_sign_PUBLICKEYBYTES)throw new Error("bad public key size");var sm=new Uint8Array(crypto_sign_BYTES+msg.length);var m=new Uint8Array(crypto_sign_BYTES+msg.length);var i;for(i=0;i<crypto_sign_BYTES;i++)sm[i]=sig[i];for(i=0;i<msg.length;i++)sm[i+crypto_sign_BYTES]=msg[i];return crypto_sign_open(m,sm,sm.length,publicKey)>=0};nacl.sign.keyPair=function(){var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES);var sk=new Uint8Array(crypto_sign_SECRETKEYBYTES);crypto_sign_keypair(pk,sk);return{publicKey:pk,secretKey:sk}};nacl.sign.keyPair.fromSecretKey=function(secretKey){checkArrayTypes(secretKey);if(secretKey.length!==crypto_sign_SECRETKEYBYTES)throw new Error("bad secret key size");var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES);for(var i=0;i<pk.length;i++)pk[i]=secretKey[32+i];return{publicKey:pk,secretKey:new Uint8Array(secretKey)}};nacl.sign.keyPair.fromSeed=function(seed){checkArrayTypes(seed);if(seed.length!==crypto_sign_SEEDBYTES)throw new Error("bad seed size");var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES);var sk=new Uint8Array(crypto_sign_SECRETKEYBYTES);for(var i=0;i<32;i++)sk[i]=seed[i];crypto_sign_keypair(pk,sk,true);return{publicKey:pk,secretKey:sk}};nacl.sign.publicKeyLength=crypto_sign_PUBLICKEYBYTES;nacl.sign.secretKeyLength=crypto_sign_SECRETKEYBYTES;nacl.sign.seedLength=crypto_sign_SEEDBYTES;nacl.sign.signatureLength=crypto_sign_BYTES;nacl.hash=function(msg){checkArrayTypes(msg);var h=new Uint8Array(crypto_hash_BYTES);crypto_hash(h,msg,msg.length);return h};nacl.hash.hashLength=crypto_hash_BYTES;nacl.verify=function(x,y){checkArrayTypes(x,y);if(x.length===0||y.length===0)return false;if(x.length!==y.length)return false;return vn(x,0,y,0,x.length)===0?true:false};nacl.setPRNG=function(fn){randombytes=fn};(function(){var crypto=typeof self!=="undefined"?self.crypto||self.msCrypto:null;if(crypto&&crypto.getRandomValues){var QUOTA=65536;nacl.setPRNG(function(x,n){var i,v=new Uint8Array(n);for(i=0;i<n;i+=QUOTA){crypto.getRandomValues(v.subarray(i,i+Math.min(n-i,QUOTA)))}for(i=0;i<n;i++)x[i]=v[i];cleanup(v)})}else if(typeof require!=="undefined"){crypto=require("crypto");if(crypto&&crypto.randomBytes){nacl.setPRNG(function(x,n){var i,v=crypto.randomBytes(n);for(i=0;i<n;i++)x[i]=v[i];cleanup(v)})}}})()})(typeof module!=="undefined"&&module.exports?module.exports:self.nacl=self.nacl||{})},{crypto:19}],51:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]);