!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.trezor=e()}}(function(){var e;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n||e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s0,descriptors:t}}},{key:"_reportChanges",value:function(){var e=this;(0,c.lock)(function(){var t=e._diff(e.previous,e.current);return e.previous=e.current,t.didUpdate&&(t.connected.forEach(function(t){e.connectEvent.emit(t)}),t.disconnected.forEach(function(t){e.disconnectEvent.emit(t)}),t.acquired.forEach(function(t){e.acquiredEvent.emit(t)}),t.released.forEach(function(t){e.releasedEvent.emit(t)}),t.changedSessions.forEach(function(t){e.changedSessionsEvent.emit(t)}),e.updateEvent.emit(t)),Promise.resolve()})}}]),t}(u.EventEmitter);n.default=l,t.exports=n.default},{"./events":4,"./flow-events":5,"./utils/connectionLock":12}],2:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return Object.keys(e).map(function(t){return e[t]})}Object.defineProperty(n,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n0}},{key:"transportType",value:function(){if(null==this.transport)return"";if(this.transport.activeName){var e=this.transport.activeName;return"BridgeTransport"===e?"bridge":"ExtensionTransport"===e?"extension":e}return this.transport.name}},{key:"transportVersion",value:function(){return null==this.transport?"":this.transport.version}},{key:"transportOutdated",value:function(){return null!=this.transport&&!!this.transport.isOutdated}},{key:"_configTransport",value:function(e){if(null!=this.options.config)return e.configure(this.options.config);var n=null==this.options.configUrl?"https://wallet.trezor.io/data/config_signed.bin?"+Date.now():this.options.configUrl;return(0,t._fetch)(n).then(function(e){if(!e.ok)throw new Error("Wrong config response.");return e.text()}).then(function(t){return e.configure(t)})}},{key:"_initTransport",value:function(){var e=this,n=this.options.transport?this.options.transport:t.defaultTransport();this.options.debugInfo&&console.log("[trezor.js] [device list] Initializing transports"),n.init(this.options.debug).then(function(){e.options.debugInfo&&console.log("[trezor.js] [device list] Configuring transports"),e._configTransport(n).then(function(){e.options.debugInfo&&console.log("[trezor.js] [device list] Configuring transports done"),e.transportEvent.emit(n)})},function(t){e.options.debugInfo&&console.error("[trezor.js] [device list] Error in transport",t),e.errorEvent.emit(t)})}},{key:"_createAndSaveDevice",value:function(e,t,n,r){var i=this;this.options.debugInfo&&console.log("[trezor.js] [device list] Creating Device",t,r);var o=t.path.toString();this.creatingDevices[o]=!0,this._createDevice(e,t,n,r).then(function(e){e instanceof d.default?(i.devices[o]=e,delete i.creatingDevices[o],i.connectEvent.emit(e,r)):(delete i.creatingDevices[o],i.unacquiredDevices[o]=e,i.connectUnacquiredEvent.emit(e))}).catch(function(e){console.debug("[trezor.js] [device list] Cannot create device",e)})}},{key:"_createDevice",value:function(e,t,n,r){var i=this;return d.default.fromDescriptor(e,t,this).then(function(e){return e}).catch(function(o){if("wrong previous session"===o.message)return null==r?i._createUnacquiredDevice(e,t,n):(i.unacquiredDevices[r.originalDescriptor.path.toString()]=r,r);throw i.errorEvent.emit(o),o})}},{key:"_createUnacquiredDevice",value:function(e,t,n){var r=this;return this.options.debugInfo&&console.log("[trezor.js] [device list] Creating Unacquired Device",t),v.default.fromDescriptor(e,t,this).then(function(e){return e}).catch(function(e){r.errorEvent.emit(e)})}},{key:"getSession",value:function(e){return this.sessions[e]}},{key:"setHard",value:function(e,t){null!=this.stream&&this.stream.setHard(e,t),this.sessions[e]=t}},{key:"_initStream",value:function(e){var t=this,n=new h.default(e);n.updateEvent.on(function(r){t.sessions={},r.descriptors.forEach(function(e){t.sessions[e.path.toString()]=e.session}),r.connected.forEach(function(r){var i=r.path;null==r.session?t._createAndSaveDevice(e,r,n):(t.creatingDevices[i.toString()]=!0,t._createUnacquiredDevice(e,r,n).then(function(e){t.unacquiredDevices[i.toString()]=e,delete t.creatingDevices[i.toString()],t.connectUnacquiredEvent.emit(e)}))}),[{d:r.changedSessions,e:t.changedSessionsEvent},{d:r.acquired,e:t.acquiredEvent},{d:r.released,e:t.releasedEvent}].forEach(function(e){var n=e.d,r=e.e;n.forEach(function(e){var n=e.path.toString(),i=t.devices[n];null!=i&&r.emit(i)})}),r.disconnected.forEach(function(e){var n=e.path,r=n.toString(),i=t.devices[r];null!=i&&(delete t.devices[r],t.disconnectEvent.emit(i));var o=t.unacquiredDevices[r];null!=o&&(delete t.unacquiredDevices[r],t.disconnectUnacquiredEvent.emit(o))}),r.released.forEach(function(r){var i=r.path;if(null!=t.unacquiredDevices[i.toString()]){var o=t.unacquiredDevices[i.toString()];delete t.unacquiredDevices[i.toString()],t._createAndSaveDevice(e,r,n,o)}}),t.updateEvent.emit(r)}),n.errorEvent.on(function(e){t.errorEvent.emit(e),n.stop()}),n.listen(),this.streamEvent.emit(n)}},{key:"onUnacquiredConnect",value:function(e,t){var n=e.originalDescriptor.path.toString();null==this.unacquiredDevices[n]?null!=this.creatingDevices[n]?this.connectEvent.on(t):null!=this.devices[n]&&t(this.devices[n],e):this.connectEvent.on(t)}},{key:"onUnacquiredDisconnect",value:function(e,t){var n=e.originalDescriptor.path.toString();null==this.unacquiredDevices[n]?null!=this.creatingDevices[n]?this.disconnectUnacquiredEvent.on(t):null==this.devices[n]&&t(e):this.disconnectUnacquiredEvent.on(t)}},{key:"onDisconnect",value:function(e,t){var n=e.originalDescriptor.path.toString();null==this.devices[n]&&null==this.creatingDevices[n]?t(e):this.disconnectEvent.on(t)}},{key:"stealFirstDevice",value:function(e){var t=this,n=this.asArray();if(n.length>0)return Promise.resolve(n[0]);var r=this.unacquiredAsArray();return r.length>0?r[0].steal():e?Promise.reject(new Error("No device connected")):new Promise(function(e,n){t.connectEvent.once(function(){t.stealFirstDevice().then(function(t){return e(t)},function(e){return n(e)})})})}},{key:"acquireFirstDevice",value:function(e){var t=this,n=function(e){return new Promise(function(t){setTimeout(function(){return t()},e)})};return new Promise(function(n,r){t.stealFirstDevice(e).then(function(e){e.run(function(t){return n({device:e,session:t}),new Promise(function(e,t){})})},function(e){r(e)})}).catch(function(r){if("wrong previous session"===r.message)return n(1e3).then(function(){return t.acquireFirstDevice(e)});throw r})}},{key:"onbeforeunload",value:function(e){this.asArray().forEach(function(t){return t.onbeforeunload(e)})}}]),t}(f.EventEmitter);g._fetch=function(){return Promise.reject(new Error("No fetch defined"))},n.default=g,t.exports=n.default},{"./descriptor-stream":1,"./device":3,"./events":4,"./flow-events":5,"./unacquired-device":10}],3:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){e.on(function(e){0!==t.listenerCount()&&t.emit(e)})}function u(e,t){e.on(function(e){t.emit(e)})}function f(e,t){e.on(function(e,n){t.emit(e,n)})}function c(e,t){e.on(function(e){t.emit(e)})}function l(e,t){e.on(function(e,n){t.emit(e,n)})}function h(e,t){return e.then(function(e){return t(e,null).then(function(){return e})},function(e){return t(null,e).then(function(){throw e},function(){throw e})})}Object.defineProperty(n,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;t=0}},{key:"getCoin",value:function(e){for(var t=this.features.coins,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};return this.callHelper.typedCall(e,t,n)}},{key:"verifyAddress",value:function(e,t,n,r){var i=this;return this.getAddress(e,n,!0,r).then(function(n){var r=n.message.address===t;return r||i.debug&&console.warn("[trezor.js] [session] Address verification failed",{path:e,jsAddress:t,trezorAddress:n.message.address}),r})}},{key:"changeLabel",value:function(e){return e.length>n.LABEL_MAX_LENGTH&&(e=e.slice(0,n.LABEL_MAX_LENGTH)),this.applySettings({label:e})}},{key:"togglePassphrase",value:function(e){return this.applySettings({use_passphrase:e})}},{key:"changeHomescreen",value:function(e){return this.applySettings({homescreen:e})}},{key:"getHDNode",value:function(e,t){return g.getHDNode(this,e,u(t))}},{key:"setU2FCounter",value:function(e){return this.typedCall("SetU2FCounter","Success",{u2f_counter:e})}},{key:"backupDevice",value:function(){return this.typedCall("BackupDevice","Success")}},{key:"nemGetAddress",value:function(e,t,n){return this.typedCall("NEMGetAddress","NEMAddress",{address_n:e,network:t,show_display:!!n})}},{key:"nemSignTx",value:function(e){return this.typedCall("NEMSignTx","NEMSignedTx",e)}}]),n}(h.EventEmitter));O.LABEL_MAX_LENGTH=16,n.default=O}).call(this,e("buffer").Buffer)},{"./events":4,"./flow-events":5,"./trezortypes":9,"./utils/call":11,"./utils/hdnode":13,"./utils/signbjstx":14,"./utils/signethtx":15,"./utils/signtx":16,"bitcoinjs-lib-zcash":35,buffer:68}],9:[function(e,t,n){"use strict"},{}],10:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},r=s(e,n);return this.session.debug&&console.log("[trezor.js] [call] Sending",e,r),this.session.sendEvent.emit(e,n),this.transport.call(this.sessionId,e,n).then(function(e){var n=s(e.type,e.message);return t.session.debug&&console.log("[trezor.js] [call] Received",e.type,n),t.session.receiveEvent.emit(e.type,e.message),e},function(e){throw t.session.debug&&console.log("[trezor.js] [call] Received error",e),t.session.errorEvent.emit(e),e})}},{key:"typedCall",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._commonCall(e,n).then(function(e){return i(e,t),e})}},{key:"_commonCall",value:function(e,t){var n=this;return this.call(e,t).then(function(e){return n._filterCommonTypes(e)})}},{key:"_filterCommonTypes",value:function(e){var t=this;if("Failure"===e.type){var n=new Error(e.message.message);return n.code=e.message.code,Promise.reject(n)}return"ButtonRequest"===e.type?(this.session.buttonEvent.emit(e.message.code),this._commonCall("ButtonAck",{})):"EntropyRequest"===e.type?this._commonCall("EntropyAck",{entropy:o(32).toString("hex")}):"PinMatrixRequest"===e.type?this._promptPin(e.message.type).then(function(e){return t._commonCall("PinMatrixAck",{pin:e})},function(){return t._commonCall("Cancel",{})}):"PassphraseRequest"===e.type?this._promptPassphrase().then(function(e){return t._commonCall("PassphraseAck",{passphrase:e})},function(e){return t._commonCall("Cancel",{}).catch(function(t){throw e||t})}):"WordRequest"===e.type?this._promptWord().then(function(e){return t._commonCall("WordAck",{word:e})},function(){return t._commonCall("Cancel",{})}):Promise.resolve(e)}},{key:"_promptPin",value:function(e){var t=this;return new Promise(function(n,r){t.session.pinEvent.emit(e,function(e,t){e||null==t?r(e):n(t)})||(t.session.debug&&console.warn("[trezor.js] [call] PIN callback not configured, cancelling request"),r(new Error("PIN callback not configured")))})}},{key:"_promptPassphrase",value:function(){var e=this;return new Promise(function(t,n){e.session.passphraseEvent.emit(function(e,r){e||null==r?n(e):t(r.normalize("NFKD"))})||(e.session.debug&&console.warn("[trezor.js] [call] Passphrase callback not configured, cancelling request"),n(new Error("Passphrase callback not configured")))})}},{key:"_promptWord",value:function(){var e=this;return new Promise(function(t,n){e.session.wordEvent.emit(function(e,r){e||null==r?n(e):t(r.toLocaleLowerCase())})||(e.session.debug&&console.warn("[trezor.js] [call] Word callback not configured, cancelling request"),n(new Error("Word callback not configured")))})}}]),e}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{randombytes:128}],12:[function(e,t,n){"use strict";function r(e){var t=i.then(function(){return e()});return i=t.catch(function(){return!0}),t}Object.defineProperty(n,"__esModule",{value:!0}),n.lock=r;var i=Promise.resolve()},{}],13:[function(e,t,n){(function(t){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){var t=e.keyPair.d;if(!t)throw new Error("Not a private node.");var n=e.depth,r=e.parentFingerprint,i=e.index,o=t.toString(16);return{depth:n,fingerprint:r,child_num:i,chain_code:e.chainCode.toString("hex"),private_key:o}}function o(e,n){var r=new t(e.chain_code,"hex"),i=new t(e.public_key,"hex");if(null==v)throw new Error("secp256k1 is null");var o=d.Point.decodeFrom(v,i),s=new h.HDNode(new h.ECPair(null,o,{network:n}),r);return s.depth=+e.depth,s.index=+e.child_num,s.parentFingerprint=e.fingerprint,s}function s(e,t){if(76067358===t.bip32.public)return e;var n=h.HDNode.fromBase58(e);return n.keyPair.network=t,n.toBase58()}function a(e,t){var n=e.message.node,r=o(n,t),i=r.toBase58(),a=s(e.message.xpub,t);if(i!==a)throw new Error("Invalid public key transmission detected - invalid xpub check. Key: "+i+", Received: "+a);return r}function u(e,t,n){var r=e.derive(n),i=r.toBase58(),o=t.toBase58();if(i!==o)throw new Error("Invalid public key transmission detected - invalid child cross-check. Computed derived: "+i+", Computed received: "+o)}function f(e,t,n){return e[t].derive(n).getIdentifier()}function c(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.networks.bitcoin,r=t.concat([0]);return e.getPublicKey(t).then(function(t){var i=a(t,n);return e.getPublicKey(r).then(function(e){var t=a(e,n);return u(i,t,0),i})})}Object.defineProperty(n,"__esModule",{value:!0}),n.bjsNode2privNode=i,n.pubNode2bjsNode=o,n.pubKey2bjsNode=a,n.checkDerivation=u,n.derivePubKeyHash=f,n.getHDNode=c;var l=e("bitcoinjs-lib-zcash"),h=r(l),p=e("ecurve"),d=r(p),y=e("../trezortypes"),v=(r(y),d.getCurveByName("secp256k1"))}).call(this,e("buffer").Buffer)},{"../trezortypes":9,"bitcoinjs-lib-zcash":35,buffer:68,ecurve:80}],14:[function(e,t,n){(function(t){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e,t){var n=e.hash,r=e.index,i=e.path,o=e.amount;return{prev_index:r,prev_hash:g(n).toString("hex"),address_n:i,script_type:e.segwit?"SPENDP2SHWITNESS":"SPENDADDRESS",amount:o,sequence:t}}function o(e){if(!Array.isArray(e))throw new Error("Both address and path of an output cannot be null.");var t=[];return e.forEach(function(e){"number"==typeof e&&t.push(e)}),t}function s(e,t){if(null==e.address){if(null!=e.opReturnData){if(null!=e.value)throw new Error("Wrong type.");return{amount:0,op_return_data:e.opReturnData.toString("hex"),script_type:"PAYTOOPRETURN"}}if(!e.path)throw new Error("Both address and path of an output cannot be null.");var n=o(e.path),r=e.value;return e.segwit?{address_n:n,amount:r,script_type:"PAYTOP2SHWITNESS"}:{address_n:n,amount:r,script_type:"PAYTOADDRESS"}}var i=e.address;if("string"!=typeof i)throw new Error("Wrong type.");var s=e.value;return d(i,t),{address:i,amount:s,script_type:"PAYTOADDRESS"}}function a(e){return m.Transaction.fromHex(e.message.serialized.serialized_tx)}function u(e){var t=y(e),n=null==t?null:t.toString("hex");return{lock_time:e.locktime,version:e.version,hash:e.getId(),inputs:e.ins.map(function(e){return{prev_index:e.index,sequence:e.sequence,prev_hash:g(e.hash).toString("hex"),script_sig:e.script.toString("hex")}}),bin_outputs:e.outs.map(function(e){return{amount:e.value,script_pubkey:e.script.toString("hex")}}),extra_data:n}}function f(e){if(e.path){return o(e.path)}if("string"==typeof e.address)return e.address;throw new Error("Wrong output type.")}function c(e){return!!e.segwit}function l(e){var n=new t(e.length+2);n[0]=0,n[1]=20,e.copy(n,2);var r=m.crypto.hash160(n),i=new t(23);return i[0]=169,i[1]=20,i[22]=135,r.copy(i,2),i}function h(e,t,n,r){var i="string"==typeof e?d(e,n)?"PAYTOSCRIPTHASH":"PAYTOADDRESS":r?"PAYTOP2SHWITNESS":"PAYTOADDRESS",o="string"==typeof e?m.address.fromBase58Check(e).hash:_.derivePubKeyHash(t,e[e.length-2],e[e.length-1]);if("PAYTOADDRESS"===i)return m.script.pubKeyHash.output.encode(o);if("PAYTOSCRIPTHASH"===i)return m.script.scriptHash.output.encode(o);if("PAYTOP2SHWITNESS"===i)return l(o);throw new Error("Unknown script type "+i)}function p(e,t,n,r,i){if(e.length!==r.ins.length)throw new Error("Signed transaction has wrong length.");if(t.length!==r.outs.length)throw new Error("Signed transaction has wrong length.");t.map(function(e,t){var o=r.outs[t].script;if(null!=e.opReturnData){if(0!==m.script.nullData.output.encode(e.opReturnData).compare(o))throw new Error("Scripts differ")}else{if(e.value!==r.outs[t].value)throw new Error("Signed transaction has wrong output value.");if(null==e.address&&null==e.path)throw new Error("Both path and address cannot be null.");var s=f(e),a=c(e);if(0!==h(s,n,i,a).compare(o))throw new Error("Scripts differ")}})}function d(e,t){var n=m.address.fromBase58Check(e);if(n.version===t.pubKeyHash)return!1;if(n.version===t.scriptHash)return!0;throw new Error("Unknown address type.")}function y(e){if(e.version<2)return null;var t=e.toBuffer(),n=e.joinsplitByteLength();return t.slice(t.length-n)}function v(e,t,n,r,o,f,c){var l=null==f?m.networks[o.toLowerCase()]:f;if(null==l)return Promise.reject(new Error("No network "+o));var h=c?4294967294:4294967295,d=t.inputs.map(function(e){return i(e,h)}),y=t.outputs.map(function(e){return s(e,l)}),v=n.map(function(e){return u(e)});return e.signTx(d,y,v,o,c).then(function(e){return a(e)}).then(function(e){return p(t.inputs,t.outputs,r,e,l),e})}function g(e){var n=new t(e.length);return e.copy(n),[].reverse.call(n),n}Object.defineProperty(n,"__esModule",{value:!0}),n.signBjsTx=v;var b=e("bitcoinjs-lib-zcash"),m=r(b),w=e("../trezortypes"),E=(r(w),e("./hdnode")),_=r(E)}).call(this,e("buffer").Buffer)},{"../trezortypes":9,"./hdnode":13,"bitcoinjs-lib-zcash":35,buffer:68}],15:[function(e,t,n){"use strict";function r(e,t){return null==e?["",""]:[e.slice(0,t),e.slice(t)]}function i(e,t,n){if(!t.data_length){var o=t.signature_v,s=t.signature_r,a=t.signature_s;if(null==o||null==s||null==a)throw new Error("Unexpected request.");return Promise.resolve({v:o,r:s,s:a})}var f=r(n,2*t.data_length),c=u(f,2),l=c[0],h=c[1];return e.typedCall("EthereumTxAck","EthereumTxRequest",{data_chunk:l}).then(function(t){return i(e,t.message,h)})}function o(e){for(;/^00/.test(e);)e=e.slice(2);return e}function s(e,t,n,s,f,c,l,h,p){var d=null==h?0:h.length/2,y=r(h,2048),v=u(y,2),g=v[0],b=v[1],m={address_n:t,nonce:o(n),gas_price:o(s),gas_limit:o(f),to:c,value:o(l)};return 0!==d&&(m=a({},m,{data_length:d,data_initial_chunk:g})),null!=p&&(m=a({},m,{chain_id:p})),e.typedCall("EthereumSignTx","EthereumTxRequest",m).then(function(t){return i(e,t.message,b)})}Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t=0;a--)if(u[a]!==f[a])return!1;for(a=u.length-1;a>=0;a--)if(s=u[a],!p(e[s],t[s],n,r))return!1;return!0}function v(e,t,n){p(e,t,!0)&&l(e,t,n,"notDeepStrictEqual",v)}function g(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function b(e){var t;try{e()}catch(e){t=e}return t}function m(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=b(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&l(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!e&&w.isError(i),a=!e&&i&&!n;if((s&&o&&g(i,n)||a)&&l(i,n,"Got unwanted exception"+r),e&&i&&n&&!g(i,n)||!e&&i)throw i}var w=e("util/"),E=Object.prototype.hasOwnProperty,_=Array.prototype.slice,T=function(){return"foo"===function(){}.name}(),S=t.exports=h,P=/\s*function\s+([^\(\s]*)\s*/;S.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=c(this),this.generatedMessage=!0);var t=e.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=a(t),o=r.indexOf("\n"+i);if(o>=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}},w.inherits(S.AssertionError,Error),S.fail=l,S.ok=h,S.equal=function(e,t,n){e!=t&&l(e,t,n,"==",S.equal)},S.notEqual=function(e,t,n){e==t&&l(e,t,n,"!=",S.notEqual)},S.deepEqual=function(e,t,n){p(e,t,!1)||l(e,t,n,"deepEqual",S.deepEqual)},S.deepStrictEqual=function(e,t,n){p(e,t,!0)||l(e,t,n,"deepStrictEqual",S.deepStrictEqual)},S.notDeepEqual=function(e,t,n){p(e,t,!1)&&l(e,t,n,"notDeepEqual",S.notDeepEqual)},S.notDeepStrictEqual=v,S.strictEqual=function(e,t,n){e!==t&&l(e,t,n,"===",S.strictEqual)},S.notStrictEqual=function(e,t,n){e===t&&l(e,t,n,"!==",S.notStrictEqual)},S.throws=function(e,t,n){m(!0,e,t,n)},S.doesNotThrow=function(e,t,n){m(!1,e,t,n)},S.ifError=function(e){if(e)throw e};var O=Object.keys||function(e){var t=[];for(var n in e)E.call(e,n)&&t.push(n);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":184}],18:[function(e,t,n){var r=e("safe-buffer").Buffer;t.exports=function(e){function t(t){if(0===t.length)return"";for(var n=[0],r=0;r0;)n.push(o%s),o=o/s|0}for(var a="",u=0;0===t[u]&&u=0;--f)a+=e[n[f]];return a}function n(e){if(0===e.length)return r.allocUnsafe(0);for(var t=[0],n=0;n>=8;for(;f>0;)t.push(255&f),f>>=8}for(var c=0;e[c]===a&&c0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return 3*e.length/4-r(e)}function o(e){var t,n,i,o,s,a=e.length;o=r(e),s=new l(3*a/4-o),n=o>0?a-4:a;var u=0;for(t=0;t>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function s(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function a(e,t,n){for(var r,i=[],o=t;ou?u:s+16383));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}n.byteLength=i,n.toByteArray=o,n.fromByteArray=u;for(var f=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=h.length;p=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i}function o(e){return it.charAt(e)}function s(e,t){var n=ot[e.charCodeAt(t)];return null==n?-1:n}function a(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function u(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+tt:this.t=0}function f(e){var t=new r;return t.fromInt(e),t}function c(e,t){var n,i=this;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void i.fromRadix(e,t);n=2}i.t=0,i.s=0;for(var o=e.length,a=!1,u=0;--o>=0;){var f=8==n?255&e[o]:s(e,o);f<0?"-"==e.charAt(o)&&(a=!0):(a=!1,0==u?i[i.t++]=f:u+n>i.DB?(i[i.t-1]|=(f&(1<>i.DB-u):i[i.t-1]|=f<=i.DB&&(u-=i.DB))}8==n&&0!=(128&e[0])&&(i.s=-1,u>0&&(i[i.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function h(e){var t=this;if(t.s<0)return"-"+t.negate().toString(e);var n;if(16==e)n=4;else if(8==e)n=3;else if(2==e)n=1;else if(32==e)n=5;else{if(4!=e)return t.toRadix(e);n=2}var r,i=(1<0)for(f>f)>0&&(s=!0,a=o(r));u>=0;)f>(f+=t.DB-n)):(r=t[u]>>(f-=n)&i,f<=0&&(f+=t.DB,--u)),r>0&&(s=!0),s&&(a+=o(r));return s?a:"0"}function p(){var e=new r;return r.ZERO.subTo(this,e),e}function d(){return this.s<0?this.negate():this}function y(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function v(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function g(){return this.t<=0?0:this.DB*(this.t-1)+v(this[this.t-1]^this.s&this.DM)}function b(){return this.bitLength()>>3}function m(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n] ;for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function w(e,t){for(var n=e;n=0;--n)t[n+a+1]=r[n]>>o|u,u=(r[n]&s)<=0;--n)t[n]=0;t[a]=u,t.t=r.t+a+1,t.s=r.s,t.clamp()}function _(e,t){var n=this;t.s=n.s;var r=Math.floor(e/n.DB);if(r>=n.t)return void(t.t=0);var i=e%n.DB,o=n.DB-i,s=(1<>i;for(var a=r+1;a>i;i>0&&(t[n.t-r-1]|=(n.s&s)<>=n.DB;if(e.t>=n.DB;i+=n.s}else{for(i+=n.s;r>=n.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[r++]=n.DV+i:i>0&&(t[r++]=i),t.t=r,t.clamp()}function S(e,t){var n=this.abs(),i=e.abs(),o=n.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function O(e,t,n){var i=this,o=e.abs();if(!(o.t<=0)){var s=i.abs();if(s.t0?(o.lShiftTo(c,a),s.lShiftTo(c,n)):(o.copyTo(a),s.copyTo(n));var l=a.t,h=a[l-1];if(0!=h){var p=h*(1<1?a[l-2]>>i.F2:0),d=i.FV/p,y=(1<=0&&(n[n.t++]=1,n.subTo(w,n)),r.ONE.dlShiftTo(l,w),w.subTo(a,a);a.t=0;){var E=n[--b]==h?i.DM:Math.floor(n[b]*d+(n[b-1]+g)*y);if((n[b]+=a.am(0,E,n,m,0,l))0&&n.rShiftTo(c,n),u<0&&r.ZERO.subTo(n,n)}}}function I(e){var t=new r;return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t}function k(e){this.m=e}function x(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function j(e){return e}function A(e){e.divRemTo(this.m,null,e)}function N(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function L(e,t){e.squareTo(t),this.reduce(t)}function R(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function B(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function D(e){var t=new r;return e.copyTo(t),this.reduce(t),t}function C(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function M(e,t){e.squareTo(t),this.reduce(t)}function F(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function z(){return 0==(this.t>0?1&this[0]:this.s)}function q(e,t){if(e>4294967295||e<1)return r.ONE;var n=new r,i=new r,o=t.convert(this),s=v(e)-1;for(o.copyTo(n);--s>=0;)if(t.sqrTo(n,i),(e&1<0)t.mulTo(i,o,n);else{var a=n;n=i,i=a}return t.revert(n)}function H(e,t){var n;return n=e<256||t.isEven()?new k(t):new B(t),this.exp(e,n)}function $(){var e=new r;return this.copyTo(e),e}function V(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function W(){return 0==this.t?this.s:this[0]<<16>>16}function K(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function G(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function Z(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),i=f(n),o=new r,s=new r,a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(n+s.intValue()).toString(e).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(e)+a}function X(e,t){var n=this;n.fromInt(0),null==t&&(t=10);for(var i=n.chunkSize(t),o=Math.pow(t,i),a=!1,u=0,f=0,c=0;c=i&&(n.dMultiply(o),n.dAddOffset(f,0),u=0,f=0))}u>0&&(n.dMultiply(Math.pow(t,u)),n.dAddOffset(f,0)),a&&r.ZERO.subTo(n,n)}function J(e,t,n){var i=this;if("number"==typeof t)if(e<2)i.fromInt(1);else for(i.fromNumber(e,n),i.testBit(e-1)||i.bitwiseTo(r.ONE.shiftLeft(e-1),se,i),i.isEven()&&i.dAddOffset(1,0);!i.isProbablePrime(t);)i.dAddOffset(2,0),i.bitLength()>e&&i.subTo(r.ONE.shiftLeft(e-1),i);else{var o=new Array,s=7&e;o.length=1+(e>>3),t.nextBytes(o),s>0?o[0]&=(1<0)for(i>i)!=(e.s&e.DM)>>i&&(n[o++]=r|e.s<=0;)i<8?(r=(e[t]&(1<>(i+=e.DB-8)):(r=e[t]>>(i-=8)&255,i<=0&&(i+=e.DB,--t)),0!=(128&r)&&(r|=-256),0===o&&(128&e.s)!=(128&r)&&++o,(o>0||r!=e.s)&&(n[o++]=r);return n}function ee(e){return 0==this.compareTo(e)}function te(e){return this.compareTo(e)<0?this:e}function ne(e){return this.compareTo(e)>0?this:e}function re(e,t,n){var r,i,o=this,s=Math.min(e.t,o.t);for(r=0;r>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function ve(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<>=n.DB;if(e.t>=n.DB;i+=n.s}else{for(i+=n.s;r>=n.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[r++]=i:i<-1&&(t[r++]=n.DV+i),t.t=r,t.clamp()}function Pe(e){var t=new r;return this.addTo(e,t),t}function Oe(e){var t=new r;return this.subTo(e,t),t}function Ie(e){var t=new r;return this.multiplyTo(e,t),t}function ke(){var e=new r;return this.squareTo(e),e}function xe(e){var t=new r;return this.divRemTo(e,t,null),t}function je(e){var t=new r;return this.divRemTo(e,null,t),t}function Ae(e){var t=new r,n=new r;return this.divRemTo(e,t,n),new Array(t,n)}function Ne(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Le(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Re(){}function Be(e){return e}function Ue(e,t,n){e.multiplyTo(t,n)}function De(e,t){e.squareTo(t)}function Ce(e){return this.exp(e,new Re)}function Me(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;var i;for(i=n.t-this.t;r=0;)n[r]=0;for(r=Math.max(t-this.t,0);r2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=new r;return e.copyTo(t),this.reduce(t),t}function He(e){return e}function $e(e){var t=this;for(e.drShiftTo(t.m.t-1,t.r2),e.t>t.m.t+1&&(e.t=t.m.t+1,e.clamp()),t.mu.multiplyUpperTo(t.r2,t.m.t+1,t.q3),t.m.multiplyLowerTo(t.q3,t.m.t+1,t.r2);e.compareTo(t.r2)<0;)e.dAddOffset(1,t.m.t+1);for(e.subTo(t.r2,e);e.compareTo(t.m)>=0;)e.subTo(t.m,e)}function Ve(e,t){e.squareTo(t),this.reduce(t)}function Ye(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function We(e,t){var n,i,o=e.bitLength(),s=f(1);if(o<=0)return s;n=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new k(t):t.isEven()?new ze(t):new B(t);var a=new Array,u=3,c=n-1,l=(1<1){var h=new r;for(i.sqrTo(a[1],h);u<=l;)a[u]=new r,i.mulTo(h,a[u-2],a[u]),u+=2}var p,d,y=e.t-1,g=!0,b=new r;for(o=v(e[y])-1;y>=0;){for(o>=c?p=e[y]>>o-c&l:(p=(e[y]&(1<0&&(p|=e[y-1]>>this.DB+o-c)),u=n;0==(1&p);)p>>=1,--u;if((o-=u)<0&&(o+=this.DB,--y),g)a[p].copyTo(s),g=!1;else{for(;u>1;)i.sqrTo(s,b),i.sqrTo(b,s),u-=2;u>0?i.sqrTo(s,b):(d=s,s=b,b=d),i.mulTo(b,a[p],s)}for(;y>=0&&0==(e[y]&1<0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function Ge(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function Ze(e){var t=e.isEven();if(0===this.signum())throw new Error("division by zero");if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var n=e.clone(),i=this.clone(),o=f(1),s=f(0),a=f(0),u=f(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),t?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),t&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(n,i),t&&a.subTo(o,a),u.subTo(s,u))}if(0!=i.compareTo(r.ONE))return r.ZERO;for(;u.compareTo(e)>=0;)u.subTo(e,u);for(;u.signum()<0;)u.addTo(e,u);return u}function Xe(e){var t,n=this.abs();if(1==n.t&&n[0]<=st[st.length-1]){for(t=0;t>1)>st.length&&(e=st.length);for(var o,s=new r(null),a=[],u=0;u72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var n=e[5+t];return 0!==n&&(6+t+n===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(n>1&&0===e[t+6]&&!(128&e[t+7]))))))}function i(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function o(e,t){var n=e.length,r=t.length;if(0===n)throw new Error("R length is zero");if(0===r)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(r>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var i=s.allocUnsafe(6+n+r);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+n]=2,i[5+n]=t.length,t.copy(i,6+n),i}var s=e("safe-buffer").Buffer;t.exports={check:r,decode:i,encode:o}},{"safe-buffer":143}],25:[function(e,t,n){t.exports={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_1:81,OP_TRUE:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}},{}],26:[function(e,t,n){var r=e("./index.json"),i={};for(var o in r){i[r[o]]=o}t.exports=i},{"./index.json":25}],27:[function(e,t,n){(function(n){function r(e){var t=a.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>22)throw new TypeError(e+" is too long");var n=22===t.length,r=n?2:1,i=n?t.readUInt16BE(0):t[0];return{hash:t.slice(r),version:i}}function i(e,t){c(l.tuple(l.Hash160bit,l.UInt16),arguments);var r=t>255,i=r?22:21,o=r?2:1,s=new n(i);return r?s.writeUInt16BE(t,0):s.writeUInt8(t,0),e.copy(s,o),a.encode(s)}function o(e,t){if(t=t||f.bitcoin,u.pubKeyHash.output.check(e))return i(u.compile(e).slice(3,23),t.pubKeyHash);if(u.scriptHash.output.check(e))return i(u.compile(e).slice(2,22),t.scriptHash);throw new Error(u.toASM(e)+" has no matching Address")}function s(e,t){t=t||f.bitcoin;var n=r(e);if(n.version===t.pubKeyHash)return u.pubKeyHash.output.encode(n.hash);if(n.version===t.scriptHash)return u.scriptHash.output.encode(n.hash);throw new Error(e+" has no matching Script")}var a=e("bs58check"),u=e("./script"),f=e("./networks"),c=e("typeforce"),l=e("./types");t.exports={fromBase58Check:r,fromOutputScript:o,toBase58Check:i,toOutputScript:s}}).call(this,e("buffer").Buffer)},{"./networks":36,"./script":37,"./types":63,bs58check:67,buffer:68,typeforce:178}],28:[function(e,t,n){(function(n){function r(){this.version=1,this.prevHash=null,this.merkleRoot=null,this.timestamp=0,this.bits=0,this.nonce=0}var i=e("./bufferutils"),o=e("./crypto"),s=e("merkle-lib/fastRoot"),a=e("typeforce"),u=e("./types"),f=e("./transaction");r.fromBuffer=function(e){function t(t){return o+=t,e.slice(o-t,o)}function n(){var t=e.readUInt32LE(o);return o+=4,t}if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");var o=0,s=new r;if(s.version=function(){var t=e.readInt32LE(o);return o+=4,t}(),s.prevHash=t(32),s.merkleRoot=t(32),s.timestamp=n(),s.bits=n(),s.nonce=n(),80===e.length)return s;var a=function(){var t=i.readVarInt(e,o);return o+=t.size,t.number}();s.transactions=[];for(var u=0;u>24)-3,r=8388607&e,i=new n(32);return i.fill(0),i.writeUInt32BE(r,28-t),i},r.calculateMerkleRoot=function(e){if(a([{getHash:u.Function}],e),0===e.length)throw TypeError("Cannot compute merkle root for zero transactions");var t=e.map(function(e){return e.getHash()});return s(t,o.hash256)},r.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;var e=r.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)},r.prototype.checkProofOfWork=function(){var e=this.getHash().reverse(),t=r.calculateTarget(this.bits);return e.compare(t)<=0},t.exports=r}).call(this,e("buffer").Buffer)},{"./bufferutils":29,"./crypto":30,"./transaction":61,"./types":63,buffer:68,"merkle-lib/fastRoot":115,typeforce:178}],29:[function(e,t,n){function r(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function i(e,t){var n=e.readUInt32LE(t),i=e.readUInt32LE(t+4);return i*=4294967296,r(i+n,9007199254740991),i+n}function o(e,t,n){return r(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}function s(e,t){return{number:f.decode(e,t),size:f.decode.bytes}}function a(e,t,n){return f.encode(t,e,n),f.encode.bytes}var u=e("pushdata-bitcoin"),f=e("varuint-bitcoin");t.exports={pushDataSize:u.encodingLength,readPushDataInt:u.decode,readUInt64LE:i,readVarInt:s,varIntBuffer:f.encode,varIntSize:f.encodingLength,writePushDataInt:u.encode,writeUInt64LE:o,writeVarInt:a}},{"pushdata-bitcoin":127,"varuint-bitcoin":185}],30:[function(e,t,n){function r(e){return u("rmd160").update(e).digest()}function i(e){return u("sha1").update(e).digest()}function o(e){return u("sha256").update(e).digest()}function s(e){return r(o(e))}function a(e){return o(o(e))}var u=e("create-hash");t.exports={hash160:s,hash256:a,ripemd160:r,sha1:i,sha256:o}},{"create-hash":72}],31:[function(e,t,n){(function(n){function r(e,t,r){a(u.tuple(u.Hash256bit,u.Buffer256bit,u.Function),arguments);var i=new n(32),o=new n(32);o.fill(1),i.fill(0),i=s("sha256",i).update(o).update(l).update(t).update(e).digest(),o=s("sha256",i).update(o).digest(),i=s("sha256",i).update(o).update(h).update(t).update(e).digest(),o=s("sha256",i).update(o).digest(),o=s("sha256",i).update(o).digest();for(var c=f.fromBuffer(o);c.signum()<=0||c.compareTo(d.n)>=0||!r(c);)i=s("sha256",i).update(o).update(l).digest(),o=s("sha256",i).update(o).digest(),o=s("sha256",i).update(o).digest(),c=f.fromBuffer(o);return c}function i(e,t){a(u.tuple(u.Hash256bit,u.BigInt),arguments);var n,i,o=t.toBuffer(32),s=f.fromBuffer(e),l=d.n,h=d.G;return r(e,o,function(e){var r=h.multiply(e);return!d.isInfinity(r)&&(n=r.affineX.mod(l),0!==n.signum()&&(i=e.modInverse(l).multiply(s.add(t.multiply(n))).mod(l),0!==i.signum()))}),i.compareTo(y)>0&&(i=l.subtract(i)),new c(n,i)}function o(e,t,n){a(u.tuple(u.Hash256bit,u.ECSignature,u.ECPoint),arguments);var r=d.n,i=d.G,o=t.r,s=t.s;if(o.signum()<=0||o.compareTo(r)>=0)return!1;if(s.signum()<=0||s.compareTo(r)>=0)return!1;var c=f.fromBuffer(e),l=s.modInverse(r),h=c.multiply(l).mod(r),p=o.multiply(l).mod(r),y=i.multiplyTwo(h,n,p);return!d.isInfinity(y)&&y.affineX.mod(r).equals(o)}var s=e("create-hmac"),a=e("typeforce"),u=e("./types"),f=e("bigi"),c=e("./ecsignature"),l=new n([0]),h=new n([1]),p=e("ecurve"),d=p.getCurveByName("secp256k1"),y=d.n.shiftRight(1);t.exports={deterministicGenerateK:r,sign:i,verify:o,__curve:d}}).call(this,e("buffer").Buffer)},{"./ecsignature":33,"./types":63,bigi:22,buffer:68,"create-hmac":75,ecurve:80,typeforce:178}],32:[function(e,t,n){function r(e,t,n){if(n&&u({compressed:f.maybe(f.Boolean),network:f.maybe(f.Network)},n),n=n||{},e){if(e.signum()<=0)throw new Error("Private key must be greater than 0");if(e.compareTo(d.n)>=0)throw new Error("Private key must be less than the curve order");if(t)throw new TypeError("Unexpected publicKey parameter");this.d=e}else u(f.ECPoint,t),this.__Q=t;this.compressed=void 0===n.compressed||n.compressed,this.network=n.network||l.bitcoin}var i=e("./address"),o=e("./crypto"),s=e("./ecdsa"),a=e("randombytes"),u=e("typeforce"),f=e("./types"),c=e("wif"),l=e("./networks"),h=e("bigi"),p=e("ecurve"),d=s.__curve;Object.defineProperty(r.prototype,"Q",{get:function(){return!this.__Q&&this.d&&(this.__Q=d.G.multiply(this.d)),this.__Q}}),r.fromPublicKeyBuffer=function(e,t){var n=p.Point.decodeFrom(d,e);return new r(null,n,{compressed:n.compressed,network:t})},r.fromWIF=function(e,t){var n=c.decode(e),i=n.version;if(f.Array(t)){if(!(t=t.filter(function(e){return i===e.wif}).pop()))throw new Error("Unknown network version")}else if(t=t||l.bitcoin,i!==t.wif)throw new Error("Invalid network version");return new r(h.fromBuffer(n.privateKey),null,{compressed:n.compressed,network:t})},r.makeRandom=function(e){e=e||{};var t,n=e.rng||a;do{var i=n(32);u(f.Buffer256bit,i),t=h.fromBuffer(i)}while(t.signum()<=0||t.compareTo(d.n)>=0);return new r(t,null,e)},r.prototype.getAddress=function(){return i.toBase58Check(o.hash160(this.getPublicKeyBuffer()),this.getNetwork().pubKeyHash)},r.prototype.getNetwork=function(){return this.network},r.prototype.getPublicKeyBuffer=function(){return this.Q.getEncoded(this.compressed)},r.prototype.sign=function(e){if(!this.d)throw new Error("Missing private key");return s.sign(e,this.d)},r.prototype.toWIF=function(){if(!this.d)throw new Error("Missing private key");return c.encode(this.network.wif,this.d.toBuffer(32),this.compressed)},r.prototype.verify=function(e,t){return s.verify(e,t,this.Q)},t.exports=r},{"./address":27,"./crypto":30,"./ecdsa":31,"./networks":36,"./types":63,bigi:22,ecurve:80,randombytes:128,typeforce:178,wif:187}],33:[function(e,t,n){(function(n){function r(e,t){o(s.tuple(s.BigInt,s.BigInt),arguments),this.r=e,this.s=t}var i=e("bip66"),o=e("typeforce"),s=e("./types"),a=e("bigi");r.parseCompact=function(e){if(65!==e.length)throw new Error("Invalid signature length");var t=e.readUInt8(0)-27;if(t!==(7&t))throw new Error("Invalid signature parameter");return{compressed:!!(4&t),i:3&t,signature:new r(a.fromBuffer(e.slice(1,33)),a.fromBuffer(e.slice(33)))}},r.fromDER=function(e){var t=i.decode(e);return new r(a.fromDERInteger(t.r),a.fromDERInteger(t.s))},r.parseScriptSignature=function(e){var t=e.readUInt8(e.length-1),n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);return{signature:r.fromDER(e.slice(0,-1)),hashType:t}},r.prototype.toCompact=function(e,t){t&&(e+=4),e+=27;var r=new n(65);return r.writeUInt8(e,0),this.r.toBuffer(32).copy(r,1),this.s.toBuffer(32).copy(r,33),r},r.prototype.toDER=function(){var e=new n(this.r.toDERInteger()),t=new n(this.s.toDERInteger());return i.encode(e,t)},r.prototype.toScriptSignature=function(e){var t=-129&e;if(t<=0||t>=4)throw new Error("Invalid hashType "+e);var r=new n(1);return r.writeUInt8(e,0),n.concat([this.toDER(),r])},t.exports=r}).call(this,e("buffer").Buffer)},{"./types":63,bigi:22,bip66:24,buffer:68,typeforce:178}],34:[function(e,t,n){(function(n){function r(e,t){if(a(u.tuple("ECPair",u.Buffer256bit),arguments),!e.compressed)throw new TypeError("BIP32 only allows compressed keyPairs");this.keyPair=e,this.chainCode=t,this.depth=0,this.index=0,this.parentFingerprint=0}var i=e("bs58check"),o=e("./crypto"),s=e("create-hmac"),a=e("typeforce"),u=e("./types"),f=e("./networks"),c=e("bigi"),l=e("./ecpair"),h=e("ecurve"),p=h.getCurveByName("secp256k1");r.HIGHEST_BIT=2147483648,r.LENGTH=78,r.MASTER_SECRET=new n("Bitcoin seed"),r.fromSeedBuffer=function(e,t){if(a(u.tuple(u.Buffer,u.maybe(u.Network)),arguments),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");var n=s("sha512",r.MASTER_SECRET).update(e).digest(),i=n.slice(0,32),o=n.slice(32),f=c.fromBuffer(i);return new r(new l(f,null,{network:t}),o)}, r.fromSeedHex=function(e,t){return r.fromSeedBuffer(new n(e,"hex"),t)},r.fromBase58=function(e,t,n){var o=i.decode(e);if(78!==o.length)throw new Error("Invalid buffer length");var s,a=o.readUInt32BE(0);if(Array.isArray(t)){if(!(s=t.filter(function(e){return a===e.bip32.private||a===e.bip32.public}).pop()))throw new Error("Unknown network version")}else s=t||f.bitcoin;if(a!==s.bip32.private&&a!==s.bip32.public)throw new Error("Invalid network version");var u=o[4],d=o.readUInt32BE(5);if(0===u&&0!==d)throw new Error("Invalid parent fingerprint");var y=o.readUInt32BE(9);if(0===u&&0!==y)throw new Error("Invalid index");var v,g=o.slice(13,45);if(a===s.bip32.private){if(0!==o.readUInt8(45))throw new Error("Invalid private key");var b=c.fromBuffer(o.slice(46,78));v=new l(b,null,{network:s})}else{var m=h.Point.decodeFrom(p,o.slice(45,78));n||p.validate(m),v=new l(null,m,{network:s})}var w=new r(v,g);return w.depth=u,w.index=y,w.parentFingerprint=d,w},r.prototype.getAddress=function(){return this.keyPair.getAddress()},r.prototype.getIdentifier=function(){return o.hash160(this.keyPair.getPublicKeyBuffer())},r.prototype.getFingerprint=function(){return this.getIdentifier().slice(0,4)},r.prototype.getNetwork=function(){return this.keyPair.getNetwork()},r.prototype.getPublicKeyBuffer=function(){return this.keyPair.getPublicKeyBuffer()},r.prototype.neutered=function(){var e=new l(null,this.keyPair.Q,{network:this.keyPair.network}),t=new r(e,this.chainCode);return t.depth=this.depth,t.index=this.index,t.parentFingerprint=this.parentFingerprint,t},r.prototype.sign=function(e){return this.keyPair.sign(e)},r.prototype.verify=function(e,t){return this.keyPair.verify(e,t)},r.prototype.toBase58=function(e){if(void 0!==e)throw new TypeError("Unsupported argument in 2.0.0");var t=this.keyPair.network,r=this.isNeutered()?t.bip32.public:t.bip32.private,o=new n(78);return o.writeUInt32BE(r,0),o.writeUInt8(this.depth,4),o.writeUInt32BE(this.parentFingerprint,5),o.writeUInt32BE(this.index,9),this.chainCode.copy(o,13),this.isNeutered()?this.keyPair.getPublicKeyBuffer().copy(o,45):(o.writeUInt8(0,45),this.keyPair.d.toBuffer(32).copy(o,46)),i.encode(o)},r.prototype.derive=function(e){a(u.UInt32,e);var t=e>=r.HIGHEST_BIT,i=new n(37);if(t){if(this.isNeutered())throw new TypeError("Could not derive hardened child key");i[0]=0,this.keyPair.d.toBuffer(32).copy(i,1),i.writeUInt32BE(e,33)}else this.keyPair.getPublicKeyBuffer().copy(i,0),i.writeUInt32BE(e,33);var o=s("sha512",this.chainCode).update(i).digest(),f=o.slice(0,32),h=o.slice(32),d=c.fromBuffer(f);if(d.compareTo(p.n)>=0)return this.derive(e+1);var y;if(this.isNeutered()){var v=p.G.multiply(d).add(this.keyPair.Q);if(p.isInfinity(v))return this.derive(e+1);y=new l(null,v,{network:this.keyPair.network})}else{var g=d.add(this.keyPair.d).mod(p.n);if(0===g.signum())return this.derive(e+1);y=new l(g,null,{network:this.keyPair.network})}var b=new r(y,h);return b.depth=this.depth+1,b.index=e,b.parentFingerprint=this.getFingerprint().readUInt32BE(0),b},r.prototype.deriveHardened=function(e){return a(u.UInt31,e),this.derive(e+r.HIGHEST_BIT)},r.prototype.isNeutered=function(){return!this.keyPair.d},r.prototype.derivePath=function(e){a(u.BIP32Path,e);var t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new Error("Not a master node");t=t.slice(1)}return t.reduce(function(e,t){var n;return"'"===t.slice(-1)?(n=parseInt(t.slice(0,-1),10),e.deriveHardened(n)):(n=parseInt(t,10),e.derive(n))},this)},t.exports=r}).call(this,e("buffer").Buffer)},{"./crypto":30,"./ecpair":32,"./networks":36,"./types":63,bigi:22,bs58check:67,buffer:68,"create-hmac":75,ecurve:80,typeforce:178}],35:[function(e,t,n){t.exports={Block:e("./block"),ECPair:e("./ecpair"),ECSignature:e("./ecsignature"),HDNode:e("./hdnode"),Transaction:e("./transaction"),TransactionBuilder:e("./transaction_builder"),address:e("./address"),bufferutils:e("./bufferutils"),crypto:e("./crypto"),networks:e("./networks"),opcodes:e("bitcoin-ops"),script:e("./script")}},{"./address":27,"./block":28,"./bufferutils":29,"./crypto":30,"./ecpair":32,"./ecsignature":33,"./hdnode":34,"./networks":36,"./script":37,"./transaction":61,"./transaction_builder":62,"bitcoin-ops":25}],36:[function(e,t,n){t.exports={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},litecoin:{messagePrefix:"Litecoin Signed Message:\n",bip32:{public:27108450,private:27106558},pubKeyHash:48,scriptHash:5,wif:176}}},{}],37:[function(e,t,n){(function(n){function r(e){return g.Number(e)&&(e===m.OP_0||e>=m.OP_1&&e<=m.OP_16||e===m.OP_1NEGATE)}function i(e){return g.Buffer(e)||r(e)}function o(e){return g.Array(e)&&e.every(i)}function s(e){if(n.isBuffer(e))return e;v(g.Array,e);var t=e.reduce(function(e,t){return n.isBuffer(t)?1===t.length&&(129===t[0]||t[0]>=1&&t[0]<=16)?e+1:e+y.encodingLength(t.length)+t.length:e+1},0),r=new n(t),i=0;if(e.forEach(function(e){if(n.isBuffer(e)){if(1===e.length&&e[0]>=1&&e[0]<=16){var t=E+e[0];return r.writeUInt8(t,i),void(i+=1)}if(1===e.length&&129===e[0])return r.writeUInt8(m.OP_1NEGATE,i),void(i+=1);i+=y.encode(r,e.length,i),e.copy(r,i),i+=e.length}else r.writeUInt8(e,i),i+=1}),i!==r.length)throw new Error("Could not decode chunks");return r}function a(e){if(g.Array(e))return e;v(g.Buffer,e);for(var t=[],n=0;nm.OP_0&&r<=m.OP_PUSHDATA4){var i=y.decode(e,n);if(null===i)return[];if((n+=i.size)+i.number>e.length)return[];var o=e.slice(n,n+i.number);n+=i.number,t.push(o)}else t.push(r),n+=1}return t}function u(e){return n.isBuffer(e)&&(e=a(e)),e.map(function(e){return n.isBuffer(e)?e.toString("hex"):w[e]}).join(" ")}function f(e){return v(g.String,e),s(e.split(" ").map(function(e){return void 0!==m[e]?m[e]:(v(g.Hex,e),new n(e,"hex"))}))}function c(e){return e=a(e),v(o,e),e.map(function(e){return n.isBuffer(e)?e:e===m.OP_0?new n(0):b.encode(e-E)})}function l(e){if(!n.isBuffer(e))return!1;if(e.length<33)return!1;switch(e[0]){case 2:case 3:return 33===e.length;case 4:return 65===e.length}return!1}function h(e){var t=-129&e;return t>0&&t<4}function p(e){return!!n.isBuffer(e)&&(!!h(e[e.length-1])&&d.check(e.slice(0,-1)))}var d=e("bip66"),y=e("pushdata-bitcoin"),v=e("typeforce"),g=e("./types"),b=e("./script_number"),m=e("bitcoin-ops"),w=e("bitcoin-ops/map"),E=m.OP_RESERVED;t.exports={compile:s,decompile:a,fromASM:f,toASM:u,toStack:c,number:e("./script_number"),isCanonicalPubKey:l,isCanonicalSignature:p,isPushOnly:o,isDefinedHashType:h};var _=e("./templates");for(var T in _)t.exports[T]=_[T]}).call(this,e("buffer").Buffer)},{"./script_number":38,"./templates":39,"./types":63,bip66:24,"bitcoin-ops":25,"bitcoin-ops/map":26,buffer:68,"pushdata-bitcoin":127,typeforce:178}],38:[function(e,t,n){(function(e){function n(e,t,n){t=t||4,n=void 0===n||n;var r=e.length;if(0===r)return 0;if(r>t)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){var i=e.readUInt32LE(0),o=e.readUInt8(4);return 128&o?-(4294967296*(-129&o)+i):4294967296*o+i}for(var s=0,a=0;a2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function i(t){for(var n=Math.abs(t),i=r(n),o=new e(i),s=t<0,a=0;a>=8;return 128&o[i-1]?o.writeUInt8(s?128:0,i-1):s&&(o[i-1]|=128),o}t.exports={decode:n,encode:i}}).call(this,e("buffer").Buffer)},{buffer:68}],39:[function(e,t,n){function r(e){if(h.output.check(e))return y.P2WPKH;if(p.output.check(e))return y.P2WSH;if(c.output.check(e))return y.P2PKH;if(l.output.check(e))return y.P2SH;var t=s(e);return a.output.check(t)?y.MULTISIG:f.output.check(t)?y.P2PK:d.output.check(t)?y.WITNESS_COMMITMENT:u.output.check(t)?y.NULLDATA:y.NONSTANDARD}function i(e,t){var n=s(e);return c.input.check(n)?y.P2PKH:l.input.check(n,t)?y.P2SH:a.input.check(n,t)?y.MULTISIG:f.input.check(n)?y.P2PK:y.NONSTANDARD}function o(e,t){var n=s(e);return h.input.check(n)?y.P2WPKH:p.input.check(n)?y.P2WSH:y.NONSTANDARD}var s=e("../script").decompile,a=e("./multisig"),u=e("./nulldata"),f=e("./pubkey"),c=e("./pubkeyhash"),l=e("./scripthash"),h=e("./witnesspubkeyhash"),p=e("./witnessscripthash"),d=e("./witnesscommitment"),y={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};t.exports={classifyInput:i,classifyOutput:r,classifyWitness:o,multisig:a,nullData:u,pubKey:f,pubKeyHash:c,scriptHash:l,witnessPubKeyHash:h,witnessScriptHash:p,witnessCommitment:d,types:y}},{"../script":37,"./multisig":40,"./nulldata":43,"./pubkey":44,"./pubkeyhash":47,"./scripthash":50,"./witnesscommitment":53,"./witnesspubkeyhash":55,"./witnessscripthash":58}],40:[function(e,t,n){t.exports={input:e("./input"),output:e("./output")}},{"./input":41,"./output":42}],41:[function(e,t,n){(function(n){function r(e){return e===l.OP_0||f.isCanonicalSignature(e)}function i(e,t){var n=f.decompile(e);return!(n.length<2)&&(n[0]===l.OP_0&&(t?n.slice(1).every(r):n.slice(1).every(f.isCanonicalSignature)))}function o(e,t){if(c([r],e),t){var i=f.multisig.output.decode(t);if(e.lengthi.pubKeys.length)throw new TypeError("Too many signatures provided")}return[].concat(new n(0),e)}function s(e,t){return f.compile(o(e,t))}function a(e,t){return c(i,e,t),e.slice(1)}function u(e,t){return a(f.decompile(e),t)}var f=e("../../script"),c=e("typeforce"),l=e("bitcoin-ops");i.toJSON=function(){return"multisig input"},t.exports={check:i,decode:u,decodeStack:a,encode:s,encodeStack:o}}).call(this,e("buffer").Buffer)},{"../../script":37,"bitcoin-ops":25,buffer:68,typeforce:178}],42:[function(e,t,n){function r(e,t){var n=s.decompile(e);if(n.length<4)return!1;if(n[n.length-1]!==f.OP_CHECKMULTISIG)return!1;if(!a.Number(n[0]))return!1;if(!a.Number(n[n.length-2]))return!1;var r=n[0]-c,i=n[n.length-2]-c;return!(r<=0)&&(!(i>16)&&(!(r>i)&&(i===n.length-3&&(!!t||n.slice(1,-2).every(s.isCanonicalPubKey)))))}function i(e,t){u({m:a.Number,pubKeys:[s.isCanonicalPubKey]},{m:e,pubKeys:t});var n=t.length;if(n1&&t[0]===f.OP_RETURN}function i(e){return u(a.Buffer,e),s.compile([f.OP_RETURN,e])}function o(e){return u(r,e),e.slice(2)}var s=e("../script"),a=e("../types"),u=e("typeforce"),f=e("bitcoin-ops");r.toJSON=function(){return"null data output"},t.exports={output:{check:r,decode:o,encode:i}}},{"../script":37,"../types":63,"bitcoin-ops":25,typeforce:178}],44:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"./input":45,"./output":46,dup:40}],45:[function(e,t,n){function r(e){var t=u.decompile(e);return 1===t.length&&u.isCanonicalSignature(t[0])}function i(e){return c(f.Buffer,e),[e]}function o(e){return u.compile(i(e))}function s(e){return c(r,e),e[0]}function a(e){return s(u.decompile(e))}var u=e("../../script"),f=e("../../types"),c=e("typeforce");r.toJSON=function(){return"pubKey input"},t.exports={check:r,decode:a,decodeStack:s,encode:o,encodeStack:i}},{"../../script":37,"../../types":63,typeforce:178}],46:[function(e,t,n){function r(e){var t=s.decompile(e);return 2===t.length&&s.isCanonicalPubKey(t[0])&&t[1]===u.OP_CHECKSIG}function i(e){return a(s.isCanonicalPubKey,e),s.compile([e,u.OP_CHECKSIG])}function o(e){var t=s.decompile(e);return a(r,t),t[0]}var s=e("../../script"),a=e("typeforce"),u=e("bitcoin-ops");r.toJSON=function(){return"pubKey output"},t.exports={check:r,decode:o,encode:i}},{"../../script":37,"bitcoin-ops":25,typeforce:178}],47:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"./input":48,"./output":49,dup:40}],48:[function(e,t,n){function r(e){var t=u.decompile(e);return 2===t.length&&u.isCanonicalSignature(t[0])&&u.isCanonicalPubKey(t[1])}function i(e,t){return c({signature:f.Buffer,pubKey:f.Buffer},{signature:e,pubKey:t}),[e,t]}function o(e,t){return u.compile(i(e,t))}function s(e){return c(r,e),{signature:e[0],pubKey:e[1]}}function a(e){return s(u.decompile(e))}var u=e("../../script"),f=e("../../types"),c=e("typeforce");r.toJSON=function(){return"pubKeyHash input"},t.exports={check:r,decode:a,decodeStack:s,encode:o,encodeStack:i}},{"../../script":37,"../../types":63,typeforce:178}],49:[function(e,t,n){function r(e){var t=s.compile(e);return 25===t.length&&t[0]===f.OP_DUP&&t[1]===f.OP_HASH160&&20===t[2]&&t[23]===f.OP_EQUALVERIFY&&t[24]===f.OP_CHECKSIG}function i(e){return u(a.Hash160bit,e),s.compile([f.OP_DUP,f.OP_HASH160,e,f.OP_EQUALVERIFY,f.OP_CHECKSIG])}function o(e){return u(r,e),e.slice(3,23)}var s=e("../../script"),a=e("../../types"),u=e("typeforce"),f=e("bitcoin-ops");r.toJSON=function(){return"pubKeyHash output"},t.exports={check:r,decode:o,encode:i}},{"../../script":37,"../../types":63,"bitcoin-ops":25,typeforce:178}],50:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"./input":51,"./output":52,dup:40}],51:[function(e,t,n){(function(n){function r(e,t){var r=u.decompile(e);if(r.length<1)return!1;var i=r[r.length-1];if(!n.isBuffer(i))return!1;var o=u.decompile(u.compile(r.slice(0,-1))),s=u.decompile(i);if(0===s.length)return!1;if(!u.isPushOnly(o))return!1;var a=u.classifyInput(o,t),f=u.classifyOutput(s);return 1===r.length?f===u.types.P2WSH||f===u.types.P2WPKH:a===f}function i(e,t){return[].concat(e,u.compile(t))}function o(e,t){var n=u.decompile(e);return u.compile(i(n,t))}function s(e){return f(r,e),{redeemScriptStack:e.slice(0,-1),redeemScript:e[e.length-1]}}function a(e){var t=u.decompile(e),n=s(t);return n.redeemScriptSig=u.compile(n.redeemScriptStack),delete n.redeemScriptStack,n}var u=e("../../script"),f=e("typeforce");r.toJSON=function(){return"scriptHash input"},t.exports={check:r,decode:a,decodeStack:s,encode:o,encodeStack:i}}).call(this,{isBuffer:e("../../../../is-buffer/index.js")})},{"../../../../is-buffer/index.js":104,"../../script":37,typeforce:178}],52:[function(e,t,n){function r(e){var t=s.compile(e);return 23===t.length&&t[0]===f.OP_HASH160&&20===t[1]&&t[22]===f.OP_EQUAL}function i(e){return u(a.Hash160bit,e),s.compile([f.OP_HASH160,e,f.OP_EQUAL])}function o(e){return u(r,e),e.slice(2,22)}var s=e("../../script"),a=e("../../types"),u=e("typeforce"),f=e("bitcoin-ops");r.toJSON=function(){return"scriptHash output"},t.exports={check:r,decode:o,encode:i}},{"../../script":37,"../../types":63,"bitcoin-ops":25,typeforce:178}],53:[function(e,t,n){t.exports={output:e("./output")}},{"./output":54}],54:[function(e,t,n){(function(n){function r(e){var t=s.compile(e);return t.length>37&&t[0]===f.OP_RETURN&&36===t[1]&&t.slice(2,6).equals(c)}function i(e){return u(a.Hash256bit,e),s.compile([f.OP_RETURN,n.concat([c,e])])}function o(e){return u(r,e),s.decompile(e)[1].slice(4,36)}var s=e("../../script"),a=e("../../types"),u=e("typeforce"),f=e("bitcoin-ops"),c=new n("aa21a9ed","hex");r.toJSON=function(){return"Witness commitment output"},t.exports={check:r,decode:o,encode:i}}).call(this,e("buffer").Buffer)},{"../../script":37,"../../types":63,"bitcoin-ops":25,buffer:68,typeforce:178}],55:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"./input":56,"./output":57,dup:40}],56:[function(e,t,n){var r=e("../pubkeyhash/input");t.exports={check:r.check,decodeStack:r.decodeStack,encodeStack:r.encodeStack}},{"../pubkeyhash/input":48}],57:[function(e,t,n){function r(e){var t=s.compile(e);return 22===t.length&&t[0]===f.OP_0&&20===t[1]}function i(e){return u(a.Hash160bit,e),s.compile([f.OP_0,e])}function o(e){return u(r,e),e.slice(2)}var s=e("../../script"),a=e("../../types"),u=e("typeforce"),f=e("bitcoin-ops");r.toJSON=function(){return"Witness pubKeyHash output"},t.exports={check:r,decode:o,encode:i}},{"../../script":37,"../../types":63,"bitcoin-ops":25,typeforce:178}],58:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"./input":59,"./output":60,dup:40}],59:[function(e,t,n){var r=e("../scripthash/input");t.exports={check:r.check,decodeStack:r.decodeStack,encodeStack:r.encodeStack}},{"../scripthash/input":51}],60:[function(e,t,n){function r(e){var t=s.compile(e);return 34===t.length&&t[0]===f.OP_0&&32===t[1]}function i(e){return u(a.Hash256bit,e),s.compile([f.OP_0,e])}function o(e){return u(r,e),e.slice(2)}var s=e("../../script"),a=e("../../types"),u=e("typeforce"),f=e("bitcoin-ops");r.toJSON=function(){return"Witness scriptHash output"},t.exports={check:r,decode:o,encode:i}},{"../../script":37,"../../types":63,"bitcoin-ops":25,typeforce:178}],61:[function(e,t,n){(function(n){function r(e){var t=e.length;return u.varIntSize(t)+t}function i(e){var t=e.length;return u.varIntSize(t)+e.reduce(function(e,t){return e+r(t)},0)}function o(){this.version=1,this.locktime=0,this.ins=[],this.outs=[],this.joinsplits=[]}var s=e("./crypto"),a=e("./script"),u=e("./bufferutils"),f=e("bitcoin-ops"),c=e("typeforce"),l=e("./types");o.DEFAULT_SEQUENCE=4294967295,o.SIGHASH_ALL=1,o.SIGHASH_NONE=2,o.SIGHASH_SINGLE=3,o.SIGHASH_ANYONECANPAY=128,o.ADVANCED_TRANSACTION_MARKER=0,o.ADVANCED_TRANSACTION_FLAG=1;var h=new n(0),p=[],d=new n("0000000000000000000000000000000000000000000000000000000000000000","hex"),y=new n("0000000000000000000000000000000000000000000000000000000000000001","hex"),v=new n("ffffffffffffffff","hex"),g={script:h,valueBuffer:v};o.ZCASH_NUM_JS_INPUTS=2,o.ZCASH_NUM_JS_OUTPUTS=2,o.ZCASH_NOTECIPHERTEXT_SIZE=601,o.ZCASH_G1_PREFIX_MASK=2,o.ZCASH_G2_PREFIX_MASK=10,o.fromBuffer=function(e,t,n){function r(t){return h+=t,e.slice(h-t,h)}function i(){var t=e.readUInt8(h);return h+=1,t}function s(){var t=e.readUInt32LE(h);return h+=4,t}function a(){var t=u.readUInt64LE(e,h);return h+=8,t}function f(){var t=u.readVarInt(e,h);return h+=t.size,t.number}function c(){return r(f())}function l(){var e=1&i();return{x:r(32),yLsb:e}}var h=0,d=new o;d.version=function(){var t=e.readInt32LE(h);return h+=4,t}();var y=e.readUInt8(h),v=e.readUInt8(h+1),g=!1;t||y===o.ADVANCED_TRANSACTION_MARKER&&v===o.ADVANCED_TRANSACTION_FLAG&&(h+=2,g=!0);for(var b=f(),m=0;m=2&&t){var E=f();for(m=0;m0&&(d.joinsplitPubkey=r(32),d.joinsplitSig=r(64))}if(d.zcash=!!t,n)return d;if(h!==e.length)throw new Error("Transaction has unexpected data");return d},o.fromHex=function(e,t){return o.fromBuffer(new n(e,"hex"),t)},o.isCoinbaseHash=function(e){c(l.Hash256bit,e);for(var t=0;t<32;++t)if(0!==e[t])return!1;return!0},o.prototype.isCoinbase=function(){return 1===this.ins.length&&o.isCoinbaseHash(this.ins[0].hash)},o.prototype.addInput=function(e,t,n,r){return c(l.tuple(l.Hash256bit,l.UInt32,l.maybe(l.UInt32),l.maybe(l.Buffer)),arguments),l.Null(n)&&(n=o.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:r||h,sequence:n,witness:p})-1},o.prototype.addOutput=function(e,t){return c(l.tuple(l.Buffer,l.Satoshi),arguments),this.outs.push({script:e,value:t})-1},o.prototype.hasWitnesses=function(){return this.ins.some(function(e){return 0!==e.witness.length})},o.prototype.byteLength=function(){return this.__byteLength(!0)},o.prototype.joinsplitByteLength=function(){if(this.version<2)return 0;if(!this.zcash)return 0;var e=this.joinsplits.length>0?96:0;return u.varIntSize(this.joinsplits.length)+this.joinsplits.reduce(function(e,t){return e+8+8+32+32*t.nullifiers.length+32*t.commitments.length+32+32+32*t.macs.length+65+231+t.ciphertexts.length*o.ZCASH_NOTECIPHERTEXT_SIZE},0)+e},o.prototype.__byteLength=function(e){var t=e&&this.hasWitnesses();return(t?10:8)+u.varIntSize(this.ins.length)+u.varIntSize(this.outs.length)+this.ins.reduce(function(e,t){return e+40+r(t.script)},0)+this.outs.reduce(function(e,t){return e+8+r(t.script)},0)+(t?this.ins.reduce(function(e,t){return e+i(t.witness)},0):0)+this.joinsplitByteLength()},o.prototype.clone=function(){var e=new o;return e.version=this.version,e.locktime=this.locktime,e.zcash=this.zcash,e.ins=this.ins.map(function(e){return{hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}}),e.outs=this.outs.map(function(e){return{script:e.script,value:e.value}}),e},o.prototype.hashForSignature=function(e,t,r){if(c(l.tuple(l.UInt32,l.Buffer,l.Number),arguments),e>=this.ins.length)return y;var i=a.compile(a.decompile(t).filter(function(e){return e!==f.OP_CODESEPARATOR})),u=this.clone();if((31&r)===o.SIGHASH_NONE)u.outs=[],u.ins.forEach(function(t,n){n!==e&&(t.sequence=0)});else if((31&r)===o.SIGHASH_SINGLE){if(e>=this.outs.length)return y;u.outs.length=e+1;for(var p=0;p=2&&this.zcash&&(c(this.joinsplits.length),this.joinsplits.forEach(function(e){f(e.vpubOld),f(e.vpubNew),i(e.anchor),e.nullifiers.forEach(function(e){i(e)}),e.commitments.forEach(function(e){i(e)}),i(e.ephemeralKey),i(e.randomSeed),e.macs.forEach(function(e){i(e)}),p(e.zproof.gA),p(e.zproof.gAPrime),d(e.zproof.gB),p(e.zproof.gBPrime),p(e.zproof.gC),p(e.zproof.gCPrime),p(e.zproof.gK),p(e.zproof.gH),e.ciphertexts.forEach(function(e){i(e)})}),this.joinsplits.length>0&&(i(this.joinsplitPubkey),i(this.joinsplitSig))),void 0!==t?e.slice(t,y):e},o.prototype.toHex=function(){return this.toBuffer().toString("hex")},o.prototype.setInputScript=function(e,t){c(l.tuple(l.Number,l.Buffer),arguments),this.ins[e].script=t},o.prototype.setWitness=function(e,t){c(l.tuple(l.Number,[l.Buffer]),arguments),this.ins[e].witness=t},t.exports=o}).call(this,e("buffer").Buffer)},{"./bufferutils":29,"./crypto":30,"./script":37,"./types":63,"bitcoin-ops":25,buffer:68,typeforce:178}],62:[function(e,t,n){(function(n){function r(e,t,n){var r=[],i=[];switch(e){case _.P2PKH:r=t.slice(1),i=t.slice(0,1);break;case _.P2PK:r[0]=n?g.pubKey.output.decode(n):void 0,i=t.slice(0,1);break;case _.MULTISIG:if(n){r=g.multisig.output.decode(n).pubKeys}i=t.slice(1).map(function(e){return 0===e.length?void 0:e})}return{pubKeys:r,signatures:i}}function i(e,t){var n,i,o,s,a,u,f,c,l,h,p=!1,d=!1,y=g.decompile(e);g.classifyInput(y,!0)===_.P2SH&&(d=!0,a=y[y.length-1],c=g.classifyOutput(a),n=g.scriptHash.output.encode(v.hash160(a)),i=_.P2SH,s=a);var b=g.classifyWitness(t);if(b===_.P2WSH){if(u=t[t.length-1],f=g.classifyOutput(u),p=!0,0===e.length){if(n=g.witnessScriptHash.output.encode(v.sha256(u)),i=_.P2WSH,void 0!==a)throw new Error("Redeem script given when unnecessary")}else{if(!a)throw new Error("No redeemScript provided for P2WSH, but scriptSig non-empty");if(l=g.witnessScriptHash.output.encode(v.sha256(u)),!a.equals(l))throw new Error("Redeem script didn't match witnessScript")}if(-1===T.indexOf(g.classifyOutput(u)))throw new Error("unsupported witness script");s=u,o=f,h=t.slice(0,-1)}else if(b===_.P2WPKH){var m=t[t.length-1],w=v.hash160(m);if(0===e.length){if(n=g.witnessPubKeyHash.output.encode(w),i=_.P2WPKH,void 0!==a)throw new Error("Redeem script given when unnecessary")}else{if(!a)throw new Error("No redeemScript provided for P2WPKH, but scriptSig wasn't empty");if(l=g.witnessPubKeyHash.output.encode(w),!a.equals(l))throw new Error("Redeem script did not have the right witness program")}o=_.P2PKH,h=t}else if(a){if(-1===S.indexOf(c))throw new Error("Bad redeemscript!");s=a,o=c,h=y.slice(0,-1)}else i=o=g.classifyInput(e),h=y;var E=r(o,h,s),P={pubKeys:E.pubKeys,signatures:E.signatures,prevOutScript:n,prevOutType:i,signType:o,signScript:s,witness:Boolean(!1)};return d&&(P.redeemScript=a,P.redeemScriptType=c),p&&(P.witnessScript=u,P.witnessScriptType=f),P}function o(e,t,n){if(e.redeemScriptType===_.MULTISIG&&e.redeemScript&&e.pubKeys.length!==e.signatures.length){var r=e.signatures.concat();e.signatures=e.pubKeys.map(function(i,o){var s,a=P.fromPublicKeyBuffer(i);return r.some(function(i,o){if(!i)return!1;var u=O.parseScriptSignature(i),f=t.hashForSignature(n,e.redeemScript,u.hashType);return!!a.verify(f,u.signature)&&(r[o]=void 0,s=i,!0)}),s})}}function s(e,t,n){w(E.Buffer,e);var r=g.decompile(e);t||(t=g.classifyOutput(e));var i=[];switch(t){case _.P2PKH:if(!n)break;var o=r[2],s=v.hash160(n);o.equals(s)&&(i=[n]);break;case _.P2WPKH:if(!n)break;var a=r[1],u=v.hash160(n);a.equals(u)&&(i=[n]);break;case _.P2PK:i=r.slice(0,1);break;case _.MULTISIG:i=r.slice(1,-2);break;default:return{scriptType:t}}return{pubKeys:i,scriptType:t,signatures:i.map(function(){})}}function a(e,t){if(e.prevOutType){if(e.prevOutType!==_.P2SH)throw new Error("PrevOutScript must be P2SH");if(!g.decompile(e.prevOutScript)[1].equals(t))throw new Error("Inconsistent hash160(RedeemScript)")}}function u(e,t){if(e.prevOutType){if(e.prevOutType!==_.P2WSH)throw new Error("PrevOutScript must be P2WSH");if(!g.decompile(e.prevOutScript)[1].equals(t))throw new Error("Inconsistent sha25(WitnessScript)")}}function f(e,t,n,r,i){var o,f,c,l,h,p,d,y,b,m=!1,w=!1,T=!1;if(n&&i){if(h=v.hash160(n),d=v.sha256(i),a(e,h),!n.equals(g.witnessScriptHash.output.encode(d)))throw new Error("Witness script inconsistent with redeem script");if(o=s(i,void 0,t),!o.pubKeys)throw new Error('WitnessScript not supported "'+g.toASM(n)+'"');f=g.types.P2SH,c=g.scriptHash.output.encode(h),m=w=T=!0,l=g.types.P2WSH,y=p=o.scriptType,b=i}else if(n){if(h=v.hash160(n),a(e,h),o=s(n,void 0,t),!o.pubKeys)throw new Error('RedeemScript not supported "'+g.toASM(n)+'"');f=g.types.P2SH,c=g.scriptHash.output.encode(h),m=!0,y=l=o.scriptType,b=n,w=y===g.types.P2WPKH}else if(i){if(d=v.sha256(i),u(e,d),o=s(i,void 0,t),!o.pubKeys)throw new Error('WitnessScript not supported "'+g.toASM(n)+'"');f=g.types.P2WSH,c=g.witnessScriptHash.output.encode(d),w=T=!0,y=p=o.scriptType,b=i}else if(e.prevOutType){if(e.prevOutType===_.P2SH||e.prevOutType===_.P2WSH)throw new Error("PrevOutScript is "+e.prevOutType+", requires redeemScript");if(f=e.prevOutType,c=e.prevOutScript,o=s(e.prevOutScript,e.prevOutType,t),!o.pubKeys)return;w=e.prevOutType===_.P2WPKH,y=f,b=c}else c=g.pubKeyHash.output.encode(v.hash160(t)),o=s(c,_.P2PKH,t),f=_.P2PKH,w=!1,y=f,b=c;if(w&&!E.Satoshi(r))throw new Error("Input was witness but not given witness value");y===_.P2WPKH&&(b=g.pubKeyHash.output.encode(g.witnessPubKeyHash.output.decode(b))),m&&(e.redeemScript=n,e.redeemScriptType=l),T&&(e.witnessScript=i,e.witnessScriptType=p),e.pubKeys=o.pubKeys,e.signatures=o.signatures,e.signScript=b,e.signType=y,e.prevOutScript=c,e.prevOutType=f,e.witness=w}function c(e,t,r,i){if(e===_.P2PKH){if(1===t.length&&t[0]instanceof n&&1===r.length)return g.pubKeyHash.input.encodeStack(t[0],r[0])}else if(e===_.P2PK){if(1===t.length&&t[0]instanceof n)return g.pubKey.input.encodeStack(t[0])}else{if(e!==_.MULTISIG)throw new Error("Not yet supported");if(t.length>0)return t=t.map(function(e){return e||m.OP_0}),i||(t=t.filter(function(e){return e!==m.OP_0})),g.multisig.input.encodeStack(t)}if(!i)throw new Error("Not enough signatures provided");return[]}function l(e,t){var n=e.prevOutType,r=[],i=[];-1!==T.indexOf(n)&&(r=c(n,e.signatures,e.pubKeys,e.script,t));var o=!1;if(n===g.types.P2SH){if(-1===S.indexOf(e.redeemScriptType))throw new Error("Impossible to sign this type");o=!0,-1!==T.indexOf(e.redeemScriptType)&&(r=c(e.redeemScriptType,e.signatures,e.pubKeys,t)),n=e.redeemScriptType}if(n===g.types.P2WPKH)i=c(g.types.P2PKH,e.signatures,e.pubKeys,t);else if(n===g.types.P2WSH){if(-1===T.indexOf(e.witnessScriptType))throw new Error;i=c(e.witnessScriptType,e.signatures,e.pubKeys,t),i.push(e.witnessScript),n=e.witnessScriptType}return o&&r.push(e.redeemScript),{type:n,script:g.compile(r),witness:i}}function h(e,t){this.prevTxMap={},this.network=e||b.bitcoin,this.maximumFeeRate=t||1e3,this.inputs=[],this.tx=new I}function p(e){return void 0!==e.prevOutScript&&void 0!==e.signScript&&void 0!==e.pubKeys&&void 0!==e.signatures&&e.signatures.length===e.pubKeys.length&&e.pubKeys.length>0&&void 0!==e.witness}function d(e){return e.readUInt8(e.length-1)}var y=e("./address"),v=e("./crypto"),g=e("./script"),b=e("./networks"),m=e("bitcoin-ops"),w=e("typeforce"),E=e("./types"),_=g.types,T=[g.types.P2PKH,g.types.P2PK,g.types.MULTISIG],S=T.concat([g.types.P2WPKH,g.types.P2WSH]),P=e("./ecpair"),O=e("./ecsignature"),I=e("./transaction");h.prototype.setLockTime=function(e){if(w(E.UInt32,e),this.inputs.some(function(e){ return!!e.signatures&&e.signatures.some(function(e){return e})}))throw new Error("No, this would invalidate signatures");this.tx.locktime=e},h.prototype.setVersion=function(e){w(E.UInt32,e),this.tx.version=e},h.fromTransaction=function(e,t){var n=new h(t);return n.setVersion(e.version),n.setLockTime(e.locktime),e.outs.forEach(function(e){n.addOutput(e.script,e.value)}),e.ins.forEach(function(e){n.__addInputUnsafe(e.hash,e.index,{sequence:e.sequence,script:e.script,witness:e.witness})}),n.inputs.forEach(function(t,n){o(t,e,n)}),n},h.prototype.addInput=function(e,t,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");var o;if("string"==typeof e)e=new n(e,"hex").reverse();else if(e instanceof I){var s=e.outs[t];i=s.script,o=s.value,e=e.getHash()}return this.__addInputUnsafe(e,t,{sequence:r,prevOutScript:i,value:o})},h.prototype.__addInputUnsafe=function(e,t,n){if(I.isCoinbaseHash(e))throw new Error("coinbase inputs not supported");var r=e.toString("hex")+":"+t;if(void 0!==this.prevTxMap[r])throw new Error("Duplicate TxOut: "+r);var o={};if(void 0!==n.script&&(o=i(n.script,n.witness)),void 0!==n.value&&(o.value=n.value),!o.prevOutScript&&n.prevOutScript){var a;if(!o.pubKeys&&!o.signatures){var u=s(n.prevOutScript);u.pubKeys&&(o.pubKeys=u.pubKeys,o.signatures=u.signatures),a=u.scriptType}o.prevOutScript=n.prevOutScript,o.prevOutType=a||g.classifyOutput(n.prevOutScript)}var f=this.tx.addInput(e,t,n.sequence,n.scriptSig);return this.inputs[f]=o,this.prevTxMap[r]=f,f},h.prototype.addOutput=function(e,t){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof e&&(e=y.toOutputScript(e,this.network)),this.tx.addOutput(e,t)},h.prototype.build=function(){return this.__build(!1)},h.prototype.buildIncomplete=function(){return this.__build(!0)},h.prototype.__build=function(e){if(!e){if(!this.tx.ins.length)throw new Error("Transaction has no inputs");if(!this.tx.outs.length)throw new Error("Transaction has no outputs")}var t=this.tx.clone();if(this.inputs.forEach(function(n,r){if(!(n.witnessScriptType||n.redeemScriptType||n.prevOutType||e))throw new Error("Transaction is not complete");var i=l(n,e);if(!e&&-1===T.indexOf(i.type)&&i.type!==g.types.P2WPKH)throw new Error(i.type+" not supported");t.setInputScript(r,i.script),t.setWitness(r,i.witness)}),!e&&this.__overMaximumFees(t.byteLength()))throw new Error("Transaction has absurd fees");return t},h.prototype.sign=function(e,t,n,r,i,o){if(t.network!==this.network)throw new Error("Inconsistent network");if(!this.inputs[e])throw new Error("No input at index: "+e);r=r||I.SIGHASH_ALL;var s=this.inputs[e];if(void 0!==s.redeemScript&&n&&!s.redeemScript.equals(n))throw new Error("Inconsistent redeemScript");var a=t.getPublicKeyBuffer();if(!p(s)&&(f(s,a,n,i,o),!p(s)))throw Error(s.prevOutType+" not supported");var u;if(u=s.witness?this.tx.hashForWitnessV0(e,s.signScript,i,r):this.tx.hashForSignature(e,s.signScript,r),!s.pubKeys.some(function(e,n){if(!a.equals(e))return!1;if(s.signatures[n])throw new Error("Signature already exists");return s.signatures[n]=t.sign(u).toScriptSignature(r),!0}))throw new Error("Key pair cannot sign for this input")},h.prototype.__canModifyInputs=function(){return this.inputs.every(function(e){return void 0===e.signatures||e.signatures.every(function(e){return!e||d(e)&I.SIGHASH_ANYONECANPAY})})},h.prototype.__canModifyOutputs=function(){var e=this.tx.ins.length,t=this.tx.outs.length;return this.inputs.every(function(n){return void 0===n.signatures||n.signatures.every(function(n){if(!n)return!0;var r=d(n),i=31&r;return i===I.SIGHASH_NONE||(i===I.SIGHASH_SINGLE?e<=t:void 0)})})},h.prototype.__overMaximumFees=function(e){return(this.inputs.reduce(function(e,t){return e+(t.value>>>0)},0)-this.tx.outs.reduce(function(e,t){return e+t.value},0))/e>this.maximumFeeRate},t.exports=h}).call(this,e("buffer").Buffer)},{"./address":27,"./crypto":30,"./ecpair":32,"./ecsignature":33,"./networks":36,"./script":37,"./transaction":61,"./types":63,"bitcoin-ops":25,buffer:68,typeforce:178}],63:[function(e,t,n){function r(e){return s.UInt32(e)&&e<=a}function i(e){return s.String(e)&&e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function o(e){return s.UInt53(e)&&e<=u}var s=e("typeforce"),a=Math.pow(2,31)-1;i.toJSON=function(){return"BIP32 derivation path"};var u=21e14,f=s.quacksLike("BigInteger"),c=s.quacksLike("Point"),l=s.compile({r:f,s:f}),h=s.compile({messagePrefix:s.oneOf(s.Buffer,s.String),bip32:{public:s.UInt32,private:s.UInt32},pubKeyHash:s.UInt16,scriptHash:s.UInt16,wif:s.UInt8}),p={BigInt:f,BIP32Path:i,Buffer256bit:s.BufferN(32),ECPoint:c,ECSignature:l,Hash160bit:s.BufferN(20),Hash256bit:s.BufferN(32),Network:h,Satoshi:o,UInt31:r};for(var d in s)p[d]=s[d];t.exports=p},{typeforce:178}],64:[function(e,t,n){},{}],65:[function(e,t,n){function r(e){if(e&&!u(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function s(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var a=e("buffer").Buffer,u=a.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},f=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=i)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};f.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,r=t.charCodeAt(i);if(r>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:68}],66:[function(e,t,n){var r=e("base-x");t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":18}],67:[function(e,t,n){(function(n){"use strict";function r(e){var t=f("sha256").update(e).digest();return f("sha256").update(t).digest()}function i(e){var t=r(e);return u.encode(n.concat([e,t],e.length+4))}function o(e){var t=e.slice(0,-4),n=e.slice(-4),i=r(t);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return t}function s(e){var t=u.decodeUnsafe(e);if(t)return o(t)}function a(e){var t=u.decode(e),n=o(t);if(!n)throw new Error("Invalid checksum");return n}var u=e("bs58"),f=e("create-hash");t.exports={encode:i,decode:a,decodeUnsafe:s}}).call(this,e("buffer").Buffer)},{bs58:66,buffer:68,"create-hash":72}],68:[function(e,t,n){(function(t){"use strict";function r(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(r()=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(r)return $(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return j(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function b(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:w(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):w(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,n,r,i){function o(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}var f;if(i){var c=-1;for(f=n;fa&&(n=a-u),f=n;f>=0;f--){for(var l=!0,h=0;hi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=n){var u,f,c,l;switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],128==(192&u)&&(l=(31&o)<<6|63&u)>127&&(s=l);break;case 3:u=e[i+1],f=e[i+2],128==(192&u)&&128==(192&f)&&(l=(15&o)<<12|(63&u)<<6|63&f)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:u=e[i+1],f=e[i+2],c=e[i+3],128==(192&u)&&128==(192&f)&&128==(192&c)&&(l=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&c)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=a}return x(r)}function x(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,n,r,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function U(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function D(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function C(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return i||C(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,i){return i||C(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(e,t,n,r,52,8),n+8}function z(e){if(e=q(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function q(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function $(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],s=0;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function W(e){return Z.toByteArray(z(e))}function K(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e){return e!==e}var Z=e("base64-js"),X=e("ieee754"),J=e("isarray");n.Buffer=o,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),n.kMaxLength=r(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return s(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return u(null,e,t,n)},o.allocUnsafe=function(e){return f(null,e)},o.allocUnsafeSlow=function(e){return f(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var s=i-r,a=n-t,u=Math.min(s,a),f=this.slice(r,i),c=e.slice(t,n),l=0;li)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return T(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return P(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),X.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),X.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),X.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),X.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){B(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);B(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s1024&&(t.push(a.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}var r=function(e,t,n){if(void 0===e&&(e=r.DEFAULT_CAPACITY),void 0===t&&(t=r.DEFAULT_ENDIAN),void 0===n&&(n=r.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=void 0!==t&&!!t,this.noAssert=!!n};r.VERSION="3.5.5",r.LITTLE_ENDIAN=!0,r.BIG_ENDIAN=!1,r.DEFAULT_CAPACITY=16,r.DEFAULT_ENDIAN=r.BIG_ENDIAN,r.DEFAULT_NOASSERT=!1,r.Long=e||null;var o=r.prototype,s=new ArrayBuffer(0),a=String.fromCharCode;r.allocate=function(e,t,n){return new r(e,t,n)},r.concat=function(e,t,n,i){"boolean"!=typeof t&&"string"==typeof t||(i=n,n=t,t=void 0);for(var o,s=0,a=0,u=e.length;a0&&(s+=o);if(0===s)return new r(0,n,i);var f,c=new r(s,n,i),l=new Uint8Array(c.buffer);for(a=0;a0&&(a.buffer=e.buffer,a.offset=e.byteOffset,a.limit=e.byteOffset+e.length,a.view=e.length>0?new DataView(e.buffer):null);else if(e instanceof ArrayBuffer)a=new r(0,n,s),e.byteLength>0&&(a.buffer=e,a.offset=0,a.limit=e.byteLength,a.view=e.byteLength>0?new DataView(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for(a=new r(e.length,n,s),a.limit=e.length,i=0;i>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=1,this.view.setInt8(t,e),n&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=this.view.getInt8(e);return t&&(this.offset+=1),n},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=1,this.view.setUint8(t,e),n&&(this.offset+=1),this},o.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){ if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=this.view.getUint8(e);return t&&(this.offset+=1),n},o.writeInt16=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=2,this.view.setInt16(t,e,this.littleEndian),n&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var n=this.view.getInt16(e,this.littleEndian);return t&&(this.offset+=2),n},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=2,this.view.setUint16(t,e,this.littleEndian),n&&(this.offset+=2),this},o.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var n=this.view.getUint16(e,this.littleEndian);return t&&(this.offset+=2),n},o.writeInt32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,this.view.setInt32(t,e,this.littleEndian),n&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=this.view.getInt32(e,this.littleEndian);return t&&(this.offset+=4),n},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,this.view.setUint32(t,e,this.littleEndian),n&&(this.offset+=4),this},o.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=this.view.getUint32(e,this.littleEndian);return t&&(this.offset+=4),n},e&&(o.writeInt64=function(t,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),n+=8;var i=this.buffer.byteLength;return n>i&&this.resize((i*=2)>n?i:n),n-=8,this.littleEndian?(this.view.setInt32(n,t.low,!0),this.view.setInt32(n+4,t.high,!0)):(this.view.setInt32(n,t.high,!1),this.view.setInt32(n+4,t.low,!1)),r&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=this.littleEndian?new e(this.view.getInt32(t,!0),this.view.getInt32(t+4,!0),!1):new e(this.view.getInt32(t+4,!1),this.view.getInt32(t,!1),!1);return n&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),n+=8;var i=this.buffer.byteLength;return n>i&&this.resize((i*=2)>n?i:n),n-=8,this.littleEndian?(this.view.setInt32(n,t.low,!0),this.view.setInt32(n+4,t.high,!0)):(this.view.setInt32(n,t.high,!1),this.view.setInt32(n+4,t.low,!1)),r&&(this.offset+=8),this},o.readUint64=function(t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=this.littleEndian?new e(this.view.getInt32(t,!0),this.view.getInt32(t+4,!0),!0):new e(this.view.getInt32(t+4,!1),this.view.getInt32(t,!1),!0);return n&&(this.offset+=8),r}),o.writeFloat32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,this.view.setFloat32(t,e,this.littleEndian),n&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=this.view.getFloat32(e,this.littleEndian);return t&&(this.offset+=4),n},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=8,this.view.setFloat64(t,e,this.littleEndian),n&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var n=this.view.getFloat64(e,this.littleEndian);return t&&(this.offset+=8),n},o.readDouble=o.readFloat64,r.MAX_VARINT32_BYTES=5,r.calculateVarint32=function(e){return e>>>=0,e<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},r.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},r.zigZagDecode32=function(e){return e>>>1^-(1&e)|0},o.writeVarint32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i,o=r.calculateVarint32(e);t+=o;var s=this.buffer.byteLength;return t>s&&this.resize((s*=2)>t?s:t),t-=o,this.view.setUint8(t,i=128|e),e>>>=0,e>=128?(i=e>>7|128,this.view.setUint8(t+1,i),e>=16384?(i=e>>14|128,this.view.setUint8(t+2,i),e>=1<<21?(i=e>>21|128,this.view.setUint8(t+3,i),e>=1<<28?(this.view.setUint8(t+4,e>>28&15),o=5):(this.view.setUint8(t+3,127&i),o=4)):(this.view.setUint8(t+2,127&i),o=3)):(this.view.setUint8(t+1,127&i),o=2)):(this.view.setUint8(t,127&i),o=1),n?(this.offset+=o,this):o},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(r.zigZagEncode32(e),t)},o.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n,r,i=0,o=0;do{if(r=e+i,!this.noAssert&&r>this.limit){var s=Error("Truncated");throw s.truncated=!0,s}n=this.view.getUint8(r),i<5&&(o|=(127&n)<<7*i>>>0),++i}while(128==(128&n));return o|=0,t?(this.offset+=i,o):{value:o,length:i}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=r.zigZagDecode32(t.value):t=r.zigZagDecode32(t),t},e&&(r.MAX_VARINT64_BYTES=10,r.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:n<1<<21?3:4:r<16384?r<128?5:6:r<1<<21?7:8:i<128?9:10},r.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},r.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned());var o=r.calculateVarint64(t),s=t.toInt()>>>0,a=t.shiftRightUnsigned(28).toInt()>>>0,u=t.shiftRightUnsigned(56).toInt()>>>0;n+=o;var f=this.buffer.byteLength;switch(n>f&&this.resize((f*=2)>n?f:n),n-=o,o){case 10:this.view.setUint8(n+9,u>>>7&1);case 9:this.view.setUint8(n+8,9!==o?128|u:127&u);case 8:this.view.setUint8(n+7,8!==o?a>>>21|128:a>>>21&127);case 7:this.view.setUint8(n+6,7!==o?a>>>14|128:a>>>14&127);case 6:this.view.setUint8(n+5,6!==o?a>>>7|128:a>>>7&127);case 5:this.view.setUint8(n+4,5!==o?128|a:127&a);case 4:this.view.setUint8(n+3,4!==o?s>>>21|128:s>>>21&127);case 3:this.view.setUint8(n+2,3!==o?s>>>14|128:s>>>14&127);case 2:this.view.setUint8(n+1,2!==o?s>>>7|128:s>>>7&127);case 1:this.view.setUint8(n,1!==o?128|s:127&s)}return i?(this.offset+=o,this):o},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(r.zigZagEncode64(e),t)},o.readVarint64=function(t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var r=t,i=0,o=0,s=0,a=0;if(a=this.view.getUint8(t++),i=127&a,128&a&&(a=this.view.getUint8(t++),i|=(127&a)<<7,128&a&&(a=this.view.getUint8(t++),i|=(127&a)<<14,128&a&&(a=this.view.getUint8(t++),i|=(127&a)<<21,128&a&&(a=this.view.getUint8(t++),o=127&a,128&a&&(a=this.view.getUint8(t++),o|=(127&a)<<7,128&a&&(a=this.view.getUint8(t++),o|=(127&a)<<14,128&a&&(a=this.view.getUint8(t++),o|=(127&a)<<21,128&a&&(a=this.view.getUint8(t++),s=127&a,128&a&&(a=this.view.getUint8(t++),s|=(127&a)<<7,128&a))))))))))throw Error("Buffer overrun");var u=e.fromBits(i|o<<28,o>>>4|s<<24,!1);return n?(this.offset=t,u):{value:u,length:t-r}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=r.zigZagDecode64(n.value):n=r.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r=void 0===n;r&&(n=this.offset);var i,o=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;i>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}o=f.calculateUTF16asUTF8(t(e))[1],n+=o+1;var s=this.buffer.byteLength;return n>s&&this.resize((s*=2)>n?s:n),n-=o+1,f.encodeUTF16toUTF8(t(e),function(e){this.view.setUint8(n++,e)}.bind(this)),this.view.setUint8(n++,0),r?(this.offset=n,this):o},o.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=e,o=-1;return f.decodeUTF8toUTF16(function(){if(0===o)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(o=this.view.getUint8(e++))?null:o}.bind(this),r=n(),!0),t?(this.offset=e,r()):{string:r(),length:e-i}},o.writeIString=function(e,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,o=n;i=f.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i;var s=this.buffer.byteLength;if(n>s&&this.resize((s*=2)>n?s:n),n-=4+i,this.view.setUint32(n,i,this.littleEndian),n+=4,f.encodeUTF16toUTF8(t(e),function(e){this.view.setUint8(n++,e)}.bind(this)),n!==o+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return r?(this.offset=n,this):n-o},o.readIString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r,i=0,o=e;i=this.view.getUint32(e,this.littleEndian),e+=4;var s,a=e+i;return f.decodeUTF8toUTF16(function(){return e>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,o=n;i=f.calculateUTF16asUTF8(t(e))[1],n+=i;var s=this.buffer.byteLength;return n>s&&this.resize((s*=2)>n?s:n),n-=i,f.encodeUTF16toUTF8(t(e),function(e){this.view.setUint8(n++,e)}.bind(this)),r?(this.offset=n,this):n-o},o.writeString=o.writeUTF8String,r.calculateUTF8Chars=function(e){return f.calculateUTF16asUTF8(t(e))[0]},r.calculateUTF8Bytes=function(e){return f.calculateUTF16asUTF8(t(e))[1]},o.readUTF8String=function(e,t,i){"number"==typeof t&&(i=t,t=void 0);var o=void 0===i;if(o&&(i=this.offset),void 0===t&&(t=r.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var s,a=0,u=i;if(t===r.METRICS_CHARS){if(s=n(),f.decodeUTF8(function(){return a>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}var c=i+e;if(f.decodeUTF8toUTF16(function(){return i>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var o,s,a=n;o=f.calculateUTF16asUTF8(t(e),this.noAssert)[1],s=r.calculateVarint32(o),n+=s+o;var u=this.buffer.byteLength;if(n>u&&this.resize((u*=2)>n?u:n),n-=s+o,n+=this.writeVarint32(o,n),f.encodeUTF16toUTF8(t(e),function(e){this.view.setUint8(n++,e)}.bind(this)),n!==a+o+s)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+o+s));return i?(this.offset=n,this):n-a},o.readVString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=this.readVarint32(e),o=e;e+=i.length,i=i.value;var s=e+i,a=n();return f.decodeUTF8toUTF16(function(){return e>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof r||(e=r.wrap(e,t));var o=e.limit-e.offset;if(o<=0)return this;n+=o;var s=this.buffer.byteLength;return n>s&&this.resize((s*=2)>n?s:n),n-=o,new Uint8Array(this.buffer,n).set(new Uint8Array(e.buffer).subarray(e.offset,e.limit)),e.offset+=o,i&&(this.offset+=o),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new r(0,this.littleEndian,this.noAssert);if(e){var n=new ArrayBuffer(this.buffer.byteLength);new Uint8Array(n).set(this.buffer),t.buffer=n,t.view=new DataView(n)}else t.buffer=this.buffer,t.view=this.view;return t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var n=t-e;if(0===n)return this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var r=new ArrayBuffer(n);return new Uint8Array(r).set(new Uint8Array(this.buffer).subarray(e,t)),this.buffer=r,this.view=new DataView(r),this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new r(0,this.littleEndian,this.noAssert);var n=t-e,i=new r(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=e),this.copyTo(i,0,e,t),i},o.copyTo=function(e,t,n,i){var o,s;if(!this.noAssert&&!r.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=void 0===t)?e.offset:0|t,n=(o=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);var a=i-n;return 0===a?e:(e.ensureCapacity(t+a),new Uint8Array(e.buffer).set(new Uint8Array(this.buffer).subarray(n,i),t),o&&(this.offset+=a),s&&(e.offset+=a),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return te?t:e):this},o.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;t>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){"number"!=typeof t&&"string"==typeof t||(n=t,t=void 0);var i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof r||(e=r.wrap(e,t));var o=e.limit-e.offset;if(o<=0)return this;var s,a=o-n;if(a>0){var u=new ArrayBuffer(this.buffer.byteLength+a);s=new Uint8Array(u),s.set(new Uint8Array(this.buffer).subarray(n,this.buffer.byteLength),o),this.buffer=u,this.view=new DataView(u),this.offset+=a,this.markedOffset>=0&&(this.markedOffset+=a),this.limit+=a,n+=a}else s=new Uint8Array(this.buffer);return s.set(new Uint8Array(e.buffer).subarray(e.offset,e.limit),n-o),e.offset=e.limit,i&&(this.offset-=o),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t?this:(Array.prototype.reverse.call(new Uint8Array(this.buffer).subarray(e,t)),this.view=new DataView(this.buffer),this)},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t=this.offset,n=this.limit;if(t>n){var r=t;t=n,n=r}if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal limit: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(!e&&0===t&&n===this.buffer.byteLength)return this.buffer;if(t===n)return s;var i=new ArrayBuffer(n-t);return new Uint8Array(i).set(new Uint8Array(this.buffer).subarray(t,n),0),i},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(e="utf8",t=e,n=t),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var u=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],n=[],r=0,i=t.length;r>2&63]),i=(3&r)<<4,null!==(r=e())?(i|=r>>4&15,n(t[63&(i|r>>4&15)]),i=(15&r)<<2,null!==(r=e())?(n(t[63&(i|r>>6&3)]),n(t[63&r])):(n(t[63&i]),n(61))):(n(t[63&i]),n(61),n(61))},e.decode=function(e,t){function r(e){throw Error("Illegal character code: "+e)}for(var i,o,s;null!==(i=e());)if(o=n[i],void 0===o&&r(i),null!==(i=e())&&(s=n[i],void 0===s&&r(i),t(o<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(o=n[i])){if(61===i)break;r(i)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(i=e())){if(void 0===(s=n[i])){if(61===i)break;r(i)}t((3&o)<<6>>>0|s)}}},e.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},e}();o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;return u.encode(function(){return e>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return"";for(var n=[],r=[];e=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},r.fromBinary=function(e,t,n){if(!n&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");for(var i,o=0,s=e.length,a=new r(s,t,n);o255)throw RangeError("Illegal charCode at "+o+": 0 <= "+i+" <= 255");a.view.setUint8(o++,i)}return a.limit=s,a},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";n32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}n===this.offset&&n===this.limit?i+=n===this.markedOffset?"!":"|":n===this.offset?i+=n===this.markedOffset?"[":"<":n===this.limit?i+=n===this.markedOffset?"]":">":i+=n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return e?s:i},r.fromDebug=function(e,t,n){for(var i,o,s=e.length,a=new r((s+1)/3|0,t,n),u=0,f=0,c=!1,l=!1,h=!1,p=!1,d=!1;u":if(!n){if(p){d=!0;break}p=!0}a.limit=f,c=!1;break;case"'":if(!n){if(h){d=!0;break}h=!0}a.markedOffset=f,c=!1;break;case" ":c=!1;break;default:if(!n&&c){d=!0;break} if(o=parseInt(i+e.charAt(u++),16),!n&&(isNaN(o)||o<0||o>255))throw TypeError("Illegal str: Not a debug encoded string");a.view.setUint8(f++,o),c=!0}if(d)throw TypeError("Illegal str: Invalid symbol at "+u)}if(!n){if(!l||!p)throw TypeError("Illegal str: Missing offset or limit");if(f>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);e255))throw TypeError("Illegal str: Contains non-hex characters");s.view.setUint8(u++,i)}return s.limit=u,s};var f=function(){var e={};return e.MAX_CODEPOINT=1114111,e.encodeUTF8=function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(n>>6&31|192),t(63&n|128)):n<65536?(t(n>>12&15|224),t(n>>6&63|128),t(63&n|128)):(t(n>>18&7|240),t(n>>12&63|128),t(n>>6&63|128),t(63&n|128)),n=null},e.decodeUTF8=function(e,t){for(var n,r,i,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(r=e())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&s([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},e.UTF16toUTF8=function(e,t){for(var n,r=null;;){if(null===(n=null!==r?r:e()))break;n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n)}null!==r&&t(r)},e.UTF8toUTF16=function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(n-=65536,t(55296+(n>>10)),t(n%1024+56320)),n=null},e.encodeUTF16toUTF8=function(t,n){e.UTF16toUTF8(t,function(t){e.encodeUTF8(t,n)})},e.decodeUTF8toUTF16=function(t,n){e.decodeUTF8(t,function(t){e.UTF8toUTF16(t,n)})},e.calculateCodePoint=function(e){return e<128?1:e<2048?2:e<65536?3:4},e.calculateUTF8=function(t){for(var n,r=0;null!==(n=t());)r+=e.calculateCodePoint(n);return r},e.calculateUTF16asUTF8=function(t){var n=0,r=0;return e.UTF16toUTF8(t,function(t){++n,r+=e.calculateCodePoint(t)}),[n,r]},e}();return o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{f.decodeUTF8toUTF16(function(){return e>>2),s=0,a=0;s>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,i=-1732584194,c=271733878,l=0;l>16)+(t>>16)+(n>>16)<<16|65535&n}function c(e,t){return e<>>32-t}var l=e("./make-hash");t.exports=function(e){return l(e,r)}},{"./make-hash":73}],75:[function(e,t,n){"use strict";function r(e,t){s.call(this,"digest"),"string"==typeof t&&(t=a.from(t));var n="sha512"===e||"sha384"===e?128:64;if(this._alg=e,this._key=t,t.length>n){t=("rmd160"===e?new f:c(e)).update(t).digest()}else t.lengthu?t=e(t):t.length2?arguments[2]:{},s=r(t);o&&(s=s.concat(Object.getOwnPropertySymbols(t))),i(s,function(r){f(e,r,t[r],n[r])})};c.supportsDescriptors=!!u,t.exports=c},{foreach:97,"object-keys":116}],78:[function(e,t,n){function r(e,t,n,r,i,a,u){this.p=e,this.a=t,this.b=n,this.G=s.fromAffine(this,r,i),this.n=a,this.h=u,this.infinity=new s(this,null,null,o.ZERO),this.pOverFour=e.add(o.ONE).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}var i=e("assert"),o=e("bigi"),s=e("./point");r.prototype.pointFromX=function(e,t){var n=t.pow(3).add(this.a.multiply(t)).add(this.b).mod(this.p),r=n.modPow(this.pOverFour,this.p),i=r;return r.isEven()^!e&&(i=this.p.subtract(i)),s.fromAffine(this,t,i)},r.prototype.isInfinity=function(e){return e===this.infinity||0===e.z.signum()&&0!==e.y.signum()},r.prototype.isOnCurve=function(e){if(this.isInfinity(e))return!0;var t=e.affineX,n=e.affineY,r=this.a,i=this.b,o=this.p;if(t.signum()<0||t.compareTo(o)>=0)return!1;if(n.signum()<0||n.compareTo(o)>=0)return!1;var s=n.square().mod(o),a=t.pow(3).add(r.multiply(t)).add(i).mod(o);return s.equals(a)},r.prototype.validate=function(e){i(!this.isInfinity(e),"Point is at infinity"),i(this.isOnCurve(e),"Point is not on the curve");var t=e.multiply(this.n);return i(this.isInfinity(t),"Point is not a scalar multiple of G"),!0},t.exports=r},{"./point":82,assert:17,bigi:22}],79:[function(e,t,n){t.exports={secp128r1:{p:"fffffffdffffffffffffffffffffffff",a:"fffffffdfffffffffffffffffffffffc",b:"e87579c11079f43dd824993c2cee5ed3",n:"fffffffe0000000075a30d1b9038a115",h:"01",Gx:"161ff7528b899b2d0c28607ca52c5b86",Gy:"cf5ac8395bafeb13c02da292dded7a83"},secp160k1:{p:"fffffffffffffffffffffffffffffffeffffac73",a:"00",b:"07",n:"0100000000000000000001b8fa16dfab9aca16b6b3",h:"01",Gx:"3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",Gy:"938cf935318fdced6bc28286531733c3f03c4fee"},secp160r1:{p:"ffffffffffffffffffffffffffffffff7fffffff",a:"ffffffffffffffffffffffffffffffff7ffffffc",b:"1c97befc54bd7a8b65acf89f81d4d4adc565fa45",n:"0100000000000000000001f4c8f927aed3ca752257",h:"01",Gx:"4a96b5688ef573284664698968c38bb913cbfc82",Gy:"23a628553168947d59dcc912042351377ac5fb32"},secp192k1:{p:"fffffffffffffffffffffffffffffffffffffffeffffee37",a:"00",b:"03",n:"fffffffffffffffffffffffe26f2fc170f69466a74defd8d",h:"01",Gx:"db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",Gy:"9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"},secp192r1:{p:"fffffffffffffffffffffffffffffffeffffffffffffffff",a:"fffffffffffffffffffffffffffffffefffffffffffffffc",b:"64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",n:"ffffffffffffffffffffffff99def836146bc9b1b4d22831",h:"01",Gx:"188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",Gy:"07192b95ffc8da78631011ed6b24cdd573f977a11e794811"},secp256k1:{p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"},secp256r1:{p:"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",a:"ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",b:"5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",n:"ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",h:"01",Gx:"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",Gy:"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"}}},{}],80:[function(e,t,n){var r=e("./point"),i=e("./curve"),o=e("./names");t.exports={Curve:i,Point:r,getCurveByName:o}},{"./curve":78,"./names":81,"./point":82}],81:[function(e,t,n){function r(e){var t=o[e];if(!t)return null;var n=new i(t.p,16),r=new i(t.a,16),a=new i(t.b,16),u=new i(t.n,16),f=new i(t.h,16),c=new i(t.Gx,16),l=new i(t.Gy,16);return new s(n,r,a,c,l,u,f)}var i=e("bigi"),o=e("./curves.json"),s=e("./curve");t.exports=r},{"./curve":78,"./curves.json":79,bigi:22}],82:[function(e,t,n){(function(n){function r(e,t,n,r){i.notStrictEqual(r,void 0,"Missing Z coordinate"),this.curve=e,this.x=t,this.y=n,this.z=r,this._zInv=null,this.compressed=!0}var i=e("assert"),o=e("bigi"),s=o.valueOf(3);Object.defineProperty(r.prototype,"zInv",{get:function(){return null===this._zInv&&(this._zInv=this.z.modInverse(this.curve.p)),this._zInv}}),Object.defineProperty(r.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(r.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),r.fromAffine=function(e,t,n){return new r(e,t,n,o.ONE)},r.prototype.equals=function(e){return e===this||(this.curve.isInfinity(this)?this.curve.isInfinity(e):this.curve.isInfinity(e)?this.curve.isInfinity(this):0===e.y.multiply(this.z).subtract(this.y.multiply(e.z)).mod(this.curve.p).signum()&&0===e.x.multiply(this.z).subtract(this.x.multiply(e.z)).mod(this.curve.p).signum())},r.prototype.negate=function(){var e=this.curve.p.subtract(this.y);return new r(this.curve,this.x,e,this.z)},r.prototype.add=function(e){if(this.curve.isInfinity(this))return e;if(this.curve.isInfinity(e))return this;var t=this.x,n=this.y,i=e.x,o=e.y,a=o.multiply(this.z).subtract(n.multiply(e.z)).mod(this.curve.p),u=i.multiply(this.z).subtract(t.multiply(e.z)).mod(this.curve.p);if(0===u.signum())return 0===a.signum()?this.twice():this.curve.infinity;var f=u.square(),c=f.multiply(u),l=t.multiply(f),h=a.square().multiply(this.z),p=h.subtract(l.shiftLeft(1)).multiply(e.z).subtract(c).multiply(u).mod(this.curve.p),d=l.multiply(s).multiply(a).subtract(n.multiply(c)).subtract(h.multiply(a)).multiply(e.z).add(a.multiply(c)).mod(this.curve.p),y=c.multiply(this.z).multiply(e.z).mod(this.curve.p);return new r(this.curve,p,d,y)},r.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(0===this.y.signum())return this.curve.infinity;var e=this.x,t=this.y,n=t.multiply(this.z).mod(this.curve.p),i=n.multiply(t).mod(this.curve.p),o=this.curve.a,a=e.square().multiply(s);0!==o.signum()&&(a=a.add(this.z.square().multiply(o))),a=a.mod(this.curve.p);var u=a.square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.p),f=a.multiply(s).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.pow(3)).mod(this.curve.p),c=n.pow(3).shiftLeft(3).mod(this.curve.p);return new r(this.curve,u,f,c)},r.prototype.multiply=function(e){if(this.curve.isInfinity(this))return this;if(0===e.signum())return this.curve.infinity;for(var t=e,n=t.multiply(s),r=this.negate(),i=this,o=n.bitLength()-2;o>0;--o){var a=n.testBit(o),u=t.testBit(o);i=i.twice(),a!==u&&(i=i.add(a?this:r))}return i},r.prototype.multiplyTwo=function(e,t,n){for(var r=Math.max(e.bitLength(),n.bitLength())-1,i=this.curve.infinity,o=this.add(t);r>=0;){var s=e.testBit(r),a=n.testBit(r);i=i.twice(),s?i=a?i.add(o):i.add(this):a&&(i=i.add(t)),--r}return i},r.prototype.getEncoded=function(e){if(null==e&&(e=this.compressed),this.curve.isInfinity(this))return new n("00","hex");var t,r=this.affineX,i=this.affineY,o=this.curve.pLength;return e?(t=new n(1+o),t.writeUInt8(i.isEven()?2:3,0)):(t=new n(1+o+o),t.writeUInt8(4,0),i.toBuffer(o).copy(t,1+o)),r.toBuffer(o).copy(t,1),t},r.decodeFrom=function(e,t){var n,s=t.readUInt8(0),a=4!==s,u=Math.floor((e.p.bitLength()+7)/8),f=o.fromBuffer(t.slice(1,1+u));if(a){i.equal(t.length,u+1,"Invalid sequence length"),i(2===s||3===s,"Invalid sequence tag");var c=3===s;n=e.pointFromX(c,f)}else{i.equal(t.length,1+u+u,"Invalid sequence length");var l=o.fromBuffer(t.slice(1+u));n=r.fromAffine(e,f,l)}return n.compressed=a,n},r.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"},t.exports=r}).call(this,e("buffer").Buffer)},{assert:17,bigi:22,buffer:68}],83:[function(e,t,n){"use strict";var r=e("has"),i=e("es-to-primitive/es6"),o=Object.prototype.toString,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,a=e("./helpers/isNaN"),u=e("./helpers/isFinite"),f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,c=e("./helpers/assign"),l=e("./helpers/sign"),h=e("./helpers/mod"),p=e("./helpers/isPrimitive"),d=parseInt,y=e("function-bind"),v=y.call(Function.call,Array.prototype.slice),g=y.call(Function.call,String.prototype.slice),b=y.call(Function.call,RegExp.prototype.test,/^0b[01]+$/i),m=y.call(Function.call,RegExp.prototype.test,/^0o[0-7]+$/i),w=y.call(Function.call,RegExp.prototype.exec),E=["…","​","￾"].join(""),_=new RegExp("["+E+"]","g"),T=y.call(Function.call,RegExp.prototype.test,_),S=/^[-+]0x[0-9a-f]+$/i,P=y.call(Function.call,RegExp.prototype.test,S),O=["\t\n\v\f\r   ᠎    ","          \u2028","\u2029\ufeff"].join(""),I=new RegExp("(^["+O+"]+)|(["+O+"]+$)","g"),k=y.call(Function.call,String.prototype.replace),x=function(e){return k(e,I,"")},j=e("./es5"),A=e("is-regex"),N=c(c({},j),{Call:function(e,t){var n=arguments.length>2?arguments[2]:[];if(!this.IsCallable(e))throw new TypeError(e+" is not a function");return e.apply(t,n)},ToPrimitive:i,ToNumber:function(e){var t=p(e)?e:i(e,Number);if("symbol"==typeof t)throw new TypeError("Cannot convert a Symbol value to a number");if("string"==typeof t){if(b(t))return this.ToNumber(d(g(t,2),2));if(m(t))return this.ToNumber(d(g(t,2),8));if(T(t)||P(t))return NaN;var n=x(t);if(n!==t)return this.ToNumber(n)}return Number(t)},ToInt16:function(e){var t=this.ToUint16(e);return t>=32768?t-65536:t},ToInt8:function(e){var t=this.ToUint8(e);return t>=128?t-256:t},ToUint8:function(e){var t=this.ToNumber(e);if(a(t)||0===t||!u(t))return 0;var n=l(t)*Math.floor(Math.abs(t));return h(n,256)},ToUint8Clamp:function(e){var t=this.ToNumber(e);if(a(t)||t<=0)return 0;if(t>=255)return 255;var n=Math.floor(e);return n+.5f?f:t},CanonicalNumericIndexString:function(e){if("[object String]"!==o.call(e))throw new TypeError("must be a string");if("-0"===e)return-0;var t=this.ToNumber(e);return this.SameValue(this.ToString(t),e)?t:void 0},RequireObjectCoercible:j.CheckObjectCoercible,IsArray:Array.isArray||function(e){return"[object Array]"===o.call(e)},IsConstructor:function(e){return"function"==typeof e&&!!e.prototype},IsExtensible:function(e){return!Object.preventExtensions||!p(e)&&Object.isExtensible(e)},IsInteger:function(e){if("number"!=typeof e||a(e)||!u(e))return!1;var t=Math.abs(e);return Math.floor(t)===t},IsPropertyKey:function(e){return"string"==typeof e||"symbol"==typeof e},IsRegExp:function(e){if(!e||"object"!=typeof e)return!1;if(s){var t=e[Symbol.match];if(void 0!==t)return j.ToBoolean(t)}return A(e)},SameValueZero:function(e,t){return e===t||a(e)&&a(t)},GetV:function(e,t){if(!this.IsPropertyKey(t))throw new TypeError("Assertion failed: IsPropertyKey(P) is not true");return this.ToObject(e)[t]},GetMethod:function(e,t){if(!this.IsPropertyKey(t))throw new TypeError("Assertion failed: IsPropertyKey(P) is not true");var n=this.GetV(e,t);if(null!=n){if(!this.IsCallable(n))throw new TypeError(t+"is not a function");return n}},Get:function(e,t){if("Object"!==this.Type(e))throw new TypeError("Assertion failed: Type(O) is not Object");if(!this.IsPropertyKey(t))throw new TypeError("Assertion failed: IsPropertyKey(P) is not true");return e[t]},Type:function(e){return"symbol"==typeof e?"Symbol":j.Type(e)},SpeciesConstructor:function(e,t){if("Object"!==this.Type(e))throw new TypeError("Assertion failed: Type(O) is not Object");var n=e.constructor;if(void 0===n)return t;if("Object"!==this.Type(n))throw new TypeError("O.constructor is not an Object");var r=s&&Symbol.species?n[Symbol.species]:void 0;if(null==r)return t;if(this.IsConstructor(r))return r;throw new TypeError("no constructor found")},CompletePropertyDescriptor:function(e){if(!this.IsPropertyDescriptor(e))throw new TypeError("Desc must be a Property Descriptor");return this.IsGenericDescriptor(e)||this.IsDataDescriptor(e)?(r(e,"[[Value]]")||(e["[[Value]]"]=void 0),r(e,"[[Writable]]")||(e["[[Writable]]"]=!1)):(r(e,"[[Get]]")||(e["[[Get]]"]=void 0),r(e,"[[Set]]")||(e["[[Set]]"]=void 0)),r(e,"[[Enumerable]]")||(e["[[Enumerable]]"]=!1),r(e,"[[Configurable]]")||(e["[[Configurable]]"]=!1),e},Set:function(e,t,n,r){if("Object"!==this.Type(e))throw new TypeError("O must be an Object");if(!this.IsPropertyKey(t))throw new TypeError("P must be a Property Key");if("Boolean"!==this.Type(r))throw new TypeError("Throw must be a Boolean");if(r)return e[t]=n,!0;try{e[t]=n}catch(e){return!1}},HasOwnProperty:function(e,t){if("Object"!==this.Type(e))throw new TypeError("O must be an Object");if(!this.IsPropertyKey(t))throw new TypeError("P must be a Property Key");return r(e,t)},HasProperty:function(e,t){if("Object"!==this.Type(e))throw new TypeError("O must be an Object");if(!this.IsPropertyKey(t))throw new TypeError("P must be a Property Key");return t in e},IsConcatSpreadable:function(e){if("Object"!==this.Type(e))return!1;if(s&&"symbol"==typeof Symbol.isConcatSpreadable){var t=this.Get(e,Symbol.isConcatSpreadable);if(void 0!==t)return this.ToBoolean(t)}return this.IsArray(e)},Invoke:function(e,t){if(!this.IsPropertyKey(t))throw new TypeError("P must be a Property Key");var n=v(arguments,2),r=this.GetV(e,t);return this.Call(r,e,n)},CreateIterResultObject:function(e,t){if("Boolean"!==this.Type(t))throw new TypeError("Assertion failed: Type(done) is not Boolean");return{value:e,done:t}},RegExpExec:function(e,t){if("Object"!==this.Type(e))throw new TypeError("R must be an Object");if("String"!==this.Type(t))throw new TypeError("S must be a String");var n=this.Get(e,"exec");if(this.IsCallable(n)){var r=this.Call(n,e,[t]);if(null===r||"Object"===this.Type(r))return r;throw new TypeError('"exec" method must return `null` or an Object')}return w(e,t)},ArraySpeciesCreate:function(e,t){if(!this.IsInteger(t)||t<0)throw new TypeError("Assertion failed: length must be an integer >= 0");var n,r=0===t?0:t;if(this.IsArray(e)&&(n=this.Get(e,"constructor"),"Object"===this.Type(n)&&s&&Symbol.species&&null===(n=this.Get(n,Symbol.species))&&(n=void 0)),void 0===n)return Array(r);if(!this.IsConstructor(n))throw new TypeError("C must be a constructor");return new n(r)},CreateDataProperty:function(e,t,n){if("Object"!==this.Type(e))throw new TypeError("Assertion failed: Type(O) is not Object");if(!this.IsPropertyKey(t))throw new TypeError("Assertion failed: IsPropertyKey(P) is not true");var r=Object.getOwnPropertyDescriptor(e,t),i=r||"function"!=typeof Object.isExtensible||Object.isExtensible(e);if(r&&(!r.writable||!r.configurable)||!i)return!1;var o={configurable:!0,enumerable:!0,value:n,writable:!0};return Object.defineProperty(e,t,o),!0},CreateDataPropertyOrThrow:function(e,t,n){if("Object"!==this.Type(e))throw new TypeError("Assertion failed: Type(O) is not Object");if(!this.IsPropertyKey(t))throw new TypeError("Assertion failed: IsPropertyKey(P) is not true");var r=this.CreateDataProperty(e,t,n);if(!r)throw new TypeError("unable to create data property");return r}});delete N.CheckObjectCoercible,t.exports=N},{"./es5":85,"./helpers/assign":87,"./helpers/isFinite":88,"./helpers/isNaN":89,"./helpers/isPrimitive":90,"./helpers/mod":91,"./helpers/sign":92,"es-to-primitive/es6":94,"function-bind":99,has:100,"is-regex":107}],84:[function(e,t,n){"use strict";var r=e("./es2015"),i=e("./helpers/assign"),o=i(i({},r),{SameValueNonNumber:function(e,t){if("number"==typeof e||typeof e!=typeof t)throw new TypeError("SameValueNonNumber requires two non-number values of the same type.");return this.SameValue(e,t)}});t.exports=o},{"./es2015":83,"./helpers/assign":87}],85:[function(e,t,n){"use strict";var r=e("./helpers/isNaN"),i=e("./helpers/isFinite"),o=e("./helpers/sign"),s=e("./helpers/mod"),a=e("is-callable"),u=e("es-to-primitive/es5"),f=e("has"),c={ToPrimitive:u,ToBoolean:function(e){return!!e},ToNumber:function(e){return Number(e)},ToInteger:function(e){var t=this.ToNumber(e);return r(t)?0:0!==t&&i(t)?o(t)*Math.floor(Math.abs(t)):t},ToInt32:function(e){return this.ToNumber(e)>>0},ToUint32:function(e){return this.ToNumber(e)>>>0},ToUint16:function(e){var t=this.ToNumber(e);if(r(t)||0===t||!i(t))return 0;var n=o(t)*Math.floor(Math.abs(t));return s(n,65536)},ToString:function(e){return String(e)},ToObject:function(e){return this.CheckObjectCoercible(e),Object(e)},CheckObjectCoercible:function(e,t){if(null==e)throw new TypeError(t||"Cannot call method on "+e);return e},IsCallable:a,SameValue:function(e,t){return e===t?0!==e||1/e==1/t:r(e)&&r(t)},Type:function(e){return null===e?"Null":void 0===e?"Undefined":"function"==typeof e||"object"==typeof e?"Object":"number"==typeof e?"Number":"boolean"==typeof e?"Boolean":"string"==typeof e?"String":void 0},IsPropertyDescriptor:function(e){if("Object"!==this.Type(e))return!1;var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var n in e)if(f(e,n)&&!t[n])return!1;var r=f(e,"[[Value]]"),i=f(e,"[[Get]]")||f(e,"[[Set]]");if(r&&i)throw new TypeError("Property Descriptors may not be both accessor and data descriptors");return!0},IsAccessorDescriptor:function(e){if(void 0===e)return!1;if(!this.IsPropertyDescriptor(e))throw new TypeError("Desc must be a Property Descriptor");return!(!f(e,"[[Get]]")&&!f(e,"[[Set]]"))},IsDataDescriptor:function(e){if(void 0===e)return!1;if(!this.IsPropertyDescriptor(e))throw new TypeError("Desc must be a Property Descriptor");return!(!f(e,"[[Value]]")&&!f(e,"[[Writable]]"))},IsGenericDescriptor:function(e){if(void 0===e)return!1;if(!this.IsPropertyDescriptor(e))throw new TypeError("Desc must be a Property Descriptor");return!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e)},FromPropertyDescriptor:function(e){if(void 0===e)return e;if(!this.IsPropertyDescriptor(e))throw new TypeError("Desc must be a Property Descriptor");if(this.IsDataDescriptor(e))return{value:e["[[Value]]"],writable:!!e["[[Writable]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};if(this.IsAccessorDescriptor(e))return{get:e["[[Get]]"],set:e["[[Set]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};throw new TypeError("FromPropertyDescriptor must be called with a fully populated Property Descriptor")},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e))throw new TypeError("ToPropertyDescriptor requires an object");var t={};if(f(e,"enumerable")&&(t["[[Enumerable]]"]=this.ToBoolean(e.enumerable)),f(e,"configurable")&&(t["[[Configurable]]"]=this.ToBoolean(e.configurable)),f(e,"value")&&(t["[[Value]]"]=e.value),f(e,"writable")&&(t["[[Writable]]"]=this.ToBoolean(e.writable)),f(e,"get")){var n=e.get;if(void 0!==n&&!this.IsCallable(n))throw new TypeError("getter must be a function");t["[[Get]]"]=n}if(f(e,"set")){var r=e.set;if(void 0!==r&&!this.IsCallable(r))throw new TypeError("setter must be a function");t["[[Set]]"]=r} if((f(t,"[[Get]]")||f(t,"[[Set]]"))&&(f(t,"[[Value]]")||f(t,"[[Writable]]")))throw new TypeError("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t}};t.exports=c},{"./helpers/isFinite":88,"./helpers/isNaN":89,"./helpers/mod":91,"./helpers/sign":92,"es-to-primitive/es5":93,has:100,"is-callable":105}],86:[function(e,t,n){"use strict";t.exports=e("./es2016")},{"./es2016":84}],87:[function(e,t,n){var r=Object.prototype.hasOwnProperty;t.exports=function(e,t){if(Object.assign)return Object.assign(e,t);for(var n in t)r.call(t,n)&&(e[n]=t[n]);return e}},{}],88:[function(e,t,n){var r=Number.isNaN||function(e){return e!==e};t.exports=Number.isFinite||function(e){return"number"==typeof e&&!r(e)&&e!==1/0&&e!==-1/0}},{}],89:[function(e,t,n){t.exports=Number.isNaN||function(e){return e!==e}},{}],90:[function(e,t,n){t.exports=function(e){return null===e||"function"!=typeof e&&"object"!=typeof e}},{}],91:[function(e,t,n){t.exports=function(e,t){var n=e%t;return Math.floor(n>=0?n:n+t)}},{}],92:[function(e,t,n){t.exports=function(e){return e>=0?1:-1}},{}],93:[function(e,t,n){"use strict";var r=Object.prototype.toString,i=e("./helpers/isPrimitive"),o=e("is-callable"),s={"[[DefaultValue]]":function(e,t){var n=t||("[object Date]"===r.call(e)?String:Number);if(n===String||n===Number){var s,a,u=n===String?["toString","valueOf"]:["valueOf","toString"];for(a=0;a1&&(t===String?n="string":t===Number&&(n="number"));var o;if(r&&(Symbol.toPrimitive?o=f(e,Symbol.toPrimitive):a(e)&&(o=Symbol.prototype.valueOf)),void 0!==o){var c=o.call(e,n);if(i(c))return c;throw new TypeError("unable to convert exotic object to primitive")}return"default"===n&&(s(e)||a(e))&&(n="string"),u(e,"default"===n?"number":n)}},{"./helpers/isPrimitive":95,"is-callable":105,"is-date-object":106,"is-symbol":108}],95:[function(e,t,n){arguments[4][90][0].apply(n,arguments)},{dup:90}],96:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,f;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(s(n))for(o=Array.prototype.slice.call(arguments,1),f=n.slice(),r=f.length,u=0;u0&&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"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,a;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=o;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){r=a;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],97:[function(e,t,n){var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString;t.exports=function(e,t,n){if("[object Function]"!==i.call(t))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var s=0;s=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},r.prototype._update=function(e){throw new Error("_update is not implemented")},r.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();return void 0!==e&&(t=t.toString(e)),t},r.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=r}).call(this,e("buffer").Buffer)},{buffer:68,inherits:103,stream:153}],102:[function(e,t,n){n.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,c=-7,l=n?i-1:0,h=n?-1:1,p=e[t+l];for(l+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+l],l+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=f}return(p?-1:1)*s*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var s,a,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?h/u:h*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,f-=8);e[n+p-d]|=128*y}},{}],103:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],104:[function(e,t,n){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function i(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&r(e.slice(0,0))}t.exports=function(e){return null!=e&&(r(e)||i(e)||!!e._isBuffer)}},{}],105:[function(e,t,n){"use strict";var r=Function.prototype.toString,i=/^\s*class /,o=function(e){try{var t=r.call(e),n=t.replace(/\/\/.*\n/g,""),o=n.replace(/\/\*[.\s\S]*\*\//g,""),s=o.replace(/\n/gm," ").replace(/ {2}/g," ");return i.test(s)}catch(e){return!1}},s=function(e){try{return!o(e)&&(r.call(e),!0)}catch(e){return!1}},a=Object.prototype.toString,u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return s(e);if(o(e))return!1;var t=a.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},{}],106:[function(e,t,n){"use strict";var r=Date.prototype.getDay,i=function(e){try{return r.call(e),!0}catch(e){return!1}},o=Object.prototype.toString,s="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(e){return"object"==typeof e&&null!==e&&(s?i(e):"[object Date]"===o.call(e))}},{}],107:[function(e,t,n){"use strict";var r=e("has"),i=RegExp.prototype.exec,o=Object.getOwnPropertyDescriptor,s=function(e){try{var t=e.lastIndex;return e.lastIndex=0,i.call(e),!0}catch(e){return!1}finally{e.lastIndex=t}},a=Object.prototype.toString,u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!u)return"[object RegExp]"===a.call(e);var t=o(e,"lastIndex");return!(!t||!r(t,"value"))&&s(e)}},{has:100}],108:[function(e,t,n){"use strict";var r=Object.prototype.toString;if("function"==typeof Symbol&&"symbol"==typeof Symbol()){var i=Symbol.prototype.toString,o=/^Symbol\(.*\)$/,s=function(e){return"symbol"==typeof e.valueOf()&&o.test(i.call(e))};t.exports=function(e){if("symbol"==typeof e)return!0;if("[object Symbol]"!==r.call(e))return!1;try{return s(e)}catch(e){return!1}}}else t.exports=function(e){return!1}},{}],109:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],110:[function(e,t,n){var r="undefined"!=typeof JSON?JSON:e("jsonify");t.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n=t.space||"";"number"==typeof n&&(n=Array(n+1).join(" "));var s="boolean"==typeof t.cycles&&t.cycles,a=t.replacer||function(e,t){return t},u=t.cmp&&function(e){return function(t){return function(n,r){var i={key:n,value:t[n]},o={key:r,value:t[r]};return e(i,o)}}}(t.cmp),f=[];return function e(t,c,l,h){var p=n?"\n"+new Array(h+1).join(n):"",d=n?": ":":";if(l&&l.toJSON&&"function"==typeof l.toJSON&&(l=l.toJSON()),void 0!==(l=a.call(t,c,l))){if("object"!=typeof l||null===l)return r.stringify(l);if(i(l)){for(var y=[],v=0;v="0"&&i<="9";)t+=i,f();if("."===i)for(t+=".";f()&&i>="0"&&i<="9";)t+=i;if("e"===i||"E"===i)for(t+=i,f(),"-"!==i&&"+"!==i||(t+=i,f());i>="0"&&i<="9";)t+=i,f();if(e=+t,isFinite(e))return e;u("Bad number")},l=function(){var e,t,n,r="";if('"'===i)for(;f();){if('"'===i)return f(),r;if("\\"===i)if(f(),"u"===i){for(n=0,t=0;t<4&&(e=parseInt(f(),16),isFinite(e));t+=1)n=16*n+e;r+=String.fromCharCode(n)}else{if("string"!=typeof a[i])break;r+=a[i]}else r+=i}u("Bad string")},h=function(){for(;i&&i<=" ";)f()},p=function(){switch(i){case"t":return f("t"),f("r"),f("u"),f("e"),!0;case"f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case"n":return f("n"),f("u"),f("l"),f("l"),null}u("Unexpected '"+i+"'")},d=function(){var e=[];if("["===i){if(f("["),h(),"]"===i)return f("]"),e;for(;i;){if(e.push(s()),h(),"]"===i)return f("]"),e;f(","),h()}}u("Bad array")},y=function(){var e,t={};if("{"===i){if(f("{"),h(),"}"===i)return f("}"),t;for(;i;){if(e=l(),h(),f(":"),Object.hasOwnProperty.call(t,e)&&u('Duplicate key "'+e+'"'),t[e]=s(),h(),"}"===i)return f("}"),t;f(","),h()}}u("Bad object")};s=function(){switch(h(),i){case"{":return y();case"[":return d();case'"':return l();case"-":return c();default:return i>="0"&&i<="9"?c():p()}},t.exports=function(e,t){var n;return o=e,r=0,i=" ",n=s(),h(),i&&u("Syntax error"),"function"==typeof t?function e(n,r){var i,o,s=n[r];if(s&&"object"==typeof s)for(i in s)Object.prototype.hasOwnProperty.call(s,i)&&(o=e(s,i),void 0!==o?s[i]=o:delete s[i]);return t.call(n,r,s)}({"":n},""):n}},{}],113:[function(e,t,n){function r(e){return u.lastIndex=0,u.test(e)?'"'+e.replace(u,function(e){var t=f[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function i(e,t){var n,u,f,c,l,h=o,p=t[e];switch(p&&"object"==typeof p&&"function"==typeof p.toJSON&&(p=p.toJSON(e)),"function"==typeof a&&(p=a.call(t,e,p)),typeof p){case"string":return r(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";if(o+=s,l=[],"[object Array]"===Object.prototype.toString.apply(p)){for(c=p.length,n=0;n>>=0)&&r<256&&(s=n[r])?s:(o=new e(r,(0|r)<0?-1:0,!0),0<=r&&r<256&&(n[r]=o),o):-128<=(r|=0)&&r<128&&(s=t[r])?s:(o=new e(r,r<0?-1:0,!1),-128<=r&&r<128&&(t[r]=o),o)},e.fromNumber=function(t,n){return n=!!n,isNaN(t)||!isFinite(t)?e.ZERO:!n&&t<=-o?e.MIN_VALUE:!n&&t+1>=o?e.MAX_VALUE:n&&t>=i?e.MAX_UNSIGNED_VALUE:t<0?e.fromNumber(-t,n).negate():new e(t%r|0,t/r|0,n)},e.fromBits=function(t,n,r){return new e(t,n,r)},e.fromString=function(t,n,r){if(0===t.length)throw Error("number format error: empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e.ZERO;if("number"==typeof n&&(r=n,n=!1),(r=r||10)<2||360)throw Error('number format error: interior "-" character: '+t);if(0===i)return e.fromString(t.substring(1),n,r).negate();for(var o=e.fromNumber(Math.pow(r,8)),s=e.ZERO,a=0;a>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*r+(this.low>>>0):this.high*r+(this.low>>>0)},e.prototype.toString=function(t){if((t=t||10)<2||36>>0,f=u.toString(t);if(n=a,n.isZero())return f+s;for(;f.length<6;)f="0"+f;s=""+f+s}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,n=31;n>0&&0==(t&1<=0},e.prototype.isOdd=function(){return 1==(1&this.low)},e.prototype.isEven=function(){return 0==(1&this.low)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},e.eq=e.prototype.equals,e.prototype.notEquals=function(e){return!this.equals(e)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(e){return this.compare(e)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(e){return this.compare(e)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(e){return this.compare(e)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.equals(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.subtract(t).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=t.high>>>16,a=65535&t.high,u=t.low>>>16,f=65535&t.low,c=0,l=0,h=0,p=0;return p+=o+f,h+=p>>>16,p&=65535,h+=i+u,l+=h>>>16,h&=65535,l+=r+a,c+=l>>>16,l&=65535,c+=n+s,c&=65535,e.fromBits(h<<16|p,c<<16|l,this.unsigned)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())return e.ZERO;if(this.equals(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.negate().multiply(t.negate()):this.negate().multiply(t).negate();if(t.isNegative())return this.multiply(t.negate()).negate();if(this.lessThan(s)&&t.lessThan(s))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,a=t.high>>>16,u=65535&t.high,f=t.low>>>16,c=65535&t.low,l=0,h=0,p=0,d=0;return d+=o*c,p+=d>>>16,d&=65535,p+=i*c,h+=p>>>16,p&=65535,p+=o*f,h+=p>>>16,p&=65535,h+=r*c,l+=h>>>16,h&=65535,h+=i*f,l+=h>>>16,h&=65535,h+=o*u,l+=h>>>16,h&=65535,l+=n*c+r*f+i*u+o*a,l&=65535,e.fromBits(p<<16|d,l<<16|h,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var n,r,i;if(this.equals(e.MIN_VALUE)){if(t.equals(e.ONE)||t.equals(e.NEG_ONE))return e.MIN_VALUE;if(t.equals(e.MIN_VALUE))return e.ONE;return n=this.shiftRight(1).divide(t).shiftLeft(1),n.equals(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(r=this.subtract(t.multiply(n)),i=n.add(r.divide(t)))}if(t.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.negate().divide(t.negate()):this.negate().divide(t).negate();if(t.isNegative())return this.divide(t.negate()).negate();for(i=e.ZERO,r=this;r.greaterThanOrEqual(t);){n=Math.max(1,Math.floor(r.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(n)/Math.LN2),s=o<=48?1:Math.pow(2,o-48),a=e.fromNumber(n),u=a.multiply(t);u.isNegative()||u.greaterThan(r);)n-=s,a=e.fromNumber(n,this.unsigned),u=a.multiply(t);a.isZero()&&(a=e.ONE),i=i.add(a),r=r.subtract(u)}return i},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.subtract(this.divide(t).multiply(t))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low<>>32-t,this.unsigned):e.fromBits(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),0===(t&=63))return this;var n=this.high;if(t<32){var r=this.low;return e.fromBits(r>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?e.fromBits(n,0,this.unsigned):e.fromBits(n>>>t-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})},{}],115:[function(e,t,n){(function(e){t.exports=function(t,n){if(!Array.isArray(t))throw TypeError("Expected values Array");if("function"!=typeof n)throw TypeError("Expected digest Function");for(var r=t.length,i=t.concat();r>1;){for(var o=0,s=0;s0&&!r.call(e,0))for(var p=0;p0)for(var y=0;y=0&&"[object Function]"===r.call(e.callee)),n}},{}],118:[function(e,t,n){"use strict";var r=e("es-abstract/es7"),i=e("has"),o=e("function-bind"),s=o.call(Function.call,Object.prototype.propertyIsEnumerable);t.exports=function(e){var t=r.RequireObjectCoercible(e),n=[];for(var o in t)i(t,o)&&s(t,o)&&n.push(t[o]);return n}},{"es-abstract/es7":86,"function-bind":99,has:100}],119:[function(e,t,n){"use strict";var r=e("define-properties"),i=e("./implementation"),o=e("./polyfill"),s=e("./shim"),a=o();r(a,{getPolyfill:o,implementation:i,shim:s}),t.exports=a},{"./implementation":118,"./polyfill":120,"./shim":121,"define-properties":77}],120:[function(e,t,n){"use strict";var r=e("./implementation");t.exports=function(){return"function"==typeof Object.values?Object.values:r}},{"./implementation":118}],121:[function(e,t,n){"use strict";var r=e("./polyfill"),i=e("define-properties");t.exports=function(){var e=r();return i(Object,{values:e},{values:function(){return Object.values!==e}}),e}},{"./polyfill":120,"define-properties":77}],122:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,i="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),o="/"===s(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),o=r(t.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u1)for(var n=1;n1)throw Error("Object.create polyfill only accepts the first parameter.");return t.prototype=e,new t});var e={};return e.IS_NODE=!1,e.XHR=function(){for(var e=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],t=null,n=0;n0)return this.stack.shift();if(this.index>=this.source.length)return null;if(this.readingString)return this.readingString=!1,this._readString();var e,n;do{for(e=!1;t.WHITESPACE.test(n=this.source.charAt(this.index));)if(this.index++,"\n"===n&&this.line++,this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if("/"===this.source.charAt(++this.index)){for(;"\n"!==this.source.charAt(this.index);)if(++this.index==this.source.length)return null;this.index++,this.line++,e=!0}else{if("*"!==this.source.charAt(this.index))throw Error("Unterminated comment at line "+this.line+": /"+this.source.charAt(this.index));for(n="";n+(n=this.source.charAt(this.index))!=="*/";)if(this.index++,"\n"===n&&this.line++,this.index===this.source.length)return null;this.index++,e=!0}}while(e);if(this.index===this.source.length)return null;var r=this.index;if(t.DELIM.lastIndex=0,t.DELIM.test(this.source.charAt(r)))++r;else for(++r;r>3;switch(o){case e.WIRE_TYPES.VARINT:do{i=r.readUint8()}while(128==(128&i));break;case e.WIRE_TYPES.BITS64:r.offset+=8;break;case e.WIRE_TYPES.LDELIM:i=r.readVarint32(),r.offset+=i;break;case e.WIRE_TYPES.STARTGROUP:n(s,r);break;case e.WIRE_TYPES.ENDGROUP:if(s===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:r.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+o)}return!0}function r(t,n){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low===t.low&&t.high===t.high)return new e.Long(t.low,t.high,void 0===n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}var i={},o=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},s=o.prototype;s.fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},s.toString=function(e){return(e?this.className+" ":"")+this.fqn()},s.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},i.T=o;var a=function(e,t,n,r){o.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{}},u=a.prototype=Object.create(o.prototype);u.getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],n=0,r=this.children.length;n0)if(1!==arguments.length||"object"!=typeof n||"function"==typeof n.encode||e.Util.isArray(n)||n instanceof t||n instanceof ArrayBuffer||e.Long&&n instanceof e.Long)for(s=0,a=arguments.length;s0;){if(o=t.readVarint32(),s=7&o,a=o>>3,s===e.WIRE_TYPES.ENDGROUP){if(a!==i)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(i?i+" expected":"not a group")+")");break}if(u=this._fieldsById[a])u.repeated&&!u.options.packed?c[u.name].push(u.decode(s,t)):(c[u.name]=u.decode(s,t),u.oneof&&(null!==this[u.oneof.name]&&(this[this[u.oneof.name]]=null),c[u.oneof.name]=u.name));else switch(s){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:var l=t.readVarint32();t.offset+=l;break;case e.WIRE_TYPES.STARTGROUP:for(;n(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(var h=0,p=this._fields.length;h4294967295?0|n:n;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof n||n===n&&n%1!=0)&&o(typeof n,"not an integer"),n<0?n>>>0:n;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return r(n,!1)}catch(e){o(typeof n,e.message)}else o(typeof n,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return r(n,!0)}catch(e){o(typeof n,e.message)}else o(typeof n,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof n&&o(typeof n,"not a boolean"),n;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof n&&o(typeof n,"not a number"),n;case e.TYPES.string:return"string"==typeof n||n&&n instanceof String||o(typeof n,"not a string"),""+n;case e.TYPES.bytes:return t.isByteBuffer(n)?n:t.wrap(n,"base64");case e.TYPES.enum:var u=this.resolvedType.getChildren(y.Value);for(s=0;s=0){r.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1);var o=r.offset;for(i=0;i1){var u=r.slice(o,r.offset);o+=a-1,r.offset=o,r.append(u)}r.writeVarint32(s,o-a)}else for(i=0;i=0){for(r+=t.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,i=0;i=0&&!r){o=n.readVarint32(),o=n.offset+o;for(var s=[];n.offset>>0;case e.TYPES.sint32:return 0|n.readVarint32ZigZag();case e.TYPES.fixed32:return n.readUint32()>>>0;case e.TYPES.sfixed32:return 0|n.readInt32();case e.TYPES.int64:return n.readVarint64();case e.TYPES.uint64:return n.readVarint64().toUnsigned();case e.TYPES.sint64:return n.readVarint64ZigZag();case e.TYPES.fixed64:return n.readUint64();case e.TYPES.sfixed64:return n.readInt64();case e.TYPES.bool:return!!n.readVarint32();case e.TYPES.enum:return n.readVarint32();case e.TYPES.float:return n.readFloat();case e.TYPES.double:return n.readDouble();case e.TYPES.string:return n.readVString();case e.TYPES.bytes:if(o=n.readVarint32(),n.remaining()=0)return!1;s.push(o)}s=null}if(void 0!==e.enums){if(!t.Util.isArray(e.enums))return!1;for(r=0;r0;){if(e=n.pop(),!t.Util.isArray(e))throw Error("Not a valid namespace: "+JSON.stringify(e));for(;e.length>0;){var o=e.shift();if(i.isValidMessage(o)){var s=new r.Message(this,this.ptr,o.name,o.options,o.isGroup),a={};if(o.oneofs)for(var u=Object.keys(o.oneofs),f=0,c=u.length;f0)for(f=0,c=o.fields.length;f0)for(f=0;f0)for(f=0;ft.ID_MAX&&(s.extensions[1]=t.ID_MAX)),this.ptr.addChild(s),v.length>0){n.push(e),e=v,v=null,this.ptr=s,s=null;continue}v=null,s=null}else if(i.isValidEnum(o)){for(s=new r.Enum(this,this.ptr,o.name,o.options),f=0;fs.extensions[1])throw Error("Illegal extended field id in message "+s.name+": "+o.fields[f].id+" ("+s.extensions.join(" to ")+" expected)");var g=o.fields[f].name;this.options.convertFieldsToCamelCase&&(g=r.Message.Field._toCamelCase(o.fields[f].name)),l=new r.Message.ExtensionField(this,s,o.fields[f].rule,o.fields[f].type,this.ptr.fqn()+"."+g,o.fields[f].id,o.fields[f].options);var b=new r.Extension(this,this.ptr,o.fields[f].name,l);l.extension=b,this.ptr.addChild(b),s.addChild(l)}else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("Extended message "+o.ref+" is not defined")}o=null}e=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(n,r){if("string"==typeof r){if(t.Util.IS_NODE&&(r=e("path").resolve(r)),!0===this.files[r])return this.reset(),this;this.files[r]=!0}if(n.imports&&n.imports.length>0){var i,o="/",s=!1;"object"==typeof r?(this.importRoot=r.root,s=!0,i=this.importRoot,r=r.file,(i.indexOf("\\")>=0||r.indexOf("\\")>=0)&&(o="\\")):"string"==typeof r?this.importRoot?i=this.importRoot:r.indexOf("/")>=0?""===(i=r.replace(/\/[^\/]*$/,""))&&(i="/"):r.indexOf("\\")>=0?(i=r.replace(/\\[^\\]*$/,""),o="\\"):i=".":i=null;for(var a=0;a=0)return!1;s.push(o)}s=null}return!0},o.resolveAll=function(){var e;if(null!=this.ptr&&"object"!=typeof this.ptr.type){if(this.ptr instanceof r.Namespace)for(var i=this.ptr.children,o=0,s=i.length;oe.length)return null;n=e.readUInt8(t+1),r=2}else if(i===s.OP_PUSHDATA2){if(t+3>e.length)return null;n=e.readUInt16LE(t+1),r=3}else{if(t+5>e.length)return null;if(i!==s.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=e.readUInt32LE(t+1),r=5}return{opcode:i,number:n,size:r}}var s=e("bitcoin-ops");t.exports={encodingLength:r,encode:i,decode:o}},{"bitcoin-ops":25}],128:[function(e,t,n){(function(n,r){"use strict";function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}function o(e,t){if(e>65536)throw new Error("requested too many random bytes");var i=new r.Uint8Array(e);e>0&&a.getRandomValues(i);var o=s.from(i.buffer);return"function"==typeof t?n.nextTick(function(){t(null,o)}):o}var s=e("safe-buffer").Buffer,a=r.crypto||r.msCrypto;a&&a.getRandomValues?t.exports=o:t.exports=i}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:124,"safe-buffer":143}],129:[function(e,t,n){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":130}],130:[function(e,t,n){"use strict";function r(e){if(!(this instanceof r))return new r(e);f.call(this,e),c.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(e){e.end()}var s=e("process-nextick-args"),a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=r;var u=e("core-util-is");u.inherits=e("inherits");var f=e("./_stream_readable"),c=e("./_stream_writable");u.inherits(r,f);for(var l=a(c.prototype),h=0;h0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===D.prototype||(t=i(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):c(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?c(e,s,t,!1):b(e,s)):c(e,s,t,!1))):r||(s.reading=!1)}return h(s)}function c(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&v(e)),b(e,t)}function l(e,t){var n;return o(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function h(e){return!e.ended&&(e.needReadable||e.length=Y?e=Y:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function d(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=p(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function y(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,v(e)}}function v(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(z("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?N(g,e):g(e))}function g(e){z("emit readable"),e.emit("readable"),S(e)}function b(e,t){t.readingMore||(t.readingMore=!0,N(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=O(e,t.buffer,t.decoder),n}function O(e,t,n){var r;return eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++r}return t.length-=r,i}function k(e,t){var n=D.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),0===(e-=s)){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,N(j,t,e))}function j(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function A(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return z("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):v(this),null;if(0===(e=d(e,t))&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;z("need readable",r),(0===t.length||t.length-e0?P(e,t):null,null===i?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},u.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},u.prototype.pipe=function(e,t){function r(e,t){z("onunpipe"),e===h&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,o())}function i(){z("onend"),e.end()}function o(){z("cleanup"),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",r),h.removeListener("end",i),h.removeListener("end",l),h.removeListener("data",a),g=!0,!p.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function a(t){z("ondata"),b=!1,!1!==e.write(t)||b||((1===p.pipesCount&&p.pipes===e||p.pipesCount>1&&-1!==A(p.pipes,e))&&!g&&(z("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,b=!0),h.pause())}function u(t){z("onerror",t),l(),e.removeListener("error",u),0===B(e,"error")&&e.emit("error",t)}function f(){e.removeListener("finish",c),l()}function c(){z("onfinish"),e.removeListener("close",f),l()}function l(){z("unpipe"),h.unpipe(e)}var h=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=e;break;case 1:p.pipes=[p.pipes,e];break;default:p.pipes.push(e)}p.pipesCount+=1,z("pipe count=%d opts=%j",p.pipesCount,t);var d=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,y=d?i:l;p.endEmitted?N(y):h.once("end",y),e.on("unpipe",r);var v=w(h);e.on("drain",v);var g=!1,b=!1;return h.on("data",a),s(e,"error",u),e.once("close",f),e.once("finish",c),e.emit("pipe",h),p.flowing||(z("pipe resume"),h.resume()),e},u.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?setImmediate:I;f.WritableState=u;var j=e("core-util-is");j.inherits=e("inherits");var A={deprecate:e("util-deprecate")},N=e("./internal/streams/stream"),L=e("safe-buffer").Buffer,R=r.Uint8Array||function(){},B=e("./internal/streams/destroy");j.inherits(f,N),u.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(u.prototype,"buffer",{get:A.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var U;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(U=Function.prototype[Symbol.hasInstance],Object.defineProperty(f,Symbol.hasInstance,{value:function(e){return!!U.call(this,e)||e&&e._writableState instanceof u}})):U=function(e){return e instanceof this},f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},f.prototype.write=function(e,t,n){var r=this._writableState,i=!1,u=s(e)&&!r.objectMode;return u&&!L.isBuffer(e)&&(e=o(e)),"function"==typeof t&&(n=t,t=null),u?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=a),r.ended?c(this,n):(u||l(this,r,e,n))&&(r.pendingcb++,i=p(this,r,u,e,t,n)),i},f.prototype.cork=function(){this._writableState.corked++},f.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||w(this,e))},f.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},f.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},f.prototype._writev=null,f.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||P(this,r,n)},Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),f.prototype.destroy=B.destroy,f.prototype._undestroy=B.undestroy,f.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":130,"./internal/streams/destroy":136,"./internal/streams/stream":137,_process:124,"core-util-is":71,inherits:103,"process-nextick-args":123,"safe-buffer":143,"util-deprecate":181}],135:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,n){e.copy(t,n)}var o=e("safe-buffer").Buffer;t.exports=function(){function e(){r(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return o.alloc(0);if(1===this.length)return this.head.data;for(var t=o.allocUnsafe(e>>>0),n=this.head,r=0;n;)i(n.data,t,r),r+=n.data.length,n=n.next;return t},e}()},{"safe-buffer":143}],136:[function(e,t,n){"use strict";function r(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;if(r||i)return void(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||s(o,this,e));this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(s(o,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})}function i(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(e,t){e.emit("error",t)}var s=e("process-nextick-args");t.exports={destroy:r,undestroy:i}},{"process-nextick-args":123}],137:[function(e,t,n){t.exports=e("events").EventEmitter},{events:96}],138:[function(e,t,n){t.exports=e("./readable").PassThrough},{"./readable":139}],139:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=n,n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":130,"./lib/_stream_passthrough.js":131,"./lib/_stream_readable.js":132,"./lib/_stream_transform.js":133,"./lib/_stream_writable.js":134}],140:[function(e,t,n){t.exports=e("./readable").Transform},{"./readable":139}],141:[function(e,t,n){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":134}],142:[function(e,t,n){(function(n){"use strict";function r(){l.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function i(e,t){return e<>>32-t}function o(e,t,n,r,o,s,a,u){return i(e+(t^n^r)+s+a|0,u)+o|0}function s(e,t,n,r,o,s,a,u){return i(e+(t&n|~t&r)+s+a|0,u)+o|0}function a(e,t,n,r,o,s,a,u){return i(e+((t|~n)^r)+s+a|0,u)+o|0}function u(e,t,n,r,o,s,a,u){return i(e+(t&r|n&~r)+s+a|0,u)+o|0}function f(e,t,n,r,o,s,a,u){return i(e+(t^(n|~r))+s+a|0,u)+o|0}var c=e("inherits"),l=e("hash-base");c(r,l),r.prototype._update=function(){for(var e=new Array(16),t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,c=this._c,l=this._d,h=this._e;n=o(n,r,c,l,h,e[0],0,11),c=i(c,10),h=o(h,n,r,c,l,e[1],0,14),r=i(r,10),l=o(l,h,n,r,c,e[2],0,15),n=i(n,10),c=o(c,l,h,n,r,e[3],0,12),h=i(h,10),r=o(r,c,l,h,n,e[4],0,5),l=i(l,10),n=o(n,r,c,l,h,e[5],0,8),c=i(c,10),h=o(h,n,r,c,l,e[6],0,7),r=i(r,10),l=o(l,h,n,r,c,e[7],0,9),n=i(n,10),c=o(c,l,h,n,r,e[8],0,11),h=i(h,10),r=o(r,c,l,h,n,e[9],0,13),l=i(l,10),n=o(n,r,c,l,h,e[10],0,14),c=i(c,10),h=o(h,n,r,c,l,e[11],0,15),r=i(r,10),l=o(l,h,n,r,c,e[12],0,6),n=i(n,10),c=o(c,l,h,n,r,e[13],0,7),h=i(h,10),r=o(r,c,l,h,n,e[14],0,9),l=i(l,10),n=o(n,r,c,l,h,e[15],0,8),c=i(c,10),h=s(h,n,r,c,l,e[7],1518500249,7),r=i(r,10),l=s(l,h,n,r,c,e[4],1518500249,6),n=i(n,10),c=s(c,l,h,n,r,e[13],1518500249,8),h=i(h,10),r=s(r,c,l,h,n,e[1],1518500249,13),l=i(l,10),n=s(n,r,c,l,h,e[10],1518500249,11),c=i(c,10),h=s(h,n,r,c,l,e[6],1518500249,9),r=i(r,10),l=s(l,h,n,r,c,e[15],1518500249,7),n=i(n,10),c=s(c,l,h,n,r,e[3],1518500249,15),h=i(h,10),r=s(r,c,l,h,n,e[12],1518500249,7),l=i(l,10),n=s(n,r,c,l,h,e[0],1518500249,12),c=i(c,10),h=s(h,n,r,c,l,e[9],1518500249,15),r=i(r,10),l=s(l,h,n,r,c,e[5],1518500249,9),n=i(n,10),c=s(c,l,h,n,r,e[2],1518500249,11),h=i(h,10),r=s(r,c,l,h,n,e[14],1518500249,7),l=i(l,10),n=s(n,r,c,l,h,e[11],1518500249,13),c=i(c,10),h=s(h,n,r,c,l,e[8],1518500249,12),r=i(r,10),l=a(l,h,n,r,c,e[3],1859775393,11),n=i(n,10),c=a(c,l,h,n,r,e[10],1859775393,13),h=i(h,10),r=a(r,c,l,h,n,e[14],1859775393,6),l=i(l,10),n=a(n,r,c,l,h,e[4],1859775393,7),c=i(c,10),h=a(h,n,r,c,l,e[9],1859775393,14),r=i(r,10),l=a(l,h,n,r,c,e[15],1859775393,9),n=i(n,10),c=a(c,l,h,n,r,e[8],1859775393,13),h=i(h,10),r=a(r,c,l,h,n,e[1],1859775393,15),l=i(l,10),n=a(n,r,c,l,h,e[2],1859775393,14),c=i(c,10),h=a(h,n,r,c,l,e[7],1859775393,8),r=i(r,10),l=a(l,h,n,r,c,e[0],1859775393,13),n=i(n,10),c=a(c,l,h,n,r,e[6],1859775393,6),h=i(h,10),r=a(r,c,l,h,n,e[13],1859775393,5),l=i(l,10),n=a(n,r,c,l,h,e[11],1859775393,12),c=i(c,10),h=a(h,n,r,c,l,e[5],1859775393,7),r=i(r,10),l=a(l,h,n,r,c,e[12],1859775393,5),n=i(n,10),c=u(c,l,h,n,r,e[1],2400959708,11),h=i(h,10),r=u(r,c,l,h,n,e[9],2400959708,12),l=i(l,10),n=u(n,r,c,l,h,e[11],2400959708,14),c=i(c,10),h=u(h,n,r,c,l,e[10],2400959708,15),r=i(r,10),l=u(l,h,n,r,c,e[0],2400959708,14),n=i(n,10),c=u(c,l,h,n,r,e[8],2400959708,15),h=i(h,10),r=u(r,c,l,h,n,e[12],2400959708,9),l=i(l,10),n=u(n,r,c,l,h,e[4],2400959708,8),c=i(c,10),h=u(h,n,r,c,l,e[13],2400959708,9),r=i(r,10),l=u(l,h,n,r,c,e[3],2400959708,14),n=i(n,10),c=u(c,l,h,n,r,e[7],2400959708,5),h=i(h,10),r=u(r,c,l,h,n,e[15],2400959708,6),l=i(l,10),n=u(n,r,c,l,h,e[14],2400959708,8),c=i(c,10),h=u(h,n,r,c,l,e[5],2400959708,6),r=i(r,10),l=u(l,h,n,r,c,e[6],2400959708,5),n=i(n,10),c=u(c,l,h,n,r,e[2],2400959708,12),h=i(h,10),r=f(r,c,l,h,n,e[4],2840853838,9),l=i(l,10),n=f(n,r,c,l,h,e[0],2840853838,15),c=i(c,10),h=f(h,n,r,c,l,e[5],2840853838,5),r=i(r,10),l=f(l,h,n,r,c,e[9],2840853838,11),n=i(n,10),c=f(c,l,h,n,r,e[7],2840853838,6),h=i(h,10),r=f(r,c,l,h,n,e[12],2840853838,8),l=i(l,10),n=f(n,r,c,l,h,e[2],2840853838,13),c=i(c,10),h=f(h,n,r,c,l,e[10],2840853838,12),r=i(r,10),l=f(l,h,n,r,c,e[14],2840853838,5),n=i(n,10),c=f(c,l,h,n,r,e[1],2840853838,12),h=i(h,10),r=f(r,c,l,h,n,e[3],2840853838,13),l=i(l,10),n=f(n,r,c,l,h,e[8],2840853838,14),c=i(c,10),h=f(h,n,r,c,l,e[11],2840853838,11),r=i(r,10),l=f(l,h,n,r,c,e[6],2840853838,8),n=i(n,10),c=f(c,l,h,n,r,e[15],2840853838,5),h=i(h,10),r=f(r,c,l,h,n,e[13],2840853838,6),l=i(l,10);var p=this._a,d=this._b,y=this._c,v=this._d,g=this._e;p=f(p,d,y,v,g,e[5],1352829926,8),y=i(y,10),g=f(g,p,d,y,v,e[14],1352829926,9),d=i(d,10),v=f(v,g,p,d,y,e[7],1352829926,9),p=i(p,10),y=f(y,v,g,p,d,e[0],1352829926,11),g=i(g,10),d=f(d,y,v,g,p,e[9],1352829926,13),v=i(v,10),p=f(p,d,y,v,g,e[2],1352829926,15),y=i(y,10),g=f(g,p,d,y,v,e[11],1352829926,15),d=i(d,10),v=f(v,g,p,d,y,e[4],1352829926,5),p=i(p,10),y=f(y,v,g,p,d,e[13],1352829926,7),g=i(g,10),d=f(d,y,v,g,p,e[6],1352829926,7),v=i(v,10),p=f(p,d,y,v,g,e[15],1352829926,8),y=i(y,10),g=f(g,p,d,y,v,e[8],1352829926,11),d=i(d,10),v=f(v,g,p,d,y,e[1],1352829926,14),p=i(p,10),y=f(y,v,g,p,d,e[10],1352829926,14),g=i(g,10),d=f(d,y,v,g,p,e[3],1352829926,12),v=i(v,10),p=f(p,d,y,v,g,e[12],1352829926,6),y=i(y,10),g=u(g,p,d,y,v,e[6],1548603684,9),d=i(d,10),v=u(v,g,p,d,y,e[11],1548603684,13),p=i(p,10),y=u(y,v,g,p,d,e[3],1548603684,15),g=i(g,10),d=u(d,y,v,g,p,e[7],1548603684,7),v=i(v,10),p=u(p,d,y,v,g,e[0],1548603684,12),y=i(y,10),g=u(g,p,d,y,v,e[13],1548603684,8),d=i(d,10),v=u(v,g,p,d,y,e[5],1548603684,9),p=i(p,10),y=u(y,v,g,p,d,e[10],1548603684,11),g=i(g,10),d=u(d,y,v,g,p,e[14],1548603684,7),v=i(v,10),p=u(p,d,y,v,g,e[15],1548603684,7),y=i(y,10),g=u(g,p,d,y,v,e[8],1548603684,12),d=i(d,10),v=u(v,g,p,d,y,e[12],1548603684,7),p=i(p,10),y=u(y,v,g,p,d,e[4],1548603684,6),g=i(g,10),d=u(d,y,v,g,p,e[9],1548603684,15),v=i(v,10),p=u(p,d,y,v,g,e[1],1548603684,13),y=i(y,10),g=u(g,p,d,y,v,e[2],1548603684,11),d=i(d,10),v=a(v,g,p,d,y,e[15],1836072691,9),p=i(p,10),y=a(y,v,g,p,d,e[5],1836072691,7),g=i(g,10),d=a(d,y,v,g,p,e[1],1836072691,15),v=i(v,10),p=a(p,d,y,v,g,e[3],1836072691,11),y=i(y,10),g=a(g,p,d,y,v,e[7],1836072691,8),d=i(d,10),v=a(v,g,p,d,y,e[14],1836072691,6),p=i(p,10),y=a(y,v,g,p,d,e[6],1836072691,6),g=i(g,10),d=a(d,y,v,g,p,e[9],1836072691,14),v=i(v,10),p=a(p,d,y,v,g,e[11],1836072691,12),y=i(y,10),g=a(g,p,d,y,v,e[8],1836072691,13),d=i(d,10),v=a(v,g,p,d,y,e[12],1836072691,5),p=i(p,10),y=a(y,v,g,p,d,e[2],1836072691,14),g=i(g,10),d=a(d,y,v,g,p,e[10],1836072691,13),v=i(v,10),p=a(p,d,y,v,g,e[0],1836072691,13),y=i(y,10),g=a(g,p,d,y,v,e[4],1836072691,7),d=i(d,10),v=a(v,g,p,d,y,e[13],1836072691,5),p=i(p,10),y=s(y,v,g,p,d,e[8],2053994217,15),g=i(g,10),d=s(d,y,v,g,p,e[6],2053994217,5),v=i(v,10),p=s(p,d,y,v,g,e[4],2053994217,8),y=i(y,10),g=s(g,p,d,y,v,e[1],2053994217,11),d=i(d,10),v=s(v,g,p,d,y,e[3],2053994217,14),p=i(p,10),y=s(y,v,g,p,d,e[11],2053994217,14),g=i(g,10),d=s(d,y,v,g,p,e[15],2053994217,6),v=i(v,10),p=s(p,d,y,v,g,e[0],2053994217,14),y=i(y,10),g=s(g,p,d,y,v,e[5],2053994217,6),d=i(d,10),v=s(v,g,p,d,y,e[12],2053994217,9),p=i(p,10),y=s(y,v,g,p,d,e[2],2053994217,12),g=i(g,10),d=s(d,y,v,g,p,e[13],2053994217,9),v=i(v,10),p=s(p,d,y,v,g,e[9],2053994217,12),y=i(y,10),g=s(g,p,d,y,v,e[7],2053994217,5),d=i(d,10),v=s(v,g,p,d,y,e[10],2053994217,15),p=i(p,10),y=s(y,v,g,p,d,e[14],2053994217,8),g=i(g,10),d=o(d,y,v,g,p,e[12],0,8),v=i(v,10),p=o(p,d,y,v,g,e[15],0,5),y=i(y,10),g=o(g,p,d,y,v,e[10],0,12),d=i(d,10),v=o(v,g,p,d,y,e[4],0,9),p=i(p,10),y=o(y,v,g,p,d,e[1],0,12),g=i(g,10),d=o(d,y,v,g,p,e[5],0,5),v=i(v,10),p=o(p,d,y,v,g,e[8],0,14),y=i(y,10),g=o(g,p,d,y,v,e[7],0,6),d=i(d,10),v=o(v,g,p,d,y,e[6],0,8),p=i(p,10),y=o(y,v,g,p,d,e[2],0,13),g=i(g,10),d=o(d,y,v,g,p,e[13],0,6),v=i(v,10),p=o(p,d,y,v,g,e[14],0,5),y=i(y,10),g=o(g,p,d,y,v,e[0],0,15),d=i(d,10),v=o(v,g,p,d,y,e[3],0,13),p=i(p,10),y=o(y,v,g,p,d,e[9],0,11),g=i(g,10),d=o(d,y,v,g,p,e[11],0,11),v=i(v,10);var b=this._b+c+v|0;this._b=this._c+l+g|0,this._c=this._d+h+p|0,this._d=this._e+n+d|0,this._e=this._a+r+y|0,this._a=b},r.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},t.exports=r}).call(this,e("buffer").Buffer)},{buffer:68,"hash-base":101,inherits:103}],143:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return s(e,t,n)}var o=e("buffer"),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?t.exports=o:(r(o,n),n.Buffer=i),r(s,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return s(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=s(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o.SlowBuffer(e)}},{buffer:68}],144:[function(e,t,n){t.exports=function(e,t){for(var n=e.split("."),r=t.split("."),i=0;i<3;i++){var o=Number(n[i]),s=Number(r[i]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return 0}},{}],145:[function(e,t,n){function r(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}var i=e("safe-buffer").Buffer;r.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var n=this._block,r=this._blockSize,o=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=4294967295&n,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},{"safe-buffer":143}],146:[function(e,t,n){var n=t.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};n.sha=e("./sha"),n.sha1=e("./sha1"),n.sha224=e("./sha224"),n.sha256=e("./sha256"),n.sha384=e("./sha384"),n.sha512=e("./sha512")},{"./sha":147,"./sha1":148,"./sha224":149,"./sha256":150,"./sha384":151,"./sha512":152}],147:[function(e,t,n){function r(){this.init(),this._w=l,u.call(this,64,56)}function i(e){return e<<5|e>>>27}function o(e){return e<<30|e>>>2}function s(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}var a=e("inherits"),u=e("./hash"),f=e("safe-buffer").Buffer,c=[1518500249,1859775393,-1894007588,-899497514],l=new Array(80);a(r,u),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,a=0|this._c,u=0|this._d,f=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var h=0;h<80;++h){var p=~~(h/20),d=i(n)+s(p,r,a,u)+f+t[h]+c[p]|0;f=u,u=a,a=o(r),r=n,n=d}this._a=n+this._a|0,this._b=r+this._b|0,this._c=a+this._c|0,this._d=u+this._d|0,this._e=f+this._e|0},r.prototype._hash=function(){var e=f.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=r},{"./hash":145,inherits:103,"safe-buffer":143}],148:[function(e,t,n){function r(){this.init(),this._w=h,f.call(this,64,56)}function i(e){return e<<1|e>>>31}function o(e){return e<<5|e>>>27}function s(e){return e<<30|e>>>2}function a(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}var u=e("inherits"),f=e("./hash"),c=e("safe-buffer").Buffer,l=[1518500249,1859775393,-1894007588,-899497514],h=new Array(80);u(r,f),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,u=0|this._c,f=0|this._d,c=0|this._e,h=0;h<16;++h)t[h]=e.readInt32BE(4*h);for(;h<80;++h)t[h]=i(t[h-3]^t[h-8]^t[h-14]^t[h-16]);for(var p=0;p<80;++p){var d=~~(p/20),y=o(n)+a(d,r,u,f)+c+t[p]+l[d]|0;c=f,f=u,u=s(r),r=n,n=y}this._a=n+this._a|0,this._b=r+this._b|0,this._c=u+this._c|0,this._d=f+this._d|0,this._e=c+this._e|0},r.prototype._hash=function(){var e=c.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=r},{"./hash":145,inherits:103,"safe-buffer":143}],149:[function(e,t,n){function r(){this.init(),this._w=u,s.call(this,64,56)}var i=e("inherits"),o=e("./sha256"),s=e("./hash"),a=e("safe-buffer").Buffer,u=new Array(64);i(r,o),r.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},r.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=r},{"./hash":145,"./sha256":150,inherits:103,"safe-buffer":143}],150:[function(e,t,n){function r(){this.init(),this._w=d,l.call(this,64,56)}function i(e,t,n){return n^e&(t^n)}function o(e,t,n){return e&t|n&(e|t)}function s(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function a(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function u(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function f(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=e("inherits"),l=e("./hash"),h=e("safe-buffer").Buffer,p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],d=new Array(64);c(r,l),r.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,c=0|this._c,l=0|this._d,h=0|this._e,d=0|this._f,y=0|this._g,v=0|this._h,g=0;g<16;++g)t[g]=e.readInt32BE(4*g);for(;g<64;++g)t[g]=f(t[g-2])+t[g-7]+u(t[g-15])+t[g-16]|0;for(var b=0;b<64;++b){var m=v+a(h)+i(h,d,y)+p[b]+t[b]|0,w=s(n)+o(n,r,c)|0;v=y,y=d,d=h,h=l+m|0,l=c,c=r,r=n,n=m+w|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=c+this._c|0,this._d=l+this._d|0,this._e=h+this._e|0,this._f=d+this._f|0,this._g=y+this._g|0,this._h=v+this._h|0},r.prototype._hash=function(){var e=h.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=r},{"./hash":145,inherits:103,"safe-buffer":143}],151:[function(e,t,n){function r(){this.init(),this._w=u,s.call(this,128,112)}var i=e("inherits"),o=e("./sha512"),s=e("./hash"),a=e("safe-buffer").Buffer,u=new Array(160);i(r,o),r.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},r.prototype._hash=function(){function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}var t=a.allocUnsafe(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=r},{"./hash":145,"./sha512":152,inherits:103,"safe-buffer":143}],152:[function(e,t,n){function r(){this.init(),this._w=g,d.call(this,128,112)}function i(e,t,n){return n^e&(t^n)}function o(e,t,n){return e&t|n&(e|t)}function s(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function a(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function u(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function f(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function c(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function h(e,t){return e>>>0>>0?1:0} var p=e("inherits"),d=e("./hash"),y=e("safe-buffer").Buffer,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],g=new Array(160);p(r,d),r.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},r.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,p=0|this._ch,d=0|this._dh,y=0|this._eh,g=0|this._fh,b=0|this._gh,m=0|this._hh,w=0|this._al,E=0|this._bl,_=0|this._cl,T=0|this._dl,S=0|this._el,P=0|this._fl,O=0|this._gl,I=0|this._hl,k=0;k<32;k+=2)t[k]=e.readInt32BE(4*k),t[k+1]=e.readInt32BE(4*k+4);for(;k<160;k+=2){var x=t[k-30],j=t[k-30+1],A=u(x,j),N=f(j,x);x=t[k-4],j=t[k-4+1];var L=c(x,j),R=l(j,x),B=t[k-14],U=t[k-14+1],D=t[k-32],C=t[k-32+1],M=N+U|0,F=A+B+h(M,N)|0;M=M+R|0,F=F+L+h(M,R)|0,M=M+C|0,F=F+D+h(M,C)|0,t[k]=F,t[k+1]=M}for(var z=0;z<160;z+=2){F=t[z],M=t[z+1];var q=o(n,r,p),H=o(w,E,_),$=s(n,w),V=s(w,n),Y=a(y,S),W=a(S,y),K=v[z],G=v[z+1],Z=i(y,g,b),X=i(S,P,O),J=I+W|0,Q=m+Y+h(J,I)|0;J=J+X|0,Q=Q+Z+h(J,X)|0,J=J+G|0,Q=Q+K+h(J,G)|0,J=J+M|0,Q=Q+F+h(J,M)|0;var ee=V+H|0,te=$+q+h(ee,V)|0;m=b,I=O,b=g,O=P,g=y,P=S,S=T+J|0,y=d+Q+h(S,T)|0,d=p,T=_,p=r,_=E,r=n,E=w,w=J+ee|0,n=Q+te+h(w,J)|0}this._al=this._al+w|0,this._bl=this._bl+E|0,this._cl=this._cl+_|0,this._dl=this._dl+T|0,this._el=this._el+S|0,this._fl=this._fl+P|0,this._gl=this._gl+O|0,this._hl=this._hl+I|0,this._ah=this._ah+n+h(this._al,w)|0,this._bh=this._bh+r+h(this._bl,E)|0,this._ch=this._ch+p+h(this._cl,_)|0,this._dh=this._dh+d+h(this._dl,T)|0,this._eh=this._eh+y+h(this._el,S)|0,this._fh=this._fh+g+h(this._fl,P)|0,this._gh=this._gh+b+h(this._gl,O)|0,this._hh=this._hh+m+h(this._hl,I)|0},r.prototype._hash=function(){function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}var t=y.allocUnsafe(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=r},{"./hash":145,inherits:103,"safe-buffer":143}],153:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e("events").EventEmitter;e("inherits")(r,i),r.Readable=e("readable-stream/readable.js"),r.Writable=e("readable-stream/writable.js"),r.Duplex=e("readable-stream/duplex.js"),r.Transform=e("readable-stream/transform.js"),r.PassThrough=e("readable-stream/passthrough.js"),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&f.pause&&f.pause()}function r(){f.readable&&f.resume&&f.resume()}function o(){c||(c=!0,e.end())}function s(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){f.removeListener("data",n),e.removeListener("drain",r),f.removeListener("end",o),f.removeListener("close",s),f.removeListener("error",a),e.removeListener("error",a),f.removeListener("end",u),f.removeListener("close",u),e.removeListener("close",u)}var f=this;f.on("data",n),e.on("drain",r),e._isStdio||t&&!1===t.end||(f.on("end",o),f.on("close",s));var c=!1;return f.on("error",a),e.on("error",a),f.on("end",u),f.on("close",u),e.on("close",u),e.emit("pipe",f),e}},{events:96,inherits:103,"readable-stream/duplex.js":129,"readable-stream/passthrough.js":138,"readable-stream/readable.js":139,"readable-stream/transform.js":140,"readable-stream/writable.js":141}],154:[function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function i(e){var t=r(e);if("string"!=typeof t&&(b.isEncoding===m||!m(e)))throw new Error("Unknown encoding: "+e);return t||e}function o(e){this.encoding=i(e);var t;switch(this.encoding){case"utf16le":this.text=h,this.end=p,t=4;break;case"utf8":this.fillLast=f,t=4;break;case"base64":this.text=d,this.end=y,t=3;break;default:return this.write=v,void(this.end=g)}this.lastNeed=0,this.lastTotal=0,this.lastChar=b.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:-1}function a(e,t,n){var r=t.length-1;if(r=0?(i>0&&(e.lastNeed=i-1),i):--r=0?(i>0&&(e.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0)}function u(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function f(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=a(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function h(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function d(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function y(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function g(e){return e&&e.length?this.write(e):""}var b=e("safe-buffer").Buffer,m=b.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};n.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0){var r=null==e.previous?"null":e.previous,i="/acquire/"+e.path+"/"+r;return t(this._post({url:i}))}return t(this._post({url:"/acquire/"+e.path}))}.$asyncbind(this))}},{key:"acquire",value:function(e){return new Promise(function(t,n){var r;return this._acquireMixed(e).then(function(e){return r=e,t(d.acquire(r))}.$asyncbind(this,n),n)}.$asyncbind(this))}},{key:"release",value:function(e){return new Promise(function(t,n){return this._post({url:"/release/"+e}).then(function(e){return t()}.$asyncbind(this,n),n)}.$asyncbind(this))}},{key:"call",value:function(e,t,n){return new Promise(function(r,i){var o;return this._post({url:"/call/"+e,body:{type:t,message:n}}).then(function(e){return o=e,r(d.call(o))}.$asyncbind(this,i),i)}.$asyncbind(this))}},{key:"requestDevice",value:function(){return Promise.reject()}}],[{key:"setFetch",value:function(e){(0,h.setFetch)(e)}}]),e}(),o(a.prototype,"init",[y.debugInOut],Object.getOwnPropertyDescriptor(a.prototype,"init"),a.prototype),o(a.prototype,"configure",[y.debugInOut],Object.getOwnPropertyDescriptor(a.prototype,"configure"),a.prototype),o(a.prototype,"listen",[y.debugInOut],Object.getOwnPropertyDescriptor(a.prototype,"listen"),a.prototype),o(a.prototype,"enumerate",[y.debugInOut],Object.getOwnPropertyDescriptor(a.prototype,"enumerate"),a.prototype),o(a.prototype,"acquire",[y.debugInOut],Object.getOwnPropertyDescriptor(a.prototype,"acquire"),a.prototype),o(a.prototype,"release",[y.debugInOut],Object.getOwnPropertyDescriptor(a.prototype,"release"),a.prototype),o(a.prototype,"call",[y.debugInOut],Object.getOwnPropertyDescriptor(a.prototype,"call"),a.prototype),a);n.default=b,t.exports=n.default}).call(this,e("_process"))},{"../debug-decorator":157,"../highlevel-checks":162,"./http":155,_process:124,"semver-compare":144}],157:[function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1e3?e.substring(0,1e3)+"...":e})),[")"]))}return i.apply(this,arguments).then(function(r){return e&&(null==r?console.log("[trezor-link] Done "+n+"."+t):console.log("[trezor-link] Done "+n+"."+t+", result ",r)),r},function(r){throw e&&console.error("[trezor-link] Error in "+n+"."+t,r),r})},n}Object.defineProperty(n,"__esModule",{value:!0}),n.debugInOut=i},{}],158:[function(e,t,n){"use strict";function r(){var e=function(e){},t=function(e){},n=new Promise(function(n,r){e=n,t=r}),r=n.then(function(){throw new Error("Promise is always rejecting")});return r.catch(function(){}),{resolve:e,reject:t,promise:n,rejectingPromise:r}}function i(e,t){return new Promise(function(n){setTimeout(function(){n(t)},e)})}function o(e,t){return new Promise(function(n,r){setTimeout(function(){r(t)},e)})}Object.defineProperty(n,"__esModule",{value:!0}),n.create=r,n.resolveTimeoutPromise=i,n.rejectTimeoutPromise=o},{}],159:[function(e,t,n){(function(r){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t,n,r,i){var o={};return Object.keys(r).forEach(function(e){o[e]=r[e]}),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce(function(n,r){return r(e,t,n)||n},o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}function a(e){if(null==e)return null;if(isNaN(e))return e;var t=parseInt(e);return isNaN(t)?e:t}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var f,c=Object.assign||function(e){for(var t=1;t=r)throw new Error("Config too old; "+i+" >= "+r);var o=n.wire_protocol,f=(0,u.protocolToJSON)(o.toRaw()),l=s.newBuilder({}).import(f).build();return new a.Messages(l)}Object.defineProperty(n,"__esModule",{value:!0}),n.parseConfigure=i;var o=e("protobufjs-old-fixed-webpack"),s=r(o),a=e("./messages.js"),u=e("./to_json.js"),f=e("./config_proto_compiled.js"),c=r(f)},{"./config_proto_compiled.js":164,"./messages.js":166,"./to_json.js":169,"protobufjs-old-fixed-webpack":126}],169:[function(e,t,n){"use strict";function r(e){var t=i(e.file[2]);return t.imports=[i(e.file[1])],t}function i(e){var t={};t.package=e.package,t.options=e.options,t.services=[];var n=Object.values(e.message_type).map(u),r=s(e.extension);return t.messages=r.concat(n),t.enums=Object.values(e.enum_type).map(o),t}function o(e){var t={};return t.name=e.name,t.values=Object.values(e.value).map(a),t.options={},t}function s(e){var t={};return Object.values(e).forEach(function(e){var n=e.extendee.slice(1);null==t[n]&&(t[n]={},t[n].ref=n,t[n].fields=[]),t[n].fields.push(f(e))}),Object.values(t)}function a(e){var t={};return t.name=e.name,t.id=e.number,t}function u(e){var t={};return t.enums=[],t.name=e.name,t.options=e.options||{},t.messages=[],t.fields=Object.values(e.field).map(f),t.oneofs={},t}function f(e){var t={};return 1===e.label&&(t.rule="optional"),2===e.label&&(t.rule="required"),3===e.label&&(t.rule="repeated"),t.type=l[e.type],e.type_name&&(t.type=e.type_name.slice(1)),t.name=e.name,t.options=e.options||{},t.id=e.number,t}Object.defineProperty(n,"__esModule",{value:!0}),n.protocolToJSON=r;var c=e("object.values");Object.values||(0,c.shim)();var l={1:"double",2:"float",3:"int64",4:"uint64",5:"int32",6:"fixed64",7:"fixed32",8:"bool",9:"string",10:"group",11:"message",12:"bytes",13:"uint32",14:"enum",15:"sfixed32",16:"sfixed64",17:"sint32",18:"sint64"}},{"object.values":119}],170:[function(e,t,n){(function(t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){var t=l.ByteBuffer.concat([e]),n=t.readByte(),r=t.readByte();if(n!==h||r!==h)throw new Error("Didn't receive expected header signature.");var i=t.readUint16(),o=t.readUint32(),s=new p(i,o);return s.append(t),s}function o(e,t){return new Promise(function(n,r){var i;return e.isDone()?n():t().then(function(s){return null==(i=s)?r(new Error("Received no data.")):(e.append(i),n(o(e,t)))}.$asyncbind(this,r),r)}.$asyncbind(this))}function s(e){return new Promise(function(t,n){var r,s;return e().then(function(a){return r=a,s=i(r),o(s,e).then(function(e){return t(s)}.$asyncbind(this,n),n)}.$asyncbind(this,n),n)}.$asyncbind(this))}function a(e,t){return new Promise(function(n,r){var i,o,a,u;return s(t).then(function(t){return i=t,o=i.typeNumber,a=i.arrayBuffer(),u=new c.MessageDecoder(e,o,a),n({message:u.decodedJSON(),type:u.messageName()})}.$asyncbind(this,r),r)}.$asyncbind(this))}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(n,"__esModule",{value:!0});var f=function(){function e(e,t){for(var n=0;n=this.expectedLength}},{key:"append",value:function(e){this.buffer.append(e)}},{key:"arrayBuffer",value:function(){var e=this.buffer;return e.reset(),e.toArrayBuffer()}}]),e}()}).call(this,e("_process"))},{"./protobuf/message_decoder.js":165,_process:124,"protobufjs-old-fixed-webpack":126}],171:[function(e,t,n){(function(t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){return new Promise(function(n,r){function i(){return(a=(l=c.next()).done)?[1]:(h=l.value,e(h).then(function(e){return o}.$asyncbind(this,y),y))}function o(){return a=!0,i}function s(){return p(d)()}var a,u,f,c,l,h,p=function(e){return function(t){try{!a&&c.return&&c.return()}catch(e){throw e}finally{if(u)throw f}return e&&e.call(this,t)}.$asyncbind(this,r)}.$asyncbind(this);a=!0,u=!1,f=void 0;var d=function(){return n()}.$asyncbind(this,r),y=function(e){return u=!0,f=e,p(d)()}.$asyncbind(this,p(r));try{return c=t[Symbol.iterator](),Function.$asyncbind.trampoline(this,s,o,y,!0)(i)}catch(e){y(e)}}.$asyncbind(this))}function o(e){delete e.$$hashKey;for(var t in e){var n=e[t];null==n?delete e[t]:(Array.isArray(n)&&n.forEach(function(e){"object"==typeof e&&o(e)}),"object"==typeof n&&o(n))}}function s(e,t,n){return new l(e,t,n).encode()}function a(e,t,n,r){return new Promise(function(o,a){var u=s(e,n,r);return o(i(t,u))}.$asyncbind(this))}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(n,"__esModule",{value:!0});var f=function(){function e(e,t){for(var n=0;n_Hü£.ǐ©3½X","c'œ\f\bfå\fǙÓ+Öº°‹màe6ѝ.ÙÎvË3\\IU®á\fÉ!Q2èS\t}T2í ky s½w@ÉLäQl±","C®Û¶÷çV?ŽÒïd왁H%çïOJ©‹'…NŒImIVÓ\0«EýÃLÒkÈq\rࣽöÞt5ý\vI+ç\nÇ_ÞX","‡|9ý|b#~‚5éÀuÚ²acxî¸í¹$‡Ÿÿíýölo‹ˆ¤ĤÎl(Þ\vÁôâŸËÅ¥ý2£à“Š",'s„ÅèÝ\nR:Û±†ÉoûdÂÇe€+òm½½ñ,1ž€Â!:lŽà=xtý"·\rhçÞäiÞÏ»µîšF\fÚE'],f=u.map(function(e){return new t(e,"binary")})}).call(this,e("buffer").Buffer)},{bigi:22,"bitcoinjs-lib-zcash":35,buffer:68}],173:[function(e,t,n){(function(r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n,r,i){var o={};return Object.keys(r).forEach(function(e){o[e]=r[e]}),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce(function(n,r){return r(e,t,n)||n},o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var s,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(){function e(e,t){for(var n=0;n0?new Promise(function(e){return setTimeout(function(){return e()},200*t)}).then(function(e){return i.call(this)}.$asyncbind(this,r),r):i.call(this)}.$asyncbind(this))},f=0,Function.$asyncbind.trampoline(this,o,i,n,!0)(r)}.$asyncbind(this))}},{key:"_connectIn",value:function(e){return new Promise(function(t,n){var r;return this._findDevice(e).then(function(e){return r=e,r.open().then(function(e){return r.selectConfiguration(1).then(function(e){return r.reset().then(function(e){return r.claimInterface(2).then(function(e){return t()}.$asyncbind(this,n),n)}.$asyncbind(this,n),n)}.$asyncbind(this,n),n)}.$asyncbind(this,n),n)}.$asyncbind(this,n),n)}.$asyncbind(this))}},{key:"disconnect",value:function(e){return new Promise(function(t,n){var r;return this._findDevice(e).then(function(e){return r=e,r.releaseInterface(2).then(function(e){return r.close().then(function(e){return t()}.$asyncbind(this,n),n)}.$asyncbind(this,n),n)}.$asyncbind(this,n),n)}.$asyncbind(this))}},{key:"requestDevice",value:function(){return new Promise(function(e,t){return this.usb.requestDevice({filters:c}).then(function(t){return e()}.$asyncbind(this,t),t)}.$asyncbind(this))}}]),e}(),o(s.prototype,"init",[f.debugInOut],Object.getOwnPropertyDescriptor(s.prototype,"init"),s.prototype),o(s.prototype,"connect",[f.debugInOut],Object.getOwnPropertyDescriptor(s.prototype,"connect"),s.prototype),o(s.prototype,"disconnect",[f.debugInOut],Object.getOwnPropertyDescriptor(s.prototype,"disconnect"),s.prototype),s);n.default=l,t.exports=n.default}).call(this,e("_process"))},{"../debug-decorator":157,_process:124}],174:[function(e,t,n){(function(r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n,r,i){var o={};return Object.keys(r).forEach(function(e){o[e]=r[e]}),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce(function(n,r){return r(e,t,n)||n},o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}function s(e){if(null==e)return"null";var t=e.map(function(e){return{path:e.path,session:null==e.session?null:e.session}});return m(t)}function a(e,t){return isNaN(parseInt(e.path))?e.patht.path?1:0:parseInt(e.path)-parseInt(t.path)}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var f,c=Object.assign||function(e){for(var t=1;tt.path?1:0:parseInt(e.path)-parseInt(t.path)}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var c,l=Object.assign||function(e){for(var t=1;t>24===e}function u(e){return e<<16>>16===e}function f(e){return(0|e)===e}function c(e){return(255&e)===e}function l(e){return(65535&e)===e}function h(e){return e>>>0===e}function p(e){return"number"==typeof e&&e>=0&&e<=m&&Math.floor(e)===e}var d=e("./native"),y=e("./errors"),v=o.bind(null,d.Array),g=o.bind(null,r),b=o.bind(null,i),m=Math.pow(2,53)-1,w={ArrayN:v,Buffer:r,BufferN:g,Finite:s,Hex:i,HexN:b,Int8:a,Int16:u,Int32:f,UInt8:c,UInt16:l,UInt32:h,UInt53:p};for(var E in w)w[E].toJSON=function(e){return e}.bind(null,E);t.exports=w}).call(this,{isBuffer:e("../is-buffer/index.js")})},{"../is-buffer/index.js":104,"./errors":176,"./native":179}],178:[function(e,t,n){function r(e){return a.String(e)?"?"===e[0]?p.maybe(e.slice(1)):a[e]||p.quacksLike(e):e&&a.Object(e)?a.Array(e)?p.arrayOf(e[0]):p.object(e):a.Function(e)?e:p.value(e)}function i(e,t,n,o){if(a.Function(e)){if(e(t,n))return!0;throw new f(o||e,t)}return i(r(e),t,n)}function o(e,t,n,r){if("function"==typeof n)return o(e,t,!1,n);try{i(e,t,n)}catch(e){return r(e)}r()}var s=e("./errors"),a=e("./native"),u=s.tfJSON,f=s.TfTypeError,c=s.TfPropertyTypeError,l=s.tfSubError,h=s.getValueTypeName,p={arrayOf:function(e){function t(t,n){return!!a.Array(t)&&t.every(function(t,r){try{return i(e,t,n)}catch(e){throw l(e,r)}})}return e=r(e),t.toJSON=function(){return"["+u(e)+"]"},t},maybe:function e(t){function n(n,r){return a.Nil(n)||t(n,r,e)}return t=r(t),n.toJSON=function(){return"?"+u(t)},n},map:function(e,t){function n(n,r){if(!a.Object(n,r))return!1;if(a.Nil(n,r))return!1;for(var o in n){try{t&&i(t,o,r)}catch(e){throw l(e,o,"key")}try{var s=n[o];i(e,s,r)}catch(e){throw l(e,o)}}return!0}return e=r(e),t&&(t=r(t)),n.toJSON=t?function(){return"{"+u(t)+": "+u(e)+"}"}:function(){return"{"+u(e)+"}"},n},object:function(e){function t(e,t){if(!a.Object(e))return!1;if(a.Nil(e))return!1;var r;try{for(r in n){i(n[r],e[r],t)}}catch(e){throw l(e,r)}if(t)for(r in e)if(!n[r])throw new c(void 0,r);return!0}var n={};for(var o in e)n[o]=r(e[o]);return t.toJSON=function(){return u(n)},t},oneOf:function(){function e(e,n){return t.some(function(t){try{return i(t,e,n)}catch(e){return!1}})}var t=[].slice.call(arguments).map(r);return e.toJSON=function(){return t.map(u).join("|")},e},quacksLike:function(e){function t(t){return e===h(t)}return t.toJSON=function(){return e},t},tuple:function(){function e(e,n){return t.every(function(t,r){try{return i(t,e[r],n)}catch(e){throw l(e,r)}})&&(!n||e.length===arguments.length)}var t=[].slice.call(arguments).map(r);return e.toJSON=function(){return"("+t.map(u).join(", ")+")"},e},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};for(var d in a)i[d]=a[d];for(d in p)i[d]=p[d];var y=e("./extra");for(d in y)i[d]=y[d];i.async=o,i.compile=r,i.TfTypeError=f,i.TfPropertyTypeError=c,t.exports=i},{"./errors":176,"./extra":177,"./native":179}],179:[function(e,t,n){var r={Array:function(e){return null!==e&&void 0!==e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return void 0===e||null===e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};r.Null=r.Nil;for(var i in r)r[i].toJSON=function(e){return e}.bind(null,i);t.exports=r},{}],180:[function(t,n,r){!function(t){"use strict";function r(e,t,n){var r=S[t];return r||(r=e(t,n),r.feature&&++P[t>>8&255]>p&&(S[t]=r)),r}function i(e,t,n){var r=65280&t,i=T.udata[r]||{},o=i[t];return o?new T(t,o):new T(t,h)}function o(e,t,n){return n?e(t,n):new T(t,null)}function s(e,t,n){var r;if(t=55296&&e<=56319},T.isLowSurrogate=function(e){return e>=56320&&e<=57343},T.prototype.prepFeature=function(){this.feature||(this.feature=T.fromCharCode(this.codepoint,!0).feature)},T.prototype.toString=function(){if(this.codepoint<65536)return String.fromCharCode(this.codepoint);var e=this.codepoint-65536;return String.fromCharCode(Math.floor(e/1024)+55296,e%1024+56320)},T.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},T.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},T.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},T.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},T.prototype.getComposite=function(e){if(this.prepFeature(),!this.feature[2])return null;var t=this.feature[2][e.codepoint];return t?T.fromCharCode(t):null};var k=function(e){this.str=e,this.cursor=0};k.prototype.next=function(){if(this.str&&this.cursor0;--n){var r=this.resBuf[n-1],i=r.getCanonicalClass();if(i<=e)break}this.resBuf.splice(n,0,t)}while(0!==e);return this.resBuf.shift()};var A=function(e){this.it=e,this.procBuf=[],this.resBuf=[],this.lastClass=null};A.prototype.next=function(){for(;0===this.resBuf.length;){var e=this.it.next();if(!e){this.resBuf=this.procBuf,this.procBuf=[];break}if(0===this.procBuf.length)this.lastClass=e.getCanonicalClass(),this.procBuf.push(e);else{var t=this.procBuf[0],n=t.getComposite(e),r=e.getCanonicalClass();n&&(this.lastClass=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),y(t)?r.showHidden=t:t&&n._extend(r,t),E(r.showHidden)&&(r.showHidden=!1),E(r.depth)&&(r.depth=2),E(r.colors)&&(r.colors=!1),E(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function s(e,t){return e}function a(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,t,r){if(e.customInspect&&t&&O(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return m(i)||(i=u(e,i,r)),i}var o=f(e,t);if(o)return o;var s=Object.keys(t),y=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),P(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return c(t);if(0===s.length){if(O(t)){var v=t.name?": "+t.name:"";return e.stylize("[Function"+v+"]","special")}if(_(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(S(t))return e.stylize(Date.prototype.toString.call(t),"date");if(P(t))return c(t)}var g="",b=!1,w=["{","}"];if(d(t)&&(b=!0,w=["[","]"]),O(t)){g=" [Function"+(t.name?": "+t.name:"")+"]"}if(_(t)&&(g=" "+RegExp.prototype.toString.call(t)),S(t)&&(g=" "+Date.prototype.toUTCString.call(t)),P(t)&&(g=" "+c(t)),0===s.length&&(!b||0==t.length))return w[0]+g+w[1];if(r<0)return _(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var E;return E=b?l(e,t,r,y,s):s.map(function(n){return h(e,t,r,y,n,b)}),e.seen.pop(),p(E,g,w)}function f(e,t){if(E(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):y(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i){for(var o=[],s=0,a=t.length;s-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e,t,n){var r=0;return e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function d(e){return Array.isArray(e)}function y(e){return"boolean"==typeof e}function v(e){return null===e}function g(e){return null==e}function b(e){return"number"==typeof e}function m(e){return"string"==typeof e}function w(e){return"symbol"==typeof e}function E(e){return void 0===e}function _(e){return T(e)&&"[object RegExp]"===k(e)}function T(e){return"object"==typeof e&&null!==e}function S(e){return T(e)&&"[object Date]"===k(e)}function P(e){return T(e)&&("[object Error]"===k(e)||e instanceof Error)}function O(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function k(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}function j(){var e=new Date,t=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":");return[e.getDate(),B[e.getMonth()],t].join(" ")}function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var N=/%[sdj%]/g;n.format=function(e){if(!m(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),a=r[n];ns||e%1!=0)throw new RangeError("value out of range")}function r(t,i,s){if(n(t),i||(i=new e(o(t))),!e.isBuffer(i))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),t<253?(i.writeUInt8(t,s),r.bytes=1):t<=65535?(i.writeUInt8(253,s),i.writeUInt16LE(t,s+1),r.bytes=3):t<=4294967295?(i.writeUInt8(254,s),i.writeUInt32LE(t,s+1),r.bytes=5):(i.writeUInt8(255,s),i.writeUInt32LE(t>>>0,s+1),i.writeUInt32LE(t/4294967296|0,s+5),r.bytes=9),i}function i(t,r){if(!e.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var o=t.readUInt8(r);if(o<253)return i.bytes=1,o;if(253===o)return i.bytes=3,t.readUInt16LE(r+1);if(254===o)return i.bytes=5,t.readUInt32LE(r+1);i.bytes=9;var s=t.readUInt32LE(r+1),a=t.readUInt32LE(r+5),u=4294967296*a+s;return n(u),u}function o(e){return n(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var s=9007199254740991;t.exports={encode:r,decode:i,encodingLength:o}}).call(this,e("buffer").Buffer)},{buffer:68}],186:[function(e,t,n){!function(e){"use strict";function t(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function n(e){return"string"!=typeof e&&(e=String(e)),e}function r(e){this.map={},e instanceof r?e.forEach(function(e,t){this.append(t,e)},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function i(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function o(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function s(e){var t=new FileReader;return t.readAsArrayBuffer(e),o(t)}function a(e){var t=new FileReader;return t.readAsText(e),o(t)}function u(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,"string"==typeof e)this._bodyText=e;else if(d.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(d.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(e){if(!d.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e))throw new Error("unsupported BodyInit type")}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type&&this.headers.set("content-type",this._bodyBlob.type))},d.blob?(this.blob=function(){var e=i(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(s)},this.text=function(){var e=i(this);if(e)return e;if(this._bodyBlob)return a(this._bodyBlob) ;if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var e=i(this);return e||Promise.resolve(this._bodyText)},d.formData&&(this.formData=function(){return this.text().then(l)}),this.json=function(){return this.text().then(JSON.parse)},this}function f(e){var t=e.toUpperCase();return y.indexOf(t)>-1?t:e}function c(e,t){t=t||{};var n=t.body;if(c.prototype.isPrototypeOf(e)){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new r(e.headers)),this.method=e.method,this.mode=e.mode,n||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=e;if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new r(t.headers)),this.method=f(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function l(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function h(e){var t=new r;return e.getAllResponseHeaders().trim().split("\n").forEach(function(e){var n=e.trim().split(":"),r=n.shift().trim(),i=n.join(":").trim();t.append(r,i)}),t}function p(e,t){t||(t={}),this.type="default",this.status=t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText,this.headers=t.headers instanceof r?t.headers:new r(t.headers),this.url=t.url||"",this._initBody(e)}if(!e.fetch){r.prototype.append=function(e,r){e=t(e),r=n(r);var i=this.map[e];i||(i=[],this.map[e]=i),i.push(r)},r.prototype.delete=function(e){delete this.map[t(e)]},r.prototype.get=function(e){var n=this.map[t(e)];return n?n[0]:null},r.prototype.getAll=function(e){return this.map[t(e)]||[]},r.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},r.prototype.set=function(e,r){this.map[t(e)]=[n(r)]},r.prototype.forEach=function(e,t){Object.getOwnPropertyNames(this.map).forEach(function(n){this.map[n].forEach(function(r){e.call(t,r,n,this)},this)},this)};var d={blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e},y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];c.prototype.clone=function(){return new c(this)},u.call(c.prototype),u.call(p.prototype),p.prototype.clone=function(){return new p(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},p.error=function(){var e=new p(null,{status:0,statusText:""});return e.type="error",e};var v=[301,302,303,307,308];p.redirect=function(e,t){if(-1===v.indexOf(t))throw new RangeError("Invalid status code");return new p(null,{status:t,headers:{location:e}})},e.Headers=r,e.Request=c,e.Response=p,e.fetch=function(e,t){return new Promise(function(n,r){function i(){return"responseURL"in s?s.responseURL:/^X-Request-URL:/m.test(s.getAllResponseHeaders())?s.getResponseHeader("X-Request-URL"):void 0}var o;o=c.prototype.isPrototypeOf(e)&&!t?e:new c(e,t);var s=new XMLHttpRequest;s.onload=function(){var e=1223===s.status?204:s.status;if(e<100||e>599)return void r(new TypeError("Network request failed"));var t={status:e,statusText:s.statusText,headers:h(s),url:i()},o="response"in s?s.response:s.responseText;n(new p(o,t))},s.onerror=function(){r(new TypeError("Network request failed"))},s.open(o.method,o.url,!0),"include"===o.credentials&&(s.withCredentials=!0),"responseType"in s&&d.blob&&(s.responseType="blob"),o.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),s.send(void 0===o._bodyInit?null:o._bodyInit)})},e.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],187:[function(e,t,n){(function(n){function r(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function i(e,t,r){var i=new n(r?34:33);return i.writeUInt8(e,0),t.copy(i,1),r&&(i[33]=1),i}function o(e,t){return r(a.decode(e),t)}function s(e,t,n){return"number"==typeof e?a.encode(i(e,t,n)):a.encode(i(e.version,e.privateKey,e.compressed))}var a=e("bs58check");t.exports={decode:o,decodeRaw:r,encode:s,encodeRaw:i}}).call(this,e("buffer").Buffer)},{bs58check:67,buffer:68}]},{},[6])(6)});