Files
bitcoinjs-lib-browser/bitcoinjs.min.js
2021-11-26 15:05:07 +08:00

2 lines
204 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).bitcoinjs=t()}}(function(){return function(){return function t(e,r,n){function i(s,u){if(!r[s]){if(!e[s]){var a="function"==typeof require&&require;if(!u&&a)return a(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=r[s]={exports:{}};e[s][0].call(c.exports,function(t){return i(e[s][1][t]||t)},c,c.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}}()({1:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer;e.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(255!==e[s])throw new TypeError(o+" is ambiguous");e[s]=i}var u=t.length,a=t.charAt(0),f=Math.log(u)/Math.log(256),c=Math.log(256)/Math.log(u);function h(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return n.alloc(0);for(var r=0,i=0,o=0;t[r]===a;)i++,r++;for(var s=(t.length-r)*f+1>>>0,c=new Uint8Array(s);t[r];){var h=e[t.charCodeAt(r)];if(255===h)return;for(var l=0,p=s-1;(0!==h||l<o)&&-1!==p;p--,l++)h+=u*c[p]>>>0,c[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");o=l,r++}for(var d=s-o;d!==s&&0===c[d];)d++;var y=n.allocUnsafe(i+(s-d));y.fill(0,0,i);for(var w=i;d!==s;)y[w++]=c[d++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,s=e.length;o!==s&&0===e[o];)o++,r++;for(var f=(s-o)*c+1>>>0,h=new Uint8Array(f);o!==s;){for(var l=e[o],p=0,d=f-1;(0!==l||p<i)&&-1!==d;d--,p++)l+=256*h[d]>>>0,h[d]=l%u>>>0,l=l/u>>>0;if(0!==l)throw new Error("Non-zero carry");i=p,o++}for(var y=f-i;y!==f&&0===h[y];)y++;for(var w=a.repeat(r);y<f;++y)w+=t.charAt(h[y]);return w},decodeUnsafe:h,decode:function(t){var e=h(t);if(e)return e;throw new Error("Non-base"+u+" character")}}}},{"safe-buffer":67}],2:[function(t,e,r){"use strict";r.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=f(t),s=n[0],u=n[1],a=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),c=0,h=u>0?s-4:s;for(r=0;r<h;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],a[c++]=e>>16&255,a[c++]=e>>8&255,a[c++]=255&e;2===u&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,a[c++]=255&e);1===u&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,a[c++]=e>>8&255,a[c++]=255&e);return a},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,u=r-i;s<u;s+=16383)o.push(c(t,s,s+16383>u?u:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,a=s.length;u<a;++u)n[u]=s[u],i[s.charCodeAt(u)]=u;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,s=[],u=e;u<r;u+=3)i=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",i={};for(let t=0;t<n.length;t++){const e=n.charAt(t);i[e]=t}function o(t){const e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function s(t){let e=1;for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=o(e)^n>>5}e=o(e);for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);e=o(e)^31&n}return e}function u(t,e,r,n){let i=0,o=0;const s=(1<<r)-1,u=[];for(let n=0;n<t.length;++n)for(i=i<<e|t[n],o+=e;o>=r;)o-=r,u.push(i>>o&s);if(n)o>0&&u.push(i<<r-o&s);else{if(o>=e)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return u}function a(t){return u(t,8,5,!0)}function f(t){const e=u(t,5,8,!1);if(Array.isArray(e))return e}function c(t){const e=u(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function h(t){let e;function r(t,r){if(r=r||90,t.length<8)return t+" too short";if(t.length>r)return"Exceeds length limit";const n=t.toLowerCase(),u=t.toUpperCase();if(t!==n&&t!==u)return"Mixed-case string "+t;const a=(t=n).lastIndexOf("1");if(-1===a)return"No separator character for "+t;if(0===a)return"Missing prefix for "+t;const f=t.slice(0,a),c=t.slice(a+1);if(c.length<6)return"Data too short";let h=s(f);if("string"==typeof h)return h;const l=[];for(let t=0;t<c.length;++t){const e=c.charAt(t),r=i[e];if(void 0===r)return"Unknown character "+e;h=o(h)^r,t+6>=c.length||l.push(r)}return h!==e?"Invalid checksum for "+t:{prefix:f,words:l}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,i){if(i=i||90,t.length+7+r.length>i)throw new TypeError("Exceeds length limit");let u=s(t=t.toLowerCase());if("string"==typeof u)throw new Error(u);let a=t+"1";for(let t=0;t<r.length;++t){const e=r[t];if(e>>5!=0)throw new Error("Non 5-bit word");u=o(u)^e,a+=n.charAt(e)}for(let t=0;t<6;++t)u=o(u);u^=e;for(let t=0;t<6;++t){const e=u>>5*(5-t)&31;a+=n.charAt(e)}return a},toWords:a,fromWordsUnsafe:f,fromWords:c}}r.bech32=h("bech32"),r.bech32m=h("bech32m")},{}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../parser");function i(t,e,r){return n=>{if(t.has(n))return;const i=r.filter(t=>t.key.toString("hex")===n)[0];e.push(i),t.add(n)}}function o(t){return t.globalMap.unsignedTx}function s(t){const e=new Set;return t.forEach(t=>{const r=t.key.toString("hex");if(e.has(r))throw new Error("Combine: KeyValue Map keys should be unique");e.add(r)}),e}r.combine=function(t){const e=t[0],r=n.psbtToKeyVals(e),u=t.slice(1);if(0===u.length)throw new Error("Combine: Nothing to combine");const a=o(e);if(void 0===a)throw new Error("Combine: Self missing transaction");const f=s(r.globalKeyVals),c=r.inputKeyVals.map(s),h=r.outputKeyVals.map(s);for(const t of u){const e=o(t);if(void 0===e||!e.toBuffer().equals(a.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const u=n.psbtToKeyVals(t);s(u.globalKeyVals).forEach(i(f,r.globalKeyVals,u.globalKeyVals)),u.inputKeyVals.map(s).forEach((t,e)=>t.forEach(i(c[e],r.inputKeyVals[e],u.inputKeyVals[e]))),u.outputKeyVals.map(s).forEach((t,e)=>t.forEach(i(h[e],r.outputKeyVals[e],u.outputKeyVals[e])))}return n.psbtFromKeyVals(a,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},{"../parser":22}],5:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields"),i=t=>[...Array(t).keys()];r.decode=function(t){if(t.key[0]!==n.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+t.key.toString("hex"));if(79!==t.key.length||![2,3].includes(t.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+t.key.toString("hex"));if(t.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const e=t.key.slice(1),r={masterFingerprint:t.value.slice(0,4),extendedPubkey:e,path:"m"};for(const e of i(t.value.length/4-1)){const n=t.value.readUInt32LE(4*e+4),i=!!(2147483648&n),o=2147483647&n;r.path+="/"+o.toString(10)+(i?"'":"")}return r},r.encode=function(t){const r=e.from([n.GlobalTypes.GLOBAL_XPUB]),i=e.concat([r,t.extendedPubkey]),o=t.path.split("/"),s=e.allocUnsafe(4*o.length);t.masterFingerprint.copy(s,0);let u=4;return o.slice(1).forEach(t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,u),u+=4}),{key:i,value:s}},r.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",r.check=function(t){const r=t.extendedPubkey,n=t.masterFingerprint,i=t.path;return e.isBuffer(r)&&78===r.length&&[2,3].indexOf(r[45])>-1&&e.isBuffer(n)&&4===n.length&&"string"==typeof i&&!!i.match(/^m(\/\d+'?)+$/)},r.canAddToArray=function(t,e,r){const n=e.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter(t=>t.extendedPubkey.equals(e.extendedPubkey)).length)}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],6:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields");r.encode=function(t){return{key:e.from([n.GlobalTypes.UNSIGNED_TX]),value:t.toBuffer()}}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../typeFields"),i=t("./global/globalXpub"),o=t("./global/unsignedTx"),s=t("./input/finalScriptSig"),u=t("./input/finalScriptWitness"),a=t("./input/nonWitnessUtxo"),f=t("./input/partialSig"),c=t("./input/porCommitment"),h=t("./input/sighashType"),l=t("./input/witnessUtxo"),p=t("./shared/bip32Derivation"),d=t("./shared/checkPubkey"),y=t("./shared/redeemScript"),w=t("./shared/witnessScript"),g={unsignedTx:o,globalXpub:i,checkPubkey:d.makeChecker([])};r.globals=g;const b={nonWitnessUtxo:a,partialSig:f,sighashType:h,finalScriptSig:s,finalScriptWitness:u,porCommitment:c,witnessUtxo:l,bip32Derivation:p.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:y.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:w.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:d.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION])};r.inputs=b;const _={bip32Derivation:p.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:y.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:w.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:d.makeChecker([n.OutputTypes.BIP32_DERIVATION])};r.outputs=_},{"../typeFields":25,"./global/globalXpub":5,"./global/unsignedTx":6,"./input/finalScriptSig":8,"./input/finalScriptWitness":9,"./input/nonWitnessUtxo":10,"./input/partialSig":11,"./input/porCommitment":12,"./input/sighashType":13,"./input/witnessUtxo":14,"./shared/bip32Derivation":15,"./shared/checkPubkey":16,"./shared/redeemScript":17,"./shared/witnessScript":18}],8:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields");r.decode=function(t){if(t.key[0]!==n.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+t.key.toString("hex"));return t.value},r.encode=function(t){return{key:e.from([n.InputTypes.FINAL_SCRIPTSIG]),value:t}},r.expected="Buffer",r.check=function(t){return e.isBuffer(t)},r.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptSig}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],9:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields");r.decode=function(t){if(t.key[0]!==n.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+t.key.toString("hex"));return t.value},r.encode=function(t){return{key:e.from([n.InputTypes.FINAL_SCRIPTWITNESS]),value:t}},r.expected="Buffer",r.check=function(t){return e.isBuffer(t)},r.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptWitness}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],10:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields");r.decode=function(t){if(t.key[0]!==n.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+t.key.toString("hex"));return t.value},r.encode=function(t){return{key:e.from([n.InputTypes.NON_WITNESS_UTXO]),value:t}},r.expected="Buffer",r.check=function(t){return e.isBuffer(t)},r.canAdd=function(t,e){return!!t&&!!e&&void 0===t.nonWitnessUtxo}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],11:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields");r.decode=function(t){if(t.key[0]!==n.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+t.key.toString("hex"));if(34!==t.key.length&&66!==t.key.length||![2,3,4].includes(t.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+t.key.toString("hex"));return{pubkey:t.key.slice(1),signature:t.value}},r.encode=function(t){const r=e.from([n.InputTypes.PARTIAL_SIG]);return{key:e.concat([r,t.pubkey]),value:t.signature}},r.expected="{ pubkey: Buffer; signature: Buffer; }",r.check=function(t){return e.isBuffer(t.pubkey)&&e.isBuffer(t.signature)&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&function(t){if(!e.isBuffer(t)||t.length<9)return!1;if(48!==t[0])return!1;if(t.length!==t[1]+3)return!1;if(2!==t[2])return!1;const r=t[3];if(r>33||r<1)return!1;if(2!==t[3+r+1])return!1;const n=t[3+r+2];return!(n>33||n<1)&&t.length===3+r+2+n+2}(t.signature)},r.canAddToArray=function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter(t=>t.pubkey.equals(e.pubkey)).length)}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],12:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields");r.decode=function(t){if(t.key[0]!==n.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+t.key.toString("hex"));return t.value.toString("utf8")},r.encode=function(t){return{key:e.from([n.InputTypes.POR_COMMITMENT]),value:e.from(t,"utf8")}},r.expected="string",r.check=function(t){return"string"==typeof t},r.canAdd=function(t,e){return!!t&&!!e&&void 0===t.porCommitment}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],13:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields");r.decode=function(t){if(t.key[0]!==n.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+t.key.toString("hex"));return t.value.readUInt32LE(0)},r.encode=function(t){const r=e.from([n.InputTypes.SIGHASH_TYPE]),i=e.allocUnsafe(4);return i.writeUInt32LE(t,0),{key:r,value:i}},r.expected="number",r.check=function(t){return"number"==typeof t},r.canAdd=function(t,e){return!!t&&!!e&&void 0===t.sighashType}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,buffer:56}],14:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../../typeFields"),i=t("../tools"),o=t("../varint");r.decode=function(t){if(t.key[0]!==n.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+t.key.toString("hex"));const e=i.readUInt64LE(t.value,0);let r=8;const s=o.decode(t.value,r);r+=o.encodingLength(s);const u=t.value.slice(r);if(u.length!==s)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:u,value:e}},r.encode=function(t){const{script:r,value:s}=t,u=o.encodingLength(r.length),a=e.allocUnsafe(8+u+r.length);return i.writeUInt64LE(a,s,0),o.encode(r.length,a,8),r.copy(a,8+u),{key:e.from([n.InputTypes.WITNESS_UTXO]),value:a}},r.expected="{ script: Buffer; value: number; }",r.check=function(t){return e.isBuffer(t.script)&&"number"==typeof t.value},r.canAdd=function(t,e){return!!t&&!!e&&void 0===t.witnessUtxo}}).call(this)}).call(this,t("buffer").Buffer)},{"../../typeFields":25,"../tools":19,"../varint":20,buffer:56}],15:[function(t,e,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const e=t=>[...Array(t).keys()];r.makeConverter=function(r){return{decode:function(t){if(t.key[0]!==r)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+t.key.toString("hex"));if(34!==t.key.length&&66!==t.key.length||![2,3,4].includes(t.key[1]))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+t.key.toString("hex"));if(t.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const n=t.key.slice(1),i={masterFingerprint:t.value.slice(0,4),pubkey:n,path:"m"};for(const r of e(t.value.length/4-1)){const e=t.value.readUInt32LE(4*r+4),n=!!(2147483648&e),o=2147483647&e;i.path+="/"+o.toString(10)+(n?"'":"")}return i},encode:function(e){const n=t.from([r]),i=t.concat([n,e.pubkey]),o=e.path.split("/"),s=t.allocUnsafe(4*o.length);e.masterFingerprint.copy(s,0);let u=4;return o.slice(1).forEach(t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,u),u+=4}),{key:i,value:s}},check:function(e){return t.isBuffer(e.pubkey)&&t.isBuffer(e.masterFingerprint)&&"string"==typeof e.path&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter(t=>t.pubkey.equals(e.pubkey)).length)}}}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.makeChecker=function(t){return function(e){let r;if(t.includes(e.key[0])&&(33!==(r=e.key.slice(1)).length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+e.key.toString("hex"));return r}}},{}],17:[function(t,e,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(r){return{key:t.from([e]),value:r}},check:function(e){return t.isBuffer(e)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.redeemScript}}}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56}],18:[function(t,e,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(r){return{key:t.from([e]),value:r}},check:function(e){return t.isBuffer(e)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.witnessScript}}}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56}],19:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("./varint");function i(t){const r=t.key.length,i=t.value.length,o=n.encodingLength(r),s=n.encodingLength(i),u=e.allocUnsafe(o+r+s+i);return n.encode(r,u,0),t.key.copy(u,o),n.encode(i,u,o+r),t.value.copy(u,o+r+s),u}function o(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}r.range=(t=>[...Array(t).keys()]),r.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},r.keyValsToBuffer=function(t){const r=t.map(i);return r.push(e.from([0])),e.concat(r)},r.keyValToBuffer=i,r.readUInt64LE=function(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return o((n*=4294967296)+r,9007199254740991),n+r},r.writeUInt64LE=function(t,e,r){return o(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}}).call(this)}).call(this,t("buffer").Buffer)},{"./varint":20,buffer:56}],20:[function(t,e,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const e=9007199254740991;function n(t){if(t<0||t>e||t%1!=0)throw new RangeError("value out of range")}function i(t){return n(t),t<253?1:t<=65535?3:t<=4294967295?5:9}r.encode=function e(r,o,s){if(n(r),o||(o=t.allocUnsafe(i(r))),!t.isBuffer(o))throw new TypeError("buffer must be a Buffer instance");return s||(s=0),r<253?(o.writeUInt8(r,s),Object.assign(e,{bytes:1})):r<=65535?(o.writeUInt8(253,s),o.writeUInt16LE(r,s+1),Object.assign(e,{bytes:3})):r<=4294967295?(o.writeUInt8(254,s),o.writeUInt32LE(r,s+1),Object.assign(e,{bytes:5})):(o.writeUInt8(255,s),o.writeUInt32LE(r>>>0,s+1),o.writeUInt32LE(r/4294967296|0,s+5),Object.assign(e,{bytes:9})),o},r.decode=function e(r,i){if(!t.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");i||(i=0);const o=r.readUInt8(i);if(o<253)return Object.assign(e,{bytes:1}),o;if(253===o)return Object.assign(e,{bytes:3}),r.readUInt16LE(i+1);if(254===o)return Object.assign(e,{bytes:5}),r.readUInt32LE(i+1);{Object.assign(e,{bytes:9});const t=r.readUInt32LE(i+1),o=4294967296*r.readUInt32LE(i+5)+t;return n(o),o}},r.encodingLength=i}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56}],21:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../converter"),i=t("../converter/tools"),o=t("../converter/varint"),s=t("../typeFields");function u(t,r,n){if(!r.equals(e.from([n])))throw new Error(`Format Error: Invalid ${t} key: ${r.toString("hex")}`)}function a(t,{globalMapKeyVals:e,inputKeyVals:r,outputKeyVals:o}){const a={unsignedTx:t};let f=0;for(const t of e)switch(t.key[0]){case s.GlobalTypes.UNSIGNED_TX:if(u("global",t.key,s.GlobalTypes.UNSIGNED_TX),f>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");f++;break;case s.GlobalTypes.GLOBAL_XPUB:void 0===a.globalXpub&&(a.globalXpub=[]),a.globalXpub.push(n.globals.globalXpub.decode(t));break;default:a.unknownKeyVals||(a.unknownKeyVals=[]),a.unknownKeyVals.push(t)}const c=r.length,h=o.length,l=[],p=[];for(const t of i.range(c)){const e={};for(const i of r[t])switch(n.inputs.checkPubkey(i),i.key[0]){case s.InputTypes.NON_WITNESS_UTXO:if(u("input",i.key,s.InputTypes.NON_WITNESS_UTXO),void 0!==e.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");e.nonWitnessUtxo=n.inputs.nonWitnessUtxo.decode(i);break;case s.InputTypes.WITNESS_UTXO:if(u("input",i.key,s.InputTypes.WITNESS_UTXO),void 0!==e.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");e.witnessUtxo=n.inputs.witnessUtxo.decode(i);break;case s.InputTypes.PARTIAL_SIG:void 0===e.partialSig&&(e.partialSig=[]),e.partialSig.push(n.inputs.partialSig.decode(i));break;case s.InputTypes.SIGHASH_TYPE:if(u("input",i.key,s.InputTypes.SIGHASH_TYPE),void 0!==e.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");e.sighashType=n.inputs.sighashType.decode(i);break;case s.InputTypes.REDEEM_SCRIPT:if(u("input",i.key,s.InputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");e.redeemScript=n.inputs.redeemScript.decode(i);break;case s.InputTypes.WITNESS_SCRIPT:if(u("input",i.key,s.InputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");e.witnessScript=n.inputs.witnessScript.decode(i);break;case s.InputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(n.inputs.bip32Derivation.decode(i));break;case s.InputTypes.FINAL_SCRIPTSIG:u("input",i.key,s.InputTypes.FINAL_SCRIPTSIG),e.finalScriptSig=n.inputs.finalScriptSig.decode(i);break;case s.InputTypes.FINAL_SCRIPTWITNESS:u("input",i.key,s.InputTypes.FINAL_SCRIPTWITNESS),e.finalScriptWitness=n.inputs.finalScriptWitness.decode(i);break;case s.InputTypes.POR_COMMITMENT:u("input",i.key,s.InputTypes.POR_COMMITMENT),e.porCommitment=n.inputs.porCommitment.decode(i);break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(i)}l.push(e)}for(const t of i.range(h)){const e={};for(const r of o[t])switch(n.outputs.checkPubkey(r),r.key[0]){case s.OutputTypes.REDEEM_SCRIPT:if(u("output",r.key,s.OutputTypes.REDEEM_SCRIPT),void 0!==e.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");e.redeemScript=n.outputs.redeemScript.decode(r);break;case s.OutputTypes.WITNESS_SCRIPT:if(u("output",r.key,s.OutputTypes.WITNESS_SCRIPT),void 0!==e.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");e.witnessScript=n.outputs.witnessScript.decode(r);break;case s.OutputTypes.BIP32_DERIVATION:void 0===e.bip32Derivation&&(e.bip32Derivation=[]),e.bip32Derivation.push(n.outputs.bip32Derivation.decode(r));break;default:e.unknownKeyVals||(e.unknownKeyVals=[]),e.unknownKeyVals.push(r)}p.push(e)}return{globalMap:a,inputs:l,outputs:p}}r.psbtFromBuffer=function(t,e){let r=0;function n(){const e=o.decode(t,r);r+=o.encodingLength(e);const n=t.slice(r,r+e);return r+=e,n}function u(){return{key:n(),value:n()}}function f(){if(r>=t.length)throw new Error("Format Error: Unexpected End of PSBT");const e=0===t.readUInt8(r);return e&&r++,e}if(1886610036!==function(){const e=t.readUInt32BE(r);return r+=4,e}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const e=t.readUInt8(r);return r+=1,e}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const c=[],h={};for(;!f();){const t=u(),e=t.key.toString("hex");if(h[e])throw new Error("Format Error: Keys must be unique for global keymap: key "+e);h[e]=1,c.push(t)}const l=c.filter(t=>t.key[0]===s.GlobalTypes.UNSIGNED_TX);if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const p=e(l[0].value),{inputCount:d,outputCount:y}=p.getInputOutputCounts(),w=[],g=[];for(const t of i.range(d)){const e={},r=[];for(;!f();){const n=u(),i=n.key.toString("hex");if(e[i])throw new Error("Format Error: Keys must be unique for each input: input index "+t+" key "+i);e[i]=1,r.push(n)}w.push(r)}for(const t of i.range(y)){const e={},r=[];for(;!f();){const n=u(),i=n.key.toString("hex");if(e[i])throw new Error("Format Error: Keys must be unique for each output: output index "+t+" key "+i);e[i]=1,r.push(n)}g.push(r)}return a(p,{globalMapKeyVals:c,inputKeyVals:w,outputKeyVals:g})},r.checkKeyBuffer=u,r.psbtFromKeyVals=a}).call(this)}).call(this,t("buffer").Buffer)},{"../converter":7,"../converter/tools":19,"../converter/varint":20,"../typeFields":25,buffer:56}],22:[function(t,e,r){"use strict";function n(t){for(var e in t)r.hasOwnProperty(e)||(r[e]=t[e])}Object.defineProperty(r,"__esModule",{value:!0}),n(t("./fromBuffer")),n(t("./toBuffer"))},{"./fromBuffer":21,"./toBuffer":23}],23:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("../converter"),i=t("../converter/tools");r.psbtToBuffer=function({globalMap:t,inputs:r,outputs:n}){const{globalKeyVals:o,inputKeyVals:s,outputKeyVals:a}=u({globalMap:t,inputs:r,outputs:n}),f=i.keyValsToBuffer(o),c=t=>0===t.length?[e.from([0])]:t.map(i.keyValsToBuffer),h=c(s),l=c(a),p=e.allocUnsafe(5);return p.writeUIntBE(482972169471,0,5),e.concat([p,f].concat(h,l))};const o=(t,e)=>t.key.compare(e.key);function s(t,e){const r=new Set,n=Object.entries(t).reduce((t,[n,i])=>{if("unknownKeyVals"===n)return t;const o=e[n];if(void 0===o)return t;const s=(Array.isArray(i)?i:[i]).map(o.encode);return s.map(t=>t.key.toString("hex")).forEach(t=>{if(r.has(t))throw new Error("Serialize Error: Duplicate key: "+t);r.add(t)}),t.concat(s)},[]),i=t.unknownKeyVals?t.unknownKeyVals.filter(t=>!r.has(t.key.toString("hex"))):[];return n.concat(i).sort(o)}function u({globalMap:t,inputs:e,outputs:r}){return{globalKeyVals:s(t,n.globals),inputKeyVals:e.map(t=>s(t,n.inputs)),outputKeyVals:r.map(t=>s(t,n.outputs))}}r.psbtToKeyVals=u}).call(this)}).call(this,t("buffer").Buffer)},{"../converter":7,"../converter/tools":19,buffer:56}],24:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("./combiner"),i=t("./parser"),o=t("./typeFields"),s=t("./utils");r.Psbt=class{constructor(t){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:t}}static fromBase64(t,r){const n=e.from(t,"base64");return this.fromBuffer(n,r)}static fromHex(t,r){const n=e.from(t,"hex");return this.fromBuffer(n,r)}static fromBuffer(t,e){const r=i.psbtFromBuffer(t,e),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return i.psbtToBuffer(this)}updateGlobal(t){return s.updateGlobal(t,this.globalMap),this}updateInput(t,e){const r=s.checkForInput(this.inputs,t);return s.updateInput(e,r),this}updateOutput(t,e){const r=s.checkForOutput(this.outputs,t);return s.updateOutput(e,r),this}addUnknownKeyValToGlobal(t){return s.checkHasKey(t,this.globalMap.unknownKeyVals,s.getEnumLength(o.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(t),this}addUnknownKeyValToInput(t,e){const r=s.checkForInput(this.inputs,t);return s.checkHasKey(e,r.unknownKeyVals,s.getEnumLength(o.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addUnknownKeyValToOutput(t,e){const r=s.checkForOutput(this.outputs,t);return s.checkHasKey(e,r.unknownKeyVals,s.getEnumLength(o.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addInput(t){this.globalMap.unsignedTx.addInput(t),this.inputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach(t=>this.addUnknownKeyValToInput(r,t)),s.addInputAttributes(this.inputs,t),this}addOutput(t){this.globalMap.unsignedTx.addOutput(t),this.outputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach(t=>this.addUnknownKeyValToInput(r,t)),s.addOutputAttributes(this.outputs,t),this}clearFinalizedInput(t){const e=s.checkForInput(this.inputs,t);s.inputCheckUncleanFinalized(t,e);for(const t of Object.keys(e))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(t)||delete e[t];return this}combine(...t){const e=n.combine([this].concat(t));return Object.assign(this,e),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}}}).call(this)}).call(this,t("buffer").Buffer)},{"./combiner":4,"./parser":22,"./typeFields":25,"./utils":26,buffer:56}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(t){t[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.GLOBAL_XPUB=1]="GLOBAL_XPUB"}(r.GlobalTypes||(r.GlobalTypes={})),r.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],function(t){t[t.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",t[t.WITNESS_UTXO=1]="WITNESS_UTXO",t[t.PARTIAL_SIG=2]="PARTIAL_SIG",t[t.SIGHASH_TYPE=3]="SIGHASH_TYPE",t[t.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",t[t.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",t[t.BIP32_DERIVATION=6]="BIP32_DERIVATION",t[t.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",t[t.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",t[t.POR_COMMITMENT=9]="POR_COMMITMENT"}(r.InputTypes||(r.InputTypes={})),r.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment"],function(t){t[t.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",t[t.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",t[t.BIP32_DERIVATION=2]="BIP32_DERIVATION"}(r.OutputTypes||(r.OutputTypes={})),r.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation"]},{}],26:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=t("./converter");function i(t,e){const r=t[e];if(void 0===r)throw new Error(`No input #${e}`);return r}function o(t,e,r,n){throw new Error(`Data for ${t} key ${e} is incorrect: Expected `+`${r} and got ${JSON.stringify(n)}`)}function s(t){return(e,r)=>{for(const i of Object.keys(e)){const s=e[i],{canAdd:u,canAddToArray:a,check:f,expected:c}=n[t+"s"][i]||{};if(f)if(!!a){if(!Array.isArray(s)||r[i]&&!Array.isArray(r[i]))throw new Error(`Key type ${i} must be an array`);s.every(f)||o(t,i,c,s);const e=r[i]||[],n=new Set;if(!s.every(t=>a(e,t,n)))throw new Error("Can not add duplicate data to array");r[i]=e.concat(s)}else{if(f(s)||o(t,i,c,s),!u(r,s))throw new Error(`Can not add duplicate data to ${t}`);r[i]=s}}}}r.checkForInput=i,r.checkForOutput=function(t,e){const r=t[e];if(void 0===r)throw new Error(`No output #${e}`);return r},r.checkHasKey=function(t,e,r){if(t.key[0]<r)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(e&&0!==e.filter(e=>e.key.equals(t.key)).length)throw new Error(`Duplicate Key: ${t.key.toString("hex")}`)},r.getEnumLength=function(t){let e=0;return Object.keys(t).forEach(t=>{Number(isNaN(Number(t)))&&e++}),e},r.inputCheckUncleanFinalized=function(t,e){let r=!1;if(e.nonWitnessUtxo||e.witnessUtxo){const t=!!e.redeemScript,n=!!e.witnessScript,i=!t||!!e.finalScriptSig,o=!n||!!e.finalScriptWitness,s=!!e.finalScriptSig||!!e.finalScriptWitness;r=i&&o&&s}if(!1===r)throw new Error(`Input #${t} has too much or too little data to clean`)},r.updateGlobal=s("global"),r.updateInput=s("input"),r.updateOutput=s("output"),r.addInputAttributes=function(t,e){const n=i(t,t.length-1);r.updateInput(e,n)},r.addOutputAttributes=function(t,e){const n=i(t,t.length-1);r.updateOutput(e,n)},r.defaultVersionSetter=function(t,r){if(!e.isBuffer(r)||r.length<4)throw new Error("Set Version: Invalid Transaction");return r.writeUInt32LE(t,0),r},r.defaultLocktimeSetter=function(t,r){if(!e.isBuffer(r)||r.length<4)throw new Error("Set Locktime: Invalid Transaction");return r.writeUInt32LE(t,r.length-4),r}}).call(this)}).call(this,{isBuffer:t("../../../is-buffer/index.js")})},{"../../../is-buffer/index.js":63,"./converter":7}],27:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.toOutputScript=r.fromOutputScript=r.toBech32=r.toBase58Check=r.fromBech32=r.fromBase58Check=void 0;const n=t("./networks"),i=t("./payments"),o=t("./script"),s=t("./types"),u=t("bech32"),a=t("bs58check"),{typeforce:f}=s,c=40,h=2,l=16,p=1,d=80;function y(t){const e=a.decode(t);if(e.length<21)throw new TypeError(t+" is too short");if(e.length>21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function w(t){let r,n;try{r=u.bech32.decode(t)}catch(t){}if(r){if(0!==(n=r.words[0]))throw new TypeError(t+" uses wrong encoding")}else if(0===(n=(r=u.bech32m.decode(t)).words[0]))throw new TypeError(t+" uses wrong encoding");const i=u.bech32.fromWords(r.words.slice(1));return{version:n,prefix:r.prefix,data:e.from(i)}}function g(t,e,r){const n=u.bech32.toWords(t);return n.unshift(e),0===e?u.bech32.encode(r,n):u.bech32m.encode(r,n)}r.fromBase58Check=y,r.fromBech32=w,r.toBase58Check=function(t,r){f(s.tuple(s.Hash160bit,s.UInt8),arguments);const n=e.allocUnsafe(21);return n.writeUInt8(r,0),t.copy(n,1),a.encode(n)},r.toBech32=g,r.fromOutputScript=function(t,e){e=e||n.bitcoin;try{return i.p2pkh({output:t,network:e}).address}catch(t){}try{return i.p2sh({output:t,network:e}).address}catch(t){}try{return i.p2wpkh({output:t,network:e}).address}catch(t){}try{return i.p2wsh({output:t,network:e}).address}catch(t){}try{return function(t,e){const r=t.slice(2);if(r.length<h||r.length>c)throw new TypeError("Invalid program length for segwit address");const n=t[0]-d;if(n<p||n>l)throw new TypeError("Invalid version for segwit address");if(t[1]!==r.length)throw new TypeError("Invalid script for segwit address");return g(r,n,e.bech32)}(t,e)}catch(t){}throw new Error(o.toASM(t)+" has no matching Address")},r.toOutputScript=function(t,e){let r,s;e=e||n.bitcoin;try{r=y(t)}catch(t){}if(r){if(r.version===e.pubKeyHash)return i.p2pkh({hash:r.hash}).output;if(r.version===e.scriptHash)return i.p2sh({hash:r.hash}).output}else{try{s=w(t)}catch(t){}if(s){if(s.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===s.version){if(20===s.data.length)return i.p2wpkh({hash:s.data}).output;if(32===s.data.length)return i.p2wsh({hash:s.data}).output}else if(s.version>=p&&s.version<=l&&s.data.length>=h&&s.data.length<=c)return o.compile([s.version+d,s.data])}}throw new Error(t+" has no matching Script")}}).call(this)}).call(this,t("buffer").Buffer)},{"./networks":34,"./payments":37,"./script":47,"./types":51,bech32:3,bs58check:55,buffer:56}],28:[function(t,e,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.encode=r.decode=r.check=void 0,r.check=function(t){if(t.length<8)return!1;if(t.length>72)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-2)return!1;if(2!==t[2])return!1;const e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;const r=t[5+e];return!(0===r||6+e+r!==t.length||128&t[4]||e>1&&0===t[4]&&!(128&t[5])||128&t[e+6]||r>1&&0===t[e+6]&&!(128&t[e+7]))},r.decode=function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");const e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");const r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},r.encode=function(e,r){const n=e.length,i=r.length;if(0===n)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&r[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(i>1&&0===r[0]&&!(128&r[1]))throw new Error("S value excessively padded");const o=t.allocUnsafe(6+n+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+n]=2,o[5+n]=r.length,r.copy(o,6+n),o}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56}],29:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Block=void 0;const n=t("./bufferutils"),i=t("./crypto"),o=t("./merkle"),s=t("./transaction"),u=t("./types"),{typeforce:a}=u,f=new TypeError("Cannot compute merkle root for zero transactions"),c=new TypeError("Cannot compute witness commit for non-segwit block");class h{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");const e=new n.BufferReader(t),r=new h;if(r.version=e.readInt32(),r.prevHash=e.readSlice(32),r.merkleRoot=e.readSlice(32),r.timestamp=e.readUInt32(),r.bits=e.readUInt32(),r.nonce=e.readUInt32(),80===t.length)return r;const i=()=>{const t=s.Transaction.fromBuffer(e.buffer.slice(e.offset),!0);return e.offset+=t.byteLength(),t},o=e.readVarInt();r.transactions=[];for(let t=0;t<o;++t){const t=i();r.transactions.push(t)}const u=r.getWitnessCommit();return u&&(r.witnessCommit=u),r}static fromHex(t){return h.fromBuffer(e.from(t,"hex"))}static calculateTarget(t){const r=((4278190080&t)>>24)-3,n=8388607&t,i=e.alloc(32,0);return i.writeUIntBE(n,29-r,3),i}static calculateMerkleRoot(t,r){if(a([{getHash:u.Function}],t),0===t.length)throw f;if(r&&!l(t))throw c;const n=t.map(t=>t.getHash(r)),s=(0,o.fastMerkleRoot)(n,i.hash256);return r?i.hash256(e.concat([s,t[0].ins[0].witness[0]])):s}getWitnessCommit(){if(!l(this.transactions))return null;const t=this.transactions[0].outs.filter(t=>t.script.slice(0,6).equals(e.from("6a24aa21a9ed","hex"))).map(t=>t.script.slice(6,38));if(0===t.length)return null;const r=t[t.length-1];return r instanceof e&&32===r.length?r:null}hasWitnessCommit(){return this.witnessCommit instanceof e&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(t=this.transactions)instanceof Array&&t.some(t=>"object"==typeof t&&t.ins instanceof Array&&t.ins.some(t=>"object"==typeof t&&t.witness instanceof Array&&t.witness.length>0));var t}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(t,e=!0){return t||!this.transactions?80:80+n.varuint.encodingLength(this.transactions.length)+this.transactions.reduce((t,r)=>t+r.byteLength(e),0)}getHash(){return i.hash256(this.toBuffer(!0))}getId(){return(0,n.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const t=new Date(0);return t.setUTCSeconds(this.timestamp),t}toBuffer(t){const r=e.allocUnsafe(this.byteLength(t)),i=new n.BufferWriter(r);return i.writeInt32(this.version),i.writeSlice(this.prevHash),i.writeSlice(this.merkleRoot),i.writeUInt32(this.timestamp),i.writeUInt32(this.bits),i.writeUInt32(this.nonce),t||!this.transactions?r:(n.varuint.encode(this.transactions.length,r,i.offset),i.offset+=n.varuint.encode.bytes,this.transactions.forEach(t=>{const e=t.byteLength();t.toBuffer(r,i.offset),i.offset+=e}),r)}toHex(t){return this.toBuffer(t).toString("hex")}checkTxRoots(){const t=this.hasWitnessCommit();return!(!t&&this.hasWitness())&&(this.__checkMerkleRoot()&&(!t||this.__checkWitnessCommit()))}checkProofOfWork(){const t=(0,n.reverseBuffer)(this.getHash()),e=h.calculateTarget(this.bits);return t.compare(e)<=0}__checkMerkleRoot(){if(!this.transactions)throw f;const t=h.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}__checkWitnessCommit(){if(!this.transactions)throw f;if(!this.hasWitnessCommit())throw c;const t=h.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(t)}}function l(t){return t instanceof Array&&t[0]&&t[0].ins&&t[0].ins instanceof Array&&t[0].ins[0]&&t[0].ins[0].witness&&t[0].ins[0].witness instanceof Array&&t[0].ins[0].witness.length>0}r.Block=h}).call(this)}).call(this,t("buffer").Buffer)},{"./bufferutils":30,"./crypto":31,"./merkle":33,"./transaction":50,"./types":51,buffer:56}],30:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.BufferReader=r.BufferWriter=r.cloneBuffer=r.reverseBuffer=r.writeUInt64LE=r.readUInt64LE=r.varuint=void 0;const n=t("./types"),{typeforce:i}=n,o=t("varuint-bitcoin");function s(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}function u(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return s((n*=4294967296)+r,9007199254740991),n+r}function a(t,e,r){return s(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}r.varuint=o,r.readUInt64LE=u,r.writeUInt64LE=a,r.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n<t.length/2;n++)r=t[n],t[n]=t[e],t[e]=r,e--;return t},r.cloneBuffer=function(t){const r=e.allocUnsafe(t.length);return t.copy(r),r};class f{constructor(t,e=0){this.buffer=t,this.offset=e,i(n.tuple(n.Buffer,n.UInt32),[t,e])}static withCapacity(t){return new f(e.alloc(t))}writeUInt8(t){this.offset=this.buffer.writeUInt8(t,this.offset)}writeInt32(t){this.offset=this.buffer.writeInt32LE(t,this.offset)}writeUInt32(t){this.offset=this.buffer.writeUInt32LE(t,this.offset)}writeUInt64(t){this.offset=a(this.buffer,t,this.offset)}writeVarInt(t){o.encode(t,this.buffer,this.offset),this.offset+=o.encode.bytes}writeSlice(t){if(this.buffer.length<this.offset+t.length)throw new Error("Cannot write slice out of bounds");this.offset+=t.copy(this.buffer,this.offset)}writeVarSlice(t){this.writeVarInt(t.length),this.writeSlice(t)}writeVector(t){this.writeVarInt(t.length),t.forEach(t=>this.writeVarSlice(t))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}r.BufferWriter=f;r.BufferReader=class{constructor(t,e=0){this.buffer=t,this.offset=e,i(n.tuple(n.Buffer,n.UInt32),[t,e])}readUInt8(){const t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){const t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){const t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){const t=u(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){const t=o.decode(this.buffer,this.offset);return this.offset+=o.decode.bytes,t}readSlice(t){if(this.buffer.length<this.offset+t)throw new Error("Cannot read slice out of bounds");const e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const t=this.readVarInt(),e=[];for(let r=0;r<t;r++)e.push(this.readVarSlice());return e}}}).call(this)}).call(this,t("buffer").Buffer)},{"./types":51,buffer:56,"varuint-bitcoin":97}],31:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.taggedHash=r.hash256=r.hash160=r.sha256=r.sha1=r.ripemd160=void 0;const n=t("create-hash");function i(t){try{return n("rmd160").update(t).digest()}catch(e){return n("ripemd160").update(t).digest()}}function o(t){return n("sha256").update(t).digest()}r.ripemd160=i,r.sha1=function(t){return n("sha1").update(t).digest()},r.sha256=o,r.hash160=function(t){return i(o(t))},r.hash256=function(t){return o(o(t))};const s=Object.fromEntries(["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"].map(t=>{const r=o(e.from(t));return[t,e.concat([r,r])]}));r.taggedHash=function(t,r){return o(e.concat([s[t],r]))}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56,"create-hash":58}],32:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Transaction=r.opcodes=r.Psbt=r.Block=r.script=r.payments=r.networks=r.crypto=r.address=void 0;const n=t("./address");r.address=n;const i=t("./crypto");r.crypto=i;const o=t("./networks");r.networks=o;const s=t("./payments");r.payments=s;const u=t("./script");r.script=u;var a=t("./block");Object.defineProperty(r,"Block",{enumerable:!0,get:function(){return a.Block}});var f=t("./psbt");Object.defineProperty(r,"Psbt",{enumerable:!0,get:function(){return f.Psbt}});var c=t("./ops");Object.defineProperty(r,"opcodes",{enumerable:!0,get:function(){return c.OPS}});var h=t("./transaction");Object.defineProperty(r,"Transaction",{enumerable:!0,get:function(){return h.Transaction}})},{"./address":27,"./block":29,"./crypto":31,"./networks":34,"./ops":35,"./payments":37,"./psbt":45,"./script":47,"./transaction":50}],33:[function(t,e,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fastMerkleRoot=void 0,r.fastMerkleRoot=function(e,r){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof r)throw TypeError("Expected digest Function");let n=e.length;const i=e.concat();for(;n>1;){let e=0;for(let o=0;o<n;o+=2,++e){const s=i[o],u=o+1===n?s:i[o+1],a=t.concat([s,u]);i[e]=r(a)}n=e}return i[0]}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56}],34:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.testnet=r.regtest=r.bitcoin=void 0,r.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},r.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},r.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},{}],35:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.REVERSE_OPS=r.OPS=void 0;const n={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1: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_CHECKSEQUENCEVERIFY: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};r.OPS=n;const i={};r.REVERSE_OPS=i;for(const t of Object.keys(n)){i[n[t]]=t}},{}],36:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2data=void 0;const n=t("../networks"),i=t("../script"),o=t("../types"),s=t("./lazy"),u=i.OPS;r.p2data=function(t,e){if(!t.data&&!t.output)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),data:o.typeforce.maybe(o.typeforce.arrayOf(o.typeforce.Buffer))},t);const r={name:"embed",network:t.network||n.bitcoin};if(s.prop(r,"output",()=>{if(t.data)return i.compile([u.OP_RETURN].concat(t.data))}),s.prop(r,"data",()=>{if(t.output)return i.decompile(t.output).slice(1)}),e.validate&&t.output){const e=i.decompile(t.output);if(e[0]!==u.OP_RETURN)throw new TypeError("Output is invalid");if(!e.slice(1).every(o.typeforce.Buffer))throw new TypeError("Output is invalid");if(t.data&&!function(t,e){return t.length===e.length&&t.every((t,r)=>t.equals(e[r]))}(t.data,r.data))throw new TypeError("Data mismatch")}return Object.assign(r,t)}},{"../networks":34,"../script":47,"../types":51,"./lazy":38}],37:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2wsh=r.p2wpkh=r.p2sh=r.p2pkh=r.p2pk=r.p2ms=r.embed=void 0;const n=t("./embed");Object.defineProperty(r,"embed",{enumerable:!0,get:function(){return n.p2data}});const i=t("./p2ms");Object.defineProperty(r,"p2ms",{enumerable:!0,get:function(){return i.p2ms}});const o=t("./p2pk");Object.defineProperty(r,"p2pk",{enumerable:!0,get:function(){return o.p2pk}});const s=t("./p2pkh");Object.defineProperty(r,"p2pkh",{enumerable:!0,get:function(){return s.p2pkh}});const u=t("./p2sh");Object.defineProperty(r,"p2sh",{enumerable:!0,get:function(){return u.p2sh}});const a=t("./p2wpkh");Object.defineProperty(r,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});const f=t("./p2wsh");Object.defineProperty(r,"p2wsh",{enumerable:!0,get:function(){return f.p2wsh}})},{"./embed":36,"./p2ms":39,"./p2pk":40,"./p2pkh":41,"./p2sh":42,"./p2wpkh":43,"./p2wsh":44}],38:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.value=r.prop=void 0,r.prop=function(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){const t=r.call(this);return this[e]=t,t},set(t){Object.defineProperty(this,e,{configurable:!0,enumerable:!0,value:t,writable:!0})}})},r.value=function(t){let e;return()=>void 0!==e?e:e=t()}},{}],39:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2ms=void 0;const n=t("../networks"),i=t("../script"),o=t("../types"),s=t("./lazy"),u=i.OPS,a=u.OP_RESERVED;function f(t,e){return t.length===e.length&&t.every((t,r)=>t.equals(e[r]))}r.p2ms=function(t,e){if(!(t.input||t.output||t.pubkeys&&void 0!==t.m||t.signatures))throw new TypeError("Not enough data");function r(t){return i.isCanonicalScriptSignature(t)||void 0!==(e.allowIncomplete&&t===u.OP_0)}e=Object.assign({validate:!0},e||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),m:o.typeforce.maybe(o.typeforce.Number),n:o.typeforce.maybe(o.typeforce.Number),output:o.typeforce.maybe(o.typeforce.Buffer),pubkeys:o.typeforce.maybe(o.typeforce.arrayOf(o.isPoint)),signatures:o.typeforce.maybe(o.typeforce.arrayOf(r)),input:o.typeforce.maybe(o.typeforce.Buffer)},t);const c={network:t.network||n.bitcoin};let h=[],l=!1;function p(t){l||(l=!0,h=i.decompile(t),c.m=h[0]-a,c.n=h[h.length-2]-a,c.pubkeys=h.slice(1,-2))}if(s.prop(c,"output",()=>{if(t.m&&c.n&&t.pubkeys)return i.compile([].concat(a+t.m,t.pubkeys,a+c.n,u.OP_CHECKMULTISIG))}),s.prop(c,"m",()=>{if(c.output)return p(c.output),c.m}),s.prop(c,"n",()=>{if(c.pubkeys)return c.pubkeys.length}),s.prop(c,"pubkeys",()=>{if(t.output)return p(t.output),c.pubkeys}),s.prop(c,"signatures",()=>{if(t.input)return i.decompile(t.input).slice(1)}),s.prop(c,"input",()=>{if(t.signatures)return i.compile([u.OP_0].concat(t.signatures))}),s.prop(c,"witness",()=>{if(c.input)return[]}),s.prop(c,"name",()=>{if(c.m&&c.n)return`p2ms(${c.m} of ${c.n})`}),e.validate){if(t.output){if(p(t.output),!o.typeforce.Number(h[0]))throw new TypeError("Output is invalid");if(!o.typeforce.Number(h[h.length-2]))throw new TypeError("Output is invalid");if(h[h.length-1]!==u.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(c.m<=0||c.n>16||c.m>c.n||c.n!==h.length-3)throw new TypeError("Output is invalid");if(!c.pubkeys.every(t=>(0,o.isPoint)(t)))throw new TypeError("Output is invalid");if(void 0!==t.m&&t.m!==c.m)throw new TypeError("m mismatch");if(void 0!==t.n&&t.n!==c.n)throw new TypeError("n mismatch");if(t.pubkeys&&!f(t.pubkeys,c.pubkeys))throw new TypeError("Pubkeys mismatch")}if(t.pubkeys){if(void 0!==t.n&&t.n!==t.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(c.n=t.pubkeys.length,c.n<c.m)throw new TypeError("Pubkey count cannot be less than m")}if(t.signatures){if(t.signatures.length<c.m)throw new TypeError("Not enough signatures provided");if(t.signatures.length>c.m)throw new TypeError("Too many signatures provided")}if(t.input){if(t.input[0]!==u.OP_0)throw new TypeError("Input is invalid");if(0===c.signatures.length||!c.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(t.signatures&&!f(t.signatures,c.signatures))throw new TypeError("Signature mismatch");if(void 0!==t.m&&t.m!==t.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(c,t)}},{"../networks":34,"../script":47,"../types":51,"./lazy":38}],40:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2pk=void 0;const n=t("../networks"),i=t("../script"),o=t("../types"),s=t("./lazy"),u=i.OPS;r.p2pk=function(t,e){if(!(t.input||t.output||t.pubkey||t.input||t.signature))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),pubkey:o.typeforce.maybe(o.isPoint),signature:o.typeforce.maybe(i.isCanonicalScriptSignature),input:o.typeforce.maybe(o.typeforce.Buffer)},t);const r=s.value(()=>i.decompile(t.input)),a={name:"p2pk",network:t.network||n.bitcoin};if(s.prop(a,"output",()=>{if(t.pubkey)return i.compile([t.pubkey,u.OP_CHECKSIG])}),s.prop(a,"pubkey",()=>{if(t.output)return t.output.slice(1,-1)}),s.prop(a,"signature",()=>{if(t.input)return r()[0]}),s.prop(a,"input",()=>{if(t.signature)return i.compile([t.signature])}),s.prop(a,"witness",()=>{if(a.input)return[]}),e.validate){if(t.output){if(t.output[t.output.length-1]!==u.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,o.isPoint)(a.pubkey))throw new TypeError("Output pubkey is invalid");if(t.pubkey&&!t.pubkey.equals(a.pubkey))throw new TypeError("Pubkey mismatch")}if(t.signature&&t.input&&!t.input.equals(a.input))throw new TypeError("Signature mismatch");if(t.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!i.isCanonicalScriptSignature(a.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(a,t)}},{"../networks":34,"../script":47,"../types":51,"./lazy":38}],41:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2pkh=void 0;const n=t("../crypto"),i=t("../networks"),o=t("../script"),s=t("../types"),u=t("./lazy"),a=t("bs58check"),f=o.OPS;r.p2pkh=function(t,r){if(!(t.address||t.hash||t.output||t.pubkey||t.input))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),output:s.typeforce.maybe(s.typeforce.BufferN(25)),pubkey:s.typeforce.maybe(s.isPoint),signature:s.typeforce.maybe(o.isCanonicalScriptSignature),input:s.typeforce.maybe(s.typeforce.Buffer)},t);const c=u.value(()=>{const e=a.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}}),h=u.value(()=>o.decompile(t.input)),l=t.network||i.bitcoin,p={name:"p2pkh",network:l};if(u.prop(p,"address",()=>{if(!p.hash)return;const t=e.allocUnsafe(21);return t.writeUInt8(l.pubKeyHash,0),p.hash.copy(t,1),a.encode(t)}),u.prop(p,"hash",()=>t.output?t.output.slice(3,23):t.address?c().hash:t.pubkey||p.pubkey?n.hash160(t.pubkey||p.pubkey):void 0),u.prop(p,"output",()=>{if(p.hash)return o.compile([f.OP_DUP,f.OP_HASH160,p.hash,f.OP_EQUALVERIFY,f.OP_CHECKSIG])}),u.prop(p,"pubkey",()=>{if(t.input)return h()[1]}),u.prop(p,"signature",()=>{if(t.input)return h()[0]}),u.prop(p,"input",()=>{if(t.pubkey&&t.signature)return o.compile([t.signature,t.pubkey])}),u.prop(p,"witness",()=>{if(p.input)return[]}),r.validate){let r=e.from([]);if(t.address){if(c().version!==l.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==c().hash.length)throw new TypeError("Invalid address");r=c().hash}if(t.hash){if(r.length>0&&!r.equals(t.hash))throw new TypeError("Hash mismatch");r=t.hash}if(t.output){if(25!==t.output.length||t.output[0]!==f.OP_DUP||t.output[1]!==f.OP_HASH160||20!==t.output[2]||t.output[23]!==f.OP_EQUALVERIFY||t.output[24]!==f.OP_CHECKSIG)throw new TypeError("Output is invalid");const e=t.output.slice(3,23);if(r.length>0&&!r.equals(e))throw new TypeError("Hash mismatch");r=e}if(t.pubkey){const e=n.hash160(t.pubkey);if(r.length>0&&!r.equals(e))throw new TypeError("Hash mismatch");r=e}if(t.input){const e=h();if(2!==e.length)throw new TypeError("Input is invalid");if(!o.isCanonicalScriptSignature(e[0]))throw new TypeError("Input has invalid signature");if(!(0,s.isPoint)(e[1]))throw new TypeError("Input has invalid pubkey");if(t.signature&&!t.signature.equals(e[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(e[1]))throw new TypeError("Pubkey mismatch");const i=n.hash160(e[1]);if(r.length>0&&!r.equals(i))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}}).call(this)}).call(this,t("buffer").Buffer)},{"../crypto":31,"../networks":34,"../script":47,"../types":51,"./lazy":38,bs58check:55,buffer:56}],42:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2sh=void 0;const n=t("../crypto"),i=t("../networks"),o=t("../script"),s=t("../types"),u=t("./lazy"),a=t("bs58check"),f=o.OPS;r.p2sh=function(t,r){if(!(t.address||t.hash||t.output||t.redeem||t.input))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),output:s.typeforce.maybe(s.typeforce.BufferN(23)),redeem:s.typeforce.maybe({network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.Buffer),input:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))}),input:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},t);let c=t.network;c||(c=t.redeem&&t.redeem.network||i.bitcoin);const h={network:c},l=u.value(()=>{const e=a.decode(t.address);return{version:e.readUInt8(0),hash:e.slice(1)}}),p=u.value(()=>o.decompile(t.input)),d=u.value(()=>{const e=p();return{network:c,output:e[e.length-1],input:o.compile(e.slice(0,-1)),witness:t.witness||[]}});if(u.prop(h,"address",()=>{if(!h.hash)return;const t=e.allocUnsafe(21);return t.writeUInt8(h.network.scriptHash,0),h.hash.copy(t,1),a.encode(t)}),u.prop(h,"hash",()=>t.output?t.output.slice(2,22):t.address?l().hash:h.redeem&&h.redeem.output?n.hash160(h.redeem.output):void 0),u.prop(h,"output",()=>{if(h.hash)return o.compile([f.OP_HASH160,h.hash,f.OP_EQUAL])}),u.prop(h,"redeem",()=>{if(t.input)return d()}),u.prop(h,"input",()=>{if(t.redeem&&t.redeem.input&&t.redeem.output)return o.compile([].concat(o.decompile(t.redeem.input),t.redeem.output))}),u.prop(h,"witness",()=>h.redeem&&h.redeem.witness?h.redeem.witness:h.input?[]:void 0),u.prop(h,"name",()=>{const t=["p2sh"];return void 0!==h.redeem&&void 0!==h.redeem.name&&t.push(h.redeem.name),t.join("-")}),r.validate){let r=e.from([]);if(t.address){if(l().version!==c.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==l().hash.length)throw new TypeError("Invalid address");r=l().hash}if(t.hash){if(r.length>0&&!r.equals(t.hash))throw new TypeError("Hash mismatch");r=t.hash}if(t.output){if(23!==t.output.length||t.output[0]!==f.OP_HASH160||20!==t.output[1]||t.output[22]!==f.OP_EQUAL)throw new TypeError("Output is invalid");const e=t.output.slice(2,22);if(r.length>0&&!r.equals(e))throw new TypeError("Hash mismatch");r=e}const i=t=>{if(t.output){const e=o.decompile(t.output);if(!e||e.length<1)throw new TypeError("Redeem.output too short");const i=n.hash160(t.output);if(r.length>0&&!r.equals(i))throw new TypeError("Hash mismatch");r=i}if(t.input){const e=t.input.length>0,r=t.witness&&t.witness.length>0;if(!e&&!r)throw new TypeError("Empty input");if(e&&r)throw new TypeError("Input and witness provided");if(e){const e=o.decompile(t.input);if(!o.isPushOnly(e))throw new TypeError("Non push-only scriptSig")}}};if(t.input){const t=p();if(!t||t.length<1)throw new TypeError("Input too short");if(!e.isBuffer(d().output))throw new TypeError("Input is invalid");i(d())}if(t.redeem){if(t.redeem.network&&t.redeem.network!==c)throw new TypeError("Network mismatch");if(t.input){const e=d();if(t.redeem.output&&!t.redeem.output.equals(e.output))throw new TypeError("Redeem.output mismatch");if(t.redeem.input&&!t.redeem.input.equals(e.input))throw new TypeError("Redeem.input mismatch")}i(t.redeem)}if(t.witness&&t.redeem&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every((t,r)=>t.equals(e[r]))}(t.redeem.witness,t.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(h,t)}}).call(this)}).call(this,t("buffer").Buffer)},{"../crypto":31,"../networks":34,"../script":47,"../types":51,"./lazy":38,bs58check:55,buffer:56}],43:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2wpkh=void 0;const n=t("../crypto"),i=t("../networks"),o=t("../script"),s=t("../types"),u=t("./lazy"),a=t("bech32"),f=o.OPS,c=e.alloc(0);r.p2wpkh=function(t,r){if(!(t.address||t.hash||t.output||t.pubkey||t.witness))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),(0,s.typeforce)({address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),input:s.typeforce.maybe(s.typeforce.BufferN(0)),network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.BufferN(22)),pubkey:s.typeforce.maybe(s.isPoint),signature:s.typeforce.maybe(o.isCanonicalScriptSignature),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},t);const h=u.value(()=>{const r=a.bech32.decode(t.address),n=r.words.shift(),i=a.bech32.fromWords(r.words);return{version:n,prefix:r.prefix,data:e.from(i)}}),l=t.network||i.bitcoin,p={name:"p2wpkh",network:l};if(u.prop(p,"address",()=>{if(!p.hash)return;const t=a.bech32.toWords(p.hash);return t.unshift(0),a.bech32.encode(l.bech32,t)}),u.prop(p,"hash",()=>t.output?t.output.slice(2,22):t.address?h().data:t.pubkey||p.pubkey?n.hash160(t.pubkey||p.pubkey):void 0),u.prop(p,"output",()=>{if(p.hash)return o.compile([f.OP_0,p.hash])}),u.prop(p,"pubkey",()=>t.pubkey?t.pubkey:t.witness?t.witness[1]:void 0),u.prop(p,"signature",()=>{if(t.witness)return t.witness[0]}),u.prop(p,"input",()=>{if(p.witness)return c}),u.prop(p,"witness",()=>{if(t.pubkey&&t.signature)return[t.signature,t.pubkey]}),r.validate){let r=e.from([]);if(t.address){if(l&&l.bech32!==h().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==h().version)throw new TypeError("Invalid address version");if(20!==h().data.length)throw new TypeError("Invalid address data");r=h().data}if(t.hash){if(r.length>0&&!r.equals(t.hash))throw new TypeError("Hash mismatch");r=t.hash}if(t.output){if(22!==t.output.length||t.output[0]!==f.OP_0||20!==t.output[1])throw new TypeError("Output is invalid");if(r.length>0&&!r.equals(t.output.slice(2)))throw new TypeError("Hash mismatch");r=t.output.slice(2)}if(t.pubkey){const e=n.hash160(t.pubkey);if(r.length>0&&!r.equals(e))throw new TypeError("Hash mismatch");if(r=e,!(0,s.isPoint)(t.pubkey)||33!==t.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(t.witness){if(2!==t.witness.length)throw new TypeError("Witness is invalid");if(!o.isCanonicalScriptSignature(t.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,s.isPoint)(t.witness[1])||33!==t.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(t.signature&&!t.signature.equals(t.witness[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(t.witness[1]))throw new TypeError("Pubkey mismatch");const e=n.hash160(t.witness[1]);if(r.length>0&&!r.equals(e))throw new TypeError("Hash mismatch")}}return Object.assign(p,t)}}).call(this)}).call(this,t("buffer").Buffer)},{"../crypto":31,"../networks":34,"../script":47,"../types":51,"./lazy":38,bech32:3,buffer:56}],44:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.p2wsh=void 0;const n=t("../crypto"),i=t("../networks"),o=t("../script"),s=t("../types"),u=t("./lazy"),a=t("bech32"),f=o.OPS,c=e.alloc(0);function h(t){return!(!e.isBuffer(t)||65!==t.length||4!==t[0]||!(0,s.isPoint)(t))}r.p2wsh=function(t,r){if(!(t.address||t.hash||t.output||t.redeem||t.witness))throw new TypeError("Not enough data");r=Object.assign({validate:!0},r||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(32)),output:s.typeforce.maybe(s.typeforce.BufferN(34)),redeem:s.typeforce.maybe({input:s.typeforce.maybe(s.typeforce.Buffer),network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))}),input:s.typeforce.maybe(s.typeforce.BufferN(0)),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},t);const l=u.value(()=>{const r=a.bech32.decode(t.address),n=r.words.shift(),i=a.bech32.fromWords(r.words);return{version:n,prefix:r.prefix,data:e.from(i)}}),p=u.value(()=>o.decompile(t.redeem.input));let d=t.network;d||(d=t.redeem&&t.redeem.network||i.bitcoin);const y={network:d};if(u.prop(y,"address",()=>{if(!y.hash)return;const t=a.bech32.toWords(y.hash);return t.unshift(0),a.bech32.encode(d.bech32,t)}),u.prop(y,"hash",()=>t.output?t.output.slice(2):t.address?l().data:y.redeem&&y.redeem.output?n.sha256(y.redeem.output):void 0),u.prop(y,"output",()=>{if(y.hash)return o.compile([f.OP_0,y.hash])}),u.prop(y,"redeem",()=>{if(t.witness)return{output:t.witness[t.witness.length-1],input:c,witness:t.witness.slice(0,-1)}}),u.prop(y,"input",()=>{if(y.witness)return c}),u.prop(y,"witness",()=>{if(t.redeem&&t.redeem.input&&t.redeem.input.length>0&&t.redeem.output&&t.redeem.output.length>0){const e=o.toStack(p());return y.redeem=Object.assign({witness:e},t.redeem),y.redeem.input=c,[].concat(e,t.redeem.output)}if(t.redeem&&t.redeem.output&&t.redeem.witness)return[].concat(t.redeem.witness,t.redeem.output)}),u.prop(y,"name",()=>{const t=["p2wsh"];return void 0!==y.redeem&&void 0!==y.redeem.name&&t.push(y.redeem.name),t.join("-")}),r.validate){let r=e.from([]);if(t.address){if(l().prefix!==d.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==l().version)throw new TypeError("Invalid address version");if(32!==l().data.length)throw new TypeError("Invalid address data");r=l().data}if(t.hash){if(r.length>0&&!r.equals(t.hash))throw new TypeError("Hash mismatch");r=t.hash}if(t.output){if(34!==t.output.length||t.output[0]!==f.OP_0||32!==t.output[1])throw new TypeError("Output is invalid");const e=t.output.slice(2);if(r.length>0&&!r.equals(e))throw new TypeError("Hash mismatch");r=e}if(t.redeem){if(t.redeem.network&&t.redeem.network!==d)throw new TypeError("Network mismatch");if(t.redeem.input&&t.redeem.input.length>0&&t.redeem.witness&&t.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(t.redeem.output){if(0===o.decompile(t.redeem.output).length)throw new TypeError("Redeem.output is invalid");const e=n.sha256(t.redeem.output);if(r.length>0&&!r.equals(e))throw new TypeError("Hash mismatch");r=e}if(t.redeem.input&&!o.isPushOnly(p()))throw new TypeError("Non push-only scriptSig");if(t.witness&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every((t,r)=>t.equals(e[r]))}(t.witness,t.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(t.redeem.input&&p().some(h)||t.redeem.output&&(o.decompile(t.redeem.output)||[]).some(h))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(t.witness&&t.witness.length>0){const e=t.witness[t.witness.length-1];if(t.redeem&&t.redeem.output&&!t.redeem.output.equals(e))throw new TypeError("Witness and redeem.output mismatch");if(t.witness.some(h)||(o.decompile(e)||[]).some(h))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(y,t)}}).call(this)}).call(this,t("buffer").Buffer)},{"../crypto":31,"../networks":34,"../script":47,"../types":51,"./lazy":38,bech32:3,buffer:56}],45:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Psbt=void 0;const n=t("bip174"),i=t("bip174/src/lib/converter/varint"),o=t("bip174/src/lib/utils"),s=t("./address"),u=t("./bufferutils"),a=t("./crypto"),f=t("./networks"),c=t("./payments"),h=t("./script"),l=t("./transaction"),p={network:f.bitcoin,maximumFeeRate:5e3};class d{constructor(t={},e=new n.Psbt(new w)){this.data=e,this.opts=Object.assign({},p,t),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const r=(t,e,r,n)=>Object.defineProperty(t,e,{enumerable:r,writable:n});r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}static fromBase64(t,r={}){const n=e.from(t,"base64");return this.fromBuffer(n,r)}static fromHex(t,r={}){const n=e.from(t,"hex");return this.fromBuffer(n,r)}static fromBuffer(t,e={}){const r=n.Psbt.fromBuffer(t,y),i=new d(e,r);var o,s;return o=i.__CACHE.__TX,s=i.__CACHE,o.ins.forEach(t=>{U(s,t)}),i}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(t){this.setVersion(t)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(t){this.setLocktime(t)}get txInputs(){return this.__CACHE.__TX.ins.map(t=>({hash:(0,u.cloneBuffer)(t.hash),index:t.index,sequence:t.sequence}))}get txOutputs(){return this.__CACHE.__TX.outs.map(t=>{let e;try{e=(0,s.fromOutputScript)(t.script,this.opts.network)}catch(t){}return{script:(0,u.cloneBuffer)(t.script),value:t.value,address:e}})}combine(...t){return this.data.combine(...t.map(t=>t.data)),this}clone(){const t=d.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}setMaximumFeeRate(t){P(t),this.opts.maximumFeeRate=t}setVersion(t){P(t),A(this.data.inputs,"setVersion");const e=this.__CACHE;return e.__TX.version=t,e.__EXTRACTED_TX=void 0,this}setLocktime(t){P(t),A(this.data.inputs,"setLocktime");const e=this.__CACHE;return e.__TX.locktime=t,e.__EXTRACTED_TX=void 0,this}setInputSequence(t,e){P(e),A(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=t)throw new Error("Input index too high");return r.__TX.ins[t].sequence=e,r.__EXTRACTED_TX=void 0,this}addInputs(t){return t.forEach(t=>this.addInput(t)),this}addInput(t){if(arguments.length>1||!t||void 0===t.hash||void 0===t.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");A(this.data.inputs,"addInput"),t.witnessScript&&X(t.witnessScript);const e=this.__CACHE;this.data.addInput(t),U(e,e.__TX.ins[e.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&F(this.__CACHE,n,r),e.__FEE=void 0,e.__FEE_RATE=void 0,e.__EXTRACTED_TX=void 0,this}addOutputs(t){return t.forEach(t=>this.addOutput(t)),this}addOutput(t){if(arguments.length>1||!t||void 0===t.value||void 0===t.address&&void 0===t.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");A(this.data.inputs,"addOutput");const{address:e}=t;if("string"==typeof e){const{network:r}=this.opts,n=(0,s.toOutputScript)(e,r);t=Object.assign(t,{script:n})}const r=this.__CACHE;return this.data.addOutput(t),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(t){if(!this.data.inputs.every(_))throw new Error("Not finalized");const e=this.__CACHE;if(t||function(t,e,r){const n=e.__FEE_RATE||t.getFeeRate(),i=e.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in `+`fees, which is ${n} satoshi per byte for a transaction `+`with a VSize of ${i} bytes (segwit counted as 0.25 byte per `+"byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.")}(this,e,this.opts),e.__EXTRACTED_TX)return e.__EXTRACTED_TX;const r=e.__TX.clone();return W(this.data.inputs,r,e,!0),r}getFeeRate(){return C("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return C("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,o.checkForInput)(this.data.inputs,0),$(this.data.inputs.length).forEach(t=>this.finalizeInput(t)),this}finalizeInput(t,e=function(t,e,r,n,i,o){const s=Y(r);if(!function(t,e,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return b(1,t.partialSig);case"multisig":const n=c.p2ms({output:e});return b(n.m,t.partialSig,n.pubkeys);default:return!1}}(e,r,s))throw new Error(`Can not finalize input #${t}`);return function(t,e,r,n,i,o){let s,u;const a=function(t,e,r){let n;switch(e){case"multisig":const i=function(t,e){return c.p2ms({output:t}).pubkeys.map(t=>(e.filter(e=>e.pubkey.equals(t))[0]||{}).signature).filter(t=>!!t)}(t,r);n=c.p2ms({output:t,signatures:i});break;case"pubkey":n=c.p2pk({output:t,signature:r[0].signature});break;case"pubkeyhash":n=c.p2pkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=c.p2wpkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(t,e,r),f=o?c.p2wsh({redeem:a}):null,h=i?c.p2sh({redeem:f||a}):null;n?(u=j(f?f.witness:a.witness),h&&(s=h.input)):s=h?h.input:a.input;return{finalScriptSig:s,finalScriptWitness:u}}(r,s,e.partialSig,n,i,o)}){const r=(0,o.checkForInput)(this.data.inputs,t),{script:n,isP2SH:i,isP2WSH:s,isSegwit:u}=function(t,e,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!e.redeemScript,i.isP2WSH=!!e.witnessScript,e.witnessScript)i.script=e.witnessScript;else if(e.redeemScript)i.script=e.redeemScript;else if(e.nonWitnessUtxo){const o=V(r,e,t),s=n.ins[t].index;i.script=o.outs[s].script}else e.witnessUtxo&&(i.script=e.witnessUtxo.script);(e.witnessScript||T(i.script))&&(i.isSegwit=!0);return i}(t,r,this.__CACHE);if(!n)throw new Error(`No script found for input #${t}`);!function(t){if(!t.sighashType||!t.partialSig)return;const{partialSig:e,sighashType:r}=t;e.forEach(t=>{const{hashType:e}=h.signature.decode(t.signature);if(r!==e)throw new Error("Signature sighash does not match input sighash type")})}(r);const{finalScriptSig:a,finalScriptWitness:f}=e(t,r,n,u,i,s);if(a&&this.data.updateInput(t,{finalScriptSig:a}),f&&this.data.updateInput(t,{finalScriptWitness:f}),!a&&!f)throw new Error(`Unknown error finalizing input #${t}`);return this.data.clearFinalizedInput(t),this}getInputType(t){const r=(0,o.checkForInput)(this.data.inputs,t),n=q(K(t,r,this.__CACHE),t,"input",r.redeemScript||function(t){if(!t)return;const r=h.decompile(t);if(!r)return;const n=r[r.length-1];if(!e.isBuffer(n)||G(n)||(i=n,h.isCanonicalScriptSignature(i)))return;var i;if(!h.decompile(n))return;return n}(r.finalScriptSig),r.witnessScript||function(t){if(!t)return;const e=D(t),r=e[e.length-1];if(G(r))return;if(!h.decompile(r))return;return r}(r.finalScriptWitness));return("raw"===n.type?"":n.type+"-")+Y(n.meaningfulScript)}inputHasPubkey(t,e){return function(t,e,r,n){const i=K(r,e,n),{meaningfulScript:o}=q(i,r,"input",e.redeemScript,e.witnessScript);return z(t,o)}(e,(0,o.checkForInput)(this.data.inputs,t),t,this.__CACHE)}inputHasHDKey(t,e){const r=(0,o.checkForInput)(this.data.inputs,t),n=O(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(t,e){return function(t,e,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=q(i,r,"output",e.redeemScript,e.witnessScript);return z(t,o)}(e,(0,o.checkForOutput)(this.data.outputs,t),t,this.__CACHE)}outputHasHDKey(t,e){const r=(0,o.checkForOutput)(this.data.outputs,t),n=O(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(t){return(0,o.checkForInput)(this.data.inputs,0),$(this.data.inputs.length).map(e=>this.validateSignaturesOfInput(e,t)).reduce((t,e)=>!0===e&&t,!0)}validateSignaturesOfInput(t,e,r){const n=this.data.inputs[t],i=(n||{}).partialSig;if(!n||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof e)throw new Error("Need validator function to validate signatures");const o=r?i.filter(t=>t.pubkey.equals(r)):i;if(o.length<1)throw new Error("No signatures for this pubkey");const s=[];let u,a,f;for(const r of o){const i=h.signature.decode(r.signature),{hash:o,script:c}=f!==i.hashType?H(t,Object.assign({},n,{sighashType:i.hashType}),this.__CACHE,!0):{hash:u,script:a};f=i.hashType,u=o,a=c,N(r.pubkey,c,"verify"),s.push(e(r.pubkey,o,i.signature))}return s.every(t=>!0===t)}signAllInputsHD(t,e=[l.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const n of $(this.data.inputs.length))try{this.signInputHD(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every(t=>!1===t))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(t,e=[l.Transaction.SIGHASH_ALL]){return new Promise((r,n)=>{if(!t||!t.publicKey||!t.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const r of $(this.data.inputs.length))o.push(this.signInputHDAsync(r,t,e).then(()=>{i.push(!0)},()=>{i.push(!1)}));return Promise.all(o).then(()=>{if(i.every(t=>!1===t))return n(new Error("No inputs were signed"));r()})})}signInputHD(t,e,r=[l.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");return M(t,this.data.inputs,e).forEach(e=>this.signInput(t,e,r)),this}signInputHDAsync(t,e,r=[l.Transaction.SIGHASH_ALL]){return new Promise((n,i)=>{if(!e||!e.publicKey||!e.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=M(t,this.data.inputs,e).map(e=>this.signInputAsync(t,e,r));return Promise.all(o).then(()=>{n()}).catch(i)})}signAllInputs(t,e=[l.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const n of $(this.data.inputs.length))try{this.signInput(n,t,e),r.push(!0)}catch(t){r.push(!1)}if(r.every(t=>!1===t))throw new Error("No inputs were signed");return this}signAllInputsAsync(t,e=[l.Transaction.SIGHASH_ALL]){return new Promise((r,n)=>{if(!t||!t.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[r]of this.data.inputs.entries())o.push(this.signInputAsync(r,t,e).then(()=>{i.push(!0)},()=>{i.push(!1)}));return Promise.all(o).then(()=>{if(i.every(t=>!1===t))return n(new Error("No inputs were signed"));r()})})}signInput(t,e,r=[l.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=L(this.data.inputs,t,e.publicKey,this.__CACHE,r),o=[{pubkey:e.publicKey,signature:h.signature.encode(e.sign(n),i)}];return this.data.updateInput(t,{partialSig:o}),this}signInputAsync(t,e,r=[l.Transaction.SIGHASH_ALL]){return Promise.resolve().then(()=>{if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=L(this.data.inputs,t,e.publicKey,this.__CACHE,r);return Promise.resolve(e.sign(n)).then(r=>{const n=[{pubkey:e.publicKey,signature:h.signature.encode(r,i)}];this.data.updateInput(t,{partialSig:n})})})}toBuffer(){return g(this.__CACHE),this.data.toBuffer()}toHex(){return g(this.__CACHE),this.data.toHex()}toBase64(){return g(this.__CACHE),this.data.toBase64()}updateGlobal(t){return this.data.updateGlobal(t),this}updateInput(t,e){return e.witnessScript&&X(e.witnessScript),this.data.updateInput(t,e),e.nonWitnessUtxo&&F(this.__CACHE,this.data.inputs[t],t),this}updateOutput(t,e){return this.data.updateOutput(t,e),this}addUnknownKeyValToGlobal(t){return this.data.addUnknownKeyValToGlobal(t),this}addUnknownKeyValToInput(t,e){return this.data.addUnknownKeyValToInput(t,e),this}addUnknownKeyValToOutput(t,e){return this.data.addUnknownKeyValToOutput(t,e),this}clearFinalizedInput(t){return this.data.clearFinalizedInput(t),this}}r.Psbt=d;const y=t=>new w(t);class w{constructor(t=e.from([2,0,0,0,0,0,0,0,0,0])){this.tx=l.Transaction.fromBuffer(t),function(t){if(!t.ins.every(t=>t.script&&0===t.script.length&&t.witness&&0===t.witness.length))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(t){if(void 0===t.hash||void 0===t.index||!e.isBuffer(t.hash)&&"string"!=typeof t.hash||"number"!=typeof t.index)throw new Error("Error adding input.");const r="string"==typeof t.hash?(0,u.reverseBuffer)(e.from(t.hash,"hex")):t.hash;this.tx.addInput(r,t.index,t.sequence)}addOutput(t){if(void 0===t.script||void 0===t.value||!e.isBuffer(t.script)||"number"!=typeof t.value)throw new Error("Error adding output.");this.tx.addOutput(t.script,t.value)}toBuffer(){return this.tx.toBuffer()}}function g(t){if(!1!==t.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function b(t,e,r){if(!e)return!1;let n;if((n=r?r.map(t=>{const r=function(t){if(65===t.length){const e=1&t[64],r=t.slice(0,33);return r[0]=2|e,r}return t.slice()}(t);return e.find(t=>t.pubkey.equals(r))}).filter(t=>!!t):e).length>t)throw new Error("Too many signatures");return n.length===t}function _(t){return!!t.finalScriptSig||!!t.finalScriptWitness}function m(t){return e=>{try{return t({output:e}),!0}catch(t){return!1}}}const v=m(c.p2ms),E=m(c.p2pk),S=m(c.p2pkh),T=m(c.p2wpkh),I=m(c.p2wsh),k=m(c.p2sh);function O(t){return e=>!!e.masterFingerprint.equals(t.fingerprint)&&!!t.derivePath(e.path).publicKey.equals(e.pubkey)}function P(t){if("number"!=typeof t||t!==Math.floor(t)||t>4294967295||t<0)throw new Error("Invalid 32 bit integer")}function A(t,r){t.forEach(t=>{let n=!1,i=[];if(0===(t.partialSig||[]).length){if(!t.finalScriptSig&&!t.finalScriptWitness)return;i=function(t){const r=t.finalScriptSig&&h.decompile(t.finalScriptSig)||[],n=t.finalScriptWitness&&h.decompile(t.finalScriptWitness)||[];return r.concat(n).filter(t=>e.isBuffer(t)&&h.isCanonicalScriptSignature(t)).map(t=>({signature:t}))}(t)}else i=t.partialSig;if(i.forEach(t=>{const{hashType:e}=h.signature.decode(t.signature),i=[];switch(e&l.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&e){case l.Transaction.SIGHASH_ALL:break;case l.Transaction.SIGHASH_SINGLE:case l.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(r)&&(n=!0)}),n)throw new Error("Can not modify transaction, signatures exist.")})}function N(t,e,r){if(!z(t,e))throw new Error(`Can not ${r} for this input with the key ${t.toString("hex")}`)}function U(t,r){const n=(0,u.reverseBuffer)(e.from(r.hash)).toString("hex")+":"+r.index;if(t.__TX_IN_CACHE[n])throw new Error("Duplicate input detected.");t.__TX_IN_CACHE[n]=1}function B(t,e){return(r,n,i,o)=>{const s=t({redeem:{output:i}}).output;if(!n.equals(s))throw new Error(`${e} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const R=B(c.p2sh,"Redeem script"),x=B(c.p2wsh,"Witness script");function C(t,e,r,n){if(!r.every(_))throw new Error(`PSBT must be finalized to calculate ${e}`);if("__FEE_RATE"===t&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===t&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),W(r,i,n,o),"__FEE_RATE"===t?n.__FEE_RATE:"__FEE"===t?n.__FEE:void 0}function L(t,e,r,n,i){const s=(0,o.checkForInput)(t,e),{hash:u,sighashType:a,script:f}=H(e,s,n,!1,i);return N(r,f,"sign"),{hash:u,sighashType:a}}function H(t,e,r,n,i){const o=r.__TX,s=e.sighashType||l.Transaction.SIGHASH_ALL;if(i&&i.indexOf(s)<0){const t=function(t){let e=t&l.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&t){case l.Transaction.SIGHASH_ALL:e+="SIGHASH_ALL";break;case l.Transaction.SIGHASH_SINGLE:e+="SIGHASH_SINGLE";break;case l.Transaction.SIGHASH_NONE:e+="SIGHASH_NONE"}return e}(s);throw new Error("Sighash type is not allowed. Retry the sign method passing the "+`sighashTypes array of whitelisted types. Sighash type: ${t}`)}let u,a;if(e.nonWitnessUtxo){const n=V(r,e,t),i=o.ins[t].hash,s=n.getHash();if(!i.equals(s))throw new Error(`Non-witness UTXO hash for input #${t} doesn't match the hash specified in the prevout`);const u=o.ins[t].index;a=n.outs[u]}else{if(!e.witnessUtxo)throw new Error("Need a Utxo input item for signing");a=e.witnessUtxo}const{meaningfulScript:f,type:h}=q(a.script,t,"input",e.redeemScript,e.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(h)>=0)u=o.hashForWitnessV0(t,f,a.value,s);else if(T(f)){const e=c.p2pkh({hash:f.slice(2)}).output;u=o.hashForWitnessV0(t,e,a.value,s)}else{if(void 0===e.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${t} has witnessUtxo but non-segwit script: `+`${f.toString("hex")}`);n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),u=o.hashForSignature(t,f,s)}return{script:f,sighashType:s,hash:u}}function M(t,e,r){const n=(0,o.checkForInput)(e,t);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map(t=>t.masterFingerprint.equals(r.fingerprint)?t:void 0).filter(t=>!!t);if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map(t=>{const e=r.derivePath(t.path);if(!t.pubkey.equals(e.publicKey))throw new Error("pubkey did not match bip32Derivation");return e})}function D(t){let e=0;function r(){const r=i.decode(t,e);return e+=i.decode.bytes,r}function n(){return n=r(),e+=n,t.slice(e-n,e);var n}return function(){const t=r(),e=[];for(let r=0;r<t;r++)e.push(n());return e}()}function j(t){let r=e.allocUnsafe(0);function n(t){const n=r.length,o=i.encodingLength(t);r=e.concat([r,e.allocUnsafe(o)]),i.encode(t,r,n)}function o(t){n(t.length),function(t){r=e.concat([r,e.from(t)])}(t)}var s;return n((s=t).length),s.forEach(o),r}function F(t,e,r){t.__NON_WITNESS_UTXO_BUF_CACHE[r]=e.nonWitnessUtxo;const n=l.Transaction.fromBuffer(e.nonWitnessUtxo);t.__NON_WITNESS_UTXO_TX_CACHE[r]=n;const i=t,o=r;delete e.nonWitnessUtxo,Object.defineProperty(e,"nonWitnessUtxo",{enumerable:!0,get(){const t=i.__NON_WITNESS_UTXO_BUF_CACHE[o],e=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==t)return t;{const t=e.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t,t}},set(t){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=t}})}function W(t,e,r,n){let i=0;t.forEach((t,o)=>{if(n&&t.finalScriptSig&&(e.ins[o].script=t.finalScriptSig),n&&t.finalScriptWitness&&(e.ins[o].witness=D(t.finalScriptWitness)),t.witnessUtxo)i+=t.witnessUtxo.value;else if(t.nonWitnessUtxo){const n=V(r,t,o),s=e.ins[o].index,u=n.outs[s];i+=u.value}});const o=e.outs.reduce((t,e)=>t+e.value,0),s=i-o;if(s<0)throw new Error("Outputs are spending more than Inputs");const u=e.virtualSize();r.__FEE=s,r.__EXTRACTED_TX=e,r.__FEE_RATE=Math.floor(s/u)}function V(t,e,r){const n=t.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||F(t,e,r),n[r]}function K(t,e,r){if(void 0!==e.witnessUtxo)return e.witnessUtxo.script;if(void 0!==e.nonWitnessUtxo){return V(r,e,t).outs[r.__TX.ins[t].index].script}throw new Error("Can't find pubkey in input without Utxo data")}function G(t){return 33===t.length&&h.isCanonicalPubKey(t)}function q(t,e,r,n,i){const o=k(t),s=o&&n&&I(n),u=I(t);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((u||s)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let a;return s?(a=i,R(e,t,n,r),x(e,n,i,r),X(a)):u?(a=i,x(e,t,i,r),X(a)):o?(a=n,R(e,t,n,r)):a=t,{meaningfulScript:a,type:s?"p2sh-p2wsh":o?"p2sh":u?"p2wsh":"raw"}}function X(t){if(T(t)||k(t))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function z(t,e){const r=(0,a.hash160)(t),n=h.decompile(e);if(null===n)throw new Error("Unknown script error");return n.some(e=>"number"!=typeof e&&(e.equals(t)||e.equals(r)))}function Y(t){return T(t)?"witnesspubkeyhash":S(t)?"pubkeyhash":v(t)?"multisig":E(t)?"pubkey":"nonstandard"}function $(t){return[...Array(t).keys()]}}).call(this)}).call(this,t("buffer").Buffer)},{"./address":27,"./bufferutils":30,"./crypto":31,"./networks":34,"./payments":37,"./script":47,"./transaction":50,bip174:24,"bip174/src/lib/converter/varint":20,"bip174/src/lib/utils":26,buffer:56}],46:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=r.encode=r.encodingLength=void 0;const n=t("./ops");function i(t){return t<n.OPS.OP_PUSHDATA1?1:t<=255?2:t<=65535?3:5}r.encodingLength=i,r.encode=function(t,e,r){const o=i(e);return 1===o?t.writeUInt8(e,r):2===o?(t.writeUInt8(n.OPS.OP_PUSHDATA1,r),t.writeUInt8(e,r+1)):3===o?(t.writeUInt8(n.OPS.OP_PUSHDATA2,r),t.writeUInt16LE(e,r+1)):(t.writeUInt8(n.OPS.OP_PUSHDATA4,r),t.writeUInt32LE(e,r+1)),o},r.decode=function(t,e){const r=t.readUInt8(e);let i,o;if(r<n.OPS.OP_PUSHDATA1)i=r,o=1;else if(r===n.OPS.OP_PUSHDATA1){if(e+2>t.length)return null;i=t.readUInt8(e+1),o=2}else if(r===n.OPS.OP_PUSHDATA2){if(e+3>t.length)return null;i=t.readUInt16LE(e+1),o=3}else{if(e+5>t.length)return null;if(r!==n.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");i=t.readUInt32LE(e+1),o=5}return{opcode:r,number:i,size:o}}},{"./ops":35}],47:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.signature=r.number=r.isCanonicalScriptSignature=r.isDefinedHashType=r.isCanonicalPubKey=r.toStack=r.fromASM=r.toASM=r.decompile=r.compile=r.isPushOnly=r.OPS=void 0;const n=t("./bip66"),i=t("./ops");Object.defineProperty(r,"OPS",{enumerable:!0,get:function(){return i.OPS}});const o=t("./push_data"),s=t("./script_number"),u=t("./script_signature"),a=t("./types"),{typeforce:f}=a,c=i.OPS.OP_RESERVED;function h(t){return a.Buffer(t)||function(t){return a.Number(t)&&(t===i.OPS.OP_0||t>=i.OPS.OP_1&&t<=i.OPS.OP_16||t===i.OPS.OP_1NEGATE)}(t)}function l(t){return a.Array(t)&&t.every(h)}function p(t){return 0===t.length?i.OPS.OP_0:1===t.length?t[0]>=1&&t[0]<=16?c+t[0]:129===t[0]?i.OPS.OP_1NEGATE:void 0:void 0}function d(t){return e.isBuffer(t)}function y(t){return e.isBuffer(t)}function w(t){if(d(t))return t;f(a.Array,t);const r=t.reduce((t,e)=>y(e)?1===e.length&&void 0!==p(e)?t+1:t+o.encodingLength(e.length)+e.length:t+1,0),n=e.allocUnsafe(r);let i=0;if(t.forEach(t=>{if(y(t)){const e=p(t);if(void 0!==e)return n.writeUInt8(e,i),void(i+=1);i+=o.encode(n,t.length,i),t.copy(n,i),i+=t.length}else n.writeUInt8(t,i),i+=1}),i!==n.length)throw new Error("Could not decode chunks");return n}function g(t){if(e=t,a.Array(e))return t;var e;f(a.Buffer,t);const r=[];let n=0;for(;n<t.length;){const e=t[n];if(e>i.OPS.OP_0&&e<=i.OPS.OP_PUSHDATA4){const e=o.decode(t,n);if(null===e)return null;if((n+=e.size)+e.number>t.length)return null;const i=t.slice(n,n+e.number);n+=e.number;const s=p(i);void 0!==s?r.push(s):r.push(i)}else r.push(e),n+=1}return r}function b(t){const e=-129&t;return e>0&&e<4}r.isPushOnly=l,r.compile=w,r.decompile=g,r.toASM=function(t){return d(t)&&(t=g(t)),t.map(t=>{if(y(t)){const e=p(t);if(void 0===e)return t.toString("hex");t=e}return i.REVERSE_OPS[t]}).join(" ")},r.fromASM=function(t){return f(a.String,t),w(t.split(" ").map(t=>void 0!==i.OPS[t]?i.OPS[t]:(f(a.Hex,t),e.from(t,"hex"))))},r.toStack=function(t){return t=g(t),f(l,t),t.map(t=>y(t)?t:t===i.OPS.OP_0?e.allocUnsafe(0):s.encode(t-c))},r.isCanonicalPubKey=function(t){return a.isPoint(t)},r.isDefinedHashType=b,r.isCanonicalScriptSignature=function(t){return!!e.isBuffer(t)&&!!b(t[t.length-1])&&n.check(t.slice(0,-1))},r.number=s,r.signature=u}).call(this)}).call(this,t("buffer").Buffer)},{"./bip66":28,"./ops":35,"./push_data":46,"./script_number":48,"./script_signature":49,"./types":51,buffer:56}],48:[function(t,e,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.encode=r.decode=void 0,r.decode=function(t,e,r){e=e||4,r=void 0===r||r;const n=t.length;if(0===n)return 0;if(n>e)throw new TypeError("Script number overflow");if(r&&0==(127&t[n-1])&&(n<=1||0==(128&t[n-2])))throw new Error("Non-minimally encoded script number");if(5===n){const e=t.readUInt32LE(0),r=t.readUInt8(4);return 128&r?-(4294967296*(-129&r)+e):4294967296*r+e}let i=0;for(let e=0;e<n;++e)i|=t[e]<<8*e;return 128&t[n-1]?-(i&~(128<<8*(n-1))):i},r.encode=function(e){let r=Math.abs(e);const n=(i=r)>2147483647?5:i>8388607?4:i>32767?3:i>127?2:i>0?1:0;var i;const o=t.allocUnsafe(n),s=e<0;for(let t=0;t<n;++t)o.writeUInt8(255&r,t),r>>=8;return 128&o[n-1]?o.writeUInt8(s?128:0,n-1):s&&(o[n-1]|=128),o}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:56}],49:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.encode=r.decode=void 0;const n=t("./bip66"),i=t("./types"),{typeforce:o}=i,s=e.alloc(1,0);function u(t){let r=0;for(;0===t[r];)++r;return r===t.length?s:128&(t=t.slice(r))[0]?e.concat([s,t],1+t.length):t}function a(t){0===t[0]&&(t=t.slice(1));const r=e.alloc(32,0),n=Math.max(0,32-t.length);return t.copy(r,n),r}r.decode=function(t){const r=t.readUInt8(t.length-1),i=-129&r;if(i<=0||i>=4)throw new Error("Invalid hashType "+r);const o=n.decode(t.slice(0,-1)),s=a(o.r),u=a(o.s);return{signature:e.concat([s,u],64),hashType:r}},r.encode=function(t,r){o({signature:i.BufferN(64),hashType:i.UInt8},{signature:t,hashType:r});const s=-129&r;if(s<=0||s>=4)throw new Error("Invalid hashType "+r);const a=e.allocUnsafe(1);a.writeUInt8(r,0);const f=u(t.slice(0,32)),c=u(t.slice(32,64));return e.concat([n.encode(f,c),a])}}).call(this)}).call(this,t("buffer").Buffer)},{"./bip66":28,"./types":51,buffer:56}],50:[function(t,e,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Transaction=void 0;const n=t("./bufferutils"),i=t("./crypto"),o=t("./script"),s=t("./script"),u=t("./types"),{typeforce:a}=u;function f(t){const e=t.length;return n.varuint.encodingLength(e)+e}const c=e.allocUnsafe(0),h=[],l=e.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),p=e.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),d=e.from("ffffffffffffffff","hex"),y={script:c,valueBuffer:d};class w{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,e){const r=new n.BufferReader(t),i=new w;i.version=r.readInt32();const o=r.readUInt8(),s=r.readUInt8();let u=!1;o===w.ADVANCED_TRANSACTION_MARKER&&s===w.ADVANCED_TRANSACTION_FLAG?u=!0:r.offset-=2;const a=r.readVarInt();for(let t=0;t<a;++t)i.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:h});const f=r.readVarInt();for(let t=0;t<f;++t)i.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(u){for(let t=0;t<a;++t)i.ins[t].witness=r.readVector();if(!i.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(i.locktime=r.readUInt32(),e)return i;if(r.offset!==t.length)throw new Error("Transaction has unexpected data");return i}static fromHex(t){return w.fromBuffer(e.from(t,"hex"),!1)}static isCoinbaseHash(t){a(u.Hash256bit,t);for(let e=0;e<32;++e)if(0!==t[e])return!1;return!0}isCoinbase(){return 1===this.ins.length&&w.isCoinbaseHash(this.ins[0].hash)}addInput(t,e,r,n){return a(u.tuple(u.Hash256bit,u.UInt32,u.maybe(u.UInt32),u.maybe(u.Buffer)),arguments),u.Null(r)&&(r=w.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:e,script:n||c,sequence:r,witness:h})-1}addOutput(t,e){return a(u.tuple(u.Buffer,u.Satoshi),arguments),this.outs.push({script:t,value:e})-1}hasWitnesses(){return this.ins.some(t=>0!==t.witness.length)}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(t=!0){const e=t&&this.hasWitnesses();return(e?10:8)+n.varuint.encodingLength(this.ins.length)+n.varuint.encodingLength(this.outs.length)+this.ins.reduce((t,e)=>t+40+f(e.script),0)+this.outs.reduce((t,e)=>t+8+f(e.script),0)+(e?this.ins.reduce((t,e)=>t+function(t){const e=t.length;return n.varuint.encodingLength(e)+t.reduce((t,e)=>t+f(e),0)}(e.witness),0):0)}clone(){const t=new w;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map(t=>({hash:t.hash,index:t.index,script:t.script,sequence:t.sequence,witness:t.witness})),t.outs=this.outs.map(t=>({script:t.script,value:t.value})),t}hashForSignature(t,r,n){if(a(u.tuple(u.UInt32,u.Buffer,u.Number),arguments),t>=this.ins.length)return p;const f=o.compile(o.decompile(r).filter(t=>t!==s.OPS.OP_CODESEPARATOR)),h=this.clone();if((31&n)===w.SIGHASH_NONE)h.outs=[],h.ins.forEach((e,r)=>{r!==t&&(e.sequence=0)});else if((31&n)===w.SIGHASH_SINGLE){if(t>=this.outs.length)return p;h.outs.length=t+1;for(let e=0;e<t;e++)h.outs[e]=y;h.ins.forEach((e,r)=>{r!==t&&(e.sequence=0)})}n&w.SIGHASH_ANYONECANPAY?(h.ins=[h.ins[t]],h.ins[0].script=f):(h.ins.forEach(t=>{t.script=c}),h.ins[t].script=f);const l=e.allocUnsafe(h.byteLength(!1)+4);return l.writeInt32LE(n,l.length-4),h.__toBuffer(l,0,!1),i.hash256(l)}hashForWitnessV1(t,r,o,s,h,l){if(a(u.tuple(u.UInt32,a.arrayOf(u.Buffer),a.arrayOf(u.Satoshi),u.UInt32),arguments),o.length!==this.ins.length||r.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const p=s===w.SIGHASH_DEFAULT?w.SIGHASH_ALL:s&w.SIGHASH_OUTPUT_MASK,d=(s&w.SIGHASH_INPUT_MASK)===w.SIGHASH_ANYONECANPAY,y=p===w.SIGHASH_NONE,g=p===w.SIGHASH_SINGLE;let b=c,_=c,m=c,v=c,E=c;if(!d){let t=n.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach(e=>{t.writeSlice(e.hash),t.writeUInt32(e.index)}),b=i.sha256(t.end()),t=n.BufferWriter.withCapacity(8*this.ins.length),o.forEach(e=>t.writeUInt64(e)),_=i.sha256(t.end()),t=n.BufferWriter.withCapacity(r.map(f).reduce((t,e)=>t+e)),r.forEach(e=>t.writeVarSlice(e)),m=i.sha256(t.end()),t=n.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach(e=>t.writeUInt32(e.sequence)),v=i.sha256(t.end())}if(y||g){if(g&&t<this.outs.length){const e=this.outs[t],r=n.BufferWriter.withCapacity(8+f(e.script));r.writeUInt64(e.value),r.writeVarSlice(e.script),E=i.sha256(r.end())}}else{const t=this.outs.map(t=>8+f(t.script)).reduce((t,e)=>t+e),e=n.BufferWriter.withCapacity(t);this.outs.forEach(t=>{e.writeUInt64(t.value),e.writeVarSlice(t.script)}),E=i.sha256(e.end())}const S=(h?2:0)+(l?1:0),T=174-(d?49:0)-(y?32:0)+(l?32:0)+(h?37:0),I=n.BufferWriter.withCapacity(T);if(I.writeUInt8(s),I.writeInt32(this.version),I.writeUInt32(this.locktime),I.writeSlice(b),I.writeSlice(_),I.writeSlice(m),I.writeSlice(v),y||g||I.writeSlice(E),I.writeUInt8(S),d){const e=this.ins[t];I.writeSlice(e.hash),I.writeUInt32(e.index),I.writeUInt64(o[t]),I.writeVarSlice(r[t]),I.writeUInt32(e.sequence)}else I.writeUInt32(t);if(l){const t=n.BufferWriter.withCapacity(f(l));t.writeVarSlice(l),I.writeSlice(i.sha256(t.end()))}return g&&I.writeSlice(E),h&&(I.writeSlice(h),I.writeUInt8(0),I.writeUInt32(4294967295)),i.taggedHash("TapSighash",e.concat([e.of(0),I.end()]))}hashForWitnessV0(t,r,o,s){a(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let c,h=e.from([]),p=l,d=l,y=l;if(s&w.SIGHASH_ANYONECANPAY||(h=e.allocUnsafe(36*this.ins.length),c=new n.BufferWriter(h,0),this.ins.forEach(t=>{c.writeSlice(t.hash),c.writeUInt32(t.index)}),d=i.hash256(h)),s&w.SIGHASH_ANYONECANPAY||(31&s)===w.SIGHASH_SINGLE||(31&s)===w.SIGHASH_NONE||(h=e.allocUnsafe(4*this.ins.length),c=new n.BufferWriter(h,0),this.ins.forEach(t=>{c.writeUInt32(t.sequence)}),y=i.hash256(h)),(31&s)!==w.SIGHASH_SINGLE&&(31&s)!==w.SIGHASH_NONE){const t=this.outs.reduce((t,e)=>t+8+f(e.script),0);h=e.allocUnsafe(t),c=new n.BufferWriter(h,0),this.outs.forEach(t=>{c.writeUInt64(t.value),c.writeVarSlice(t.script)}),p=i.hash256(h)}else if((31&s)===w.SIGHASH_SINGLE&&t<this.outs.length){const r=this.outs[t];h=e.allocUnsafe(8+f(r.script)),(c=new n.BufferWriter(h,0)).writeUInt64(r.value),c.writeVarSlice(r.script),p=i.hash256(h)}h=e.allocUnsafe(156+f(r)),c=new n.BufferWriter(h,0);const g=this.ins[t];return c.writeInt32(this.version),c.writeSlice(d),c.writeSlice(y),c.writeSlice(g.hash),c.writeUInt32(g.index),c.writeVarSlice(r),c.writeUInt64(o),c.writeUInt32(g.sequence),c.writeSlice(p),c.writeUInt32(this.locktime),c.writeUInt32(s),i.hash256(h)}getHash(t){return t&&this.isCoinbase()?e.alloc(32,0):i.hash256(this.__toBuffer(void 0,void 0,t))}getId(){return(0,n.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(t,e){return this.__toBuffer(t,e,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(t,e){a(u.tuple(u.Number,u.Buffer),arguments),this.ins[t].script=e}setWitness(t,e){a(u.tuple(u.Number,[u.Buffer]),arguments),this.ins[t].witness=e}__toBuffer(t,r,i=!1){t||(t=e.allocUnsafe(this.byteLength(i)));const o=new n.BufferWriter(t,r||0);o.writeInt32(this.version);const s=i&&this.hasWitnesses();return s&&(o.writeUInt8(w.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(w.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach(t=>{o.writeSlice(t.hash),o.writeUInt32(t.index),o.writeVarSlice(t.script),o.writeUInt32(t.sequence)}),o.writeVarInt(this.outs.length),this.outs.forEach(t=>{void 0!==t.value?o.writeUInt64(t.value):o.writeSlice(t.valueBuffer),o.writeVarSlice(t.script)}),s&&this.ins.forEach(t=>{o.writeVector(t.witness)}),o.writeUInt32(this.locktime),void 0!==r?t.slice(r,o.offset):t}}r.Transaction=w,w.DEFAULT_SEQUENCE=4294967295,w.SIGHASH_DEFAULT=0,w.SIGHASH_ALL=1,w.SIGHASH_NONE=2,w.SIGHASH_SINGLE=3,w.SIGHASH_ANYONECANPAY=128,w.SIGHASH_OUTPUT_MASK=3,w.SIGHASH_INPUT_MASK=128,w.ADVANCED_TRANSACTION_MARKER=0,w.ADVANCED_TRANSACTION_FLAG=1}).call(this)}).call(this,t("buffer").Buffer)},{"./bufferutils":30,"./crypto":31,"./script":47,"./types":51,buffer:56}],51:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.oneOf=r.Null=r.BufferN=r.Function=r.UInt32=r.UInt8=r.tuple=r.maybe=r.Hex=r.Buffer=r.String=r.Boolean=r.Array=r.Number=r.Hash256bit=r.Hash160bit=r.Buffer256bit=r.Network=r.ECPoint=r.Satoshi=r.Signer=r.BIP32Path=r.UInt31=r.isPoint=r.typeforce=void 0;const n=t("buffer");r.typeforce=t("typeforce");const i=n.Buffer.alloc(32,0),o=n.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");r.isPoint=function(t){if(!n.Buffer.isBuffer(t))return!1;if(t.length<33)return!1;const e=t[0],r=t.slice(1,33);if(0===r.compare(i))return!1;if(r.compare(o)>=0)return!1;if((2===e||3===e)&&33===t.length)return!0;const s=t.slice(33);return 0!==s.compare(i)&&!(s.compare(o)>=0)&&4===e&&65===t.length};const s=Math.pow(2,31)-1;function u(t){return r.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}r.UInt31=function(t){return r.typeforce.UInt32(t)&&t<=s},r.BIP32Path=u,u.toJSON=(()=>"BIP32 derivation path"),r.Signer=function(t){return(r.typeforce.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign};const a=21e14;r.Satoshi=function(t){return r.typeforce.UInt53(t)&&t<=a},r.ECPoint=r.typeforce.quacksLike("Point"),r.Network=r.typeforce.compile({messagePrefix:r.typeforce.oneOf(r.typeforce.Buffer,r.typeforce.String),bip32:{public:r.typeforce.UInt32,private:r.typeforce.UInt32},pubKeyHash:r.typeforce.UInt8,scriptHash:r.typeforce.UInt8,wif:r.typeforce.UInt8}),r.Buffer256bit=r.typeforce.BufferN(32),r.Hash160bit=r.typeforce.BufferN(20),r.Hash256bit=r.typeforce.BufferN(32),r.Number=r.typeforce.Number,r.Array=r.typeforce.Array,r.Boolean=r.typeforce.Boolean,r.String=r.typeforce.String,r.Buffer=r.typeforce.Buffer,r.Hex=r.typeforce.Hex,r.maybe=r.typeforce.maybe,r.tuple=r.typeforce.tuple,r.UInt8=r.typeforce.UInt8,r.UInt32=r.typeforce.UInt32,r.Function=r.typeforce.Function,r.BufferN=r.typeforce.BufferN,r.Null=r.typeforce.Null,r.oneOf=r.typeforce.oneOf},{buffer:56,typeforce:94}],52:[function(t,e,r){},{}],53:[function(t,e,r){var n=t("base-x");e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":1}],54:[function(t,e,r){"use strict";var n=t("bs58"),i=t("safe-buffer").Buffer;e.exports=function(t){function e(e){var r=e.slice(0,-4),n=e.slice(-4),i=t(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(e){var r=t(e);return n.encode(i.concat([e,r],e.length+4))},decode:function(t){var r=e(n.decode(t));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(t){var r=n.decodeUnsafe(t);if(r)return e(r)}}}},{bs58:53,"safe-buffer":67}],55:[function(t,e,r){"use strict";var n=t("create-hash"),i=t("./base");e.exports=i(function(t){var e=n("sha256").update(t).digest();return n("sha256").update(e).digest()})},{"./base":54,"create-hash":58}],56:[function(t,e,r){(function(e){(function(){"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|l(t,e),n=o(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(D(t,ArrayBuffer)||t&&D(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=s.prototype,n}(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return s.from(n,e,r);var i=function(t){if(s.isBuffer(t)){var e=0|h(t.length),r=o(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(void 0!==t.length)return"number"!=typeof t.length||j(t.length)?o(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return a(t),o(t<0?0:0|h(t))}function c(t){for(var e=t.length<0?0:0|h(t.length),r=o(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function h(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function l(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||D(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(i)return n?-1:L(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),j(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var o,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var c=-1;for(o=r;o<u;o++)if(f(t,o)===f(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===a)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(r+a>u&&(r=u-a),o=r;o>=0;o--){for(var h=!0,l=0;l<a;l++)if(f(t,o+l)!==f(e,l)){h=!1;break}if(h)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var u=parseInt(e.substr(2*s,2),16);if(j(u))return s;t[r+s]=u}return s}function g(t,e,r,n){return M(L(e,t.length-r),t,r,n)}function b(t,e,r,n){return M(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function _(t,e,r,n){return b(t,e,r,n)}function m(t,e,r,n){return M(H(e),t,r,n)}function v(t,e,r,n){return M(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,u,a,f=t[i],c=null,h=f>239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&f)<<6|63&o)>127&&(c=a);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(a=(15&f)<<12|(63&o)<<6|63&s)>2047&&(a<55296||a>57343)&&(c=a);break;case 4:o=t[i+1],s=t[i+2],u=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(c=a)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(t,e,r){return function(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},s.allocUnsafe=function(t){return f(t)},s.allocUnsafeSlow=function(t){return f(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(D(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),D(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=s.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(D(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},s.byteLength=l,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)p(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)p(this,e,e+3),p(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},s.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},s.prototype.compare=function(t,e,r,n,i){if(D(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,u=r-e,a=Math.min(o,u),f=this.slice(n,i),c=t.slice(e,r),h=0;h<a;++h)if(f[h]!==c[h]){o=f[h],u=c[h];break}return o<u?-1:u<o?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function I(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function O(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=C(t[o]);return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function A(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function U(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,i,o){return e=+e,r>>>=0,o||U(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function R(t,e,r,i,o){return e=+e,r>>>=0,o||U(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||A(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||A(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||A(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||A(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||A(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||A(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=0,s=1,u=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===u&&0!==this[e+o-1]&&(u=1),this[e+o]=(t/s>>0)-u&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,s=1,u=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/s>>0)-u&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var o=i-1;o>=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var u=s.isBuffer(t)?t:s.from(t,n),a=u.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=u[o%a]}return this};var x=/[^+/0-9A-Za-z-_]/g;function C(t){return t<16?"0"+t.toString(16):t.toString(16)}function L(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function H(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function D(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function j(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":2,buffer:56,ieee754:61}],57:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("stream").Transform,o=t("string_decoder").StringDecoder;function s(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}t("inherits")(s,i),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},e.exports=s},{inherits:62,"safe-buffer":67,stream:76,string_decoder:91}],58:[function(t,e,r){"use strict";var n=t("inherits"),i=t("md5.js"),o=t("ripemd160"),s=t("sha.js"),u=t("cipher-base");function a(t){u.call(this,"digest"),this._hash=t}n(a,u),a.prototype._update=function(t){this._hash.update(t)},a.prototype._final=function(){return this._hash.digest()},e.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new a(s(t))}},{"cipher-base":57,inherits:62,"md5.js":64,ripemd160:66,"sha.js":69}],59:[function(t,e,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function u(){u.init.call(this)}e.exports=u,e.exports.once=function(t,e){return new Promise(function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}w(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&w(t,"error",e,r)}(t,i,{once:!0})})},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var a=10;function f(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function h(t,e,r,n){var i,o,s,u;if(f(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,u=a,console&&console.warn&&console.warn(u)}return t}function l(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(n);return i.listener=r,n.wrapFn=i,i}function p(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):y(i,i.length)}function d(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function w(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)})}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var a=i[t];if(void 0===a)return!1;if("function"==typeof a)o(a,this,e);else{var f=a.length,c=y(a,f);for(r=0;r<f;++r)o(c[r],this,e)}return!0},u.prototype.addListener=function(t,e){return h(this,t,e,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(t,e){return h(this,t,e,!0)},u.prototype.once=function(t,e){return f(e),this.on(t,l(this,t,e)),this},u.prototype.prependOnceListener=function(t,e){return f(e),this.prependListener(t,l(this,t,e)),this},u.prototype.removeListener=function(t,e){var r,n,i,o,s;if(f(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return p(this,t,!0)},u.prototype.rawListeners=function(t){return p(this,t,!1)},u.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},u.prototype.listenerCount=d,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],60:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("stream").Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}t("inherits")(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var s=0,u=8*t.length;u>0;++s)this._length[s]+=u,(u=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*u);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},{inherits:62,"safe-buffer":67,stream:76}],61:[function(t,e,r){r.read=function(t,e,r,n,i){var o,s,u=8*i-n-1,a=(1<<u)-1,f=a>>1,c=-7,h=r?i-1:0,l=r?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-c)-1,p>>=-c,c+=u;c>0;o=256*o+t[e+h],h+=l,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=l,c-=8);if(0===o)o=1-f;else{if(o===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var s,u,a,f=8*o-i-1,c=(1<<f)-1,h=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+h>=1?l/a:l*Math.pow(2,1-h))*a>=2&&(s++,a/=2),s+h>=c?(u=0,s=c):s+h>=1?(u=(e*a-1)*Math.pow(2,i),s+=h):(u=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&u,p+=d,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;t[r+p]=255&s,p+=d,s/=256,f-=8);t[r+p-d]|=128*y}},{}],62:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],63:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],64:[function(t,e,r){"use strict";var n=t("inherits"),i=t("hash-base"),o=t("safe-buffer").Buffer,s=new Array(16);function u(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function a(t,e){return t<<e|t>>>32-e}function f(t,e,r,n,i,o,s){return a(t+(e&r|~e&n)+i+o|0,s)+e|0}function c(t,e,r,n,i,o,s){return a(t+(e&n|r&~n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return a(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return a(t+(r^(e|~n))+i+o|0,s)+e|0}n(u,i),u.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;n=l(n=l(n=l(n=l(n=h(n=h(n=h(n=h(n=c(n=c(n=c(n=c(n=f(n=f(n=f(n=f(n,i=f(i,o=f(o,r=f(r,n,i,o,t[0],3614090360,7),n,i,t[1],3905402710,12),r,n,t[2],606105819,17),o,r,t[3],3250441966,22),i=f(i,o=f(o,r=f(r,n,i,o,t[4],4118548399,7),n,i,t[5],1200080426,12),r,n,t[6],2821735955,17),o,r,t[7],4249261313,22),i=f(i,o=f(o,r=f(r,n,i,o,t[8],1770035416,7),n,i,t[9],2336552879,12),r,n,t[10],4294925233,17),o,r,t[11],2304563134,22),i=f(i,o=f(o,r=f(r,n,i,o,t[12],1804603682,7),n,i,t[13],4254626195,12),r,n,t[14],2792965006,17),o,r,t[15],1236535329,22),i=c(i,o=c(o,r=c(r,n,i,o,t[1],4129170786,5),n,i,t[6],3225465664,9),r,n,t[11],643717713,14),o,r,t[0],3921069994,20),i=c(i,o=c(o,r=c(r,n,i,o,t[5],3593408605,5),n,i,t[10],38016083,9),r,n,t[15],3634488961,14),o,r,t[4],3889429448,20),i=c(i,o=c(o,r=c(r,n,i,o,t[9],568446438,5),n,i,t[14],3275163606,9),r,n,t[3],4107603335,14),o,r,t[8],1163531501,20),i=c(i,o=c(o,r=c(r,n,i,o,t[13],2850285829,5),n,i,t[2],4243563512,9),r,n,t[7],1735328473,14),o,r,t[12],2368359562,20),i=h(i,o=h(o,r=h(r,n,i,o,t[5],4294588738,4),n,i,t[8],2272392833,11),r,n,t[11],1839030562,16),o,r,t[14],4259657740,23),i=h(i,o=h(o,r=h(r,n,i,o,t[1],2763975236,4),n,i,t[4],1272893353,11),r,n,t[7],4139469664,16),o,r,t[10],3200236656,23),i=h(i,o=h(o,r=h(r,n,i,o,t[13],681279174,4),n,i,t[0],3936430074,11),r,n,t[3],3572445317,16),o,r,t[6],76029189,23),i=h(i,o=h(o,r=h(r,n,i,o,t[9],3654602809,4),n,i,t[12],3873151461,11),r,n,t[15],530742520,16),o,r,t[2],3299628645,23),i=l(i,o=l(o,r=l(r,n,i,o,t[0],4096336452,6),n,i,t[7],1126891415,10),r,n,t[14],2878612391,15),o,r,t[5],4237533241,21),i=l(i,o=l(o,r=l(r,n,i,o,t[12],1700485571,6),n,i,t[3],2399980690,10),r,n,t[10],4293915773,15),o,r,t[1],2240044497,21),i=l(i,o=l(o,r=l(r,n,i,o,t[8],1873313359,6),n,i,t[15],4264355552,10),r,n,t[6],2734768916,15),o,r,t[13],1309151649,21),i=l(i,o=l(o,r=l(r,n,i,o,t[4],4149444226,6),n,i,t[11],3174756917,10),r,n,t[2],718787259,15),o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},u.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 t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=u},{"hash-base":60,inherits:62,"safe-buffer":67}],65:[function(t,e,r){var n,i,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{i="function"==typeof clearTimeout?clearTimeout:u}catch(t){i=u}}();var f,c=[],h=!1,l=-1;function p(){h&&f&&(h=!1,f.length?c=f.concat(c):l=-1,c.length&&d())}function d(){if(!h){var t=a(p);h=!0;for(var e=c.length;e;){for(f=c,c=[];++l<e;)f&&f[l].run();l=-1,e=c.length}f=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===u||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function y(t,e){this.fun=t,this.array=e}function w(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new y(t,e)),1!==c.length||h||a(d)},y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=w,o.addListener=w,o.once=w,o.off=w,o.removeListener=w,o.removeAllListeners=w,o.emit=w,o.prependListener=w,o.prependOnceListener=w,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],66:[function(t,e,r){"use strict";var n=t("buffer").Buffer,i=t("inherits"),o=t("hash-base"),s=new Array(16),u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],a=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],f=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],c=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function p(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function d(t,e){return t<<e|t>>>32-e}function y(t,e,r,n,i,o,s,u){return d(t+(e^r^n)+o+s|0,u)+i|0}function w(t,e,r,n,i,o,s,u){return d(t+(e&r|~e&n)+o+s|0,u)+i|0}function g(t,e,r,n,i,o,s,u){return d(t+((e|~r)^n)+o+s|0,u)+i|0}function b(t,e,r,n,i,o,s,u){return d(t+(e&n|r&~n)+o+s|0,u)+i|0}function _(t,e,r,n,i,o,s,u){return d(t+(e^(r|~n))+o+s|0,u)+i|0}i(p,o),p.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,p=0|this._e,m=0|this._a,v=0|this._b,E=0|this._c,S=0|this._d,T=0|this._e,I=0;I<80;I+=1){var k,O;I<16?(k=y(r,n,i,o,p,t[u[I]],h[0],f[I]),O=_(m,v,E,S,T,t[a[I]],l[0],c[I])):I<32?(k=w(r,n,i,o,p,t[u[I]],h[1],f[I]),O=b(m,v,E,S,T,t[a[I]],l[1],c[I])):I<48?(k=g(r,n,i,o,p,t[u[I]],h[2],f[I]),O=g(m,v,E,S,T,t[a[I]],l[2],c[I])):I<64?(k=b(r,n,i,o,p,t[u[I]],h[3],f[I]),O=w(m,v,E,S,T,t[a[I]],l[3],c[I])):(k=_(r,n,i,o,p,t[u[I]],h[4],f[I]),O=y(m,v,E,S,T,t[a[I]],l[4],c[I])),r=p,p=o,o=d(i,10),i=n,n=k,m=T,T=S,S=d(E,10),E=v,v=O}var P=this._b+i+S|0;this._b=this._c+o+T|0,this._c=this._d+p+m|0,this._d=this._e+r+v|0,this._e=this._a+n+E|0,this._a=P},p.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 t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=p},{buffer:56,"hash-base":60,inherits:62}],67:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:56}],68:[function(t,e,r){var n=t("safe-buffer").Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,s=this._len,u=0;u<o;){for(var a=s%i,f=Math.min(o-u,i-a),c=0;c<f;c++)r[a+c]=t[u+c];u+=f,(s+=f)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},{"safe-buffer":67}],69:[function(t,e,r){(r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e}).sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":70,"./sha1":71,"./sha224":72,"./sha256":73,"./sha384":74,"./sha512":75}],70:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,s=[1518500249,1859775393,-1894007588,-899497514],u=new Array(80);function a(){this.init(),this._w=u,i.call(this,64,56)}function f(t){return t<<30|t>>>2}function c(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(a,i),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},a.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,u=0|this._d,a=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var l=0;l<80;++l){var p=~~(l/20),d=0|((e=n)<<5|e>>>27)+c(p,i,o,u)+a+r[l]+s[p];a=u,u=o,o=f(i),i=n,n=d}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=u+this._d|0,this._e=a+this._e|0},a.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=a},{"./hash":68,inherits:62,"safe-buffer":67}],71:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,s=[1518500249,1859775393,-1894007588,-899497514],u=new Array(80);function a(){this.init(),this._w=u,i.call(this,64,56)}function f(t){return t<<5|t>>>27}function c(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(a,i),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},a.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,u=0|this._d,a=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var p=0;p<80;++p){var d=~~(p/20),y=f(n)+h(d,i,o,u)+a+r[p]+s[d]|0;a=u,u=o,o=c(i),i=n,n=y}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=u+this._d|0,this._e=a+this._e|0},a.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=a},{"./hash":68,inherits:62,"safe-buffer":67}],72:[function(t,e,r){var n=t("inherits"),i=t("./sha256"),o=t("./hash"),s=t("safe-buffer").Buffer,u=new Array(64);function a(){this.init(),this._w=u,o.call(this,64,56)}n(a,i),a.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},a.prototype._hash=function(){var t=s.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=a},{"./hash":68,"./sha256":73,inherits:62,"safe-buffer":67}],73:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,s=[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],u=new Array(64);function a(){this.init(),this._w=u,i.call(this,64,56)}function f(t,e,r){return r^t&(e^r)}function c(t,e,r){return t&e|r&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function p(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(a,i),a.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},a.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,u=0|this._d,a=0|this._e,d=0|this._f,y=0|this._g,w=0|this._h,g=0;g<16;++g)r[g]=t.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((e=r[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[g-7]+p(r[g-15])+r[g-16];for(var b=0;b<64;++b){var _=w+l(a)+f(a,d,y)+s[b]+r[b]|0,m=h(n)+c(n,i,o)|0;w=y,y=d,d=a,a=u+_|0,u=o,o=i,i=n,n=_+m|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=u+this._d|0,this._e=a+this._e|0,this._f=d+this._f|0,this._g=y+this._g|0,this._h=w+this._h|0},a.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=a},{"./hash":68,inherits:62,"safe-buffer":67}],74:[function(t,e,r){var n=t("inherits"),i=t("./sha512"),o=t("./hash"),s=t("safe-buffer").Buffer,u=new Array(160);function a(){this.init(),this._w=u,o.call(this,128,112)}n(a,i),a.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},a.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}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},e.exports=a},{"./hash":68,"./sha512":75,inherits:62,"safe-buffer":67}],75:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,s=[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],u=new Array(160);function a(){this.init(),this._w=u,i.call(this,128,112)}function f(t,e,r){return r^t&(e^r)}function c(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function w(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0<e>>>0?1:0}n(a,i),a.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},a.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,u=0|this._eh,a=0|this._fh,b=0|this._gh,_=0|this._hh,m=0|this._al,v=0|this._bl,E=0|this._cl,S=0|this._dl,T=0|this._el,I=0|this._fl,k=0|this._gl,O=0|this._hl,P=0;P<32;P+=2)e[P]=t.readInt32BE(4*P),e[P+1]=t.readInt32BE(4*P+4);for(;P<160;P+=2){var A=e[P-30],N=e[P-30+1],U=p(A,N),B=d(N,A),R=y(A=e[P-4],N=e[P-4+1]),x=w(N,A),C=e[P-14],L=e[P-14+1],H=e[P-32],M=e[P-32+1],D=B+L|0,j=U+C+g(D,B)|0;j=(j=j+R+g(D=D+x|0,x)|0)+H+g(D=D+M|0,M)|0,e[P]=j,e[P+1]=D}for(var F=0;F<160;F+=2){j=e[F],D=e[F+1];var W=c(r,n,i),V=c(m,v,E),K=h(r,m),G=h(m,r),q=l(u,T),X=l(T,u),z=s[F],Y=s[F+1],$=f(u,a,b),J=f(T,I,k),Q=O+X|0,Z=_+q+g(Q,O)|0;Z=(Z=(Z=Z+$+g(Q=Q+J|0,J)|0)+z+g(Q=Q+Y|0,Y)|0)+j+g(Q=Q+D|0,D)|0;var tt=G+V|0,et=K+W+g(tt,G)|0;_=b,O=k,b=a,k=I,a=u,I=T,u=o+Z+g(T=S+Q|0,S)|0,o=i,S=E,i=n,E=v,n=r,v=m,r=Z+et+g(m=Q+tt|0,Q)|0}this._al=this._al+m|0,this._bl=this._bl+v|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+T|0,this._fl=this._fl+I|0,this._gl=this._gl+k|0,this._hl=this._hl+O|0,this._ah=this._ah+r+g(this._al,m)|0,this._bh=this._bh+n+g(this._bl,v)|0,this._ch=this._ch+i+g(this._cl,E)|0,this._dh=this._dh+o+g(this._dl,S)|0,this._eh=this._eh+u+g(this._el,T)|0,this._fh=this._fh+a+g(this._fl,I)|0,this._gh=this._gh+b+g(this._gl,k)|0,this._hh=this._hh+_+g(this._hl,O)|0},a.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}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},e.exports=a},{"./hash":68,inherits:62,"safe-buffer":67}],76:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/lib/_stream_readable.js"),i.Writable=t("readable-stream/lib/_stream_writable.js"),i.Duplex=t("readable-stream/lib/_stream_duplex.js"),i.Transform=t("readable-stream/lib/_stream_transform.js"),i.PassThrough=t("readable-stream/lib/_stream_passthrough.js"),i.finished=t("readable-stream/lib/internal/streams/end-of-stream.js"),i.pipeline=t("readable-stream/lib/internal/streams/pipeline.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",u),r.on("close",a));var s=!1;function u(){s||(s=!0,t.end())}function a(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function f(t){if(c(),0===n.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",u),r.removeListener("close",a),r.removeListener("error",f),t.removeListener("error",f),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",f),t.on("error",f),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:59,inherits:62,"readable-stream/lib/_stream_duplex.js":78,"readable-stream/lib/_stream_passthrough.js":79,"readable-stream/lib/_stream_readable.js":80,"readable-stream/lib/_stream_transform.js":81,"readable-stream/lib/_stream_writable.js":82,"readable-stream/lib/internal/streams/end-of-stream.js":86,"readable-stream/lib/internal/streams/pipeline.js":88}],77:[function(t,e,r){"use strict";var n={};function i(t,e,r){r||(r=Error);var i=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=t,n[t]=i}function o(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(t){return String(t)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(t,e,r){var n,i,s,u;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))u="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var a=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";u='The "'.concat(t,'" ').concat(a," ").concat(n," ").concat(o(e,"type"))}return u+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},{}],78:[function(t,e,r){(function(r){(function(){"use strict";var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=f;var i=t("./_stream_readable"),o=t("./_stream_writable");t("inherits")(f,i);for(var s=n(o.prototype),u=0;u<s.length;u++){var a=s[u];f.prototype[a]||(f.prototype[a]=o.prototype[a])}function f(t){if(!(this instanceof f))return new f(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||r.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(f.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(f.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this)}).call(this,t("_process"))},{"./_stream_readable":80,"./_stream_writable":82,_process:65,inherits:62}],79:[function(t,e,r){"use strict";e.exports=i;var n=t("./_stream_transform");function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}t("inherits")(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},{"./_stream_transform":81,inherits:62}],80:[function(t,e,r){(function(r,n){(function(){"use strict";var i;e.exports=I,I.ReadableState=T;t("events").EventEmitter;var o=function(t,e){return t.listeners(e).length},s=t("./internal/streams/stream"),u=t("buffer").Buffer,a=n.Uint8Array||function(){};var f,c=t("util");f=c&&c.debuglog?c.debuglog("stream"):function(){};var h,l,p,d=t("./internal/streams/buffer_list"),y=t("./internal/streams/destroy"),w=t("./internal/streams/state").getHighWaterMark,g=t("../errors").codes,b=g.ERR_INVALID_ARG_TYPE,_=g.ERR_STREAM_PUSH_AFTER_EOF,m=g.ERR_METHOD_NOT_IMPLEMENTED,v=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t("inherits")(I,s);var E=y.errorOrDestroy,S=["error","close","destroy","pause","resume"];function T(e,r,n){i=i||t("./_stream_duplex"),e=e||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=w(this,e,"readableHighWaterMark",n),this.buffer=new d,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=t("string_decoder/").StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function I(e){if(i=i||t("./_stream_duplex"),!(this instanceof I))return new I(e);var r=this instanceof i;this._readableState=new T(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function k(t,e,r,n,i){f("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(f("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?N(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,U(t)))}(t,s);else if(i||(o=function(t,e){var r;n=e,u.isBuffer(n)||n instanceof a||"string"==typeof e||void 0===e||t.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(s,e)),o)E(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),n)s.endEmitted?E(t,new v):O(t,s,e,!0);else if(s.ended)E(t,new _);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?O(t,s,e,!1):B(t,s)):O(t,s,e,!1)}else n||(s.reading=!1,B(t,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function O(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&N(t)),B(t,e)}Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),I.prototype.destroy=y.destroy,I.prototype._undestroy=y.undestroy,I.prototype._destroy=function(t,e){e(t)},I.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=u.from(t,e),e=""),r=!0),k(this,t,e,!1,r)},I.prototype.unshift=function(t){return k(this,t,null,!0,!1)},I.prototype.isPaused=function(){return!1===this._readableState.flowing},I.prototype.setEncoding=function(e){h||(h=t("string_decoder/").StringDecoder);var r=new h(e);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var P=1073741824;function A(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=P?t=P:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function N(t){var e=t._readableState;f("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(U,t))}function U(t){var e=t._readableState;f("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,H(t)}function B(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(R,t,e))}function R(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(f("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function x(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C(t){f("readable nexttick read 0"),t.read(0)}function L(t,e){f("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),H(t),e.flowing&&!e.reading&&t.read(0)}function H(t){var e=t._readableState;for(f("flow",e.flowing);e.flowing&&null!==t.read(););}function M(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function D(t){var e=t._readableState;f("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(j,e,t))}function j(t,e){if(f("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function F(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}I.prototype.read=function(t){f("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?D(this):N(this),null;if(0===(t=A(t,e))&&e.ended)return 0===e.length&&D(this),null;var n,i=e.needReadable;return f("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&f("length less than watermark",i=!0),e.ended||e.reading?f("reading or ended",i=!1):i&&(f("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=A(r,e))),null===(n=t>0?M(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&D(this)),null!==n&&this.emit("data",n),n},I.prototype._read=function(t){E(this,new m("_read()"))},I.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,e);var s=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?a:w;function u(e,r){f("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,f("cleanup"),t.removeListener("close",d),t.removeListener("finish",y),t.removeListener("drain",c),t.removeListener("error",p),t.removeListener("unpipe",u),n.removeListener("end",a),n.removeListener("end",w),n.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}function a(){f("onend"),t.end()}i.endEmitted?r.nextTick(s):n.once("end",s),t.on("unpipe",u);var c=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,H(t))}}(n);t.on("drain",c);var h=!1;function l(e){f("ondata");var r=t.write(e);f("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!h&&(f("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function p(e){f("onerror",e),w(),t.removeListener("error",p),0===o(t,"error")&&E(t,e)}function d(){t.removeListener("finish",y),w()}function y(){f("onfinish"),t.removeListener("close",d),w()}function w(){f("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",p),t.once("close",d),t.once("finish",y),t.emit("pipe",n),i.flowing||(f("pipe resume"),n.resume()),t},I.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=F(e.pipes,t);return-1===s?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)},I.prototype.on=function(t,e){var n=s.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,f("on readable",i.length,i.reading),i.length?N(this):i.reading||r.nextTick(C,this))),n},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(t,e){var n=s.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(x,this),n},I.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(x,this),e},I.prototype.resume=function(){var t=this._readableState;return t.flowing||(f("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(L,t,e))}(this,t)),t.paused=!1,this},I.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(f("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(f("wrapped data"),r.decoder&&(i=r.decoder.write(i)),!r.objectMode||null!==i&&void 0!==i)&&((r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause())))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<S.length;o++)t.on(S[o],this.emit.bind(this,S[o]));return this._read=function(e){f("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(I.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=t("./internal/streams/async_iterator")),l(this)}),Object.defineProperty(I.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(I.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(I.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),I._fromList=M,Object.defineProperty(I.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(I.from=function(e,r){return void 0===p&&(p=t("./internal/streams/from")),p(I,e,r)})}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":77,"./_stream_duplex":78,"./internal/streams/async_iterator":83,"./internal/streams/buffer_list":84,"./internal/streams/destroy":85,"./internal/streams/from":87,"./internal/streams/state":89,"./internal/streams/stream":90,_process:65,buffer:56,events:59,inherits:62,"string_decoder/":91,util:52}],81:[function(t,e,r){"use strict";e.exports=f;var n=t("../errors").codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,u=n.ERR_TRANSFORM_WITH_LENGTH_0,a=t("./_stream_duplex");function f(t){if(!(this instanceof f))return new f(t);a.call(this,t),this._transformState={afterTransform:function(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",c)}function c(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush(function(e,r){h(t,e,r)})}function h(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new u;if(t._transformState.transforming)throw new s;return t.push(null)}t("inherits")(f,a),f.prototype.push=function(t,e){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,e)},f.prototype._transform=function(t,e,r){r(new i("_transform()"))},f.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},f.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},f.prototype._destroy=function(t,e){a.prototype._destroy.call(this,t,function(t){e(t)})}},{"../errors":77,"./_stream_duplex":78,inherits:62}],82:[function(t,e,r){(function(r,n){(function(){"use strict";function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var o;e.exports=I,I.WritableState=T;var s={deprecate:t("util-deprecate")},u=t("./internal/streams/stream"),a=t("buffer").Buffer,f=n.Uint8Array||function(){};var c,h=t("./internal/streams/destroy"),l=t("./internal/streams/state").getHighWaterMark,p=t("../errors").codes,d=p.ERR_INVALID_ARG_TYPE,y=p.ERR_METHOD_NOT_IMPLEMENTED,w=p.ERR_MULTIPLE_CALLBACK,g=p.ERR_STREAM_CANNOT_PIPE,b=p.ERR_STREAM_DESTROYED,_=p.ERR_STREAM_NULL_VALUES,m=p.ERR_STREAM_WRITE_AFTER_END,v=p.ERR_UNKNOWN_ENCODING,E=h.errorOrDestroy;function S(){}function T(e,n,s){o=o||t("./_stream_duplex"),e=e||{},"boolean"!=typeof s&&(s=n instanceof o),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var u=!1===e.decodeStrings;this.decodeStrings=!u,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new w;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(U,t,e),t._writableState.errorEmitted=!0,E(t,i)):(o(i),t._writableState.errorEmitted=!0,E(t,i),U(t,e))}(t,n,i,e,o);else{var s=A(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||P(t,n),i?r.nextTick(O,t,n,s,o):O(t,n,s,o)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function I(e){var r=this instanceof(o=o||t("./_stream_duplex"));if(!r&&!c.call(I,this))return new I(e);this._writableState=new T(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function k(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new b("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function O(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),U(t,e)}function P(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,o=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var u=0,a=!0;r;)o[u]=r,r.isBuf||(a=!1),r=r.next,u+=1;o.allBuffers=a,k(t,e,!0,e.length,o,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,h=r.callback;if(k(t,e,!1,e.objectMode?1:f.length,f,c,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function A(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function N(t,e){t._final(function(r){e.pendingcb--,r&&E(t,r),e.prefinished=!0,t.emit("prefinish"),U(t,e)})}function U(t,e){var n=A(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(N,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}t("inherits")(I,u),T.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(T.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===I&&(t&&t._writableState instanceof T)}})):c=function(t){return t instanceof this},I.prototype.pipe=function(){E(this,new g)},I.prototype.write=function(t,e,n){var i,o=this._writableState,s=!1,u=!o.objectMode&&(i=t,a.isBuffer(i)||i instanceof f);return u&&!a.isBuffer(t)&&(t=function(t){return a.from(t)}(t)),"function"==typeof e&&(n=e,e=null),u?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=S),o.ending?function(t,e){var n=new m;E(t,n),r.nextTick(e,n)}(this,n):(u||function(t,e,n,i){var o;return null===n?o=new _:"string"==typeof n||e.objectMode||(o=new d("chunk",["string","Buffer"],n)),!o||(E(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var u=e.objectMode?1:n.length;e.length+=u;var f=e.length<e.highWaterMark;f||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else k(t,e,!1,u,n,i,o);return f}(this,o,u,t,e,n)),s},I.prototype.cork=function(){this._writableState.corked++},I.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||P(this,t))},I.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function(t,e,r){r(new y("_write()"))},I.prototype._writev=null,I.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,U(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=h.destroy,I.prototype._undestroy=h.undestroy,I.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":77,"./_stream_duplex":78,"./internal/streams/destroy":85,"./internal/streams/state":89,"./internal/streams/stream":90,_process:65,buffer:56,inherits:62,"util-deprecate":96}],83:[function(t,e,r){(function(r){(function(){"use strict";var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("./end-of-stream"),s=Symbol("lastResolve"),u=Symbol("lastReject"),a=Symbol("error"),f=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function p(t,e){return{value:t,done:e}}function d(t){var e=t[s];if(null!==e){var r=t[l].read();null!==r&&(t[c]=null,t[s]=null,t[u]=null,e(p(r,!1)))}}var y=Object.getPrototypeOf(function(){}),w=Object.setPrototypeOf((i(n={get stream(){return this[l]},next:function(){var t=this,e=this[a];if(null!==e)return Promise.reject(e);if(this[f])return Promise.resolve(p(void 0,!0));if(this[l].destroyed)return new Promise(function(e,n){r.nextTick(function(){t[a]?n(t[a]):e(p(void 0,!0))})});var n,i=this[c];if(i)n=new Promise(function(t,e){return function(r,n){t.then(function(){e[f]?r(p(void 0,!0)):e[h](r,n)},n)}}(i,this));else{var o=this[l].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[h])}return this[c]=n,n}},Symbol.asyncIterator,function(){return this}),i(n,"return",function(){var t=this;return new Promise(function(e,r){t[l].destroy(null,function(t){t?r(t):e(p(void 0,!0))})})}),n),y);e.exports=function(t){var e,n=Object.create(w,(i(e={},l,{value:t,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,f,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var r=n[l].read();r?(n[c]=null,n[s]=null,n[u]=null,t(p(r,!1))):(n[s]=t,n[u]=e)},writable:!0}),e));return n[c]=null,o(t,function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[u];return null!==e&&(n[c]=null,n[s]=null,n[u]=null,e(t)),void(n[a]=t)}var r=n[s];null!==r&&(n[c]=null,n[s]=null,n[u]=null,r(p(void 0,!0))),n[f]=!0}),t.on("readable",function(t){r.nextTick(d,t)}.bind(null,n)),n}}).call(this)}).call(this,t("_process"))},{"./end-of-stream":86,_process:65}],84:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=t("buffer").Buffer,u=t("util").inspect,a=u&&u.custom||"inspect";e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,f;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,u=0;o;)e=o.data,r=i,n=u,s.prototype.copy.call(e,r,n),u+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0===(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0===(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:a,value:function(t,e){return u(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),f&&o(e,f),t}()},{buffer:56,util:52}],85:[function(t,e,r){(function(t){(function(){"use strict";function r(t,e){i(t,e),n(t)}function n(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}e.exports={destroy:function(e,o){var s=this,u=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return u||a?(o?o(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(i,this,e)):t.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!o&&e?s._writableState?s._writableState.errorEmitted?t.nextTick(n,s):(s._writableState.errorEmitted=!0,t.nextTick(r,s,e)):t.nextTick(r,s,e):o?(t.nextTick(n,s),o(e)):t.nextTick(n,s)}),this)},undestroy:function(){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.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this)}).call(this,t("_process"))},{_process:65}],86:[function(t,e,r){"use strict";var n=t("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,u=r.writable||!1!==r.writable&&e.writable,a=function(){e.writable||c()},f=e._writableState&&e._writableState.finished,c=function(){u=!1,f=!0,s||o.call(e)},h=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,h=!0,u||o.call(e)},p=function(t){o.call(e,t)},d=function(){var t;return s&&!h?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):u&&!f?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},y=function(){e.req.on("finish",c)};return function(t){return t.setHeader&&"function"==typeof t.abort}(e)?(e.on("complete",c),e.on("abort",d),e.req?y():e.on("request",y)):u&&!e._writableState&&(e.on("end",a),e.on("close",a)),e.on("end",l),e.on("finish",c),!1!==r.error&&e.on("error",p),e.on("close",d),function(){e.removeListener("complete",c),e.removeListener("abort",d),e.removeListener("request",y),e.req&&e.req.removeListener("finish",c),e.removeListener("end",a),e.removeListener("close",a),e.removeListener("finish",c),e.removeListener("end",l),e.removeListener("error",p),e.removeListener("close",d)}}},{"../../../errors":77}],87:[function(t,e,r){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],88:[function(t,e,r){"use strict";var n;var i=t("../../../errors").codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function u(t){if(t)throw t}function a(t){t()}function f(t,e){return t.pipe(e)}e.exports=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var c,h=function(t){return t.length?"function"!=typeof t[t.length-1]?u:t.pop():u}(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new o("streams");var l=r.map(function(e,i){var o=i<r.length-1;return function(e,r,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var u=!1;e.on("close",function(){u=!0}),void 0===n&&(n=t("./end-of-stream")),n(e,{readable:r,writable:i},function(t){if(t)return o(t);u=!0,o()});var a=!1;return function(t){if(!u&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}(e,o,i>0,function(t){c||(c=t),t&&l.forEach(a),o||(l.forEach(a),h(c))})});return r.reduce(f)}},{"../../../errors":77,"./end-of-stream":86}],89:[function(t,e,r){"use strict";var n=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(t,e,r,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},{"../../../errors":77}],90:[function(t,e,r){e.exports=t("events").EventEmitter},{events:59}],91:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=a,this.end=f,e=4;break;case"utf8":this.fillLast=u,e=4;break;case"base64":this.text=c,this.end=h,e=3;break;default:return this.write=l,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function u(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"<22>";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"<22>";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"<22>"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function a(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}r.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"<22>":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=s(e[n]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":67}],92:[function(t,e,r){var n=t("./native");function i(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function o(t){return n.Nil(t)?"":i(t.constructor)}function s(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function u(t){return n.Function(t)?t.toJSON?t.toJSON():i(t):n.Array(t)?"Array":t&&n.Object(t)?"Object":void 0!==t?t:""}function a(t,e,r){var i=function(t){return n.Function(t)?"":n.String(t)?JSON.stringify(t):t&&n.Object(t)?"":t}(e);return"Expected "+u(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function f(t,e,r){r=r||o(e),this.message=a(t,e,r),s(this,f),this.__type=t,this.__value=e,this.__valueTypeName=r}function c(t,e,r,n,i){t?(i=i||o(n),this.message=function(t,e,r,n,i){var o='" of type ';return"key"===e&&(o='" with key type '),a('property "'+u(r)+o+u(t),n,i)}(t,r,e,n,i)):this.message='Unexpected property "'+e+'"',s(this,f),this.__label=r,this.__property=e,this.__type=t,this.__value=n,this.__valueTypeName=i}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,c.prototype=Object.create(Error.prototype),c.prototype.constructor=f,e.exports={TfTypeError:f,TfPropertyTypeError:c,tfCustomError:function(t,e){return new f(t,{},e)},tfSubError:function(t,e,r){return t instanceof c?(e=e+"."+t.__property,t=new c(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof f&&(t=new c(t.__type,e,r,t.__value,t.__valueTypeName)),s(t),t},tfJSON:u,getValueTypeName:o}},{"./native":95}],93:[function(t,e,r){(function(r){(function(){var n=t("./native"),i=t("./errors");function o(t){return r.isBuffer(t)}function s(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function u(t,e){var r=t.toJSON();function n(n){if(!t(n))return!1;if(n.length===e)return!0;throw i.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var a=u.bind(null,n.Array),f=u.bind(null,o),c=u.bind(null,s),h=u.bind(null,n.String);var l=Math.pow(2,53)-1;var p={ArrayN:a,Buffer:o,BufferN:f,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:s,HexN:c,Int8:function(t){return t<<24>>24===t},Int16:function(t){return t<<16>>16===t},Int32:function(t){return(0|t)===t},Int53:function(t){return"number"==typeof t&&t>=-l&&t<=l&&Math.floor(t)===t},Range:function(t,e,r){function i(n,i){return r(n,i)&&n>t&&n<e}return r=r||n.Number,i.toJSON=function(){return`${r.toJSON()} between [${t}, ${e}]`},i},StringN:h,UInt8:function(t){return(255&t)===t},UInt16:function(t){return(65535&t)===t},UInt32:function(t){return t>>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=l&&Math.floor(t)===t}};for(var d in p)p[d].toJSON=function(t){return t}.bind(null,d);e.exports=p}).call(this)}).call(this,{isBuffer:t("../is-buffer/index.js")})},{"../is-buffer/index.js":63,"./errors":92,"./native":95}],94:[function(t,e,r){var n=t("./errors"),i=t("./native"),o=n.tfJSON,s=n.TfTypeError,u=n.TfPropertyTypeError,a=n.tfSubError,f=n.getValueTypeName,c={arrayOf:function(t,e){function r(r,n){return!!i.Array(r)&&(!i.Nil(r)&&(!(void 0!==e.minLength&&r.length<e.minLength)&&(!(void 0!==e.maxLength&&r.length>e.maxLength)&&((void 0===e.length||r.length===e.length)&&r.every(function(e,r){try{return l(t,e,n)}catch(t){throw a(t,r)}})))))}return t=h(t),e=e||{},r.toJSON=function(){var r="["+o(t)+"]";return void 0!==e.length?r+="{"+e.length+"}":void 0===e.minLength&&void 0===e.maxLength||(r+="{"+(void 0===e.minLength?0:e.minLength)+","+(void 0===e.maxLength?1/0:e.maxLength)+"}"),r},r},maybe:function t(e){function r(r,n){return i.Nil(r)||e(r,n,t)}return e=h(e),r.toJSON=function(){return"?"+o(e)},r},map:function(t,e){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var o in r){try{e&&l(e,o,n)}catch(t){throw a(t,o,"key")}try{var s=r[o];l(t,s,n)}catch(t){throw a(t,o)}}return!0}return t=h(t),e&&(e=h(e)),r.toJSON=e?function(){return"{"+o(e)+": "+o(t)+"}"}:function(){return"{"+o(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=h(t[r]);function n(t,r){if(!i.Object(t))return!1;if(i.Nil(t))return!1;var n;try{for(n in e){l(e[n],t[n],r)}}catch(t){throw a(t,n)}if(r)for(n in t)if(!e[n])throw new u(void 0,n);return!0}return n.toJSON=function(){return o(e)},n},anyOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.some(function(t){try{return l(t,e,r)}catch(t){return!1}})}return e.toJSON=function(){return t.map(o).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return t.every(function(t){try{return l(t,e,r)}catch(t){return!1}})}return e.toJSON=function(){return t.map(o).join(" & ")},e},quacksLike:function(t){function e(e){return t===f(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(h);function e(e,r){return!i.Nil(e)&&(!i.Nil(e.length)&&((!r||e.length===t.length)&&t.every(function(t,n){try{return l(t,e[n],r)}catch(t){throw a(t,n)}})))}return e.toJSON=function(){return"("+t.map(o).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function h(t){if(i.String(t))return"?"===t[0]?c.maybe(t.slice(1)):i[t]||c.quacksLike(t);if(t&&i.Object(t)){if(i.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(t[0])}return c.object(t)}return i.Function(t)?t:c.value(t)}function l(t,e,r,n){if(i.Function(t)){if(t(e,r))return!0;throw new s(n||t,e)}return l(h(t),e,r)}for(var p in c.oneOf=c.anyOf,i)l[p]=i[p];for(p in c)l[p]=c[p];var d=t("./extra");for(p in d)l[p]=d[p];l.compile=h,l.TfTypeError=s,l.TfPropertyTypeError=u,e.exports=l},{"./errors":92,"./extra":93,"./native":95}],95:[function(t,e,r){var n={Array:function(t){return null!==t&&void 0!==t&&t.constructor===Array},Boolean:function(t){return"boolean"==typeof t},Function:function(t){return"function"==typeof t},Nil:function(t){return void 0===t||null===t},Number:function(t){return"number"==typeof t},Object:function(t){return"object"==typeof t},String:function(t){return"string"==typeof t},"":function(){return!0}};for(var i in n.Null=n.Nil,n)n[i].toJSON=function(t){return t}.bind(null,i);e.exports=n},{}],96:[function(t,e,r){(function(t){(function(){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],97:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=9007199254740991;function o(t){if(t<0||t>i||t%1!=0)throw new RangeError("value out of range")}function s(t){return o(t),t<253?1:t<=65535?3:t<=4294967295?5:9}e.exports={encode:function t(e,r,i){if(o(e),r||(r=n.allocUnsafe(s(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),e<253?(r.writeUInt8(e,i),t.bytes=1):e<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(e,i+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(e,i+1),t.bytes=5):(r.writeUInt8(255,i),r.writeUInt32LE(e>>>0,i+1),r.writeUInt32LE(e/4294967296|0,i+5),t.bytes=9),r},decode:function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var i=e.readUInt8(r);if(i<253)return t.bytes=1,i;if(253===i)return t.bytes=3,e.readUInt16LE(r+1);if(254===i)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var s=e.readUInt32LE(r+1),u=4294967296*e.readUInt32LE(r+5)+s;return o(u),u},encodingLength:s}},{"safe-buffer":67}],"/":[function(t,e,r){var n=t("bitcoinjs-lib");n.Buffer=t("safe-buffer").Buffer,e.exports=n},{"bitcoinjs-lib":32,"safe-buffer":67}]},{},[])("/")});