(function(e){vari=function(e,i){Object.defineProperty(module.exports,e,{get:function(){returnrequire(i)}})};i("Bignum","bignum"),Object.defineProperty(module.exports,"bignum",{get:function(){returnconsole.log('bignum (with a lower-case "b") is deprecated. Use bitcore.Bignum (capital "B") instead.'),require("bignum")}}),i("Base58","./lib/Base58"),Object.defineProperty(module.exports,"base58",{get:function(){returnconsole.log('base58 (with a lower-case "b") is deprecated. Use bitcore.Base58 (capital "B") instead.'),require("./lib/Base58")}}),i("bufferput","bufferput"),i("buffertools","buffertools"),i("Buffers.monkey","./patches/Buffers.monkey"),i("config","./config"),i("const","./const"),i("Deserialize","./lib/Deserialize"),i("ECIES","./lib/ECIES"),i("log","./util/log"),i("networks","./networks"),i("SecureRandom","./lib/SecureRandom"),i("sjcl","./lib/sjcl"),i("util","./util/util"),i("EncodedData","./util/EncodedData"),i("VersionedData","./util/VersionedData"),i("BinaryParser","./util/BinaryParser"),i("Address","./lib/Address"),i("AuthMessage","./lib/AuthMessage"),i("HierarchicalKey","./lib/HierarchicalKey"),i("BIP21","./lib/BIP21"),Object.defineProperty(module.exports,"BIP32",{get:function(){returnconsole.log("BIP32 is deprecated. Use bitcore.HierarchicalKey instead."),require("./lib/HierarchicalKey")}}),i("BIP39","./lib/BIP39"),i("BIP39WordlistEn","./lib/BIP39WordlistEn"),i("Point","./lib/Point"),i("Opcode","./lib/Opcode"),i("Script","./lib/Script"),i("Transaction","./lib/Transaction"),i("TransactionBuilder","./lib/TransactionBuilder"),i("Connection","./lib/Connection"),i("PayPro","./lib/PayPro"),i("Peer","./lib/Peer"),i("Block","./lib/Block"),i("ScriptInterpreter","./lib/ScriptInterpreter"),i("Bloom","./lib/Bloom"),i("Key","./lib/Key"),Object.defineProperty(module.exports,"KeyModule",{get:function(){returnconsole.log("KeyModule is deprecated."),require("bindings")("KeyModule")}}),i("SINKey","./lib/SINKey"),i("SIN","./lib/SIN"),i("PrivateKey","./lib/PrivateKey"),i("RpcClient","./lib/RpcClient"),i("Wallet","./lib/Wallet"),i("WalletKey","./lib/WalletKey"),i("PeerManager","./lib/PeerManager"),i("Message","./lib/Message"),i("Electrum","./lib/Electrum"),i("Armory","./lib/Armory"),i("NetworkMonitor","./lib/NetworkMonitor"),module.exports.Buffer=e}).call(this,require("buffer").Buffer);
(function(e){"use strict";functionr(t,i){if(i&&i.length&&(!e.isBuffer(i)||20!=i.length))thrownewError("Hash must be 20 bytes");r.super_.call(this,t,i)}vart=require("../util"),i=require("../util/VersionedData"),n=require("../util/EncodedData"),s=require("../networks"),o=require("./Script"),u=require("util");u.inherits(r,i),n.applyEncodingsTo(r),r.fromPubKey=function(e,i){if(i||(i="livenet"),33!==e.length&&65!==e.length)thrownewError("Invalid public key");varn=s[i].addressVersion,o=t.sha256ripe160(e);returnnewr(n,o)},r.fromKey=function(e,t){returnr.fromPubKey(e.public,t)},r.fromPubKeys=function(e,t,i,n){i||(i="livenet");for(varsint){varu=t[s];if(33!=u.length&&65!=u.length)thrownewError("Invalid public key")}vara=o.createMultisig(e,t,n);returnr.fromScript(a,i)},r.fromScript=function(i,n){n||(n="livenet"),"string"==typeofi&&(i=newo(newe(i,"hex")));varu=s[n].P2SHVersion,a=i.getBuffer(),f=t.sha256ripe160(a);returnnewr(u,f)},r.fromScriptPubKey=function(i,n){"string"==typeofi&&(i=newo(newe(i,"hex"))),n||(n="livenet");varu,a=[],f=i.capture();if(f){varc=i.classify();switch(c){caseo.TX_PUBKEY:f[0]=t.sha256ripe160(f[0]),u=s[n].addressVersion;break;caseo.TX_PUBKEYHASH:u=s[n].addressVersion;break;caseo.TX_MULTISIG:u=s[n].addressVersion;for(varlinf)f[l]=t.sha256ripe160(f[l]);break;caseo.TX_SCRIPTHASH:u=s[n].P2SHVersion}for(varlinf)a.push(newr(u,f[l]))}returna},r.prototype.validate=function(){if(this.doAsBinary(function(){if(r.super_.prototype.validate.apply(this),21!==this.data.length)thrownewError("invalid data length")}),"undefined"==typeofthis.network())thrownewError("invalid network")},r.prototype.network=function(){vare,r=this.version(),t=s.livenet,i=s.testnet;returnr===t.addressVersion||r===t.P2SHVersion?e=t:(r===i.addressVersion||r===i.P2SHVersion)&&(e=i),e},r.prototype.isScript=function(){returnthis.isValid()&&this.version()===this.network().P2SHVersion},r.prototype.getScriptPubKey=function(){vare,r=this.version(),t=s.livenet,i=s.testnet;if(r===t.addressVersion||r===i.addressVersion)e=o.createPubKeyHashOut(this.payload());else{if(r!==t.P2SHVersion&&r!==i.P2SHVersion)thrownewError("invalid address - unknown version");e=o.createP2SH(this.payload())}returne},r.fromPubkeyHashScriptSig=function(e,t){returnr.fromPubKey(e.chunks[1],t)},r.fromScriptSig=function(t,i){"string"==typeoft&&(t=newo(newe(t,"hex"))),i||(i="livenet");t.chunks;return2===t.chunks.length?r.fromPubkeyHashScriptSig(t,i):null},r.getScriptPubKeyFor=function(e){returnnewr(e).getScriptPubKey()},r.validate=function(e){returnnewr(e).isValid()},module.exports=r}).call(this,require("buffer").Buffer);
(function(r){"use strict";vare=require("./Message"),n=require("./ECIES"),t=require("preconditions").singleton(),o=require("./Key"),i=1,c=0,a=function(){};a.setVersion=function(r,e){i=r,c=e},a.encode=function(e,n,u,f){t.checkArgument(ninstanceofo,"fromkey"),"string"==typeofe&&(e=newr(e,"hex")),uinstanceofr||(u=newr(JSON.stringify(u)));vars=newr([i]),h=newr([c]);if(f&&f.nonce&&r.isBuffer(f.nonce)&&8==f.nonce.length)varv=f.nonce;else{varv=newr(8);v.fill(0)}varw=r.concat([s,h,v,u]),y=newr(w.toString("hex")),d=a._encrypt(e,y),g=a._sign(n,d),p={pubkey:n.public.toString("hex"),sig:g.toString("hex"),encrypted:d.toString("hex"),to:e.toString("hex")};returnp},a.decode=function(e,n,t){if(t&&t.prevnonce&&r.isBuffer(t.prevnonce)&&8==t.prevnonce.length)varo=t.prevnonce;else{varo=newr(8);o.fill(0)}try{varc=newr(n.pubkey,"hex")}catch(u){thrownewError("Error decoding public key: "+u)}try{varf=newr(n.sig,"hex"),s=newr(n.encrypted,"hex")}catch(u){thrownewError("Error decoding data: "+u)}try{varh=a._verify(c,f,s)}catch(u){thrownewError("Error verifying signature: "+u)}if(!h)thrownewError("Invalid signature");try{varv=a._decrypt(e.private,s),w=newr(v.toString(),"hex")}catch(u){thrownewError("Cannot decrypt data: "+u)}try{vary=w[0],d=w[1],g=w.slice(2,10),p=w.slice(10)}catch(u){thrownewError("Cannot parse decrypted data: "+u)}if(0===p.length)thrownewError("No data present");if(y!==i)thrownewError("Invalid version number");if(!a._noncegt(g,o)&&"0000000000000000"!==o.toString("hex"))thrownewError("Nonce not equal to zero and not greater than the previous nonce");try{p=JSON.parse(p)}catch(u){if(!(uinstanceofSyntaxError))throwu}varl={version1:y,version2:d,nonce:g,payload:p};returnl},a._noncegt=function(r,e){varn=r.slice(0,4).readUInt32BE(0),t=e.slice(0,4).readUInt32BE(0);if(n>t)return!0;if(t>n)return!1;varo=r.slice(4,8).readUInt32BE(0),i=e.slice(4,8).readUInt32BE(0);returno>i?!0:!1},a._encrypt=function(r,e,t,o){vari=n.encrypt(r,e,t,o);returni},a._decrypt=function(r,e){vart=n.decrypt(r,e);returnt},a._sign=function(r,n){vart=e.sign(n,r);returnt},a._verify=function(r,n,t){varo=e.verifyWithPubKey(r,t,n);returno},module.exports=a}).call(this,require("buffer").Buffer);
(function(e){functionr(r){returnnewe(t.createHash("sha256").update(r).digest("binary"),"binary")}functionn(e){returnr(r(e))}for(vart=require("crypto"),o=require("bignum"),i=newe(1024),c=newe(0),f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",u=f[0],a=newe(f,"ascii"),h={},d=0;d<f.length;d++)h[f[d]]=d;varl={encode:function(r){varn,t,c=o.fromBuffer(r);n=r.length<512?i:newe(r.length<<1);for(varf=n.length-1;c.gt(0);)t=c.mod(58),c=c.div(58),n[f]=a[t.toNumber()],f--;for(varu=0;0==r[u];)n[f]=a[0],u++,f--;returnn.slice(f+1,n.length).toString("ascii")},decode:function(r){if(0==r.length)returnc;for(varn=o(0),t=0;t<r.length;t++)n=n.mul(58),n=n.add(h[r[t]]);for(vart=0;t<r.length&&r[t]==u;)t++;if(t>0){vari=newe(t);returni.fill(0),t==r.length?i:(n=n.toBuffer(),e.concat([i,n],t+n.length))}returnn.toBuffer()}},s={encode:function(r){vart=newe(r.length+4),o=n(r);returnr.copy(t),o.copy(t,r.length),l.encode(t)},decode:function(e){varr=l.decode(e);if(r.length<4)thrownewError("invalid input: too short");vart=r.slice(0,-4),o=r.slice(-4),i=n(t),c=i.slice(0,4);if(o.toString("hex")!==c.toString("hex"))thrownewError("checksum mismatch");returnt}};exports.setBuffer=function(e){i=e},exports.base58=l,exports.base58Check=s,exports.encode=l.encode,exports.decode=l.decode}).call(this,require("buffer").Buffer);
(function(t){functione(t){"object"!=typeoft&&(t={}),this.hash=t.hash||null,this.prev_hash=t.prev_hash||r.NULL_HASH,this.merkle_root=t.merkle_root||r.NULL_HASH,this.timestamp=t.timestamp||0,this.bits=t.bits||0,this.nonce=t.nonce||0,this.version=t.version||0,this.height=t.height||0,this.size=t.size||0,this.active=t.active||!1,this.chainWork=t.chainWork||r.EMPTY_BUFFER,this.txs=t.txs||[]}varr=require("../util"),i=require("./Script"),o=require("bignum"),s=(require("binary"),require("step"),require("buffertools")),h=require("./Transaction"),n=h.In,a=h.Out,c=h.COINBASE_OP,u=require("../util/error").VerificationError,l={maxTimeOffset:7200,largestHash:newo("10000000000000000000000000000000000000000000000000000000000000000",16)};e.prototype.getHeader=function(){vare=newt(80),r=0;returne.writeUInt32LE(this.version,r),r+=4,this.prev_hash.copy(e,r),r+=32,this.merkle_root.copy(e,r),r+=32,e.writeUInt32LE(this.timestamp,r),r+=4,e.writeUInt32LE(this.bits,r),r+=4,e.writeUInt32LE(this.nonce,r),r+=4,e},e.prototype.parse=function(t,e){if(this.version=t.word32le(),this.prev_hash=t.buffer(32),this.merkle_root=t.buffer(32),this.timestamp=t.word32le(),this.bits=t.word32le(),this.nonce=t.word32le(),this.txs=[],this.size=0,!e)for(varr=t.varInt(),i=0;r>i;i++){varo=newh;o.parse(t),this.txs.push(o)}},e.prototype.calcHash=function(){vart=this.getHeader();returnr.twoSha256(t)},e.prototype.checkHash=function(){returnthis.hash&&this.hash.length?0==s.compare(this.calcHash(),this.hash):!1},e.prototype.getHash=function(){returnthis.hash&&this.hash.length||(this.hash=this.calcHash()),this.hash},e.prototype.checkProofOfWork=function(){vart=r.decodeDiffBits(this.bits),e=s.reverse(this.hash);if(s.compare(e,t)>0)thrownewu("Difficulty target not met");return!0},e.prototype.getWork=function(){vart=r.decodeDiffBits(this.bits,!0);returnl.largestHash.div(t.add(1))},e.prototype.checkTimestamp=function(){vart=(newDate).getTime()/1e3;if(this.timestamp>t+l.maxTimeOffset)thrownewu("Timestamp too far into the future");return!0},e.prototype.checkTransactions=function(t){if(!Array.isArray(t)||t.length<=0)thrownewu("No transactions");if(!t[0].isCoinBase())thrownewu("First tx must be coinbase");for(vare=1;e<t.length;e++)if(t[e].isCoinBase())thrownewu("Tx index "+e+" must not be coinbase");return!0},e.prototype.getMerkleTree=function(e){if(0==e.length)return[r.NULL_HASH.slice(0)];for(vari=e.map(function(t){returntinstanceofh?t.getHash():t}),o=0,s=e.length;s>1;s=Math.floor((s+1)/2)){for(varn=0;s>n;n+=2){vara=Math.min(n+1,s-1),c=i[o+n],u=i[o+a];i.push(r.twoSha256(t.concat([c,u])))}o+=s}returni},e.prototype.calcMerkleRoot=function(t){vare=this.getMerkleTree(t);returne[e.length-1]},e.prototype.checkMerkleRoot=function(e){if(!this.merkle_root||!this.merkle_root.length)thrownewu("No merkle root");if(0!==s.compare(this.calcMerkleRoot(e),newt(this.merkle_root)))thrownewu("Merkle root incorrect");return!0},e.prototype.checkBlock=function(t){if(!this.checkHash())thrownewu("Block hash invalid");if(this.checkProofOfWork(),this.checkTimestamp(),t&&(this.checkTransactions(t),!this.checkMerkleRoot(t)))thrownewu("Merkle hash invalid");return!0},e.getBlockValue=function(t){vare=50*r.COIN;returne/=Math.pow(2,Math.floor(t/21e4)),e=Math.floor(e),e=newo(e)},e.prototype.getBlockValue=function(){returne.getBlockValue(this.height)},e.prototype.toString=function(){return"<Block "+r.formatHashAlt(this.hash)+" height="+this.height+">"},e.prototype.createCoinbaseTx=function(t){vare=newh;returne.ins.push(newn({s:r.EMPTY_BUFFER,q:4294967295,o:c})),e.outs.push(newa({v:r.bigIntToValue(this.getBlockValue()),s:i.createPubKeyOut(t).getBuffer()})),e},e.prototype.solve=function(t,e){vari=this.getHeader(),o=r.decodeDiffBits(this.bits);t.solve(i,o,e)},e.prototype.getStandardizedObject=function(t){vare={hash:r.formatHashFull(this.getHash()),version:this.version,prev_block:r.formatHashFull(this.prev_hash),mrkl_root:r.formatHashFull(this.merkle_root),time:this.timestamp,bits:this.bits,nonce:this.nonce,height:this.height};if(t){vari=this.getMerkleTree(t).map(
(function(e){"use strict";varr=require("../util"),i=require("./Key"),n=require("bignum"),r=require("../util"),t=function(){};t.sign=function(e,r){vari=t.magicHash(e),n=r.signSync(i);returnn},t.verifyWithPubKey=function(e,r,n){varu=t.magicHash(r),a=newi;return65==e.length&&(a.compressed=!1),a.public=e,a.verifySignatureSync(u,n)},t.signMessage=function(e,r){varu=t.magicHash(e),a=n.fromBuffer(r.private),s=i.signCompressed(u,a);returns},t.verifyMessage=function(e,r,n){varu=t.magicHash(r);returni.verifyCompressed(u,n,e)},t.magicBytes=newe("Bitcoin Signed Message:\n"),t.magicHash=function(i){varn=t.magicBytes,u=r.varIntBuf(n.length),a=newe(i),s=r.varIntBuf(a.length),c=e.concat([u,n,s,a]),f=r.twoSha256(c);returnf},module.exports=t}).call(this,require("buffer").Buffer);
(function(t){"use strict";functioni(n,r){if("number"!=typeofn)returnvoidi.super_.call(this,n,r);if(!t.isBuffer(r)||20!=r.length)thrownewError("Payload must be 20 bytes");this.data=newt(2+r.length),this.converters=this.encodings.binary.converters,this._encoding=this.encodings.binary._encoding,this.encoding("binary"),this.prefix(15),this.type(n),this.payload(r)}varn=require("../util/VersionedData"),r=require("../util/EncodedData"),e=require("util"),o=require("../util");e.inherits(i,n),r.applyEncodingsTo(i),i.SIN_PERSIST_MAINNET=1,i.SIN_PERSIST_TESTNET=17,i.SIN_EPHEM=2,i.prototype.prefix=function(t){returnt||0===t?(this.doAsBinary(function(){this.data.writeUInt8(t,0)}),t):this.as("binary").readUInt8(0)},i.prototype.type=function(t){returnt||0===t?(this.doAsBinary(function(){this.data.writeUInt8(t,1)}),t):this.as("binary").readUInt8(1)},i.prototype.payload=function(t){returnt?(this.doAsBinary(function(){t.copy(this.data,2)}),t):this.as("binary").slice(1)},i.prototype.validate=function(){this.doAsBinary(function(){if(i.super_.prototype.validate.call(this),22!=this.data.length)thrownewError("invalid data length")})},i.fromPubKey=function(n,r){if(r||(r=i.SIN_EPHEM),!t.isBuffer(n)||33!==n.length&&65!=n.length)thrownewError("Invalid public key");vare=o.sha256ripe160(n);returnnewi(e,r)},module.exports=i}).call(this,require("buffer").Buffer);
(function(t){functione(t){this.buffer=t?t:f.EMPTY_BUFFER,this.chunks=[],this.parse()}functionr(t){returnt==h.map.OP_0||t>=h.map.OP_1&&t<=h.map.OP_16}functionn(t){returnt<h.map.OP_PUSHDATA1?1:255>=t?2:65535>=t?3:5}functions(e){varr=void0;returne<h.map.OP_PUSHDATA1?(r=newt(1),r.writeUInt8(e,0)):255>=e?(r=newt(2),r.writeUInt8(h.map.OP_PUSHDATA1,0),r.writeUInt8(e,1)):65535>=e?(r=newt(3),r.writeUInt8(h.map.OP_PUSHDATA2,0),r.writeUInt16LE(e,1)):(r=newt(5),r.writeUInt8(h.map.OP_PUSHDATA4,0),r.writeUInt32LE(e,1)),r}varu=(require("../config"),require("../util/log")),h=require("./Opcode"),o=require("buffertools"),f=require("../util/util"),c=require("../util/BinaryParser"),p=require("bufferput"),a=0,l=1,g=2,k=3,y=4,S=["unknown","pubkey","pubkeyhash","multisig","scripthash"];e.TX_UNKNOWN=a,e.TX_PUBKEY=l,e.TX_PUBKEYHASH=g,e.TX_MULTISIG=k,e.TX_SCRIPTHASH=y,e.prototype.parse=function(){this.chunks=[];for(vart=newc(this.buffer);!t.eof();){vare,r,n=t.word8();n>0&&n<h.map.OP_PUSHDATA1?this.chunks.push(t.buffer(n)):n===h.map.OP_PUSHDATA1?(e=t.word8(),r=t.buffer(e),this.chunks.push(r)):n===h.map.OP_PUSHDATA2?(e=t.word16le(),r=t.buffer(e),this.chunks.push(r)):n===h.map.OP_PUSHDATA4?(e=t.word32le(),r=t.buffer(e),this.chunks.push(r)):this.chunks.push(n)}},e.prototype.isPushOnly=function(){for(vare=0;e<this.chunks.length;e++){varr=this.chunks[e];if(!t.isBuffer(r)&&r>h.map.OP_16)return!1}return!0},e.prototype.isP2SH=function(){return3==this.chunks.length&&this.chunks[0]==h.map.OP_HASH160&&t.isBuffer(this.chunks[1])&&20==this.chunks[1].length&&this.chunks[2]==h.map.OP_EQUAL},e.prototype.isPubkey=function(){return2==this.chunks.length&&t.isBuffer(this.chunks[0])&&this.chunks[1]==h.map.OP_CHECKSIG},e.prototype.isPubkeyHash=function(){return5==this.chunks.length&&this.chunks[0]==h.map.OP_DUP&&this.chunks[1]==h.map.OP_HASH160&&t.isBuffer(this.chunks[2])&&20==this.chunks[2].length&&this.chunks[3]==h.map.OP_EQUALVERIFY&&this.chunks[4]==h.map.OP_CHECKSIG},e.prototype.isMultiSig=function(){returnthis.chunks.length>3&&r(this.chunks[0])&&this.chunks.slice(1,this.chunks.length-2).every(function(e){returnt.isBuffer(e)})&&r(this.chunks[this.chunks.length-2])&&this.chunks[this.chunks.length-1]==h.map.OP_CHECKMULTISIG},e.prototype.isPubkeyHashScriptSig=function(){return2==this.chunks.length&&t.isBuffer(this.chunks[0])&&t.isBuffer(this.chunks[1])},e.prototype.isP2shScriptSig=function(){if(!r(this.chunks[0])||0!==this.chunks[0])return!1;vart=newe(this.chunks[this.chunks.length-1]),n=t.classify();returnn!==a},e.prototype.isMultiSigScriptSig=function(){returnr(this.chunks[0])&&0===this.chunks[0]?!this.isP2shScriptSig():!1},e.prototype.isPubkeyScriptSig=function(){return1==this.chunks.length&&t.isBuffer(this.chunks[0])},e.prototype.countSignatures=function(){vart=0,e=this.chunks.length;returnt=this.isMultiSigScriptSig()?e-1:this.isP2shScriptSig()?e-2:this.isPubkeyHashScriptSig()?1:0},e.prototype.getSignatures=function(){ret=[];vart=this.chunks.length;if(this.isMultiSigScriptSig())for(vare=1;t>e;e++)ret.push(this.chunks[e]);elseif(this.isP2shScriptSig())for(vare=1;t-1>e;e++)ret.push(this.chunks[e]);elsethis.isPubkeyHashScriptSig()&&ret.push(this.chunks[0]);returnret},e.prototype.getHashType=function(){for(vart=this.getSignatures(),e=null,r=0;r<t.length;r++){varn=t[r],i=n[n.length-1];if(null!==e&&e!==i)returnnull;e=i}returne},e.prototype.countMissingSignatures=function(){if(this.isMultiSig())returnu.debug("Can not count missing signatures on normal Multisig script"),null;vart=0,n=this.chunks.length;if(r(this.chunks[0])&&0===this.chunks[0]){vari=newe(this.chunks[n-1]);if(r(i.chunks[0])){vars=i.chunks[0]-80;t=s-(n-2)}elseu.debug("Unrecognized script type")}else0===o.compare(this.getBuffer(),f.EMPTY_BUFFER)&&(t=1);returnt},e.prototype.finishedMultiSig=function(){vart=this.countMissingSignatures();returnnull===t?null:0===t},e.prototype.getMultiSigInfo=function(){if(!this.isMultiSig())thrownewError("Script.getMultiSigInfo(): Not a multiSig script.");for(vart=this.chunks[0]-80,e=this.chunks[this.chunks.length-2]-80,r=[
(function(t){"use strict";functione(t){returnt=t||{},this.vanilla={},this.vanilla.scriptSig=[],this.vanilla.opts=JSON.stringify(t),this.lockTime=t.lockTime||0,this.spendUnconfirmed=t.spendUnconfirmed||!1,(t.fee||t.feeSat)&&(this.givenFeeSat=t.fee?t.fee*n.COIN:t.feeSat),this.remainderOut=t.remainderOut,this.signhash=t.signhash||f.SIGHASH_ALL,this.tx={},this.inputsSigned=0,this}vari=require("./Address"),r=require("./Script"),n=require("../util"),s=require("bignum"),u=require("buffertools"),o=require("../networks"),a=require("./WalletKey"),h=require("./PrivateKey"),p=require("./Key"),c=require("../util/log"),f=require("./Transaction"),g=parseInt(1e-4*n.COIN),l=1;e.FEE_PER_1000B_SAT=g,e._scriptForPubkeys=function(e){for(vari=e.pubkeys.length,n=[],s=0;i>s;s++)n.push(newt(e.pubkeys[s],"hex"));returnr.createMultisig(e.nreq,n)},e._scriptForOut=function(t){vare;if(t.address)e=newi(t.address).getScriptPubKey();else{if(!(t.pubkeys||t.nreq||t.nreq>1))thrownewError("unknown out type");e=this._scriptForPubkeys(t)}returne},e.infoForP2sh=function(t,e){varr=this._scriptForOut(t),s=n.sha256ripe160(r.getBuffer()),u="testnet"===e?o.testnet.P2SHVersion:o.livenet.P2SHVersion,a=newi(u,s),h=a.as("base58");return{script:r,scriptBufHex:r.getBuffer().toString("hex"),hash:s,address:h}},e.prototype.setUnspent=function(t){returnthis.vanilla.utxos=JSON.stringify(t),this.utxos=t,this},e.prototype._setInputMap=function(){for(vare=[],i=this.selectedUtxos.length,n=0;i>n;n++){vars=this.selectedUtxos[n],u=newt(s.scriptPubKey,"hex"),o=newr(u),a=o.classify();if(a===r.TX_UNKNOWN)thrownewError("unkown output type at:"+n+" Type:"+o.getRawOutType());e.push({address:s.address,scriptPubKey:o,scriptType:a,i:n})}returnthis.inputMap=e,this},e.prototype.getSelectedUnspent=function(){returnthis.selectedUtxos},e.prototype._selectUnspent=function(t){if(!this.utxos||!this.utxos.length)thrownewError("unspent not set");vare=[6,1];this.spendUnconfirmed&&e.push(0);vari=[],r=s(0),u=!1,o=null,a=this.utxos.length;do{for(varh=e.shift(),p=0;a>p;p++){varc=this.utxos[p],f=c.confirmations||0;if(!(h>f||o&&f>=o)){varg=c.amountSat||n.parseValue(c.amount);if(r=r.add(g),i.push(c),r.cmp(t)>=0){u=!0;break}}}o=h}while(!u&&e.length);if(!u)thrownewError("not enough unspent tx outputs to fulfill totalNeededAmount [SAT]:"+t);returnthis.selectedUtxos=i,this._setInputMap(),this},e.prototype._setInputs=function(e){vari=this.selectedUtxos,r=i.length,o=s(0);e.ins=[];for(vara=0;r>a;a++){o=o.add(n.parseValue(i[a].amount));varh={};h.s=n.EMPTY_BUFFER,h.q=4294967295;varp=newt(i[a].txid,"hex"),c=u.reverse(p),f=parseInt(i[a].vout),g=newt(4);g.writeUInt32LE(f,0),h.o=t.concat([c,g]),e.ins.push(h)}returnthis.valueInSat=o,this},e.prototype._setFee=function(t){if("undefined"==typeofthis.valueOutSat)thrownewError("valueOutSat undefined");vare=this.valueOutSat.add(t);if(this.valueInSat.cmp(e)<0){vari=this.valueInSat.toString(),r=e.toString();thrownewError("transaction input amount is less than outputs: "+i+" < "+r+" [SAT]")}returnthis.feeSat=t,this},e.prototype._setRemainder=function(t,i){if("undefined"==typeofthis.valueInSat||"undefined"==typeofthis.valueOutSat)thrownewError("valueInSat / valueOutSat undefined");varr=this.valueInSat.sub(this.valueOutSat).sub(this.feeSat),u=t.outs.length;if(this.remainderSat=s(0),u>i&&t.outs.pop(),r.cmp(0)>0){varo=this.remainderOut||this.selectedUtxos[0],a=n.bigIntToValue(r),h=e._scriptForOut(o),p={v:a,s:h.getBuffer()};t.outs.push(p),this.remainderSat=r}returnthis},e.prototype._setFeeAndRemainder=function(t){vare,i=500,r=t.outs.length;do{e=parseInt(i/1e3)+1;varn=this.givenFeeSat?this.givenFeeSat:e*g,s=this.valueOutSat.add(n);this._selectUnspent(s)._setInputs(t)._setFee(n)._setRemainder(t,r),i=newf(t).getSize()}while(i>1e3*(e+1));returnthis},e.prototype.setOutputs=function(t){this.vanilla.outs=JSON.stringify(t);vari=s(0),r={};r.version=1,r.lock_time=this.lockTime||0,r.ins=[],r.outs=[];for(varu=t.length,o=0;u>o;o++){vara=t[o].amountSat||t[o].amountSatStr?s(t[o].amountSatStr):n.parseValue(t[o].amount),h=n.bigIntToValue(a),p
(function(e){"use strict";vart=require("../sjcl"),c=require("../common/ECIES");c.symmetricEncrypt=function(c,r,o){vari=t.codec.hex.toBits(c.toString("hex")),s=t.codec.hex.toBits(r.toString("hex")),n=t.codec.hex.toBits(o.toString("hex"));t.beware["CBC mode is dangerous because it doesn't protect message integrity."]();varh=newt.cipher.aes(i),d=t.mode.cbc.encrypt(h,n,s),a=newe(t.codec.hex.fromBits(d),"hex"),x=e.concat([r,a]);returnx},c.symmetricDecrypt=function(c,r){varo=t.codec.hex.toBits(c.toString("hex")),i=r.slice(0,16),s=r.slice(16,r.length);t.beware["CBC mode is dangerous because it doesn't protect message integrity."]();varn=t.codec.hex.toBits(s.toString("hex")),h=t.codec.hex.toBits(i.toString("hex")),d=newt.cipher.aes(o),a=t.mode.cbc.decrypt(d,n,h),x=newe(t.codec.hex.fromBits(a),"hex");returnx},module.exports=c}).call(this,require("buffer").Buffer);
(function(e){varr=require("../SecureRandom"),t=require("bignum"),i=require("elliptic"),n=require("./Point"),s=require("../common/Key"),o=(require("util"),function(){this._pub=null,this._compressed=!0});for(varuins)s.hasOwnProperty(u)&&(o[u]=s[u]);o.bufferToArray=function(e){for(varr=[],t=e.length,i=0;t>i;i++)r.push(e.readUInt8(i));returnr};Object.defineProperty(o.prototype,"public",{set:function(r){if(!e.isBuffer(r))thrownewError("Arg should be a buffer");vart=r[0];this._compressed=4!==t,this._pub=r},get:function(){returnthis._pub}}),Object.defineProperty(o.prototype,"compressed",{set:function(r){vars=this._compressed;if(this._compressed=!!r,s!=this._compressed){{this._pub}if(this._pub)if(this._compressed){varo=this._pub.slice(1,33),u=this._pub.slice(33,65),f=newt(o),c=newt(u),p=newn(f,c);this._pub=p.toCompressedPubKey()}else{vara=i.curves.secp256k1,o=this._pub.slice(1,33),h=3==this._pub[0]?!0:!1,p=a.curve.pointFromX(h,o),u=newe(p.y.toArray()),v=newt(o),y=newt(u),m=newn(v,y);this._pub=m.toUncompressedPubKey()}!this._compressed}},get:function(){returnthis._compressed}}),o.generateSync=function(){for(vare,n=i.curves.secp256k1;;)if(e=r.getRandomBuffer(32),t.fromBuffer(e,{size:32}).cmp(n.n)<0)break;vars=newo;returns.private=e,s.regenerateSync(),s},o.prototype.regenerateSync=function(){if(!this.private)thrownewError("Key does not have a private key set");vare=i.curves.secp256k1,r=(e.g,e.g.mul(this.private)),s=newt(r.x.toArray()),o=newt(r.y.toArray()),u=newn(s,o);returnthis._pub=this.compressed?u.toCompressedPubKey():u.toUncompressedPubKey(),this},o.prototype.signSync=function(r){i.curves.secp256k1;if(!this.private)thrownewError("Key does not have a private key set");if(!e.isBuffer(r)||32!==r.length)thrownewError("Arg should be a 32 bytes hash buffer");varn=newt(this.private),s=o.sign(r,n),u=o.rs2DER(s.r,s.s);returnu},o.prototype.verifySignature=function(e,r,t){try{vari=this.verifySignatureSync(e,r);t(null,i)}catch(n){t(n)}},o.prototype.verifySignatureSync=function(e,r){vart=newi.ec(i.curves.secp256k1),n=e.toString("hex"),s=this._pub.toString("hex"),r=r.toString("hex"),o=t.verify(n,r,s);returno},o.sign=function(e,r,i){vars=r,u=n.getN(),f=newt(e);dovari=i||o.genk(),c=n.getG(),p=n.multiply(c,i),a=p.x.mod(u),h=i.invm(u).mul(f.add(s.mul(a))).mod(u);while(a.cmp(newt(0))<=0||h.cmp(newt(0))<=0);return{r:a,s:h}},o.signCompressed=function(r,i,s){varu=o.sign(r,i,s),f=u.r,c=u.s,p=t.fromBuffer(r),a=n.getG(),h=n.multiply(a,i),v=o.calcPubKeyRecoveryParam(p,f,c,h),y=f.toBuffer({size:32}),m=c.toBuffer({size:32}),l=newe([v]),b=e.concat([l,y,m]);returnb},o.verifyCompressed=function(e,r){if(65!==r.length)thrownewError("Invalid length for sigbuf");vari=r[0];if(0>i||i>3)thrownewError("Invalid value for i");varn=r.slice(1,33),s=r.slice(33,65),u=t.fromBuffer(n),f=t.fromBuffer(s),c=o.rs2DER(u,f),p=t.fromBuffer(e),a=newo,h=o.recoverPubKey(p,u,f,i),v=h.toCompressedPubKey();returna.public=v,a.verifySignatureSync(e,c)},module.exports=o}).call(this,require("buffer").Buffer);
(function(e){"use strict";varr=(require("./Key"),require("bignum")),u=(require("assert"),require("elliptic")),i=require("../common/Point");i.add=function(e,r){vart=u.curves.secp256k1,n=t.curve.point(e.x,e.y),s=t.curve.point(r.x,r.y),c=n.add(s),f=newi(c.x,c.y);returnf},i.multiply=function(t,n){if(e.isBuffer(n)&&32!==n.length)thrownewError("if x is a buffer, it must be 32 bytes");vars=u.curves.secp256k1,c=s.curve.point(t.x,t.y);"string"==typeofn&&(n=newr(n));varf=c.mul(n),o=newi(f.x,f.y);returno},module.exports=i}).call(this,require("buffer").Buffer);
(function(o){varr=require("../common/SecureRandom");r.getRandomBuffer=function(r){if(!window.crypto&&!window.msCrypto)thrownewError("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)vare=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)thrownewError("window.crypto.getRandomValues not available");vare=window.msCrypto}varn=newUint8Array(r);e.getRandomValues(n);varw=newo(n);returnw},module.exports=r}).call(this,require("buffer").Buffer);
(function(e){"use strict";varr=require("../../util"),t=require("../Point"),i=require("../SecureRandom"),n=require("../Key"),c=function(){};c.encryptObj=function(e,r,t,n){vars=newc;s.KB=e,s.message=r,t=s.getRandomSeed(t);varo=(s.R,s.S=s.getSfromPubkey()),u=c.kdf(o),a=s.kE=u.slice(0,32),p=s.kM=u.slice(32,64);n=n||i.getRandomBuffer(16);{varf=s.c=c.symmetricEncrypt(a,n,r);s.d=c.mac(p,f)}returns},c.encrypt=function(r,t,i,s){varo=c.encryptObj(r,t,i,s),u=newn;u.compressed=!1,u.public=o.R.toUncompressedPubKey(),u.compressed=!0;vara=u.public,p=e.concat([a,o.c,o.d]);returnp},c.decryptObj=function(e){varr=e.kB,i=e.R,n=e.c,s=e.d,o=t.multiply(i,r),u=o.x.toBuffer({size:32}),a=c.kdf(u),p=e.kE=a.slice(0,32),f=e.kM=a.slice(32,64),y=c.mac(f,n);if(s.toString("hex")!==y.toString("hex"))thrownewError("MAC check incorrect. Data is invalid.");varh=c.symmetricDecrypt(p,n);returnh},c.decrypt=function(e,r){if(r.length<97)thrownewError("invalid length of encrypted data");vari=newc;i.kB=e;vars=r.slice(0,33),o=newn;returno.public=s,o.compressed=!1,i.R=t.fromUncompressedPubKey(o.public),i.c=r.slice(33,r.length-64),i.d=r.slice(r.length-64,r.length),c.decryptObj(i)},c.kdf=function(e){vart=r.sha512(e);returnt},c.mac=function(e,t){vari=r.sha512hmac(e,t);returni},c.prototype.getRandomSeed=function(e){returne?(this.key=newn,this.key.private=e,this.key.regenerateSync()):this.key=n.generateSync(),this.r=this.key.private,this.key.compressed=!1,this.R=t.fromUncompressedPubKey(this.key.public),this.r},c.prototype.getSfromPubkey=function(){vare=newn;e.public=this.KB,e.compressed=!1;varr=t.fromUncompressedPubKey(e.public);returnthis.P=t.multiply(r,this.r),this.S=this.P.x.toBuffer({size:32}),this.S},c.prototype.getSfromPrivkey=function(){vare=this.R,r=this.kB,i=t.multiply(e,r),n=i.x.toBuffer({size:32});returnn},module.exports=c}).call(this,require("buffer").Buffer);
(function(r){vare=require("bignum"),n=require("../Point"),t=require("../SecureRandom"),e=require("bignum"),o=require("elliptic"),f=function(){};f.parseDERsig=function(n){if(!r.isBuffer(n))thrownewError("DER formatted signature should be a buffer");vart=n[0];if(48!==t)thrownewError("Header byte should be 0x30");varo=n[1];if(o!==n.slice(2).length)thrownewError("Length byte should length of what follows");varf=n[2];if(2!==f)thrownewError("Integer byte for r should be 0x02");vari=n[3],u=n.slice(4,4+i),a=e.fromBuffer(u),c=0===n[4]?!0:!1;if(i!==u.length)thrownewError("Length of r incorrect");varh=n[4+i+0];if(2!==h)thrownewError("Integer byte for s should be 0x02");varg=n[4+i+1],l=n.slice(4+i+2,4+i+2+g),s=e.fromBuffer(l),w=0===n[4+i+2+2]?!0:!1;if(g!==l.length)thrownewError("Length of s incorrect");varv=4+i+2+g;if(o!==v-2)thrownewError("Length of signature incorrect");vard={header:t,length:o,rheader:f,rlength:i,rneg:c,rbuf:u,r:a,sheader:h,slength:g,sneg:w,sbuf:l,s:s};returnd},f.rs2DER=function(e,n){vart=e.toBuffer(),o=n.toBuffer(),f=128&t[0]?!0:!1,i=128&o[0]?!0:!1,u=f?r.concat([newr([0]),t]):t,a=i?r.concat([newr([0]),o]):o,c=2+u.length+2+a.length,h=u.length,g=a.length,l=2,s=2,w=48,v=r.concat([newr([w,c,l,h]),u,newr([s,g]),a]);returnv},f.recoverPubKey=function(r,t,f,i){varu=require("bn.js");if(i>3||0>i)thrownewError("Recovery param is more than two bits");r=newu(r.toBuffer({size:32})),t=newu(t.toBuffer({size:32})),f=newu(f.toBuffer({size:32}));vara=o.curves.secp256k1,c=1&i,h=i>>1,g=a.curve.n,l=a.curve.g,s=h?t.add(g):t,w=a.curve.pointFromX(c,s.toArray()),v=(w.mul(g),r.neg().mod(g)),d=t.invm(g),b=w.mul(f).add(l.mul(v)).mul(d);a.curve.validate(b);varm=newn;returnm.x=e(b.x.toString()),m.y=e(b.y.toString()),m},f.calcPubKeyRecoveryParam=function(r,e,n,t){for(varo=0;4>o;o++){vari=f.recoverPubKey(r,e,n,o);if(i.x.toString()==t.x.toString()&&i.y.toString()==t.y.toString())returno}thrownewError("Unable to find valid recovery factor")},f.genk=function(){varr=newe(t.getRandomBuffer(32));returnr},module.exports=f}).call(this,require("buffer").Buffer);
(function(t){functionn(t){for(varn=0,e=0;e<t.length;e++)n+=Math.pow(256,e)*t[e];returnn}functione(t){for(varn=0,e=0;e<t.length;e++)n+=Math.pow(256,t.length-e-1)*t[e];returnn}functionr(t){varn=e(t);return128==(128&t[0])&&(n-=Math.pow(256,t.length)),n}functiono(t){vare=n(t);return128==(128&t[t.length-1])&&(e-=Math.pow(256,t.length)),e}functioni(t){vari={};return[1,2,4,8].forEach(function(u){vars=8*u;i["word"+s+"le"]=i["word"+s+"lu"]=t(u,n),i["word"+s+"ls"]=t(u,o),i["word"+s+"be"]=i["word"+s+"bu"]=t(u,e),i["word"+s+"bs"]=t(u,r)}),i.word8=i.word8u=i.word8be,i.word8s=i.word8bs,i}varu=require("chainsaw"),s=require("events").EventEmitter,f=require("buffers"),c=require("./lib/vars.js"),l=require("stream").Stream;exports=module.exports=function(n,e){if(t.isBuffer(n))returnexports.parse(n);varr=exports.stream();returnn&&n.pipe?n.pipe(r):n&&(n.on(e||"data",function(t){r.write(t)}),n.on("end",function(){r.end()})),r},exports.stream=function(n){functione(t,n,e){a={bytes:t,skip:e,cb:function(t){a=null,n(t)}},r()}functionr(){if(!a)returnvoid(b&&(w=!0));if("function"==typeofa)a();else{vart=p+a.bytes;if(g.length>=t){varn;null==p?(n=g.splice(0,t),a.skip||(n=n.slice())):(a.skip||(n=g.slice(p,t)),p=t),a.skip?a.cb():a.cb(n)}}}functiono(n){functiono(){w||n.next()}varu=i(function(t,n){returnfunction(r){e(t,function(t){v.set(r,n(t)),o()})}});returnu.tap=function(t){n.nest(t,v.store)},u.into=function(t,e){v.get(t)||v.set(t,{});varr=v;v=c(r.get(t)),n.nest(function(){e.apply(this,arguments),this.tap(function(){v=r})},v.store)},u.flush=function(){v.store={},o()},u.loop=function(t){vare=!1;n.nest(!1,functionr(){this.vars=v.store,t.call(this,function(){e=!0,o()},v.store),this.tap(function(){e?n.next():r.call(this)}.bind(this))},v.store)},u.buffer=function(t,n){"string"==typeofn&&(n=v.get(n)),e(n,function(n){v.set(t,n),o()})},u.skip=function(t){"string"==typeoft&&(t=v.get(t)),e(t,function(){o()})},u.scan=function(n,e){if("string"==typeofe)e=newt(e);elseif(!t.isBuffer(e))thrownewError("search must be a Buffer or a string");vari=0;a=function(){vart=g.indexOf(e,p+i),u=t-p-i;-1!==t?(a=null,null!=p?(v.set(n,g.slice(p,p+i+u)),p+=i+u+e.length):(v.set(n,g.slice(0,i+u)),g.splice(0,i+u+e.length)),o(),r()):u=Math.max(g.length-e.length-p-i,0),i+=u},r()},u.peek=function(t){p=0,n.nest(function(){t.call(this,v.store),this.tap(function(){p=null})})},u}if(n)returnexports.apply(null,arguments);vara=null,p=null,h=u.light(o);h.writable=!0;varg=f();h.write=function(t){g.push(t),r()};varv=c(),w=!1,b=!1;returnh.end=function(){b=!0},h.pipe=l.prototype.pipe,Object.getOwnPropertyNames(s.prototype).forEach(function(t){h[t]=s.prototype[t]}),h},exports.parse=function(n){vare=i(function(t,i){returnfunction(u){if(r+t<=n.length){vars=n.slice(r,r+t);r+=t,o.set(u,i(s))}elseo.set(u,null);returne}}),r=0,o=c();returne.vars=o.store,e.tap=function(t){returnt.call(e,o.store),e},e.into=function(t,n){o.get(t)||o.set(t,{});varr=o;returno=c(r.get(t)),n.call(e,o.store),o=r,e},e.loop=function(t){for(varn=!1,r=function(){n=!0};n===!1;)t.call(e,r,o.store);returne},e.buffer=function(t,i){"string"==typeofi&&(i=o.get(i));varu=n.slice(r,Math.min(n.length,r+i));returnr+=i,o.set(t,u),e},e.skip=function(t){return"string"==typeoft&&(t=o.get(t)),r+=t,e},e.scan=function(i,u){if("string"==typeofu)u=newt(u);elseif(!t.isBuffer(u))thrownewError("search must be a Buffer or a string");o.set(i,null);for(vars=0;s+r<=n.length-u.length+1;s++){for(varf=0;f<u.length&&n[r+s+f]===u[f];f++);if(f===u.length)break}returno.set(i,n.slice(r,r+s)),r+=s+u.length,e},e.peek=function(t){varn=r;returnt.call(e,o.store),r=n,e},e.flush=function(){returno.store={},e},e.eof=function(){returnr>=n.length},e}}).call(this,require("buffer").Buffer);
(function(n){functiont(n){vare=t.saw(n,{}),r=n.call(e.handlers,e);returnvoid0!==r&&(e.handlers=r),e.record(),e.chain()}functione(n){n.step=0,n.pop=function(){returnn.actions[n.step++]},n.trap=function(t,e){varr=Array.isArray(t)?t:[t];n.actions.push({path:r,step:n.step,cb:e,trap:!0})},n.down=function(t){vare=(Array.isArray(t)?t:[t]).join("/"),r=n.actions.slice(n.step).map(function(t){returnt.trap&&t.step<=n.step?!1:t.path.join("/")==e}).indexOf(!0);r>=0?n.step+=r:n.step=n.actions.length;vara=n.actions[n.step-1];a&&a.trap?(n.step=a.step,a.cb()):n.next()},n.jump=function(t){n.step=t,n.next()}}varr=require("traverse"),a=require("events").EventEmitter;module.exports=t,t.light=function(n){vare=t.saw(n,{}),r=n.call(e.handlers,e);returnvoid0!==r&&(e.handlers=r),e.chain()},t.saw=function(s,o){vari=newa;returni.handlers=o,i.actions=[],i.chain=function(){vart=r(i.handlers).map(function(n){if(this.isRoot)returnn;vare=this.path;"function"==typeofn&&this.update(function(){returni.actions.push({path:e,args:[].slice.call(arguments)}),t})});returnn.nextTick(function(){i.emit("begin"),i.next()}),t},i.pop=function(){returni.actions.shift()},i.next=function(){varn=i.pop();if(n){if(!n.trap){vart=i.handlers;n.path.forEach(function(n){t=t[n]}),t.apply(i.handlers,n.args)}}elsei.emit("end")},i.nest=function(n){vare=[].slice.call(arguments,1),r=!0;if("boolean"==typeofn){varr=n;n=e.shift()}vara=t.saw(s,{}),o=s.call(a.handlers,a);void0!==o&&(a.handlers=o),"undefined"!=typeofi.step&&a.record(),n.apply(a.chain(),e),r!==!1&&a.on("end",i.next)},i.record=function(){e(i)},["trap","down","jump"].forEach(function(n){i[n]=function(){thrownewError("To use the trap, down and jump features, please call record() first to start recording actions.")}}),i}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
functionTraverse(e){returnthisinstanceofTraverse?void(this.value=e):newTraverse(e)}functionwalk(e,t,r){varn=[],o=[],a=!0;returnfunctioni(e){varc=r?copy(e):e,s={},f={node:c,node_:e,path:[].concat(n),parent:o.slice(-1)[0],key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(e){f.isRoot||(f.parent.node[f.key]=e),f.node=e},"delete":function(){deletef.parent.node[f.key]},remove:function(){Array.isArray(f.parent.node)?f.parent.node.splice(f.key,1):deletef.parent.node[f.key]},before:function(e){s.before=e},after:function(e){s.after=e},pre:function(e){s.pre=e},post:function(e){s.post=e},stop:function(){a=!1}};if(!a)returnf;if("object"==typeofc&&null!==c){f.isLeaf=0==Object.keys(c).length;for(varu=0;u<o.length;u++)if(o[u].node_===e){f.circular=o[u];break}}elsef.isLeaf=!0;f.notLeaf=!f.isLeaf,f.notRoot=!f.isRoot;varl=t.call(f,f.node);if(void0!==l&&f.update&&f.update(l),s.before&&s.before.call(f,f.node),"object"==typeoff.node&&null!==f.node&&!f.circular){o.push(f);varp=Object.keys(f.node);p.forEach(function(e,t){n.push(e),s.pre&&s.pre.call(f,f.node[e],e);varo=i(f.node[e]);r&&Object.hasOwnProperty.call(f.node,e)&&(f.node[e]=o.node),o.isLast=t==p.length-1,o.isFirst=0==t,s.post&&s.post.call(f,o),n.pop()}),o.pop()}returns.after&&s.after.call(f,f.node),f}(e).node}functioncopy(e){if("object"==typeofe&&null!==e){vart;returnt=Array.isArray(e)?[]:einstanceofDate?newDate(e):einstanceofBoolean?newBoolean(e):einstanceofNumber?newNumber(e):einstanceofString?newString(e):Object.create(Object.getPrototypeOf(e)),Object.keys(e).forEach(function(r){t[r]=e[r]}),t}returne}module.exports=Traverse,Traverse.prototype.get=function(e){for(vart=this.value,r=0;r<e.length;r++){varn=e[r];if(!Object.hasOwnProperty.call(t,n)){t=void0;break}t=t[n]}returnt},Traverse.prototype.set=function(e,t){for(varr=this.value,n=0;n<e.length-1;n++){varo=e[n];Object.hasOwnProperty.call(r,o)||(r[o]={}),r=r[o]}returnr[e[n]]=t,t},Traverse.prototype.map=function(e){returnwalk(this.value,e,!0)},Traverse.prototype.forEach=function(e){returnthis.value=walk(this.value,e,!1),this.value},Traverse.prototype.reduce=function(e,t){varr=1===arguments.length,n=r?this.value:t;returnthis.forEach(function(t){this.isRoot&&r||(n=e.call(this,n,t))}),n},Traverse.prototype.deepEqual=function(e){if(1!==arguments.length)thrownewError("deepEqual requires exactly one object to compare against");vart=!0,r=e;returnthis.forEach(function(n){varo=function(){returnvoid(t=!1)}.bind(this);if(!this.isRoot){if("object"!=typeofr)returno();r=r[this.key]}vara=r;this.post(function(){r=a});vari=function(e){returnObject.prototype.toString.call(e)};if(this.circular)Traverse(e).get(this.circular.path)!==a&&o();elseif(typeofa!=typeofn)o();elseif(null===a||null===n||void0===a||void0===n)a!==n&&o();elseif(a.__proto__!==n.__proto__)o();elseif(a===n);elseif("function"==typeofa)ainstanceofRegExp?a.toString()!=n.toString()&&o():a!==n&&o();elseif("object"==typeofa)if("[object Arguments]"===i(n)||"[object Arguments]"===i(a))i(a)!==i(n)&&o();elseif(ainstanceofDate||ninstanceofDate)ainstanceofDate&&ninstanceofDate&&a.getTime()===n.getTime()||o();else{varc=Object.keys(a),s=Object.keys(n);if(c.length!==s.length)returno();for(varf=0;f<c.length;f++){varu=c[f];Object.hasOwnProperty.call(n,u)||o()}}}),t},Traverse.prototype.paths=function(){vare=[];returnthis.forEach(function(){e.push(this.path)}),e},Traverse.prototype.nodes=function(){vare=[];returnthis.forEach(function(){e.push(this.node)}),e},Traverse.prototype.clone=function(){vare=[],t=[];returnfunctionr(n){for(varo=0;o<e.length;o++)if(e[o]===n)returnt[o];if("object"==typeofn&&null!==n){vara=copy(n);returne.push(n),t.push(a),Object.keys(n).forEach(function(e){a[e]=r(n[e])}),e.pop(),t.pop(),a}returnn}(this.value)},Object.keys(Traverse.prototype).forEach(function(e){Traverse[e]=function(t){varr=[].slice.call(arguments,1),n=Traverse(t);returnn[e].apply(n,r)}});
(function(e,r){functiono(e){"string"==typeofe?e={bindings:e}:e||(e={}),e.__proto__=d,e.module_root||(e.module_root=exports.getRoot(exports.getFileName())),".node"!=i.extname(e.bindings)&&(e.bindings+=".node");for(varr,o,n,s=[],a=0,l=e.try.length;l>a;a++){r=t.apply(null,e.try[a].map(function(r){returne[r]||r})),s.push(r);try{returno=e.path?require.resolve(r):require(r),e.path||(o.path=r),o}catch(u){if(!/not find/i.test(u.message))throwu}}thrown=newError("Could not locate the bindings file. Tried:\n"+s.map(function(r){returne.arrow+r}).join("\n")),n.tries=s,n}varn=require("fs"),i=require("path"),t=i.join,s=i.dirname,a=n.existsSync||i.existsSync,d={arrow:e.env.NODE_BINDINGS_ARROW||" → ",compiled:e.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:e.platform,arch:e.arch,version:e.versions.node,bindings:"bindings.node","try":[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"]]};module.exports=exports=o,exports.getFileName=function(){vare,o=Error.prepareStackTrace,n=Error.stackTraceLimit,i={};returnError.stackTraceLimit=10,Error.prepareStackTrace=function(o,n){for(vari=0,t=n.length;t>i;i++)if(e=n[i].getFileName(),e!==r)return},Error.captureStackTrace(i),i.stack,Error.prepareStackTrace=o,Error.stackTraceLimit=n,e},exports.getRoot=function(r){for(varo,n=s(r);;){if("."===n&&(n=e.cwd()),a(t(n,"package.json"))||a(t(n,"node_modules")))returnn;if(o===n)thrownewError('Could not find module root given file: "'+r+'". Do you have a `package.json` file? ');o=n,n=t(n,"..")}}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/bindings/bindings.js");
(function(t){"use strict";functionr(){this.writable=!0,this.buffer=null}vare=require("events"),n=require("util"),i={};module.exports.Buffer=t;varo=function(r){returnrinstanceoft||rinstanceofUint8Array},f=function(t){returnfunction(){varr=this;if(o(r));else{if(!o(arguments[0]))thrownewError("Argument should be a buffer object.");r=arguments[0],Array.prototype.shift.apply(arguments)}returnt.apply(r,arguments)}},u=function(t){returnfunction(){varr=this;if(o(r));else{if(!o(arguments[0]))throwError("Argument should be a buffer object.");r=arguments[0],Array.prototype.shift.apply(arguments)}vare=arguments[0];if("string"==typeofe||einstanceofString||o(e))returnt.apply(r,arguments);thrownewError("Second argument must be a string or a buffer.")}};i.clear=f(function(){for(vart=0;t<this.length;t++)this[t]=0;returnthis}),i.fill=f(function(t){for(varr="undefined"==typeoft.length?1:t.length,e=0;e<this.length;e+=r)for(varn=0;r>n;n++)this[e+n]="undefined"==typeoft.length?t:"string"==typeoft[n]?t[n].charCodeAt(0):t[n];returnthis}),i.indexOf=f(function(t,r){if(r=r||0,0===t.length)return-1;for(vare=r;e<this.length-t.length+1;e+=1){for(varn=!0,i=0;i<t.length;i++){varo=this[e+i],f=t[i];if("string"==typeoff&&(f=f.charCodeAt(0)),o!==f){n=!1;break}}if(n)returne}return-1}),i.equals=u(function(t){return0===i.compare(this,t)}),i.compare=u(function(t){varr=this,e=r.length,n=t.length;if(e!==n)returne>n?1:-1;for(vari=0;e>i;i++){varo=r[i],f=t[i];if("string"==typeoff&&(f=f.charCodeAt(0)),o!==f)returno>f?1:-1}return0}),i.concat=function(){for(varr=0,e=0;e<arguments.length;e++){if(void0===arguments[e].length)throwError("all arguments must be strings or Buffers");r+=arguments[e].length}for(varn=newt(r),i=0,e=0;e<arguments.length;e++)for(varo=0;o<arguments[e].length;o++)n[i++]="string"==typeofarguments[e][o]?arguments[e][o].charCodeAt(0):arguments[e][o];returnn},i.reverse=f(function(){for(varr=newt(this.length),e=0;e<this.length;e++)r[e]=this[this.length-e-1];returnr}),i.toHex=f(function(){for(vart="",r=0;r<this.length;r++){vare=this[r].toString(16);1==e.length&&(e="0"+e),e.length>2&&(e=e.substring(1,3)),t+=e}returnt}),i.fromHex=f(function(){varr=this.length;if(r%2!==0)thrownewError("Invalid hex string length");for(vare=newt(r/2),n=0;n<e.length;n++){vari=String.fromCharCode(this[2*n]),o=String.fromCharCode(this[2*n+1]);e[n]=parseInt(i+o,16)}returne}),exports.extend=function(){varr;r=arguments.length>0?Array.prototype.slice.call(arguments):"function"==typeofUint8Array?[t.prototype,Uint8Array.prototype]:[t.prototype];for(vare=0,n=r.length;n>e;e+=1){varo=r[e];for(varfini)o[f]=i[f];o!==exports&&(o.concat=function(){vart=[this].concat(Array.prototype.slice.call(arguments));returni.concat.apply(i,t)})}},exports.extend(exports),n.inherits(r,e.EventEmitter),r.prototype._append=function(r,e){if(!this.writable)thrownewError("Stream is not writable.");if(t.isBuffer(r));else{if("string"!=typeofr)thrownewError("Argument should be either a buffer or a string.");r=newt(r,e||"utf8")}this.buffer?this.buffer=i.concat(this.buffer,r):(this.buffer=newt(r.length),r.copy(this.buffer))},r.prototype.write=function(t,r){returnthis._append(t,r),!0},r.prototype.end=function(t,r){t&&this._append(t,r),this.emit("close"),this.writable=!1},r.prototype.getBuffer=function(){returnthis.buffer?this.buffer:newt(0)},r.prototype.toString=function(){returnthis.getBuffer().toString()},exports.WritableBufferStream=r}).call(this,require("buffer").Buffer);
functionBuffer(e,t,r){if(!(thisinstanceofBuffer))returnnewBuffer(e,t,r);varn=typeofe;if("base64"===t&&"string"===n)for(e=stringtrim(e);e.length%4!==0;)e+="=";vari;if("number"===n)i=coerce(e);elseif("string"===n)i=Buffer.byteLength(e,t);else{if("object"!==n)thrownewError("First argument needs to be a number, array or string.");i=coerce(e.length)}vars;Buffer._useTypedArrays?s=Buffer._augment(newUint8Array(i)):(s=this,s.length=i,s._isBuffer=!0);vara;if(Buffer._useTypedArrays&&"number"==typeofe.byteLength)s._set(e);elseif(isArrayish(e))for(a=0;i>a;a++)s[a]=Buffer.isBuffer(e)?e.readUInt8(a):e[a];elseif("string"===n)s.write(e,0,t);elseif("number"===n&&!Buffer._useTypedArrays&&!r)for(a=0;i>a;a++)s[a]=0;returns}function_hexWrite(e,t,r,n){r=Number(r)||0;vari=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;vars=t.length;assert(s%2===0,"Invalid hex string"),n>s/2&&(n=s/2);for(vara=0;n>a;a++){varo=parseInt(t.substr(2*a,2),16);assert(!isNaN(o),"Invalid hex string"),e[r+a]=o}returnBuffer._charsWritten=2*a,a}function_utf8Write(e,t,r,n){vari=Buffer._charsWritten=blitBuffer(utf8ToBytes(t),e,r,n);returni}function_asciiWrite(e,t,r,n){vari=Buffer._charsWritten=blitBuffer(asciiToBytes(t),e,r,n);returni}function_binaryWrite(e,t,r,n){return_asciiWrite(e,t,r,n)}function_base64Write(e,t,r,n){vari=Buffer._charsWritten=blitBuffer(base64ToBytes(t),e,r,n);returni}function_utf16leWrite(e,t,r,n){vari=Buffer._charsWritten=blitBuffer(utf16leToBytes(t),e,r,n);returni}function_base64Slice(e,t,r){returnbase64.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function_utf8Slice(e,t,r){varn="",i="";r=Math.min(e.length,r);for(vars=t;r>s;s++)e[s]<=127?(n+=decodeUtf8Char(i)+String.fromCharCode(e[s]),i=""):i+="%"+e[s].toString(16);returnn+decodeUtf8Char(i)}function_asciiSlice(e,t,r){varn="";r=Math.min(e.length,r);for(vari=t;r>i;i++)n+=String.fromCharCode(e[i]);returnn}function_binarySlice(e,t,r){return_asciiSlice(e,t,r)}function_hexSlice(e,t,r){varn=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(vari="",s=t;r>s;s++)i+=toHex(e[s]);returni}function_utf16leSlice(e,t,r){for(varn=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);returni}function_readUInt16(e,t,r,n){n||(assert("boolean"==typeofr,"missing or invalid endian"),assert(void0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));vari=e.length;if(!(t>=i)){vars;returnr?(s=e[t],i>t+1&&(s|=e[t+1]<<8)):(s=e[t]<<8,i>t+1&&(s|=e[t+1])),s}}function_readUInt32(e,t,r,n){n||(assert("boolean"==typeofr,"missing or invalid endian"),assert(void0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));vari=e.length;if(!(t>=i)){vars;returnr?(i>t+2&&(s=e[t+2]<<16),i>t+1&&(s|=e[t+1]<<8),s|=e[t],i>t+3&&(s+=e[t+3]<<24>>>0)):(i>t+1&&(s=e[t+1]<<16),i>t+2&&(s|=e[t+2]<<8),i>t+3&&(s|=e[t+3]),s+=e[t]<<24>>>0),s}}function_readInt16(e,t,r,n){n||(assert("boolean"==typeofr,"missing or invalid endian"),assert(void0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));vari=e.length;if(!(t>=i)){vars=_readUInt16(e,t,r,!0),a=32768&s;returna?-1*(65535-s+1):s}}function_readInt32(e,t,r,n){n||(assert("boolean"==typeofr,"missing or invalid endian"),assert(void0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));vari=e.length;if(!(t>=i)){vars=_readUInt32(e,t,r,!0),a=2147483648&s;returna?-1*(4294967295-s+1):s}}function_readFloat(e,t,r,n){returnn||(assert("boolean"==typeofr,"missing or invalid endian"),assert(t+3<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,23,4)}function_readDouble(e,t,r,n){returnn||(assert("boolean"==typeofr,"missing or invalid endian"),assert(t+7<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,52,8)}function_writeUInt16(e,t,r,n,i){i||(assert(void0!==t&&null!==t,"missing value"),assert("boolean"==typeofn,"missing or invalid endian"),assert(void0!==r&&null!==r,"missing offset"),assert(r+1<e.length,"tryingtowritebeyondb
varlookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";functionr(t){varr=t.charCodeAt(0);returnr===h?62:r===c?63:o>r?-1:o+10>r?r-o+26+26:i+26>r?r-i:A+26>r?r-A+26:void0}functione(t){functione(t){i[f++]=t}varn,h,c,o,A,i;if(t.length%4>0)thrownewError("Invalid string. Length must be a multiple of 4");varu=t.length;A="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,i=newa(3*t.length/4-A),c=A>0?t.length-4:t.length;varf=0;for(n=0,h=0;c>n;n+=4,h+=3)o=r(t.charAt(n))<<18|r(t.charAt(n+1))<<12|r(t.charAt(n+2))<<6|r(t.charAt(n+3)),e((16711680&o)>>16),e((65280&o)>>8),e(255&o);return2===A?(o=r(t.charAt(n))<<2|r(t.charAt(n+1))>>4,e(255&o)):1===A&&(o=r(t.charAt(n))<<10|r(t.charAt(n+1))<<4|r(t.charAt(n+2))>>2,e(o>>8&255),e(255&o)),i}functionn(t){functionr(t){returnlookup.charAt(t)}functione(t){returnr(t>>18&63)+r(t>>12&63)+r(t>>6&63)+r(63&t)}varn,a,h,c=t.length%3,o="";for(n=0,h=t.length-c;h>n;n+=3)a=(t[n]<<16)+(t[n+1]<<8)+t[n+2],o+=e(a);switch(c){case1:a=t[t.length-1],o+=r(a>>2),o+=r(a<<4&63),o+="==";break;case2:a=(t[t.length-2]<<8)+t[t.length-1],o+=r(a>>10),o+=r(a>>4&63),o+=r(a<<2&63),o+="="}returno}vara="undefined"!=typeofUint8Array?Uint8Array:Array,h="+".charCodeAt(0),c="/".charCodeAt(0),o="0".charCodeAt(0),A="a".charCodeAt(0),i="A".charCodeAt(0);t.toByteArray=e,t.fromByteArray=n}("undefined"==typeofexports?this.base64js={}:exports);
functionEventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void0}functionisFunction(e){return"function"==typeofe}functionisNumber(e){return"number"==typeofe}functionisObject(e){return"object"==typeofe&&null!==e}functionisUndefined(e){returnvoid0===e}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void0,EventEmitter.prototype._maxListeners=void0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||0>e||isNaN(e))throwTypeError("n must be a positive number");returnthis._maxListeners=e,this},EventEmitter.prototype.emit=function(e){vart,n,s,i,r,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length))throwt=arguments[1],tinstanceofError?t:TypeError('Uncaught, unspecified "error" event.');if(n=this._events[e],isUndefined(n))return!1;if(isFunction(n))switch(arguments.length){case1:n.call(this);break;case2:n.call(this,arguments[1]);break;case3:n.call(this,arguments[1],arguments[2]);break;default:for(s=arguments.length,i=newArray(s-1),r=1;s>r;r++)i[r-1]=arguments[r];n.apply(this,i)}elseif(isObject(n)){for(s=arguments.length,i=newArray(s-1),r=1;s>r;r++)i[r-1]=arguments[r];for(o=n.slice(),s=o.length,r=0;s>r;r++)o[r].apply(this,i)}return!0},EventEmitter.prototype.addListener=function(e,t){varn;if(!isFunction(t))throwTypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,isFunction(t.listener)?t.listener:t),this._events[e]?isObject(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,isObject(this._events[e])&&!this._events[e].warned){varn;n=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeofconsole.trace&&console.trace())}returnthis},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){functionn(){this.removeListener(e,n),s||(s=!0,t.apply(this,arguments))}if(!isFunction(t))throwTypeError("listener must be a function");vars=!1;returnn.listener=t,this.on(e,n),this},EventEmitter.prototype.removeListener=function(e,t){varn,s,i,r;if(!isFunction(t))throwTypeError("listener must be a function");if(!this._events||!this._events[e])returnthis;if(n=this._events[e],i=n.length,s=-1,n===t||isFunction(n.listener)&&n.listener===t)deletethis._events[e],this._events.removeListener&&this.emit("removeListener",e,t);elseif(isObject(n)){for(r=i;r-->0;)if(n[r]===t||n[r].listener&&n[r].listener===t){s=r;break}if(0>s)returnthis;1===n.length?(n.length=0,deletethis._events[e]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}returnthis},EventEmitter.prototype.removeAllListeners=function(e){vart,n;if(!this._events)returnthis;if(!this._events.removeListener)return0===arguments.length?this._events={}:this._events[e]&&deletethis._events[e],this;if(0===arguments.length){for(tinthis._events)"removeListener"!==t&&this.removeAllListeners(t);returnthis.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],isFunction(n))this.removeListener(e,n);elsefor(;n.length;)this.removeListener(e,n[n.length-1]);returndeletethis._events[e],this},EventEmitter.prototype.listeners=function(e){vart;returnt=this._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.listenerCount=function(e,t){varn;returnn=e._events&&e._events[t]?isFunction(e._events[t])?1:e._events[t].length:0};
varhttp=module.exports,EventEmitter=require("events").EventEmitter,Request=require("./lib/request"),url=require("url");http.request=function(e,t){"string"==typeofe&&(e=url.parse(e)),e||(e={}),e.host||e.port||(e.port=parseInt(window.location.port,10)),!e.host&&e.hostname&&(e.host=e.hostname),e.scheme||(e.scheme=window.location.protocol.split(":")[0]),e.host||(e.host=window.location.hostname||window.location.host),/:/.test(e.host)&&(e.port||(e.port=e.host.split(":")[1]),e.host=e.host.split(":")[0]),e.port||(e.port="https"==e.scheme?443:80);varo=newRequest(newxhrHttp,e);returnt&&o.on("response",t),o},http.get=function(e,t){e.method="GET";varo=http.request(e,t);returno.end(),o},http.Agent=function(){},http.Agent.defaultMaxSockets=4;varxhrHttp=function(){if("undefined"==typeofwindow)thrownewError("no window object present");if(window.XMLHttpRequest)returnwindow.XMLHttpRequest;if(window.ActiveXObject){for(vare=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{varo=newwindow.ActiveXObject(e[t]);returnfunction(){if(o){varr=o;returno=null,r}returnnewwindow.ActiveXObject(e[t])}}catch(r){}thrownewError("ajax not supported in this browser")}thrownewError("ajax not supported in this browser")}();http.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};
!function(){functiont(t){this.message=t}vare="undefined"!=typeofexports?exports:this,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=newError,t.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(varo,n,a=0,i=r,c="";e.charAt(0|a)||(i="=",a%1);c+=i.charAt(63&o>>8-a%1*8)){if(n=e.charCodeAt(a+=.75),n>255)thrownewt("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}returnc}),e.atob||(e.atob=function(e){if(e=e.replace(/=+$/,""),e.length%4==1)thrownewt("'atob' failed: The string to be decoded is not correctly encoded.");for(varo,n,a=0,i=0,c="";n=e.charAt(i++);~n&&(o=a%4?64*o+n:n,a++%4)?c+=String.fromCharCode(255&o>>(-2*a&6)):0)n=r.indexOf(n);returnc})}();
functionnoop(){}varprocess=module.exports={};process.nextTick=function(){varo="undefined"!=typeofwindow&&window.setImmediate,e="undefined"!=typeofwindow&&window.postMessage&&window.addEventListener;if(o)returnfunction(o){returnwindow.setImmediate(o)};if(e){varn=[];returnwindow.addEventListener("message",function(o){vare=o.source;if((e===window||null===e)&&"process-tick"===o.data&&(o.stopPropagation(),n.length>0)){vars=n.shift();s()}},!0),function(o){n.push(o),window.postMessage("process-tick","*")}}returnfunction(o){setTimeout(o,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.on=noop,process.once=noop,process.off=noop,process.emit=noop,process.binding=function(){thrownewError("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){thrownewError("process.chdir is not supported")};
(function(r){functiont(r,t){for(vare=0,n=r.length-1;n>=0;n--){vars=r[n];"."===s?r.splice(n,1):".."===s?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");returnr}functione(r,t){if(r.filter)returnr.filter(t);for(vare=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);returne}varn=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(r){returnn.exec(r).slice(1)};exports.resolve=function(){for(varn="",s=!1,o=arguments.length-1;o>=-1&&!s;o--){vari=o>=0?arguments[o]:r.cwd();if("string"!=typeofi)thrownewTypeError("Arguments to path.resolve must be strings");i&&(n=i+"/"+n,s="/"===i.charAt(0))}returnn=t(e(n.split("/"),function(r){return!!r}),!s).join("/"),(s?"/":"")+n||"."},exports.normalize=function(r){varn=exports.isAbsolute(r),s="/"===o(r,-1);returnr=t(e(r.split("/"),function(r){return!!r}),!n).join("/"),r||n||(r="."),r&&s&&(r+="/"),(n?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){varr=Array.prototype.slice.call(arguments,0);returnexports.normalize(e(r,function(r){if("string"!=typeofr)thrownewTypeError("Arguments to path.join must be strings");returnr}).join("/"))},exports.relative=function(r,t){functione(r){for(vart=0;t<r.length&&""===r[t];t++);for(vare=r.length-1;e>=0&&""===r[e];e--);returnt>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(varn=e(r.split("/")),s=e(t.split("/")),o=Math.min(n.length,s.length),i=o,u=0;o>u;u++)if(n[u]!==s[u]){i=u;break}for(varl=[],u=i;u<n.length;u++)l.push("..");returnl=l.concat(s.slice(i)),l.join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){vart=s(r),e=t[0],n=t[1];returne||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},exports.basename=function(r,t){vare=s(r)[2];returnt&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},exports.extname=function(r){returns(r)[3]};varo="b"==="ab".substr(-1)?function(r,t,e){returnr.substr(t,e)}:function(r,t,e){return0>t&&(t=r.length+t),r.substr(t,e)}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
varprocess=module.exports={};process.nextTick=function(){vare="undefined"!=typeofwindow&&window.setImmediate,n="undefined"!=typeofwindow&&window.postMessage&&window.addEventListener;if(e)returnfunction(e){returnwindow.setImmediate(e)};if(n){varo=[];returnwindow.addEventListener("message",function(e){varn=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),o.length>0)){varr=o.shift();r()}},!0),function(e){o.push(e),window.postMessage("process-tick","*")}}returnfunction(e){setTimeout(e,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.binding=function(){thrownewError("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){thrownewError("process.chdir is not supported")};
(function(e){functiont(e){e=e||{};vart=e.highWaterMark;this.highWaterMark=t||0===t?t:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(_||(_=require("string_decoder").StringDecoder),this.decoder=new_(e.encoding),this.encoding=e.encoding)}functionn(e){returnthisinstanceofn?(this._readableState=newt(e,this),this.readable=!0,voidS.call(this)):newn(e)}functionr(e,t,n,r,a){varo=d(t,n);if(o)e.emit("error",o);elseif(null===n||void0===n)t.reading=!1,t.ended||s(e,t);elseif(t.objectMode||n&&n.length>0)if(t.ended&&!a){varu=newError("stream.push() after EOF");e.emit("error",u)}elseif(t.endEmitted&&a){varu=newError("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||a||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,a?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),h(e,t);elsea||(t.reading=!1);returni(t)}functioni(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}functiona(e){if(e>=L)e=L;else{e--;for(vart=1;32>t;t<<=1)e|=e>>t;e++}returne}functiono(e,t){return0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||null===e?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}functiond(e,t){varn=null;returnR.isBuffer(t)||"string"==typeoft||null===t||void0===t||e.objectMode||n||(n=newTypeError("Invalid non-string/buffer chunk")),n}functions(e,t){if(t.decoder&&!t.ended){varn=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):v(e)}functionl(e){vart=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?E(function(){u(e)}):u(e))}functionu(e){e.emit("readable")}functionh(e,t){t.readingMore||(t.readingMore=!0,E(function(){f(e,t)}))}functionf(e,t){for(varn=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}functionp(e){returnfunction(){vart=e._readableState;t.awaitDrain--,0===t.awaitDrain&&c(e)}}functionc(e){functiont(e){vart=e.write(n);!1===t&&r.awaitDrain++}varn,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):w(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return0===r.pipesCount?(r.flowing=!1,void(M.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}functiong(){this._readableState.ranOut&&(this._readableState.ranOut=!1,c(this))}functionb(e,t){varn=e._readableState;if(n.flowing)thrownewError("Cannot switch to old mode now.");varr=t||!1,i=!1;e.readable=!0,e.pipe=S.prototype.pipe,e.on=e.addListener=S.prototype.on,e.on("readable",function(){i=!0;for(vart;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?E(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}functionm(e,t){varn,r=t.buffer,i=t.length,a=!!t.decoder,o=!!t.objectMode;if(0===r.length)returnnull;if(0===i)n=null;elseif(o)n=r.shift();elseif(!e||e>=i)n=a?r.join(""):R.concat(r,i),r.length=0;elseif(e<r[0].length){vard=r[0];n=d.slice(0,e),r[0]=d.slice(e)}elseif(e===r[0].length)n=r.shift();else{n=a?"":newR(e);for(vars=0,l=0,u=r.length;u>l&&e>s;l++){vard=r[0],h=Math.min(e-s,d.length);a?n+=d.slice(0,h):d.copy(n,s,0,h),h<d.length?r[0]=d.slice(h):r.shift(),s+=h}}returnn}functionv(e){vart=e._readableState;if(t.length>0)thrownewError("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,E(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.r
functionTransformState(r,t){this.afterTransform=function(r,n){returnafterTransform(t,r,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}functionafterTransform(r,t,n){vare=r._transformState;e.transforming=!1;vara=e.writecb;if(!a)returnr.emit("error",newError("no writecb in Transform class"));e.writechunk=null,e.writecb=null,null!==n&&void0!==n&&r.push(n),a&&a(t);vari=r._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&r._read(i.highWaterMark)}functionTransform(r){if(!(thisinstanceofTransform))returnnewTransform(r);Duplex.call(this,r);vart=(this._transformState=newTransformState(r,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeofthis._flush?this._flush(function(r){done(t,r)}):done(t)})}functiondone(r,t){if(t)returnr.emit("error",t);varn=r._writableState,e=(r._readableState,r._transformState);if(n.length)thrownewError("calling transform done when ws.length != 0");if(e.transforming)thrownewError("calling transform done when still transforming");returnr.push(null)}module.exports=Transform;varDuplex=require("./duplex.js"),inherits=require("inherits");inherits(Transform,Duplex),Transform.prototype.push=function(r,t){returnthis._transformState.needTransform=!1,Duplex.prototype.push.call(this,r,t)},Transform.prototype._transform=function(){thrownewError("not implemented")},Transform.prototype._write=function(r,t,n){vare=this._transformState;if(e.writecb=n,e.writechunk=r,e.writeencoding=t,!e.transforming){vara=this._readableState;(e.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(){varr=this._transformState;r.writechunk&&r.writecb&&!r.transforming?(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform)):r.needTransform=!0};
functionWriteReq(e,t,r){this.chunk=e,this.encoding=t,this.callback=r}functionWritableState(e,t){e=e||{};varr=e.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;vari=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){onwrite(t,e)},this.writecb=null,this.writelen=0,this.buffer=[]}functionWritable(e){returnthisinstanceofWritable||thisinstanceofStream.Duplex?(this._writableState=newWritableState(e,this),this.writable=!0,voidStream.call(this)):newWritable(e)}functionwriteAfterEnd(e,t,r){vari=newError("write after end");e.emit("error",i),setImmediate(function(){r(i)})}functionvalidChunk(e,t,r,i){varn=!0;if(!Buffer.isBuffer(r)&&"string"!=typeofr&&null!==r&&void0!==r&&!t.objectMode){varf=newTypeError("Invalid non-string/buffer chunk");e.emit("error",f),setImmediate(function(){i(f)}),n=!1}returnn}functiondecodeChunk(e,t,r){returne.objectMode||e.decodeStrings===!1||"string"!=typeoft||(t=newBuffer(t,r)),t}functionwriteOrBuffer(e,t,r,i,n){r=decodeChunk(t,r,i);varf=t.objectMode?1:r.length;t.length+=f;varo=t.length<t.highWaterMark;returnt.needDrain=!o,t.writing?t.buffer.push(newWriteReq(r,i,n)):doWrite(e,t,f,r,i,n),o}functiondoWrite(e,t,r,i,n,f){t.writelen=r,t.writecb=f,t.writing=!0,t.sync=!0,e._write(i,n,t.onwrite),t.sync=!1}functiononwriteError(e,t,r,i,n){r?setImmediate(function(){n(i)}):n(i),e.emit("error",i)}functiononwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}functiononwrite(e,t){varr=e._writableState,i=r.sync,n=r.writecb;if(onwriteStateUpdate(r),t)onwriteError(e,r,i,t,n);else{varf=needFinish(e,r);f||r.bufferProcessing||!r.buffer.length||clearBuffer(e,r),i?setImmediate(function(){afterWrite(e,r,f,n)}):afterWrite(e,r,f,n)}}functionafterWrite(e,t,r,i){r||onwriteDrain(e,t),i(),r&&finishMaybe(e,t)}functiononwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}functionclearBuffer(e,t){t.bufferProcessing=!0;for(varr=0;r<t.buffer.length;r++){vari=t.buffer[r],n=i.chunk,f=i.encoding,o=i.callback,a=t.objectMode?1:n.length;if(doWrite(e,t,a,n,f,o),t.writing){r++;break}}t.bufferProcessing=!1,r<t.buffer.length?t.buffer=t.buffer.slice(r):t.buffer.length=0}functionneedFinish(e,t){returnt.ending&&0===t.length&&!t.finished&&!t.writing}functionfinishMaybe(e,t){varr=needFinish(e,t);returnr&&(t.finished=!0,e.emit("finish")),r}functionendWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?setImmediate(r):e.once("finish",r)),t.ended=!0}module.exports=Writable,Writable.WritableState=WritableState;varisUint8Array="undefined"!=typeofUint8Array?function(e){returneinstanceofUint8Array}:function(e){returne&&e.constructor&&"Uint8Array"===e.constructor.name},isArrayBuffer="undefined"!=typeofArrayBuffer?function(e){returneinstanceofArrayBuffer}:function(e){returne&&e.constructor&&"ArrayBuffer"===e.constructor.name},inherits=require("inherits"),Stream=require("./index.js"),setImmediate=require("process/browser.js").nextTick,Buffer=require("buffer").Buffer;inherits(Writable,Stream),Writable.prototype.pipe=function(){this.emit("error",newError("Cannot pipe. Not readable."))},Writable.prototype.write=function(e,t,r){vari=this._writableState,n=!1;return"function"==typeoft&&(r=t,t=null),!Buffer.isBuffer(e)&&isUint8Array(e)&&(e=newBuffer(e)),isArrayBuffer(e)&&"undefined"!=typeofUint8Array&&(e=newBuffer(newUint8Array(e))),Buffer.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeofr&&(r=function(){}),i.ended?writeAfterEnd(this,i,r):validChunk(this,i,e,r)&&(n=writeOrBuffer(this,i,e,t,r)),n},Writable.prototype._write=function(e,t,r){r(newError("not implemented"))},Writable.prototype.end=function(e,t,r){vari=this._writableState;"function"==typeofe?(r=e,e=null,t=null):"function"==typeoft&&(r=t,t=null),"undefined"!=typeofe&&null!==e&&this.write(e,t),i.endin
!function(){"use strict";functiont(t,h,a){if(t&&"object"==typeoft&&t.href)returnt;if("string"!=typeoft)thrownewTypeError("Parameter 'url' must be a string, not "+typeoft);varn={},p=t;p=p.trim();vari=r.exec(p);if(i){i=i[0];varq=i.toLowerCase();n.protocol=q,p=p.substr(i.length)}if(a||i||p.match(/^\/\/[^@\/]+@[^@\/]+/)){varj="//"===p.substr(0,2);!j||i&&g[i]||(p=p.substr(2),n.slashes=!0)}if(!g[i]&&(j||i&&!y[i])){varx=p.indexOf("@");if(-1!==x){for(varA=p.slice(0,x),O=!0,z=0,C=m.length;C>z;z++)if(-1!==A.indexOf(m[z])){O=!1;break}O&&(n.auth=decodeURIComponent(A),p=p.substr(x+1))}for(varZ=-1,z=0,C=f.length;C>z;z++){vark=p.indexOf(f[z]);-1!==k&&(0>Z||Z>k)&&(Z=k)}-1!==Z?(n.host=p.substr(0,Z),p=p.substr(Z)):(n.host=p,p="");for(varw=s(n.host),I=Object.keys(w),z=0,C=I.length;C>z;z++){varR=I[z];n[R]=w[R]}n.hostname=n.hostname||"";varU="["===n.hostname[0]&&"]"===n.hostname[n.hostname.length-1];if(n.hostname.length>l)n.hostname="";elseif(!U)for(var$=n.hostname.split(/\./),z=0,C=$.length;C>z;z++){var_=$[z];if(_&&!_.match(u)){for(varL="",E=0,P=_.length;P>E;E++)L+=_.charCodeAt(E)>127?"x":_[E];if(!L.match(u)){varT=$.slice(0,z),B=$.slice(z+1),D=_.match(v);D&&(T.push(D[1]),B.unshift(D[2])),B.length&&(p="/"+B.join(".")+p),n.hostname=T.join(".");break}}}if(n.hostname=n.hostname.toLowerCase(),!U){for(varF=n.hostname.split("."),G=[],z=0;z<F.length;++z){varH=F[z];G.push(H.match(/[^A-Za-z0-9_-]/)?"xn--"+o.encode(H):H)}n.hostname=G.join(".")}n.host=(n.hostname||"")+(n.port?":"+n.port:""),n.href+=n.host,U&&(n.hostname=n.hostname.substr(1,n.hostname.length-2),"/"!==p[0]&&(p="/"+p))}if(!d[q])for(varz=0,C=c.length;C>z;z++){varJ=c[z],K=encodeURIComponent(J);K===J&&(K=escape(J)),p=p.split(J).join(K)}varM=p.indexOf("#");-1!==M&&(n.hash=p.substr(M),p=p.slice(0,M));varN=p.indexOf("?");return-1!==N?(n.search=p.substr(N),n.query=p.substr(N+1),h&&(n.query=b.parse(n.query)),p=p.slice(0,N)):h&&(n.search="",n.query={}),p&&(n.pathname=p),y[i]&&n.hostname&&!n.pathname&&(n.pathname="/"),(n.pathname||n.search)&&(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=e(n),n}functione(e){"string"==typeofe&&(e=t(e));varh=e.auth||"";h&&(h=encodeURIComponent(h),h=h.replace(/%3A/i,":"),h+="@");vara=e.protocol||"",s=e.pathname||"",o=e.hash||"",r=!1,n="";void0!==e.host?r=h+e.host:void0!==e.hostname&&(r=h+(-1===e.hostname.indexOf(":")?e.hostname:"["+e.hostname+"]"),e.port&&(r+=":"+e.port)),e.query&&"object"==typeofe.query&&Object.keys(e.query).length&&(n=b.stringify(e.query));varp=e.search||n&&"?"+n||"";returna&&":"!==a.substr(-1)&&(a+=":"),e.slashes||(!a||y[a])&&r!==!1?(r="//"+(r||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):r||(r=""),o&&"#"!==o.charAt(0)&&(o="#"+o),p&&"?"!==p.charAt(0)&&(p="?"+p),a+r+s+p+o}functionh(t,h){returne(a(t,h))}functiona(h,a){if(!h)returna;if(h=t(e(h),!1,!0),a=t(e(a),!1,!0),h.hash=a.hash,""===a.href)returnh.href=e(h),h;if(a.slashes&&!a.protocol)returna.protocol=h.protocol,y[a.protocol]&&a.hostname&&!a.pathname&&(a.path=a.pathname="/"),a.href=e(a),a;if(a.protocol&&a.protocol!==h.protocol){if(!y[a.protocol])returna.href=e(a),a;if(h.protocol=a.protocol,!a.host&&!g[a.protocol]){for(vars=(a.pathname||"").split("/");s.length&&!(a.host=s.shift()););a.host||(a.host=""),a.hostname||(a.hostname=""),""!==s[0]&&s.unshift(""),s.length<2&&s.unshift(""),a.pathname=s.join("/")}returnh.pathname=a.pathname,h.search=a.search,h.query=a.query,h.host=a.host||"",h.auth=a.auth,h.hostname=a.hostname||a.host,h.port=a.port,(void0!==h.pathname||void0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.slashes=h.slashes||a.slashes,h.href=e(h),h}varo=h.pathname&&"/"===h.pathname.charAt(0),r=void0!==a.host||a.pathname&&"/"===a.pathname.charAt(0),n=r||o||h.host&&a.pathname,p=n,i=h.pathname&&h.pathname.split("/")||[],s=a.pathname&&a.pathname.split("/")||[],c=h.protocol&&!y[h.protocol];if(c&&(deleteh.hostname,deleteh.port,h.host&&(""===i[0]?i[0]=h.host:i.unshift(h.host)),deleteh.host,a.protocol&&(deletea.hostname,deletea.port,a.host&&(""===s[0]?s[0]=a.host:s.unshift(a.host)),deletea.host),n=n&&(""===s[
(function(t){functione(t){returnthisinstanceofe?(this.buffers=t||[],void(this.length=this.buffers.reduce(function(t,e){returnt+e.length},0))):newe(t)}module.exports=e,e.prototype.push=function(){for(vare=0;e<arguments.length;e++)if(!t.isBuffer(arguments[e]))thrownewTypeError("Tried to push a non-buffer");for(vare=0;e<arguments.length;e++){varr=arguments[e];this.buffers.push(r),this.length+=r.length}returnthis.length},e.prototype.unshift=function(){for(vare=0;e<arguments.length;e++)if(!t.isBuffer(arguments[e]))thrownewTypeError("Tried to unshift a non-buffer");for(vare=0;e<arguments.length;e++){varr=arguments[e];this.buffers.unshift(r),this.length+=r.length}returnthis.length},e.prototype.copy=function(t,e,r,n){returnthis.slice(r,n).copy(t,e,0,n-r)},e.prototype.splice=function(r,n){vars=this.buffers,i=r>=0?r:this.length-r,h=[].slice.call(arguments,2);void0===n?n=this.length-i:n>this.length-i&&(n=this.length-i);for(varr=0;r<h.length;r++)this.length+=h[r].length;for(varf=newe,o=0,l=0;l<s.length&&o+s[l].length<i;l++)o+=s[l].length;if(i-o>0){varu=i-o;if(u+n<s[l].length){f.push(s[l].slice(u,u+n));for(varg=s[l],p=newt(u),r=0;u>r;r++)p[r]=g[r];for(vara=newt(g.length-u-n),r=u+n;r<g.length;r++)a[r-n-u]=g[r];if(h.length>0){varc=h.slice();c.unshift(p),c.push(a),s.splice.apply(s,[l,1].concat(c)),l+=c.length,h=[]}elses.splice(l,1,p,a),l+=2}elsef.push(s[l].slice(u)),s[l]=s[l].slice(0,u),l++}for(h.length>0&&(s.splice.apply(s,[l,0].concat(h)),l+=h.length);f.length<n;){varv=s[l],b=v.length,y=Math.min(b,n-f.length);y===b?(f.push(v),s.splice(l,1)):(f.push(v.slice(0,y)),s[l]=s[l].slice(y))}returnthis.length-=f.length,f},e.prototype.slice=function(e,r){varn=this.buffers;void0===r&&(r=this.length),void0===e&&(e=0),r>this.length&&(r=this.length);for(vars=0,i=0;i<n.length&&s+n[i].length<=e;i++)s+=n[i].length;for(varh=newt(r-e),f=0,o=i;r-e>f&&o<n.length;o++){varl=n[o].length,u=0===f?e-s:0,g=f+l>=r-e?Math.min(u+(r-e)-f,l):l;n[o].copy(h,f,u,g),f+=g-u}returnh},e.prototype.pos=function(t){if(0>t||t>=this.length)thrownewError("oob");for(vare=t,r=0,n=null;;){if(n=this.buffers[r],e<n.length)return{buf:r,offset:e};e-=n.length,r++}},e.prototype.get=function(t){vare=this.pos(t);returnthis.buffers[e.buf].get(e.offset)},e.prototype.set=function(t,e){varr=this.pos(t);returnthis.buffers[r.buf].set(r.offset,e)},e.prototype.indexOf=function(e,r){if("string"==typeofe)e=newt(e);elseif(!(einstanceoft))thrownewError("Invalid type for a search string");if(!e.length)return0;if(!this.length)return-1;varn,s=0,i=0,h=0,f=0;if(r){varo=this.pos(r);s=o.buf,i=o.offset,f=r}for(;;){for(;i>=this.buffers[s].length;)if(i=0,s++,s>=this.buffers.length)return-1;varl=this.buffers[s][i];if(l==e[h]){if(0==h&&(n={i:s,j:i,pos:f}),h++,h==e.length)returnn.pos}else0!=h&&(s=n.i,i=n.j,f=n.pos,h=0);i++,f++}},e.prototype.toBuffer=function(){returnthis.slice()},e.prototype.toString=function(t,e,r){returnthis.slice(e,r).toString(t)}}).call(this,require("buffer").Buffer);
functionEdwardsCurve(t){this.twisted=1!=t.a,this.mOneA=this.twisted&&-1==t.a,this.extended=this.mOneA,Base.call(this,"mont",t),this.a=newbn(t.a,16).mod(this.red.m).toRed(this.red),this.c=newbn(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=newbn(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==t.c}functionPoint(t,e,r,i,d){Base.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=newbn(e,16),this.y=newbn(r,16),this.z=i?newbn(i,16):this.curve.one,this.t=d&&newbn(d,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}varassert=require("assert"),curve=require("../curve"),elliptic=require("../../elliptic"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base,getNAF=elliptic.utils.getNAF;inherits(EdwardsCurve,Base),module.exports=EdwardsCurve,EdwardsCurve.prototype._mulA=function(t){returnthis.mOneA?t.redNeg():this.a.redMul(t)},EdwardsCurve.prototype._mulC=function(t){returnthis.oneC?t:this.c.redMul(t)},EdwardsCurve.prototype.point=function(t,e,r,i){returnnewPoint(this,t,e,r,i)},EdwardsCurve.prototype.jpoint=function(t,e,r,i){returnthis.point(t,e,r,i)},EdwardsCurve.prototype.pointFromJSON=function(t){returnPoint.fromJSON(this,t)},EdwardsCurve.prototype.pointFromX=function(t,e){e=newbn(e,16),e.red||(e=e.toRed(this.red));varr=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),d=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=i.redMul(d.redInvm()).redSqrt(),u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s,curve.one)},EdwardsCurve.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();vare=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),d=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return0===i.cmp(d)},inherits(Point,Base.BasePoint),Point.fromJSON=function(t,e){returnnewPoint(t,e[0],e[1],e[2])},Point.prototype.inspect=function(){returnthis.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16)+" y: "+this.y.fromRed().toString(16)+" z: "+this.z.fromRed().toString(16)+">"},Point.prototype.isInfinity=function(){return0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},Point.prototype._extDbl=function(){vart=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);vari=this.curve._mulA(t),d=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=i.redAdd(e),u=s.redSub(r),n=i.redSub(e),h=d.redMul(u),o=s.redMul(n),l=d.redMul(n),c=u.redMul(s);returnthis.curve.point(h,o,c,l)},Point.prototype._projDbl=function(){vart=this.x.redAdd(this.y).redSqr(),e=this.x.redSqr(),r=this.y.redSqr();if(this.curve.twisted){vari=this.curve._mulA(e),d=i.redAdd(r);if(this.zOne)vars=t.redSub(e).redSub(r).redMul(d.redSub(this.curve.two)),u=d.redMul(i.redSub(r)),n=d.redSqr().redSub(d).redSub(d);elsevarh=this.z.redSqr(),o=d.redSub(h).redISub(h),s=t.redSub(e).redISub(r).redMul(o),u=d.redMul(i.redSub(r)),n=d.redMul(o)}elsevari=e.redAdd(r),h=this.curve._mulC(redMul(this.z)).redSqr(),o=i.redSub(h).redSub(h),s=this.curve._mulC(t.redISub(i)).redMul(o),u=this.curve._mulC(i).redMul(e.redISub(r)),n=i.redMul(o);returnthis.curve.point(s,u,n)},Point.prototype.dbl=function(){returnthis.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function(t){vare=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),d=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),u=d.redSub(i),n=d.redAdd(i),h=r.redAdd(e),o=s.redMul(u),l=n.redMul(h),c=s.redMul(h),p=u.redMul(n);returnthis.curve.point(o,l,p,c)},Point.prototype._projAdd=functio
functionMontCurve(t){Base.call(this,"mont",t),this.a=newbn(t.a,16).toRed(this.red),this.b=newbn(t.b,16).toRed(this.red),this.i4=newbn(4).toRed(this.red).redInvm(),this.two=newbn(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}functionPoint(t,e,r){Base.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=newbn(e,16),this.z=newbn(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}varassert=require("assert"),curve=require("../curve"),elliptic=require("../../elliptic"),bn=require("bn.js"),inherits=require("inherits"),Base=curve.base,getNAF=elliptic.utils.getNAF;inherits(MontCurve,Base),module.exports=MontCurve,MontCurve.prototype.point=function(t,e){returnnewPoint(this,t,e)},MontCurve.prototype.pointFromJSON=function(t){returnPoint.fromJSON(this,t)},MontCurve.prototype.validate=function(t){vare=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e),n=i.redSqrt();return0===n.redSqr().cmp(i)},inherits(Point,Base.BasePoint),Point.prototype.precompute=function(){},Point.fromJSON=function(t,e){returnnewPoint(t,e[0],e[1]||t.one)},Point.prototype.inspect=function(){returnthis.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16)+" z: "+this.z.fromRed().toString(16)+">"},Point.prototype.isInfinity=function(){return0===this.z.cmpn(0)},Point.prototype.dbl=function(){vart=this.x.redAdd(this.z),e=t.redSqr(),r=this.x.redSub(this.z),i=r.redSqr(),n=e.redSub(i),o=e.redMul(i),d=n.redMul(i.redAdd(this.curve.a24.redMul(n)));returnthis.curve.point(o,d)},Point.prototype.add=function(){thrownewError("Not supported on Montgomery curve")},Point.prototype.diffAdd=function(t,e){varr=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z),d=o.redMul(r),s=n.redMul(i),u=e.z.redMul(d.redAdd(s).redSqr()),h=e.x.redMul(d.redISub(s).redSqr());returnthis.curve.point(u,h)},Point.prototype.mul=function(t){for(vare=t.clone(),r=this,i=this.curve.point(null,null),n=this,o=[];0!==e.cmpn(0);e.ishrn(1))o.push(e.andln(1));for(vard=o.length-1;d>=0;d--)0===o[d]?(r=r.diffAdd(i,n),i=i.dbl()):(i=r.diffAdd(i,n),r=r.dbl());returni},Point.prototype.mulAdd=function(){thrownewError("Not supported on Montgomery curve")},Point.prototype.normalize=function(){returnthis.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function(){returnthis.normalize(),this.x.fromRed()};
functionKeyPair(t,i,e){returniinstanceofKeyPair?i:einstanceofKeyPair?e:(i||(i=e,e=null),null!==i&&"object"==typeofi&&(i.x?(e=i,i=null):(i.priv||i.pub)&&(e=i.pub,i=i.priv)),this.ec=t,this.priv=null,this.pub=null,void(this._importPublicHex(i,e)||("hex"===e&&(e=null),i&&this._importPrivate(i),e&&this._importPublic(e))))}varassert=require("assert"),bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils;module.exports=KeyPair,KeyPair.prototype.validate=function(){vart=this.getPublic();returnt.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function(t,i){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeoft&&(i=t,t=null),!i)returnthis.pub;for(vare=this.ec.curve.p.byteLength(),r=this.pub.getX().toArray(),n=r.length;e>n;n++)r.unshift(0);if(t)varu=[this.pub.getY().isEven()?2:3].concat(r);else{for(vars=this.pub.getY().toArray(),n=s.length;e>n;n++)s.unshift(0);varu=[4].concat(r,s)}returnutils.encode(u,i)},KeyPair.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16):this.priv},KeyPair.prototype._importPrivate=function(t){this.priv=newbn(t,16),this.priv=this.priv.mod(this.ec.curve.n)},KeyPair.prototype._importPublic=function(t){this.pub=this.ec.curve.point(t.x,t.y)},KeyPair.prototype._importPublicHex=function(t,i){t=utils.toArray(t,i);vare=this.ec.curve.p.byteLength();if(4===t[0]&&t.length-1===2*e)this.pub=this.ec.curve.point(t.slice(1,1+e),t.slice(1+e,1+2*e));else{if(2!==t[0]&&3!==t[0]||t.length-1!==e)return!1;this.pub=this.ec.curve.pointFromX(3===t[0],t.slice(1,1+e))}return!0},KeyPair.prototype.derive=function(t){returnt.mul(this.priv).getX()},KeyPair.prototype.sign=function(t){returnthis.ec.sign(t,this)},KeyPair.prototype.verify=function(t,i){returnthis.ec.verify(t,i,this)},KeyPair.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16))+" pub: "+(this.pub&&this.pub.inspect())+" >"};
functionSignature(t,r){returntinstanceofSignature?t:void(this._importDER(t,r)||(assert(t&&r,"Signature without r or s"),this.r=newbn(t,16),this.s=newbn(r,16)))}varassert=require("assert"),bn=require("bn.js"),elliptic=require("../../elliptic"),utils=elliptic.utils;module.exports=Signature,Signature.prototype._importDER=function(t,r){if(t=utils.toArray(t,r),t.length<6||48!==t[0]||2!==t[2])return!1;vare=t[1];if(1+e>t.length)return!1;varn=t[3];if(n>=128)return!1;if(4+n+2>=t.length)return!1;if(2!==t[4+n])return!1;vari=t[5+n];returni>=128?!1:4+n+2+i>t.length?!1:(this.r=newbn(t.slice(4,4+n)),this.s=newbn(t.slice(4+n+2,4+n+2+i)),!0)},Signature.prototype.toDER=function(t){varr=this.r.toArray(),e=this.s.toArray();128&r[0]&&(r=[0].concat(r)),128&e[0]&&(e=[0].concat(e));varn=r.length+e.length+4,i=[48,n,2,r.length];returni=i.concat(r,[2,e.length],e),utils.encode(i,t)};
functionHmacDRBG(t){if(!(thisinstanceofHmacDRBG))returnnewHmacDRBG(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;vare=utils.toArray(t.entropy,t.entropyEnc),i=utils.toArray(t.nonce,t.nonceEnc),s=utils.toArray(t.pers,t.persEnc);assert(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,i,s)}varassert=require("assert"),hash=require("hash.js"),elliptic=require("../elliptic"),utils=elliptic.utils;module.exports=HmacDRBG,HmacDRBG.prototype._init=function(t,e,i){vars=t.concat(e).concat(i);this.K=newArray(this.outLen/8),this.V=newArray(this.outLen/8);for(varh=0;h<this.V.length;h++)this.K[h]=0,this.V[h]=1;this._update(s),this.reseed=1,this.reseedInterval=281474976710656},HmacDRBG.prototype._hmac=function(){returnnewhash.hmac(this.hash,this.K)},HmacDRBG.prototype._update=function(t){vare=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},HmacDRBG.prototype.reseed=function(t,e,i,s){"string"!=typeofe&&(s=i,i=e,e=null),t=utils.toBuffer(t,e),i=utils.toBuffer(i,s),assert(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(i||[])),this.reseed=1},HmacDRBG.prototype.generate=function(t,e,i,s){if(this.reseed>this.reseedInterval)thrownewError("Reseed is required");"string"!=typeofe&&(s=i,i=e,e=null),i&&(i=utils.toArray(i,s),this._update(i));for(varh=[];h.length<t;)this.V=this._hmac().update(this.V).digest(),h=h.concat(this.V);varr=h.slice(0,t);returnthis._update(i),this.reseed++,utils.encode(r,e)};
(function(){varn=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){returnninstanceofj?n:thisinstanceofj?void(this._wrapped=n):newj(n)};"undefined"!=typeofexports?("undefined"!=typeofmodule&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";varA=j.each=j.forEach=function(n,t,e){if(null==n)returnn;if(s&&n.forEach===s)n.forEach(t,e);elseif(n.length===+n.length){for(varu=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}elsefor(vara=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;returnn};j.map=j.collect=function(n,t,r){vare=[];returnnull==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};varO="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){varu=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)returne&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)thrownewTypeError(O);returnr},j.reduceRight=j.foldr=function(n,t,r,e){varu=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)returne&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);vari=n.length;if(i!==+i){vara=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)thrownewTypeError(O);returnr},j.find=j.detect=function(n,t,r){vare;returnk(n,function(n,u,i){returnt.call(r,n,u,i)?(e=n,!0):void0}),e},j.filter=j.select=function(n,t,r){vare=[];returnnull==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){returnj.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);varu=!0;returnnull==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void0:r}),!!u)};vark=j.some=j.any=function(n,t,e){t||(t=j.identity);varu=!1;returnnull==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){returnu||(u=t.call(e,n,i,a))?r:void0}),!!u)};j.contains=j.include=function(n,t){returnnull==n?!1:y&&n.indexOf===y?-1!=n.indexOf(t):k(n,function(n){returnn===t})},j.invoke=function(n,t){varr=o.call(arguments,2),e=j.isFunction(t);returnj.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){returnj.map(n,j.property(t))},j.where=function(n,t){returnj.filter(n,j.matches(t))},j.findWhere=function(n,t){returnj.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)returnMath.max.apply(Math,n);vare=-1/0,u=-1/0;returnA(n,function(n,i,a){varo=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)returnMath.min.apply(Math,n);vare=1/0,u=1/0;returnA(n,function(n,i,a){varo=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){vart,r=0,e=[];returnA(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){returnnull==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};varE=function(n){returnnull==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){returnt=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){varr=n.criteria,e=t.criteria;if(r!==e){if(r>e||void0===r)return1;if(e>r||void0===e)return-1}returnn.index-t.index}),"value")};varF=function(n){returnfunction(t,r,e){varu={};returnr=E(r),A(t,function(i,a){varo=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(varu=r.call(e,t),i=0,a=n.length;a>i;){varo=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}returni},j.toArray=function(n){returnn?j.isArray
exports.ShouldBeDefined="Variable should be defined.",exports.ShouldBeUndefined="Variable should be undefined.",exports.ShouldBeArray="Variable should be of type Array.",exports.ShouldNotBeArray="Variable should NOT be of type Array.",exports.ShouldBeObject="Variable should be of type Object.",exports.ShouldNotBeObject="Variable should NOT be of type Object.",exports.ShouldBeEmpty="Array or object should be empty.",exports.ShouldNotBeEmpty="Array or object should NOT be empty.",exports.ShouldBeFunction="Variable should be a Function.",exports.ShouldNotBeFunction="Variable should NOT be a Function.",exports.ShouldBeString="Variable should be a String.",exports.ShouldNotBeString="Variable should NOT be a String.",exports.ShouldBeNumber="Variable should be a Number.",exports.ShouldNotBeNumber="Variable should NOT be a Number.",exports.ShouldBeFinite="Variable should be Finite (i.e. not infinity).",exports.ShouldBeInfinite="Variable should be Infinite.",exports.ShouldBeBoolean="Variable should be a Boolean.",exports.ShouldNotBeBoolean="Variable should NOT be a Boolean.",exports.ShouldBeDate="Variable should be a Date.",exports.ShouldNotBeDate="Variable should NOT be a Date.",exports.ShouldBeRegExp="Variable should be a RegExp.",exports.ShouldNotBeRegExp="Variable should NOT be a RegExp.",exports.ShouldBeFalsey="Variable should be falsey.",exports.ShouldNotBeFalsey="Variable should NOT be falsey.",exports.IllegalArgument="Illegal Argument.",exports.IllegalState="Illegal State.",exports.ShouldHaveValidIndex="Index should be between between 0 (inclusive) and size (exclusive).",exports.ShouldHaveValidPosition="Index should be between index between 0 (inclusive) and size (inclusive).",exports.ShouldHaveValidPositions="Start and End should be between valid sub range between 0 (inclusive) and size (inclusive).",exports.StartBeforeEnd="Start value should be less than the end value.";