diff --git a/curation/registry-starter b/curation/registry-starter new file mode 160000 index 0000000..5d8f8a2 --- /dev/null +++ b/curation/registry-starter @@ -0,0 +1 @@ +Subproject commit 5d8f8a215eb71600f36c8d3cfd8bf4283d45d072 diff --git a/frontend/dist/css/ArtistPage.02cc352e.css b/frontend/dist/css/ArtistPage.02cc352e.css new file mode 100644 index 0000000..51480af --- /dev/null +++ b/frontend/dist/css/ArtistPage.02cc352e.css @@ -0,0 +1 @@ +.btn-cancel[data-v-6be94cbe]{border:1px solid grey}.col1[data-v-6be94cbe]{float:left}.col2[data-v-6be94cbe]{float:right}#currency-amount[data-v-6be94cbe]{text-align:left;font-weight:550;margin:10px 0 20px 0;border-radius:1px;font-size:18px;padding:15px 20px;background-color:#e3e5e8;border:1px solid #000}.modal-mask[data-v-6be94cbe]{position:fixed;z-index:9998;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.5);display:table;-webkit-transition:opacity .3s ease;transition:opacity .3s ease}.modal-wrapper[data-v-6be94cbe]{display:table-cell;vertical-align:middle}.modal-container[data-v-6be94cbe]{position:relative;width:350px;margin:0 auto;padding:20px 30px;background-color:#fff;border-radius:2px;-webkit-box-shadow:0 2px 8px rgba(0,0,0,.33);box-shadow:0 2px 8px rgba(0,0,0,.33);-webkit-transition:all .3s ease;transition:all .3s ease;font-family:Helvetica,Arial,sans-serif}.modal-header h3[data-v-6be94cbe]{margin-top:0;color:#42b983}.modal-body[data-v-6be94cbe]{position:relative;margin:0 0 20px 0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:distribute;justify-content:space-around;line-height:300%}.close-modal[data-v-6be94cbe]{position:absolute;bottom:15px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);height:25px;cursor:pointer}#left-column[data-v-6be94cbe]{width:50%;float:left;text-align:left}#right-column[data-v-6be94cbe]{width:50%;float:right;text-align:right}.btn-cancel[data-v-231b042c]{border:1px solid grey}.col1[data-v-231b042c]{float:left}.col2[data-v-231b042c]{float:right}.modal-mask[data-v-231b042c]{position:fixed;z-index:9998;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.5);display:table;-webkit-transition:opacity .3s ease;transition:opacity .3s ease}.modal-wrapper[data-v-231b042c]{display:table-cell;vertical-align:middle}.modal-container[data-v-231b042c]{position:relative;width:350px;margin:0 auto;padding:20px 30px;background-color:#fff;border-radius:2px;-webkit-box-shadow:0 2px 8px rgba(0,0,0,.33);box-shadow:0 2px 8px rgba(0,0,0,.33);-webkit-transition:all .3s ease;transition:all .3s ease;font-family:Helvetica,Arial,sans-serif}.modal-header h3[data-v-231b042c]{margin-top:0;color:#42b983}.modal-body[data-v-231b042c]{position:relative;margin:0 0 20px 0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:distribute;justify-content:space-around;line-height:300%}.close-modal[data-v-231b042c]{position:absolute;bottom:15px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);height:25px;cursor:pointer}#left-column[data-v-231b042c]{width:50%;float:left;text-align:left}#right-column[data-v-231b042c]{width:50%;float:right;text-align:right}#pause[data-v-0fc7ea69],#play[data-v-0fc7ea69]{position:relative;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}#album-container[data-v-0fc7ea69]{position:relative;width:100%;border-radius:10px}#albumArt[data-v-0fc7ea69]{width:100%;border-radius:10px}#pause[data-v-0fc7ea69],#play[data-v-0fc7ea69]{position:absolute;height:50px;padding:150px}.btn-cancel[data-v-0fc7ea69]{border:1px solid grey}.modal-mask[data-v-0fc7ea69]{position:fixed;z-index:9998;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.5);display:table;-webkit-transition:opacity .3s ease;transition:opacity .3s ease}.modal-wrapper[data-v-0fc7ea69]{display:table-cell;vertical-align:middle}.modal-container[data-v-0fc7ea69]{position:relative;width:350px;margin:0 auto;padding:20px 30px;background-color:#fff;border-radius:2px;-webkit-box-shadow:0 2px 8px rgba(0,0,0,.33);box-shadow:0 2px 8px rgba(0,0,0,.33);-webkit-transition:all .3s ease;transition:all .3s ease;font-family:Helvetica,Arial,sans-serif}.modal-header h3[data-v-0fc7ea69]{margin-top:0;color:#42b983}.modal-body[data-v-0fc7ea69]{position:relative;margin:0 0 20px 0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:distribute;justify-content:space-around;line-height:300%}.close-modal[data-v-0fc7ea69]{position:absolute;bottom:15px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);height:25px;cursor:pointer}#locked-content[data-v-662da522],.card[data-v-662da522],.card p[data-v-662da522]{position:relative;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}#locked[data-v-662da522]{height:600px;border-radius:20px;color:#fff;font-family:Syne;background:linear-gradient(224.38deg,#000 1.05%,#537466);background-size:400% 400%;-webkit-animation:gradientRotate-data-v-662da522 6s linear infinite;animation:gradientRotate-data-v-662da522 6s linear infinite}#locked-content[data-v-662da522]{line-height:200%;font-size:24px}#prizes[data-v-662da522]{position:relative;margin:auto;max-width:1130px;margin-top:50px}#unlocked-grid[data-v-662da522]{position:absolute;top:100px;left:0;width:1130px;margin:auto;display:grid;grid-gap:1rem;-webkit-transition:1.5s;transition:1.5s;z-index:-50}.card[data-v-662da522]{cursor:pointer;color:#1d1f20;padding:1rem;font-family:Syne;font-size:24px;color:#fff;height:250px;border-radius:10px;border:1px solid #1d1f20;background:radial-gradient(114.92% 114.92% at 50% -14.92%,rgba(6,0,251,.76) 25%,#a624bd 50.14%,#db4d7f 74.96%,rgba(255,191,0,.96) 100%)}@-webkit-keyframes gradientRotate-data-v-662da522{0%{background-position:0 74%}50%{background-position:100% 27%}to{background-position:0 74%}}@keyframes gradientRotate-data-v-662da522{0%{background-position:0 74%}50%{background-position:100% 27%}to{background-position:0 74%}}[data-v-2fa309b2]{margin:5px;color:#1d1f20}#artist-name[data-v-2fa309b2]{font-size:48px}#verified p[data-v-2fa309b2]{display:inline;opacity:.4;font-size:18px}#verified img[data-v-2fa309b2]{-webkit-transform:translateY(6px);transform:translateY(6px);margin-right:10px;opacity:1}.tokenOwnership[data-v-2fa309b2]{float:right;padding:15px 20px;border-radius:5px;background:hsla(0,0%,82.7%,.1);-webkit-transform:translate(10px,-75px);transform:translate(10px,-75px)}.dontOwn[data-v-2fa309b2]{border:1px solid rgba(0,0,0,.5);opacity:.3}.own[data-v-2fa309b2]{border:1px solid #26a200;opacity:1;color:#26a200}#artist-title[data-v-2fa309b2]{font-family:syne;text-align:left;margin:auto;margin-top:24px;max-width:1130px}.btn p{position:relative;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.btn{transition:all .4s ease;-webkit-transition:all .4s ease;-moz-transition:all .4s ease}.btn:hover{opacity:.5;cursor:pointer}*{margin:0}h1{color:rgba(29,31,32,.72);font-size:44px;font-family:UltraSystem;margin:10px 0 0 10px}h2{font-family:Syne;width:100%;text-align:left;margin:25px 0 15px 0;padding-bottom:20px;border-bottom:1px solid #fff}h5{color:#1d1f20;opacity:.45;font-size:16px;margin:20px 0 10px 10px;font-variant:small-caps}ul{margin-top:15px;line-height:120%}li{margin-bottom:20px;opacity:.9}.shrink-top{margin-top:-20px}#artist-page{max-width:80%;margin:auto}#artist-img{width:100%;height:200px;border-radius:5px;-o-object-fit:cover;object-fit:cover}#artist-card{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:20px;width:460px;height:560px;border:1px solid #000;border-radius:10px;background:#1d1f20;margin:20px;color:#fff;text-align:left}.modal{position:absolute;top:0;left:0}#curve-card{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;width:591px;height:600px;border:1px solid rgba(0,0,0,.5);border-radius:10px;background:transparent;margin:20px;color:#fff;text-align:left;-webkit-clip-path:inset(0 0 0 0);clip-path:inset(0 0 0 0)}#graph-section{-webkit-box-flex:1;-ms-flex:1;flex:1}.graph{left:0}.graph-lines{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.numbers{height:40px;-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.btn{width:250px;height:60px;-webkit-box-shadow:0 8px 12px rgba(0,0,0,.1);box-shadow:0 8px 12px rgba(0,0,0,.1);border-radius:5px;text-align:center;margin:20px 10px 0 10px}.btn p{color:#fff}#offers{padding-left:20px}#card-titles,#primary{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:80%;margin:auto}#card-titles{max-width:1130px}#trade-section{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:210px;padding:0 20px 20px 20px}#trade-buttons{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;bottom:25px}#price-and-token,#trade-buttons{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}#token-number{display:inline-block;-webkit-transform:translate(25%);transform:translate(25%)} \ No newline at end of file diff --git a/frontend/dist/css/app.d4953d5e.css b/frontend/dist/css/app.d4953d5e.css new file mode 100644 index 0000000..5e2d697 --- /dev/null +++ b/frontend/dist/css/app.d4953d5e.css @@ -0,0 +1 @@ +#wallet{transition:all .4s ease;-webkit-transition:all .4s ease;-moz-transition:all .4s ease}#wallet:hover{opacity:.5;cursor:pointer}.dot{width:6px;height:6px;border-radius:50px;margin-right:3px}.green{background:-webkit-gradient(linear,left top,left bottom,from(#398557),to(#33c16b));background:linear-gradient(180deg,#398557,#33c16b)}.red{background:-webkit-gradient(linear,left top,left bottom,from(#d34f6b),to(#d16969));background:linear-gradient(180deg,#d34f6b,#d16969)}#wallet{width:143px;height:34px;background:#e3e5e8;border-radius:4px;margin-right:30px;padding:4px 8px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wallet p{color:#1d1f20;opacity:.6;margin-left:5px}#logo{transition:all .4s ease;-webkit-transition:all .4s ease;-moz-transition:all .4s ease}#logo:hover{opacity:.5;cursor:pointer}#logo{margin-left:20px;font-weight:700}#navbar{width:100%;height:65px;position:absolute;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-bottom:1px solid rgba(0,0,0,.5)}#navbar a{text-decoration:none}#navbar.router-link-exact-active{color:#42b983}@font-face{font-family:UltraSystem;src:url(../fonts/ultra-system.34e817f5.ttf)}@font-face{font-family:Syne;src:url(../fonts/Syne-Bold.327a2544.ttf)}@font-face{font-family:SF;src:url(../fonts/SF-Regular.404e4373.otf)}#app{font-family:SF,Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}h3{font-family:Syne;font-size:32px;text-align:left;margin-bottom:16px}#content{padding-top:80px!important}.card[data-v-73b6502a]{transition:all .4s ease;-webkit-transition:all .4s ease;-moz-transition:all .4s ease}.card[data-v-73b6502a]:hover{opacity:.5;cursor:pointer}p[data-v-73b6502a]{margin:0}.home[data-v-73b6502a]{font-size:22px}.card[data-v-73b6502a]{background-color:#1d1f20;color:#fff;padding:1rem;height:250px;border-radius:5px}.card p[data-v-73b6502a]{margin-top:15px}#card-grid[data-v-73b6502a]{max-width:1200px;margin:auto;display:grid;grid-gap:1rem;-webkit-transition:1.5s;transition:1.5s}@media (min-width:600px){#card-grid[data-v-73b6502a]{grid-template-columns:repeat(2,1fr)}}@media (min-width:900px){#card-grid[data-v-73b6502a]{grid-template-columns:repeat(3,1fr)}} \ No newline at end of file diff --git a/frontend/dist/favicon.ico b/frontend/dist/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/frontend/dist/favicon.ico differ diff --git a/frontend/dist/fonts/SF-Regular.404e4373.otf b/frontend/dist/fonts/SF-Regular.404e4373.otf new file mode 100644 index 0000000..65f9ea5 Binary files /dev/null and b/frontend/dist/fonts/SF-Regular.404e4373.otf differ diff --git a/frontend/dist/fonts/Syne-Bold.327a2544.ttf b/frontend/dist/fonts/Syne-Bold.327a2544.ttf new file mode 100644 index 0000000..295817a Binary files /dev/null and b/frontend/dist/fonts/Syne-Bold.327a2544.ttf differ diff --git a/frontend/dist/fonts/ultra-system.34e817f5.ttf b/frontend/dist/fonts/ultra-system.34e817f5.ttf new file mode 100644 index 0000000..0e0b00c Binary files /dev/null and b/frontend/dist/fonts/ultra-system.34e817f5.ttf differ diff --git a/frontend/dist/img/KaytranadaAlbumArt.0860b12e.jpg b/frontend/dist/img/KaytranadaAlbumArt.0860b12e.jpg new file mode 100644 index 0000000..ccb3d3b Binary files /dev/null and b/frontend/dist/img/KaytranadaAlbumArt.0860b12e.jpg differ diff --git a/frontend/dist/img/boundLogo.62253b94.svg b/frontend/dist/img/boundLogo.62253b94.svg new file mode 100644 index 0000000..77e57d1 --- /dev/null +++ b/frontend/dist/img/boundLogo.62253b94.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/dist/img/graph.e9fcdd63.svg b/frontend/dist/img/graph.e9fcdd63.svg new file mode 100644 index 0000000..fc0a3bd --- /dev/null +++ b/frontend/dist/img/graph.e9fcdd63.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/dist/img/lock.7aee2123.svg b/frontend/dist/img/lock.7aee2123.svg new file mode 100644 index 0000000..0c9c8fe --- /dev/null +++ b/frontend/dist/img/lock.7aee2123.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/dist/img/pauseIcon.fe9c0941.svg b/frontend/dist/img/pauseIcon.fe9c0941.svg new file mode 100644 index 0000000..95a35e1 --- /dev/null +++ b/frontend/dist/img/pauseIcon.fe9c0941.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/dist/img/playIcon.1fc9ea3d.svg b/frontend/dist/img/playIcon.1fc9ea3d.svg new file mode 100644 index 0000000..3c71f9c --- /dev/null +++ b/frontend/dist/img/playIcon.1fc9ea3d.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/dist/img/tokenNumber.00b0ca2c.svg b/frontend/dist/img/tokenNumber.00b0ca2c.svg new file mode 100644 index 0000000..f73348b --- /dev/null +++ b/frontend/dist/img/tokenNumber.00b0ca2c.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/dist/img/verfied.815c6157.svg b/frontend/dist/img/verfied.815c6157.svg new file mode 100644 index 0000000..8bb728a --- /dev/null +++ b/frontend/dist/img/verfied.815c6157.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/dist/index.html b/frontend/dist/index.html new file mode 100644 index 0000000..68d0240 --- /dev/null +++ b/frontend/dist/index.html @@ -0,0 +1 @@ +bound
\ No newline at end of file diff --git a/frontend/dist/js/ArtistPage.cc88fd13.js b/frontend/dist/js/ArtistPage.cc88fd13.js new file mode 100644 index 0000000..800cdc1 --- /dev/null +++ b/frontend/dist/js/ArtistPage.cc88fd13.js @@ -0,0 +1,164 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["ArtistPage"],{"000a":function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},"005a":function(e,t,r){"use strict";const n=r("218a"),i=r("33fc"),s=r("d3fa");e.exports=function(e){return function(t,r){return i(n.source(e._getAsyncIterator(t,r)),s(e=>(e.content&&(e.content=n.source(e.content())),e)))}}},"0085":function(e,t,r){"use strict";function n(e){return e}var i=r("64f1");e.exports=function(e){return e?(e=i(e),function(t){return function(r,n){t(r,(function(r,i){try{i=r?null:e(i)}catch(s){return t(s,(function(){return n(s)}))}n(r,i)}))}}):n}},"009e":function(e,t,r){"use strict";const n=r("fa4d"),i=r("2644"),s=r("f0e1");e.exports=e=>{const t=s(e);return n((e,r)=>{"function"===typeof e&&(r=e,e={});const n=(e,t)=>{t(null,e.map(e=>({ref:e.Ref,err:e.Err})))},s={path:"refs/local",qs:e};t(s,(e,t)=>{if(e)return r(e);i(t,n,r)})})}},"00c9":function(e,t,r){"use strict";e.exports=function(e){return e=e||Math.random,function(t,r){return t?r&&r(t):r(null,e())}}},"00d8":function(e,t,r){"use strict";var n=r("da3e"),i=r("3fb5");function s(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"===typeof e)if(t){if("hex"===t)for(e=e.replace(/[^a-z0-9]+/gi,""),e.length%2!==0&&(e="0"+e),n=0;n>8,o=255&i;s?r.push(s,o):r.push(o)}else for(n=0;n>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function c(e,t){for(var r="",n=0;n>>0}return o}function f(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r}function d(e,t){return e>>>t|e<<32-t}function p(e,t){return e<>>32-t}function y(e,t){return e+t>>>0}function g(e,t,r){return e+t+r>>>0}function m(e,t,r,n){return e+t+r+n>>>0}function b(e,t,r,n,i){return e+t+r+n+i>>>0}function v(e,t,r,n){var i=e[t],s=e[t+1],o=n+s>>>0,a=(o>>0,e[t+1]=o}function w(e,t,r,n){var i=t+n>>>0,s=(i>>0}function _(e,t,r,n){var i=t+n;return i>>>0}function E(e,t,r,n,i,s,o,a){var c=0,u=t;u=u+n>>>0,c+=u>>0,c+=u>>0,c+=u>>0}function S(e,t,r,n,i,s,o,a){var c=t+n+s+a;return c>>>0}function k(e,t,r,n,i,s,o,a,c,u){var l=0,h=t;h=h+n>>>0,l+=h>>0,l+=h>>0,l+=h>>0,l+=h>>0}function C(e,t,r,n,i,s,o,a,c,u){var l=t+n+s+a+u;return l>>>0}function A(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}function I(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}function T(e,t,r){return e>>>r}function x(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}t.inherits=i,t.toArray=s,t.toHex=o,t.htonl=a,t.toHex32=c,t.zero2=u,t.zero8=l,t.join32=h,t.split32=f,t.rotr32=d,t.rotl32=p,t.sum32=y,t.sum32_3=g,t.sum32_4=m,t.sum32_5=b,t.sum64=v,t.sum64_hi=w,t.sum64_lo=_,t.sum64_4_hi=E,t.sum64_4_lo=S,t.sum64_5_hi=k,t.sum64_5_lo=C,t.rotr64_hi=A,t.rotr64_lo=I,t.shr64_hi=T,t.shr64_lo=x},"0109":function(e,t,r){"use strict";var n=r("ffb2");const i="networks/5.0.0-beta.135";r.d(t,"a",(function(){return f}));const s=new n["Logger"](i);function o(e){return function(t,r){null==r&&(r={});const n=[];if(t.InfuraProvider)try{n.push(new t.InfuraProvider(e,r.infura))}catch(i){}if(t.EtherscanProvider)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(i){}if(t.AlchemyProvider)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(i){}if(t.CloudflareProvider)try{n.push(new t.CloudflareProvider(e))}catch(i){}if(0===n.length)return null;if(t.FallbackProvider){let i=n.length/2;return null!=r.quorum?i=r.quorum:i>2&&(i="homestead"===e?2:1),new t.FallbackProvider(n,i)}return n[0]}}function a(e,t){return function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null}}const c={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:o("homestead")},u={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:o("ropsten")},l={chainId:63,name:"classicMordor",_defaultProvider:a("https://www.ethercluster.com/mordor","classicMordor")},h={unspecified:{chainId:0,name:"unspecified"},homestead:c,mainnet:c,morden:{chainId:2,name:"morden"},ropsten:u,testnet:u,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:o("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:o("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:o("goerli")},classic:{chainId:61,name:"classic",_defaultProvider:a("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:l,classicTestnet:l,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:a("https://www.ethercluster.com/kotti","classicKotti")}};function f(e){if(null==e)return null;if("number"===typeof e){for(const t in h){const r=h[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"===typeof e){const t=h[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=h[e.name];return t?(0!==e.chainId&&e.chainId!==t.chainId&&s.throwArgumentError("network chainId mismatch","network",e),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:e._defaultProvider||t._defaultProvider||null}):("number"!==typeof e.chainId&&s.throwArgumentError("invalid network chainId","network",e),e)}},"010f":function(e,t,r){(function(e){t.utf8=t["utf-8"]={encode:function(e){return i(e)?e:String(e)},decode:n,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(t){return i(t)?t:e.from(t)},decode:n,buffer:!0,type:"binary"},t.none={encode:n,decode:n,buffer:!1,type:"id"},t.id=t.none;var r=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];function n(e){return e}function i(t){return void 0===t||null===t||e.isBuffer(t)}r.forEach((function(r){t[r]={encode:function(t){return i(t)?t:e.from(t,r)},decode:function(e){return e.toString(r)},buffer:!0,type:r}}))}).call(this,r("b639").Buffer)},"014a":function(e,t,r){"use strict";const n=r("d58b"),i=r("d27c");function s(e,t){let r;n(e,i(e=>{r=e}),e=>t(e,r))}e.exports=s},"016f":function(e,t,r){"use strict";e.exports=function(e){return()=>Boolean(e._bitswap&&e.libp2p&&e.libp2p.isStarted())}},"01de":function(e,t,r){"use strict";const n=r("34eb"),i=n("repo-migrations:repo_mem_lock"),s="repo.lock",o={};t.lock=async function(e,t){const r=t+"/"+s;if(i("locking %s",r),!0===o[r])throw Error(`There is already present lock for: ${r}`);return o[r]=!0,{close(){o[r]&&(i("releasing lock %s",r),delete o[r])}}}},"01f1":function(e,t,r){"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,s=Object.prototype.toString,o=r("d621"),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(e){var t=e.constructor;return t&&t.prototype===e},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"===typeof window)return!1;for(var e in window)try{if(!f["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"===typeof window[e])try{h(window[e])}catch(t){return!0}}catch(t){return!0}return!1}(),p=function(e){if("undefined"===typeof window||!d)return h(e);try{return h(e)}catch(t){return!1}};n=function(e){var t=null!==e&&"object"===typeof e,r="[object Function]"===s.call(e),n=o(e),a=t&&"[object String]"===s.call(e),h=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var f=u&&r;if(a&&e.length>0&&!i.call(e,0))for(var d=0;d0)for(var y=0;ythis._reseedInterval)throw new Error("Reseed is required");r&&0===r.length&&(r=void 0),r&&this._update(r);var i=new t(0);while(i.length/^0x[a-fA-F0-9]{40}$/.test(e);function d(e){const t=a.getNetwork(e);if(!t._defaultProvider)throw new Error(`Network with chainId ${e} is not supported`);return t._defaultProvider(a)}async function p(e){const t=(0,i.encodeRpcCall)("eth_chainId",[]),r=await g(t,e);return parseInt(r,16)}async function y(e,t){const r=(0,i.encodeRpcCall)("eth_getCode",[e,"latest"]),n=await g(r,t);return n}async function g(e,t){const r=(Boolean(t.sendAsync)?t.sendAsync:t.send).bind(t);return new Promise((t,n)=>{r(e,(function(e,r){e?n(e):r.error?n(r.error):t(r.result)}))})}async function m(e,t,r,s={}){const{message:o,timestamp:a}=(0,i.getConsentMessage)(e,!s.skipTimestamp),c=(0,i.encodeRpcCall)("personal_sign",[o,t]),u=await g(c,r),l={version:1,type:n.ADDRESS_TYPES.ethereumEOA,message:o,signature:u,address:t};return s.skipTimestamp||(l.timestamp=a),l}async function b(e,t,r,i){const s=await m(e,t,r,i),o=await p(r);return Object.assign(s,{type:n.ADDRESS_TYPES.erc1271,chainId:o})}async function v(e,t){if(!f(e))return!1;const r=await y(e,t).catch(()=>null);return r&&"0x"!==r&&"0x0"!==r&&"0x00"!==r?n.ADDRESS_TYPES.erc1271:n.ADDRESS_TYPES.ethereumEOA}async function w(e,t,r,i,s){return t=t.toLowerCase(),r===n.ADDRESS_TYPES.ethereumEOA?m(e,t,i,s):r===n.ADDRESS_TYPES.erc1271?b(e,t,i,s):void 0}async function _(e){const t=(0,s.verifyMessage)(e.message,e.signature).toLowerCase();return e.address&&e.address!==t?null:(e.address=t,e)}async function E(t){const r=d(t.chainId),n=new o.Contract(t.address,l,r),i="0x"+e.from(t.message,"utf8").toString("hex"),s=await n.isValidSignature(i,t.signature);return s===h?t:null}async function S(e){return e.type===n.ADDRESS_TYPES.ethereumEOA?_(e):e.type===n.ADDRESS_TYPES.erc1271?E(e):void 0}var k={validateLink:S,createLink:w,typeDetector:v};t.default=k}).call(this,r("b639").Buffer)},"021d":function(e,t,r){var n=r("69d0"),i=r("3ba4");function s(e,t,r){var s=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var o=e.random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;++a)t[s+a]=o[a];return t||i(o)}e.exports=s},"0254":function(e,t,r){"use strict";const n={description:"Empty migration.",migrate:()=>{},revert:()=>{},empty:!0};e.exports=[Object.assign({},n,{version:7,revert:void 0}),Object.assign({},n,{version:6,revert:void 0}),Object.assign({},n,{version:5,revert:void 0}),Object.assign({},n,{version:4,revert:void 0}),Object.assign({},n,{version:3,revert:void 0}),Object.assign({},n,{version:2,revert:void 0}),Object.assign({},n,{version:1,revert:void 0})]},"0286":function(e,t,r){"use strict";var n=r("8707").Buffer,i=r("614f");function s(){this.negative=0,this.words=null,this.length=0}s.fromNumber=function(e){var t=new s;return t.words=[67108863&e],t.length=1,t},s.fromBuffer=function(e){var t=new s;return t.words=new Array(10),t.words[0]=(3&e[28])<<24|e[29]<<16|e[30]<<8|e[31],t.words[1]=(15&e[25])<<22|e[26]<<14|e[27]<<6|e[28]>>>2,t.words[2]=(63&e[22])<<20|e[23]<<12|e[24]<<4|e[25]>>>4,t.words[3]=(255&e[19])<<18|e[20]<<10|e[21]<<2|e[22]>>>6,t.words[4]=(3&e[15])<<24|e[16]<<16|e[17]<<8|e[18],t.words[5]=(15&e[12])<<22|e[13]<<14|e[14]<<6|e[15]>>>2,t.words[6]=(63&e[9])<<20|e[10]<<12|e[11]<<4|e[12]>>>4,t.words[7]=(255&e[6])<<18|e[7]<<10|e[8]<<2|e[9]>>>6,t.words[8]=(3&e[2])<<24|e[3]<<16|e[4]<<8|e[5],t.words[9]=e[0]<<14|e[1]<<6|e[2]>>>2,t.length=10,t.strip()},s.prototype.toBuffer=function(){for(var e=this.words,t=this.length;t<10;++t)e[t]=0;return n.from([e[9]>>>14&255,e[9]>>>6&255,(63&e[9])<<2|e[8]>>>24&3,e[8]>>>16&255,e[8]>>>8&255,255&e[8],e[7]>>>18&255,e[7]>>>10&255,e[7]>>>2&255,(3&e[7])<<6|e[6]>>>20&63,e[6]>>>12&255,e[6]>>>4&255,(15&e[6])<<4|e[5]>>>22&15,e[5]>>>14&255,e[5]>>>6&255,(63&e[5])<<2|e[4]>>>24&3,e[4]>>>16&255,e[4]>>>8&255,255&e[4],e[3]>>>18&255,e[3]>>>10&255,e[3]>>>2&255,(3&e[3])<<6|e[2]>>>20&63,e[2]>>>12&255,e[2]>>>4&255,(15&e[2])<<4|e[1]>>>22&15,e[1]>>>14&255,e[1]>>>6&255,(63&e[1])<<2|e[0]>>>24&3,e[0]>>>16&255,e[0]>>>8&255,255&e[0]])},s.prototype.clone=function(){var e=new s;e.words=new Array(this.length);for(var t=0;t1&&0===(0|this.words[this.length-1]))this.length--;return this},s.prototype.normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.isEven=function(){return 0===(1&this.words[0])},s.prototype.isOdd=function(){return 1===(1&this.words[0])},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.ucmp=function(e){if(this.length!==e.length)return this.length>e.length?1:-1;for(var t=this.length-1;t>=0;--t)if(this.words[t]!==e.words[t])return this.words[t]>e.words[t]?1:-1;return 0},s.prototype.gtOne=function(){return this.length>1||this.words[0]>1},s.prototype.isOverflow=function(){return this.ucmp(s.n)>=0},s.prototype.isHigh=function(){return 1===this.ucmp(s.nh)},s.prototype.bitLengthGT256=function(){return this.length>10||10===this.length&&this.words[9]>4194303},s.prototype.iuaddn=function(e){this.words[0]+=e;for(var t=0;this.words[t]>67108863&&te.length?(t=this,r=e):(t=e,r=this);for(var n=0,i=0;n>>26}for(;0!==i&&n>>26;if(this.length=t.length,0!==i)this.words[this.length++]=i;else if(t!==this)for(;n0?(t=this,r=e):(t=e,r=this);for(var i=0,s=0;i>26,this.words[i]=67108863&o}for(;0!==s&&i>26,this.words[i]=67108863&o;if(0===s&&i>>26,l=67108863&o,h=Math.max(0,a-e.length+1),f=Math.min(a,t.length-1);h<=f;h++){var d=a-h,p=e.words[d],y=t.words[h],g=p*y+l;u+=g/67108864|0,l=67108863&g}r.words[a]=l,o=u}return 0!==o&&(r.words[r.length++]=o),r.strip()},s.umulTo10x10=Math.imul?i.umulTo10x10:s.umulTo,s.umulnTo=function(e,t,r){if(0===t)return r.words=[0],r.length=1,r;for(var n=0,i=0;n0?(r.words[n]=i,r.length=e.length+1):r.length=e.length,r},s.prototype.umul=function(e){var t=new s;return t.words=new Array(this.length+e.length),10===this.length&&10===e.length?s.umulTo10x10(this,e,t):1===this.length?s.umulnTo(e,this.words[0],t):1===e.length?s.umulnTo(this,e.words[0],t):s.umulTo(this,e,t)},s.prototype.isplit=function(e){e.length=Math.min(this.length,9);for(var t=0;t>>22,r=n}return r>>>=22,this.words[t-10]=r,0===r&&this.length>10?this.length-=10:this.length-=9,this},s.prototype.fireduce=function(){return this.isOverflow()&&this.isub(s.n),this},s.prototype.ureduce=function(){var e=this.clone().isplit(s.tmp).umul(s.nc).iadd(s.tmp);return e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp),e.bitLengthGT256()&&(e=e.isplit(s.tmp).umul(s.nc).iadd(s.tmp))),e.fireduce()},s.prototype.ishrn=function(e){for(var t=(1<=0;--n){var s=this.words[n];this.words[n]=i<>>e,i=s&t}return this.length>1&&0===this.words[this.length-1]&&(this.length-=1),this},s.prototype.uinvm=function(){var e=this.clone(),t=s.n.clone(),r=s.fromNumber(1),n=s.fromNumber(0),i=s.fromNumber(0),o=s.fromNumber(1);while(e.isEven()&&t.isEven()){for(var a=1,c=1;0===(e.words[0]&c)&&0===(t.words[0]&c)&&a<26;++a,c<<=1);e.ishrn(a),t.ishrn(a)}var u=t.clone(),l=e.clone();while(!e.isZero()){for(var h=0,f=1;0===(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0){e.ishrn(h);while(h-- >0)(r.isOdd()||n.isOdd())&&(r.iadd(u),n.isub(l)),r.ishrn(1),n.ishrn(1)}for(var d=0,p=1;0===(t.words[0]&p)&&d<26;++d,p<<=1);if(d>0){t.ishrn(d);while(d-- >0)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(l)),i.ishrn(1),o.ishrn(1)}e.ucmp(t)>=0?(e.isub(t),r.isub(i),n.isub(o)):(t.isub(e),i.isub(r),o.isub(n))}if(1===i.negative){i.negative=0;var y=i.ureduce();return y.negative^=1,y.normSign().iadd(s.n)}return i.ureduce()},s.prototype.imulK=function(){this.words[this.length]=0,this.words[this.length+1]=0,this.length+=2;for(var e=0,t=0;e0?this.isub(s.p):this.strip(),this},s.prototype.redNeg=function(){return this.isZero()?s.fromNumber(0):s.p.sub(this)},s.prototype.redAdd=function(e){return this.clone().redIAdd(e)},s.prototype.redIAdd=function(e){return this.iadd(e),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redIAdd7=function(){return this.iuaddn(7),this.ucmp(s.p)>=0&&this.isub(s.p),this},s.prototype.redSub=function(e){return this.clone().redISub(e)},s.prototype.redISub=function(e){return this.isub(e),0!==this.negative&&this.iadd(s.p),this},s.prototype.redMul=function(e){return this.umul(e).redIReduce()},s.prototype.redSqr=function(){return this.umul(this).redIReduce()},s.prototype.redSqrt=function(){if(this.isZero())return this.clone();for(var e=this.redSqr(),t=e.redSqr(),r=t.redSqr().redMul(t),n=r.redMul(e),i=n.redMul(this),s=i,o=0;o<54;++o)s=s.redSqr().redSqr().redSqr().redSqr().redMul(i);for(s=s.redSqr().redSqr().redSqr().redSqr().redMul(n),o=0;o<5;++o)s=s.redSqr().redSqr().redSqr().redSqr().redMul(i);return s=s.redSqr().redSqr().redSqr().redSqr().redMul(r),s=s.redSqr().redSqr().redSqr().redSqr().redSqr().redSqr().redMul(r),0===s.redSqr().ucmp(this)?s:null},s.prototype.redInvm=function(){var e,t=this.clone(),r=s.p.clone(),n=s.fromNumber(1),i=s.fromNumber(0);while(t.gtOne()&&r.gtOne()){for(var o=0,a=1;0===(t.words[0]&a)&&o<26;++o,a<<=1);if(o>0){t.ishrn(o);while(o-- >0)n.isOdd()&&n.iadd(s.p),n.ishrn(1)}for(var c=0,u=1;0===(r.words[0]&u)&&c<26;++c,u<<=1);if(c>0){r.ishrn(c);while(c-- >0)i.isOdd()&&i.iadd(s.p),i.ishrn(1)}t.ucmp(r)>=0?(t.isub(r),n.isub(i)):(r.isub(t),i.isub(n))}return e=1===t.length&&1===t.words[0]?n:i,0!==e.negative&&e.iadd(s.p),0!==e.negative?(e.negative=0,e.redIReduce().redNeg()):e.redIReduce()},s.prototype.getNAF=function(e){var t=[],r=1<>1,s=this.clone();while(!s.isZero()){for(var o=0,a=1;0===(s.words[0]&a)&&o<26;++o,a<<=1)t.push(0);if(0!==o)s.ishrn(o);else{var c=s.words[0]&n;if(c>=i)t.push(i-c),s.iuaddn(c-i).ishrn(1);else if(t.push(c),s.words[0]-=c,!s.isZero()){for(o=e-1;o>0;--o)t.push(0);s.ishrn(e)}}}return t},s.prototype.inspect=function(){if(this.isZero())return"0";for(var e=this.toBuffer().toString("hex"),t=0;"0"===e[t];++t);return e.slice(t)},s.n=s.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex")),s.nh=s.n.clone().ishrn(1),s.nc=s.fromBuffer(n.from("000000000000000000000000000000014551231950B75FC4402DA1732FC9BEBF","hex")),s.p=s.fromBuffer(n.from("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","hex")),s.psn=s.p.sub(s.n),s.tmp=new s,s.tmp.words=new Array(10),function(){var e=s.fromNumber(1);e.words[3]=0}(),e.exports=s},"02a6":function(e,t,r){var n=r("c3bb"),i=r("9d8a"),s=r("e0c5").Buffer,o=[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],a=new Array(160);function c(){this.init(),this._w=a,i.call(this,128,112)}function u(e,t,r){return r^e&(t^r)}function l(e,t,r){return e&t|r&(e|t)}function h(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function y(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function m(e,t){return e>>>0>>0?1:0}n(c,i),c.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},c.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,s=0|this._dh,a=0|this._eh,c=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,E=0|this._cl,S=0|this._dl,k=0|this._el,C=0|this._fl,A=0|this._gl,I=0|this._hl,T=0;T<32;T+=2)t[T]=e.readInt32BE(4*T),t[T+1]=e.readInt32BE(4*T+4);for(;T<160;T+=2){var x=t[T-30],B=t[T-30+1],R=d(x,B),N=p(B,x);x=t[T-4],B=t[T-4+1];var O=y(x,B),P=g(B,x),D=t[T-14],L=t[T-14+1],M=t[T-32],U=t[T-32+1],j=N+L|0,K=R+D+m(j,N)|0;j=j+P|0,K=K+O+m(j,P)|0,j=j+U|0,K=K+M+m(j,U)|0,t[T]=K,t[T+1]=j}for(var F=0;F<160;F+=2){K=t[F],j=t[F+1];var V=l(r,n,i),q=l(w,_,E),z=h(r,w),H=h(w,r),G=f(a,k),$=f(k,a),W=o[F],Y=o[F+1],Q=u(a,c,b),J=u(k,C,A),X=I+$|0,Z=v+G+m(X,I)|0;X=X+J|0,Z=Z+Q+m(X,J)|0,X=X+Y|0,Z=Z+W+m(X,Y)|0,X=X+j|0,Z=Z+K+m(X,j)|0;var ee=H+q|0,te=z+V+m(ee,H)|0;v=b,I=A,b=c,A=C,c=a,C=k,k=S+X|0,a=s+Z+m(k,S)|0,s=i,S=E,i=n,E=_,n=r,_=w,w=X+ee|0,r=Z+te+m(w,X)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+k|0,this._fl=this._fl+C|0,this._gl=this._gl+A|0,this._hl=this._hl+I|0,this._ah=this._ah+r+m(this._al,w)|0,this._bh=this._bh+n+m(this._bl,_)|0,this._ch=this._ch+i+m(this._cl,E)|0,this._dh=this._dh+s+m(this._dl,S)|0,this._eh=this._eh+a+m(this._el,k)|0,this._fh=this._fh+c+m(this._fl,C)|0,this._gh=this._gh+b+m(this._gl,A)|0,this._hh=this._hh+v+m(this._hl,I)|0},c.prototype._hash=function(){var e=s.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=c},"02ce":function(e,t,r){"use strict";const n=r("e782"),i=r("0c9a"),s=(e,t,r)=>{!r.codec&&e.length&&(r.cidVersion=1,r.codec="raw"),isNaN(r.hashAlg)&&(r.hashAlg=n.names[r.hashAlg]),r.hashAlg!==n.names["sha2-256"]&&(r.cidVersion=1),r.format&&(r.codec=r.format);const s=i[r.codec.toUpperCase().replace(/-/g,"_")];return t.put(e,s,r)};e.exports=s},"02f2":function(e,t,r){"use strict";(function(n){const i=r("f654"),s=r("ec12"),o=r("d7cb"),a=r("41fe");class c{constructor(e,t,r){0!==r&&i(r,"A DAGNode requires it's serialized size"),this._data=e||n.alloc(0),this._links=t,this._serializedSize=r,a.hidePrivateFields(this),a.addEnumerableGetters(this,["Data","Links"]),t.forEach((e,t)=>{o(this,e.Name,t)})}toJSON(){return this._json||(this._json=Object.freeze({data:this.Data,links:this._links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}get size(){return void 0===this._size&&(this._size=this._links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get Data(){return this._data}set Data(e){throw new Error("Can't set property: 'Data' is immutable")}get Links(){return this._links.map(e=>({Name:e.Name,Tsize:e.Tsize,Hash:e.Hash}))}set Links(e){throw new Error("Can't set property: 'Links' is immutable")}}t=e.exports=s(c,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"}),t.create=r("70cf"),t.clone=r("64d4"),t.addLink=r("11ca"),t.rmLink=r("69e7")}).call(this,r("b639").Buffer)},"034e":function(e,t,r){"use strict";(function(n){const i=r("96a8"),s=i(r("eee0"));r("a43d"),r("9051"),r("b6fe");const o=r("f0a0");t=e.exports;const a={rsa:r("2ff2"),ed25519:r("7cb4"),secp256k1:r("9294")(s,r("3d5a"))};function c(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=s,t.keyStretcher=r("104e"),t.generateEphemeralKeyPair=r("6b25"),t.generateKeyPair=(e,t,r)=>{const n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)},t.generateKeyPairFromSeed=(e,t,r,n)=>{const i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))},t.unmarshalPublicKey=e=>{const t=s.PublicKey.decode(e),r=t.Data;switch(t.Type){case s.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case s.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case s.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}},t.marshalPublicKey=(e,t)=>{if(t=(t||"rsa").toLowerCase(),!c(t))throw new Error("invalid or unsupported key type");return e.bytes},t.unmarshalPrivateKey=(e,t)=>{let r;try{r=s.PrivateKey.decode(e)}catch(i){return t(i)}const n=r.Data;switch(r.Type){case s.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case s.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case s.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}},t.marshalPrivateKey=(e,t)=>{if(t=(t||"rsa").toLowerCase(),!c(t))throw new Error("invalid or unsupported key type");return e.bytes},t.import=(e,t,r)=>{try{const i=o.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let s=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return s=n.from(s.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(s,r)}catch(i){r(i)}}}).call(this,r("b639").Buffer)},"0380":function(e,t,r){"use strict";const n=r("cf8f"),i=r("1421"),s=r("6166"),o=r("bcc7"),a=r("4bc2"),c=a("libp2p:circuit:transportdialer");c.err=a("libp2p:circuit:error:transportdialer");const u=r("05c7");class l{static get tag(){return"Circuit"}constructor(e,t){this.options=t||{},this.swarm=e,this.dialer=null,this.utils=o(e),this.peerInfo=this.swarm._peerInfo,this.relays=this.filter(this.peerInfo.multiaddrs.toArray()),0===this.relays.length&&this.peerInfo.multiaddrs.add(`/p2p-circuit/ipfs/${this.peerInfo.id.toB58String()}`),this.dialer=new s(e,t),this.swarm.on("peer-mux-established",e=>{this.dialer.canHop(e)}),this.swarm.on("peer-mux-closed",e=>{this.dialer.relayPeers.delete(e.id.toB58String())})}_dialSwarmRelays(){this.relays.forEach(e=>{const t=e.toString().split("/p2p-circuit").filter(e=>e.length);t.forEach(e=>{const t=this.utils.peerInfoFromMa(i(e));this.dialer._dialRelay(t)})})}dial(e,t,r){return this.dialer.dial(e,t,r)}createListener(e,t){"function"===typeof e&&(t=e,e=this.options||{});const r=u(this.swarm,e,t);return r.on("listen",this._dialSwarmRelays.bind(this)),r}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>n.Circuit.matches(e))}}e.exports=l},"0395":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r("c1cd"),i=h(n),s=r("532e"),o=h(s),a=r("6307"),c=h(a),u=r("76bf"),l=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r){r=r||i.default;var n=(0,o.default)(t)?[]:{};e(t,(function(e,t,r){(0,l.default)(e)((function(e,i){arguments.length>2&&(i=(0,c.default)(arguments,1)),n[t]=i,r(e)}))}),(function(e){r(e,n)}))}e.exports=t["default"]},"0397":function(e,t,r){"use strict";var n=r("4ea4"),i=n(r("a34a")),s=n(r("c973")),o=r("9440"),a=n(r("a18f")),c="https://ipfs.infura.io/ipfs/";function u(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];function t(e,t){return r.apply(this,arguments)}function r(){return r=(0,s["default"])(i["default"].mark((function t(r,n){var s;return i["default"].wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,l(e,n.id);case 2:return s=t.sent,t.abrupt("return",p(r,s));case 4:case"end":return t.stop()}}),t)}))),r.apply(this,arguments)}(0,o.registerMethod)("muport",t)}function l(e,t){return h.apply(this,arguments)}function h(){return h=(0,s["default"])(i["default"].mark((function e(t,r){var n;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(e.prev=0,!t){e.next=9;break}return e.t1=JSON,e.next=5,t.cat(r);case 5:e.t2=e.sent,e.t0=e.t1.parse.call(e.t1,e.t2),e.next=12;break;case 9:return e.next=11,f(r);case 11:e.t0=e.sent;case 12:n=e.t0,e.next=17;break;case 15:e.prev=15,e.t3=e["catch"](0);case 17:if(n&&1===n.version&&n.signingKey&&n.managementKey&&n.asymEncryptionKey){e.next=27;break}if(e.prev=18,!t){e.next=22;break}return e.next=22,t.pin.rm(r);case 22:e.next=26;break;case 24:e.prev=24,e.t4=e["catch"](18);case 26:throw new Error("Invalid muport did");case 27:return e.abrupt("return",n);case 28:case"end":return e.stop()}}),e,null,[[0,15],[18,24]])}))),h.apply(this,arguments)}function f(e){return d.apply(this,arguments)}function d(){return d=(0,s["default"])(i["default"].mark((function e(t){return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,a["default"])(c+t);case 2:return e.abrupt("return",e.sent.json());case 3:case"end":return e.stop()}}),e)}))),d.apply(this,arguments)}function p(e,t){var r={"@context":"https://w3id.org/did/v1",id:e,publicKey:[{id:e+"#signingKey",type:"Secp256k1VerificationKey2018",owner:e,publicKeyHex:t.signingKey},{id:e+"#managementKey",type:"Secp256k1VerificationKey2018",owner:e},{id:e+"#encryptionKey",type:"Curve25519EncryptionPublicKey",owner:e,publicKeyBase64:t.asymEncryptionKey}],authentication:[{type:"Secp256k1SignatureAuthentication2018",publicKey:e+"#signingKey"}],muportData:{}};return 42===t.managementKey.length?r.publicKey[1].ethereumAddress=t.managementKey:r.publicKey[1].publicKeyHex=t.managementKey,t.publicProfile&&(r.uportProfile=t.publicProfile),t.symEncryptedData&&(r.muportData.symEncryptedData=t.symEncryptedData),t.recoveryNetwork&&(r.muportData.recoveryNetwork=t.recoveryNetwork),r}e.exports=u},"0398":function(e,t){const r="https://api.coingecko.com/api/",n="api.coingecko.com",i="3",s=`${r}v${i}`,o=10,a=3e4,c={GECKO_ASC:"gecko_asc",GECKO_DESC:"gecko_desc",MARKET_CAP_ASC:"market_cap_asc",MARKET_CAP_DESC:"market_cap_desc",VOLUME_ASC:"volume_asc",VOLUME_DESC:"volume_desc",COIN_NAME_ASC:"coin_name_asc",COIN_NAME_DESC:"coin_name_desc",PRICE_ASC:"price_asc",PRICE_DESC:"price_desc",HOUR_24_ASC:"h24_change_asc",HOUR_24_DESC:"h24_change_desc",TRUST_SCORE_DESC:"trust_score_desc",NAME_ASC:"name_asc",NAME_DESC:"name_desc",OPEN_INTEREST_BTC_ASC:"open_interest_btc_asc",OPEN_INTEREST_BTC_DESC:"open_interest_btc_desc",TRADE_VOLUME_24H_BTC_ASC:"trade_volume_24h_btc_asc",TRADE_VOLUME_24H_BTC_DESC:"trade_volume_24h_btc_desc"},u={GENERAL:"general",MILESTONE:"milestone",PARTNERSHIP:"partnership",EXCHANGE_LISTING:"exchange_listing",SOFTWARE_RELEASE:"software_release",FUND_MOVEMENT:"fund_movement",NEW_LISTINGS:"new_listings",EVENT:"event"},l={COIN:"coin",MARKET:"market"},h={EVENT:"Event",CONFERENCE:"Conference",MEETUP:"Meetup"};e.exports={BASE:r,HOST:n,API_VERSION:i,URI:s,REQUESTS_PER_SECOND:o,ORDER:c,STATUS_UPDATE_CATEGORY:u,STATUS_UPDATE_PROJECT_TYPE:l,EVENT_TYPE:h,TIMEOUT:a}},"03b2":function(e,t,r){"use strict";e.exports=function(e){return function(t,r){r(e)}}},"0417":function(e,t,r){"use strict";class n{async canAppend(e,t){return!0}}e.exports=n},"043f":function(e,t,r){"use strict";(function(t){const n=r("1304").Key,i=r("bb8f"),s=new n("datastore_spec");e.exports=e=>({async exists(){return e.has(s)},async get(){const t=await e.get(s);return JSON.parse(t.toString())},async set(r){return e.put(s,t.from(JSON.stringify(i(r,{deep:!0}))))}})}).call(this,r("b639").Buffer)},"0497":function(e,t,r){(function(t){var n=r("a977").strict;e.exports=function(e){if(n(e)){var r=t.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(r=r.slice(e.byteOffset,e.byteOffset+e.byteLength)),r}return t.from(e)}}).call(this,r("b639").Buffer)},"04dc":function(e,t,r){"use strict";const n=r("231e"),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const s=i[e.length];if(!s)return r(new Error("Invalid key length"));const o=n.createCipheriv(s,e,t),a=n.createDecipheriv(s,e,t),c={encrypt(e,t){t(null,o.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,c)}},"04dcb":function(e,t,r){"use strict";const n=r("faa1"),i=r("26a6"),s=r("d720"),o=r("65b6");class a extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this);const r=this._options.movingAverageIntervals;for(var n=0;n{this._updateFrequencyFor(r,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=t||1,o=n/i*1e3;let a=this._movingAverages[e];a||(a=this._movingAverages[e]={});const c=this._options.movingAverageIntervals;for(var u=0;ut&&(e=h(t,r)),e.isProbablePrime(o))return c(null,e);e.dAddOffset(i[s++%8],0)}while(a<0||+new Date-le&&(o=h(e,t));var d=o.toString(16);i.target.postMessage({hex:d,workLoad:u}),o.dAddOffset(l,0)}}}d()}function h(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),o,n),n.dAddOffset(31-n.mod(s).byteValue(),0),n}function f(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}}()},"04e4":function(e,t,r){var n=r("8284");function i(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}e.exports=i},"0503":function(e,t,r){"use strict";const n=r("7048");e.exports=(e={},t)=>{Array.isArray(e)&&(e=e.filter(e=>"object"===typeof e).pop()||{});const r={};for(const n in t)null!==e[n]&&void 0!==e[n]?r[n]=e[n]:r[n]=t[n];const i=r.format||r.codec;if(i&&isNaN(i)&&(r.format=i,delete r.codec),void 0!==e.count&&(r.length=e.count),void 0!==e.p&&(r.parents=e.p),void 0!==e.l&&(r.long=e.l),r.length||0===r.length||(r.length=1/0),r.offset<0)throw n(new Error("cannot have negative write offset"),"ERR_INVALID_PARAMS");if(r.length<0)throw n(new Error("cannot have negative byte count"),"ERR_INVALID_PARAMS");return r}},"0512":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var n=r("0395"),i=a(n),s=r("ea8c"),o=a(s);function a(e){return e&&e.__esModule?e:{default:e}}function c(e,t){(0,i.default)(o.default,e,t)}e.exports=t["default"]},"057f":function(e,t,r){var n=r("fc6a"),i=r("241c").f,s={}.toString,o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(e){try{return i(e)}catch(t){return o.slice()}};e.exports.f=function(e){return o&&"[object Window]"==s.call(e)?a(e):i(n(e))}},"0580":function(e,t,r){const n=r("faa1").EventEmitter,i=r("e063"),{WORKER_REQUEST_READ_LOCK:s,WORKER_RELEASE_READ_LOCK:o,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:c,WORKER_RELEASE_WRITE_LOCK:u,MASTER_GRANT_WRITE_LOCK:l}=r("2046"),h=r("c275"),f=r("c707")(),d=(e,t,r,n,i)=>(s,o)=>{if(!o||!o.data||o.data.type!==r)return;const a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};e.emit(t,a.name,()=>(s.postMessage({type:i,name:a.name,identifier:a.identifier}),new Promise(e=>{const t=r=>{if(!r||!r.data)return;const i={type:r.data.type,name:r.data.name,identifier:r.data.identifier};i&&i.type===n&&i.identifier===a.identifier&&(s.removeEventListener("message",t),e())};s.addEventListener("message",t)})))},p=(e,t,r,n)=>()=>{const s=i.generate();return f.postMessage({type:t,identifier:s,name:e}),new Promise(t=>{const i=o=>{if(!o||!o.data)return;const a={type:o.data.type,identifier:o.data.identifier};a&&a.type===r&&a.identifier===s&&(f.removeEventListener("message",i),t(()=>{f.postMessage({type:n,identifier:s,name:e})}))};f.addEventListener("message",i)})},y={singleProcess:!1};e.exports=e=>{e=Object.assign({},y,e);const t=!!f.document||e.singleProcess;if(t){const e=new n;return h.addEventListener("message",d(e,"requestReadLock",s,o,a)),h.addEventListener("message",d(e,"requestWriteLock",c,u,l)),e}return{isWorker:!0,readLock:e=>p(e,s,a,o),writeLock:e=>p(e,c,l,u)}}},"05c7":function(e,t,r){"use strict";const n=r("9941"),i=r("8ffa"),s=r("faa1").EventEmitter,o=r("1421"),a=r("cf8f"),c=r("567e"),u=r("fa5a"),l=r("6c8b"),h=r("bcc7"),f=r("f8c9"),d=r("4bc2"),p=d("libp2p:circuit:listener");p.err=d("libp2p:circuit:error:listener"),e.exports=(e,t,r)=>{const d=new s,y=h(e);return d.stopHandler=new c(e),d.stopHandler.on("connection",e=>d.emit("connection",e)),d.hopHandler=new u(e,t.hop),d.listen=(t,s)=>{s=s||(()=>{}),e.handle(i.relay,(e,t)=>{const n=new f(t);n.read((e,t)=>{if(e)return void p.err(e);let i=null;try{i=l.CircuitRelay.decode(t)}catch(e){return y.writeResponse(n,l.CircuitRelay.Status.MALFORMED_MESSAGE)}switch(i.type){case l.CircuitRelay.Type.CAN_HOP:case l.CircuitRelay.Type.HOP:return d.hopHandler.handle(i,n);case l.CircuitRelay.Type.STOP:return d.stopHandler.handle(i,n,r);default:return y.writeResponse(n,l.CircuitRelay.Status.INVALID_MSG_TYPE),n.close()}})}),n(()=>d.emit("listen")),s()},d.close=t=>{e.unhandle(i.relay),n(()=>d.emit("close")),t()},d.getAddrs=t=>{let r=e._peerInfo.multiaddrs.toArray();const n=r.filter(t=>a.Circuit.matches(t)&&!t.toString().includes(e._peerInfo.id.toB58String()));n.length&&(r=n);const i=[];r.forEach(t=>{const r=`/p2p-circuit/ipfs/${e._peerInfo.id.toB58String()}`;if(t.toString()!==r)if(a.Circuit.matches(t))i.push(t.encapsulate(`/ipfs/${e._peerInfo.id.toB58String()}`));else if(t.getPeerId())i.push(o("/p2p-circuit").encapsulate(t));else{const r=`${t}/ipfs/${e._peerInfo.id.toB58String()}`;i.push(o("/p2p-circuit").encapsulate(r))}else i.push(o(r))}),t(null,i)},d}},"05dd":function(e,t,r){"use strict";const n=async(e,t,r)=>{const n=async()=>{const n=await e.pubsub.peers(r),i=0===t.map(e=>n.includes(e)).filter(e=>!1===e).length;return i};return await n()?Promise.resolve():new Promise(async(e,t)=>{const r=setInterval(async()=>{try{await n()&&(clearInterval(r),e())}catch(i){t(i)}},100)})};e.exports=n},"05f9":function(e,t,r){"use strict";const n=e=>void 0!==e&&null!==e;e.exports=n},"060c":function(e,t){var r=Object.prototype;function n(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||r;return e===n}e.exports=n},"0611":function(e,t,r){var n=r("c027"),i=r("6a63"),s=r("4bc2")("engine.io-client:socket"),o=r("666d"),a=r("7c47"),c=r("f4d7"),u=r("c81c");function l(e,t){if(!(this instanceof l))return new l(e,t);t=t||{},e&&"object"===typeof e&&(t=e,e=null),e?(e=c(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=c(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!==typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!==typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!==typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"===typeof this.query&&(this.query=u.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.withCredentials=!1!==t.withCredentials,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"===typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function h(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}e.exports=l,l.priorWebsocketSuccess=!1,i(l.prototype),l.protocol=a.protocol,l.Socket=l,l.Transport=r("19c3"),l.transports=r("c027"),l.parser=r("7c47"),l.prototype.createTransport=function(e){s('creating transport "%s"',e);var t=h(this.query);t.EIO=a.protocol,t.transport=e;var r=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var i=new n[e]({query:t,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,withCredentials:r.withCredentials||this.withCredentials,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative});return i},l.prototype.open=function(){var e;if(this.rememberUpgrade&&l.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(r){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},l.prototype.setTransport=function(e){s("setting transport %s",e.name);var t=this;this.transport&&(s("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},l.prototype.probe=function(e){s('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;function i(){if(n.onlyBinaryUpgrades){var i=!this.supportsBinary&&n.transport.supportsBinary;r=r||i}r||(s('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(i){if(!r)if("pong"===i.type&&"probe"===i.data){if(s('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;l.priorWebsocketSuccess="websocket"===t.name,s('pausing current transport "%s"',n.transport.name),n.transport.pause((function(){r||"closed"!==n.readyState&&(s("changing transport and sending upgrade packet"),f(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())}))}else{s('probe transport "%s" failed',e);var o=new Error("probe error");o.transport=t.name,n.emit("upgradeError",o)}})))}function o(){r||(r=!0,f(),t.close(),t=null)}function a(r){var i=new Error("probe error: "+r);i.transport=t.name,o(),s('probe transport "%s" failed because of error: %s',e,r),n.emit("upgradeError",i)}function c(){a("transport closed")}function u(){a("socket closed")}function h(e){t&&e.name!==t.name&&(s('"%s" works - aborting "%s"',e.name,t.name),o())}function f(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",c),n.removeListener("close",u),n.removeListener("upgrading",h)}l.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",c),this.once("close",u),this.once("upgrading",h),t.open()},l.prototype.onOpen=function(){if(s("socket open"),this.readyState="open",l.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){s("starting upgrade probes");for(var e=0,t=this.upgrades.length;e{let n,i;if(e<0)n=r,i=t;else{if(!(e>0))return t[0];n=t,i=r}for(let s of n)for(let e of i)if(s===e)return s;throw new Error("No algorithms in common!")},t.makeMacAndCipher=(e,t)=>{u([t=>l(e.hashT,e.keys.macKey,t),t=>h(e.cipherT,e.keys.iv,e.keys.cipherKey,t)],(r,n)=>{if(r)return t(r);e.mac=n[0],e.cipher=n[1],t()})},t.selectBest=(r,n,i)=>{t.digest(e.concat([n.pubKeyBytes,r.nonce]),(s,o)=>{if(s)return i(s);t.digest(e.concat([r.pubKeyBytes,n.nonce]),(s,a)=>{if(s)return i(s);const c=e.compare(o,a);if(0===c)return i(new Error("you are trying to talk to yourself"));i(null,{curveT:t.theBest(c,r.exchanges,n.exchanges),cipherT:t.theBest(c,r.ciphers,n.ciphers),hashT:t.theBest(c,r.hashes,n.hashes),order:c})})})},t.digest=(e,t)=>{n.digest(e,"sha2-256",e.length,t)},t.write=function(e,t,r){r=r||(()=>{}),s(o([t]),i.encode({fixed:!0,bytes:4}),a((t,n)=>{if(t)return r(t);e.shake.write(n[0]),r()}))},t.read=function(e,t){i.decodeFromReader(e,{fixed:!0,bytes:4},t)}}).call(this,r("b639").Buffer)},"063e":function(e,t,r){"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},"0676":function(e,t){function r(){throw new TypeError("Invalid attempt to spread non-iterable instance")}e.exports=r},"06a1":function(e,t,r){"use strict";(function(e){var r=e.MutationObserver||e.WebKitMutationObserver;t.test=function(){return r},t.install=function(t){var n=0,i=new r(t),s=e.document.createTextNode("");return i.observe(s,{characterData:!0}),function(){s.data=n=++n%2}}}).call(this,r("c8ba"))},"0730":function(e,t){var r=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t=null==t?r:t,!!t&&("number"==i||"symbol"!=i&&n.test(e))&&e>-1&&e%1==0&&e{const r=new n(e).child(new n(o)),i="function"===typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t),s=await i(r);return h((s||"").toString().trim())},t.readme=i,t.parseShardFun=h,t.Prefix=c,t.Suffix=u,t.NextToLast=l},"07be6":function(e,t,r){"use strict";(function(t){const n=r("b13c"),i=r("e009"),s=r("b061"),o=r("2f58"),a=s.toCallback,c=s.toBuf,u=s.fromString,l=s.fromNumberTo32BitBuf,h=(e,r)=>{o.sha2256(e,(e,n)=>{e&&r(e),o.sha2256(t.from(n),r)})};e.exports={sha1:o.sha1,sha2256:o.sha2256,sha2512:o.sha2512,sha3512:a(c(n.sha3_512)),sha3384:a(c(n.sha3_384)),sha3256:a(c(n.sha3_256)),sha3224:a(c(n.sha3_224)),shake128:a(c(n.shake_128,128)),shake256:a(c(n.shake_256,256)),keccak224:a(c(n.keccak_224)),keccak256:a(c(n.keccak_256)),keccak384:a(c(n.keccak_384)),keccak512:a(c(n.keccak_512)),murmur3128:a(c(u(i.x64.hash128))),murmur332:a(l(u(i.x86.hash32))),addBlake:r("74c2"),dblSha2256:h}}).call(this,r("b639").Buffer)},"07e3":function(e,t,r){"use strict";const n=r("135c"),i=r("de17"),s=r("5f0c"),o=r("5dd0");async function*a(e,t,r){for await(const a of e)if(a.path&&("./"===a.path.substring(0,2)&&(r.wrapWithDirectory=!0),a.path=a.path.split("/").filter(e=>e&&"."!==e).join("/")),a.content){let e=a.content;(e[Symbol.asyncIterator]||e[Symbol.iterator])&&void 0===e.length||(e={[Symbol.iterator]:function*(){yield a.content}});const n=s(r.chunker,o(e),r.chunkerOptions);yield i(a,n,t,r)}else yield n(a,t,r)}e.exports=a},"083e":function(e,t,r){var n=r("918b");r("5ee0"),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){e&&this._input.putBuffer(e);while(!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},"0841":function(e,t,r){"use strict";const n=r("694c"),i=r("eb8e");t.encode=n,t.decode=i.decode,t.decodeFromReader=i.decodeFromReader},"0866":function(e,t,r){"use strict";class n{constructor(e={}){this._cache=e}set(e,t){this._cache[e]=t}get(e){return this._cache[e]}delete(e){return delete this._cache[e]}add(e){this._cache=Object.assign(this._cache,e)}get length(){return Object.values(this._cache).length}}e.exports=n},"086c":function(e,t,r){"use strict";const n=r("fb92").Errors,i=r("4bc2")("datastore:core:tiered");class s{constructor(e){this.stores=e.slice()}async open(){try{await this.stores.map(e=>e.open())}catch(e){throw n.dbOpenFailedError()}}async put(e,t){try{await Promise.all(this.stores.map(r=>r.put(e,t)))}catch(r){throw n.dbWriteFailedError()}}async get(e){for(const r of this.stores)try{const t=await r.get(e);if(t)return t}catch(t){i(t)}throw n.notFoundError()}has(e){return new Promise(async t=>{await Promise.all(this.stores.map(async r=>{const n=await r.has(e);n&&t(!0)})),t(!1)})}async delete(e){try{await Promise.all(this.stores.map(t=>t.delete(e)))}catch(t){throw n.dbDeleteFailedError()}}async close(){await Promise.all(this.stores.map(e=>e.close()))}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,r)=>{e.forEach(e=>e.put(t,r))},delete:t=>{e.forEach(e=>e.delete(t))},commit:async()=>{for(const t of e)await t.commit()}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=s},"087c":function(e,t){var r=1e3,n=60*r,i=60*n,s=24*i,o=365.25*s;function a(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),c=(t[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"days":case"day":case"d":return a*s;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function c(e){return e>=s?Math.round(e/s)+"d":e>=i?Math.round(e/i)+"h":e>=n?Math.round(e/n)+"m":e>=r?Math.round(e/r)+"s":e+"ms"}function u(e){return l(e,s,"day")||l(e,i,"hour")||l(e,n,"minute")||l(e,r,"second")||e+" ms"}function l(e,t,r){if(!(e0)return a(e);if("number"===r&&!1===isNaN(e))return t.long?u(e):c(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},"08df":function(e,t,r){var n=r("91f5"),i=r("0d0f");e.exports=n,e.exports.parse=n,e.exports.stringify=i},"0909":function(e,t,r){"use strict";t.deepEqual=(e,t)=>{const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!==n.length)return!1;for(let i=0;i{const t=n();if("function"===typeof e)return e;if("object"===typeof e)return i(e);if("string"===typeof e){const r=s(e).nodeAddress();return t.host=r.address,t.port=r.port,i(t)}throw new Error("Argument must be a send function or a config object.")}},"0937":function(e,t,r){var n=r("f64a"),i="object"==typeof self&&self&&self.Object===Object&&self,s=n||i||Function("return this")();e.exports=s},"0948":function(e,t,r){"use strict";const n=r("cd6d"),i=r("dacf");class s extends n{constructor(e,t,r,n){n||(n={}),n.Index||Object.assign(n,{Index:i}),super(e,t,r,n),this._type="feed"}remove(e,t={}){return this.del(e,t)}del(e,t={}){const r={op:"DEL",key:null,value:e};return this._addOperation(r,t)}}e.exports=s},"097a":function(e,t,r){"use strict";const n=self.crypto||self.msCrypto,{Buffer:i}=r("b639"),s=65536;function o(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}function a(e){const t=new Uint8Array(e);let r=0;if(e>0)if(e>s)while(re?(n.getRandomValues(t.subarray(r,r+(e-r))),r+=e-r):(n.getRandomValues(t.subarray(r,r+s)),r+=s);else n.getRandomValues(t);return i.from(t)}n&&n.getRandomValues?e.exports=a:e.exports=o},"09a4":function(e,t){function r(e){var t=e.length;return function(){var r=[].slice.call(arguments),n=this;if(r.length!==t+1||"function"!==typeof r[t])return e.apply(n,arguments);var i=r.pop();e.apply(this,r).then((function(e){i.call(n,null,e)}),(function(e){i.call(n,e)}))}}function n(e){return function(){var t=[].slice.call(arguments),r=this;if(!(t.length>=1&&"function"===typeof t[t.length-1]))return e.apply(r,arguments);var n=t.pop();e.apply(this,t).then((function(e){n.call(r,null,e)}),(function(e){n.call(r,e)}))}}e.exports=r,e.exports.variadic=n},"0a3d":function(e,t,r){"use strict";const n=r("e62b"),i=r("09a4");e.exports=function(e){return i(async()=>{const t=await e.repo.version();return{version:n.version,repo:t,commit:""}})}},"0a4a":function(e,t,r){"use strict";var n=r("4ea4"),i=n(r("a34a")),s=n(r("c973")),o=r("3337"),a=r("b0e4"),c=new o.ec("secp256k1");function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;return e.length===t?e:"0".repeat(t-e.length)+e}function l(e){var t=c.keyFromPrivate(e);return(function(){var e=(0,s.default)(i.default.mark((function e(r){var n,s,o,c;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.sign((0,a.sha256)(r)),s=n.r,o=n.s,c=n.recoveryParam,e.abrupt("return",{r:u(s.toString("hex")),s:u(o.toString("hex")),recoveryParam:c});case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())}e.exports=l},"0a86":function(e,t,r){"use strict";function n(e){return e}var i=r("64f1"),s=r("8e7a");e.exports=function(e,t){e=i(e)||n;var r={};return s((function(n){var i=e(n);return r[i]?!!t:(r[i]=!0,!t)}))}},"0ab6":function(e,t,r){var n=r("3053"),i=n.Global;function s(){return i.sessionStorage}function o(e){return s().getItem(e)}function a(e,t){return s().setItem(e,t)}function c(e){for(var t=s().length-1;t>=0;t--){var r=s().key(t);e(o(r),r)}}function u(e){return s().removeItem(e)}function l(){return s().clear()}e.exports={name:"sessionStorage",read:o,write:a,each:c,remove:u,clearAll:l}},"0aee":function(e,t,r){"use strict";class n{constructor(e){this.id=e,this._index=[]}get(){return this._index}async updateIndex(e,t){this._index=e.values}}e.exports=n},"0b0f":function(e,t,r){"use strict";e.exports="/mplex/6.7.0"},"0b0f7":function(e,t,r){var n=r("060c"),i=r("27de"),s=Object.prototype,o=s.hasOwnProperty;function a(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))o.call(e,r)&&"constructor"!=r&&t.push(r);return t}e.exports=a},"0b22":function(e,t,r){var n=r("cc29"),i=r("6f55"),s="[object AsyncFunction]",o="[object Function]",a="[object GeneratorFunction]",c="[object Proxy]";function u(e){if(!i(e))return!1;var t=n(e);return t==o||t==a||t==s||t==c}e.exports=u},"0b54":function(e,t,r){"use strict";const n=(e,t,r)=>new Promise((n,i)=>{if(r=Object.assign({concurrency:1/0},r),"function"!==typeof t)throw new TypeError("Mapper function is required");const{concurrency:s}=r;if(!("number"===typeof s&&s>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${s}\` (${typeof s})`);const o=[],a=e[Symbol.iterator]();let c=!1,u=!1,l=0,h=0;const f=()=>{if(c)return;const e=a.next(),r=h;if(h++,e.done)return u=!0,void(0===l&&n(o));l++,Promise.resolve(e.value).then(e=>t(e,r)).then(e=>{o[r]=e,l--,f()},e=>{c=!0,i(e)})};for(let e=0;er?1:0};var s=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},o=t.lowerBound=function(e,t){var r=s(e);return r?e[r]:t},a=t.lowerBoundInclusive=function(e){return!n(e,"gt")},c=t.upperBoundInclusive=function(e){return!n(e,"lt")},u=t.lowerBoundExclusive=function(e){return!a(e)},l=t.upperBoundExclusive=function(e){return!c(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},f=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function d(e){return e}t.start=function(e,t){return e.reverse?f(e,t):o(e,t)},t.end=function(e,t){return e.reverse?o(e,t):f(e,t)},t.startInclusive=function(e){return e.reverse?c(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):c(e)},t.toLtgt=function(e,r,i,s,o){r=r||{},i=i||d;var a=arguments.length>3,c=t.lowerBoundKey(e),u=t.upperBoundKey(e);return c?"gt"===c?r.gt=i(e.gt,!1):r.gte=i(e[c],!1):a&&(r.gte=i(s,!1)),u?"lt"===u?r.lt=i(e.lt,!0):r.lte=i(e[u],!0):a&&(r.lte=i(o,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),n(r,"max")&&delete r.max,n(r,"min")&&delete r.min,n(r,"start")&&delete r.start,n(r,"end")&&delete r.end,r},t.contains=function(e,n,i){i=i||t.compare;var s=o(e);if(r(s)){var a=i(n,s);if(a<0||0===a&&u(e))return!1}var c=f(e);if(r(c)){a=i(n,c);if(a>0||0===a&&l(e))return!1}return!0},t.filter=function(e,r){return function(n){return t.contains(e,n,r)}}}).call(this,r("b639").Buffer)},"0bac":function(e,t){e.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var e={},t=0;t>>t}function o(e,t){return n[e]&i[Math.min(t+e-1,7)]}e.exports=class{constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+8*this._currentBytePos}totalBits(){return 8*this._value.length}take(e){let t=e,r=0;while(t&&this._haveBits()){const e=this._value[this._currentBytePos],n=this._currentBitPos+1,i=Math.min(n,t),o=s(e,n-i,i);r=(r<7)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}}},"0bd9":function(e,t){t.getCallback=function(e,t){return"function"===typeof e?e:t},t.getOptions=function(e){return"object"===typeof e&&null!==e?e:{}}},"0bda":function(e,t,r){const n=r("1421"),i=(e,t)=>t,s=(e,t,r,n)=>{if(n&&!1===n.assumeHttp)return`tcp://${e}:${t}`;let i="tcp",s=`:${t}`;const o=r[r.length-1];return"tcp"===o.protocol&&(i=443===t?"https":"http",s=443===t||80===t?"":s),`${i}://${e}${s}`},o={ip4:i,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:`[${t}]`,tcp:(e,t,r,n,i)=>n.some(e=>["http","https","ws","wss"].includes(e.protocol))?`${e}:${t}`:s(e,t,n,i),udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e,t)=>n(e).stringTuples().map(e=>({protocol:n.protocols.codes[e[0]].name,content:e[1]})).reduce((e,r,n,i)=>{const s=o[r.protocol];if(!s)throw new Error(`Unsupported protocol ${r.protocol}`);return s(e,r.content,n,i,t)},"")},"0c4e":function(e,t,r){var n=r("d7d8"),i=r("e0c5").Buffer,s=r("5190"),o=r("c3bb"),a=r("ad17"),c=r("ff48"),u=r("72e8");function l(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i-1&&e%1==0&&e<=r}e.exports=n},"0c9a":function(e,t,r){"use strict";(function(n){const i=r("9efb"),s=r("ef89"),o=r("bd14"),a=r("1d74");t=e.exports,t.addPrefix=(e,t)=>{let r;if(n.isBuffer(e))r=a.varintBufferEncode(e);else{if(!s[e])throw new Error("multicodec not recognized");r=s[e]}return n.concat([r,t])},t.rmPrefix=e=>(i.decode(e),e.slice(i.decode.bytes)),t.getCodec=e=>{const t=a.varintBufferDecode(e),r=o[t.toString("hex")];if(void 0===r)throw new Error("Code `0x"+t.toString("hex")+"` not found");return r},t.getName=e=>o[e.toString(16)],t.getNumber=e=>{const t=s[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]},t.getCode=e=>i.decode(e),t.getCodeVarint=e=>{const t=s[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t},t.getVarint=e=>i.encode(e);const c=r("ac5c");Object.assign(t,c),t.print=r("ed71")}).call(this,r("b639").Buffer)},"0ca2":function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r("8d3ff"),a=r("289f"),c=r("3be2");class u{constructor(){this.data={}}async open(){}async put(e,t){this.data[e.toString()]=t}async get(e){const t=await this.has(e);if(!t)throw c.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:async()=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[]}}}query(e){let t=Object.entries(this.data);if(t=o(t,e=>({key:new a(e[0]),value:e[1]})),null!=e.prefix&&(t=n(t,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(t=e.filters.reduce((e,t)=>n(e,t),t)),Array.isArray(e.orders)&&(t=e.orders.reduce((e,t)=>i(e,t),t)),null!=e.offset){let r=0;t=n(t,()=>r++>=e.offset)}return null!=e.limit&&(t=s(t,e.limit)),!0===e.keysOnly&&(t=o(t,e=>({key:e.key}))),t}async close(){}}e.exports=u},"0cb2":function(e,t){e.exports=function(e){var t=function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e},r=function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}},n=function(e){return e.trim()};return e.replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(n).filter(Boolean).map(t).map(n).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(r())}},"0cc4":function(e,t,r){const n=r("df7c"),i=r("b8ba"),s=r("c807"),o=r("aea9"),a=o.create("orbit-db");async function c(e,t,r){let o,c=e.caches[t.directory]?e.caches[t.directory].cache:null;if(!c){const t=(n.posix||n).join(e.directory,r.root,r.path);if(i&&i.existsSync&&!i.existsSync(t))return;o=await e.storage.createStore(t),c=new s(o)}const u=await c.get("_localHeads");if(!u)return;const l=r.toString();a.debug("Attempting to migrate from old cache location");const h=["_remoteHeads","_localHeads","snapshot","queue"];for(const i in h)try{const e=n.join(l,h[i]),r=await c.get(h[i]);r&&await t.cache.set(e,r)}catch(f){a.debug(f.message)}await t.cache.set(n.join(l,"_manifest"),r.root),o&&await o.close()}o.setLogLevel("ERROR"),e.exports=c},"0d05":function(e,t,r){"use strict";class n extends Error{constructor(e){super(e),this.name="LockExistsError",this.code=n.code}}n.code="ERR_LOCK_EXISTS",t.LockExistsError=n;class i extends Error{constructor(e){super(e),this.name="NotFoundError",this.code=i.code}}i.code="ERR_NOT_FOUND",t.NotFoundError=i;class s extends Error{constructor(e){super(e),this.name="InvalidRepoVersionError",this.code=s.code}}s.code="ERR_INVALID_REPO_VERSION",t.InvalidRepoVersionError=s,t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED",t.ERR_REPO_ALREADY_OPEN="ERR_REPO_ALREADY_OPEN",t.ERR_REPO_ALREADY_CLOSED="ERR_REPO_ALREADY_CLOSED"},"0d07":function(e,t){const r="moderator-access",n="MODERATOR",i="MEMBER";class s{constructor(e,t){this._capabilityTypes=[n],this._write=[],this._firstModerator=e,this._write.push(this._firstModerator),this._members=Boolean(t.members),this._members&&this._capabilityTypes.push(i),this._encKeyId=t.encKeyId}static get type(){return r}isMod(e){return this._write.includes(e)}isValidCapability(e){return this._capabilityTypes.includes(e)}get firstModerator(){return this._firstModerator}async canAppend(e,t){const r=e.identity.id,i=e.payload.value.capability,s=e.payload.value.id,o=this.isMod(r),a=this.isValidCapability(i),c=async()=>t.verifyIdentity(e.identity);if(o&&a&&await c()){if(i===n){if(s===this.firstModerator)return!0;this._write.push(s)}return!0}return!1}async load(e){const t=e.split("/"),r=t.pop();this._members="members"===r;const n=r.includes("mod")?r:t.pop();this._firstModerator=n.split("_")[1]}async save(){let e=`${r}/mod_${this._firstModerator}`;e+=this._members?"/members":"";const t={address:e};return this._encKeyId&&(t.encKeyId=this._encKeyId),t}static async create(e,t={}){let r,n,i;if(t.address?(n=t.address.includes("members"),r=t.address.split("/")[1].split("_")[1],i=t.encKeyId):(n=t.members,r=t.firstModerator,i=t.encKeyId),!r)throw new Error("Moderator AC: firstModerator required");return new s(r,{members:n,encKeyId:i})}}e.exports=s},"0d0f":function(e,t){var r=function(e,t){var r=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(r="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(r="");var n=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return n&&(n=" ["+n+"]"),t.push((r?r+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+n+";"),t},n=function(e,t){t.push("message "+e.name+" {"),e.options||(e.options={}),o(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){t.push(i(e,[]))})),e.messages||(e.messages=[]),e.messages.forEach((function(e){t.push(n(e,[]))}));var s={};return e.fields||(e.fields=[]),e.fields.forEach((function(e){e.oneof?(s[e.oneof]||(s[e.oneof]=[]),s[e.oneof].push(r(e,[]))):t.push(r(e,[]))})),Object.keys(s).forEach((function(e){s[e].unshift("oneof "+e+" {"),s[e].push("}"),t.push(s[e])})),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var r=o(e.options,[]);return r.length>1&&t.push(r.slice(0,-1)),Object.keys(e.values).map((function(r){var n=s(e.values[r]);t.push([r+" = "+n+";"])})),t.push("}",""),t},s=function(e,t){var r=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");r&&(r=" ["+r+"]");var n=e.value+r;return n},o=function(e,t){var r=Object.keys(e);return r.forEach((function(r){var n=e[r];~r.indexOf(".")&&(r="("+r+")");var i=typeof n;"object"===i?(n=a(n,[]),n.length&&t.push("option "+r+" = {",n,"};")):("string"===i&&"optimize_for"!==r&&(n='"'+n+'"'),t.push("option "+r+" = "+n+";"))})),r.length>0&&t.push(""),t},a=function(e,t){var r=Object.keys(e);return r.forEach((function(r){var n=e[r],i=typeof n;"object"===i?Array.isArray(n)?n.forEach((function(e){e=a(e,[]),e.length&&t.push(r+" {",e,"}")})):(n=a(n,[]),n.length&&t.push(r+" {",n,"}")):("string"===i&&(n='"'+n+'"'),t.push(r+": "+n))})),t},c=function(e,t){return t.push("service "+e.name+" {"),e.options||(e.options={}),o(e.options,t),e.methods||(e.methods=[]),e.methods.forEach((function(e){t.push(u(e,[]))})),t.push("}",""),t},u=function(e,t){var r="rpc "+e.name+"(";e.client_streaming&&(r+="stream "),r+=e.input_type+") returns (",e.server_streaming&&(r+="stream "),r+=e.output_type+")",e.options||(e.options={});var n=o(e.options,[]);return n.length>1?t.push(r+" {",n.slice(0,-1),"}"):t.push(r+";"),t},l=function(e){return function(t){return Array.isArray(t)?t.map(l(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),o(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){i(e,t)})),e.messages||(e.messages=[]),e.messages.forEach((function(e){n(e,t)})),e.services&&e.services.forEach((function(e){c(e,t)})),t.map(l("")).join("\n")}},"0d8d":function(e,t,r){"use strict";e.exports={DENY_TTL:3e5,DENY_ATTEMPTS:5,DIAL_TIMEOUT:3e4,MAX_COLD_CALLS:50,MAX_PARALLEL_DIALS:100,QUARTER_HOUR:9e5,PRIORITY_HIGH:10,PRIORITY_LOW:20}},"0dad":function(e,t,r){"use strict";var n,i="object"===typeof window&&(window.crypto||window.msCrypto);n=i&&i.getRandomValues?function(e){return i.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r0)if(e>s)while(re?(n.getRandomValues(t.subarray(r,r+(e-r))),r+=e-r):(n.getRandomValues(t.subarray(r,r+s)),r+=s);else n.getRandomValues(t);return i.from(t)}n&&n.getRandomValues?e.exports=a:e.exports=o},"0e3e":function(e,t,r){"use strict";class n{constructor(e,t){this._refCounter=1,this.cid=e,this.priority=t||1}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){const e=this.cid.toString("base58btc");return`WantlistEntry `}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority}}e.exports=n},"0e54":function(e,t,r){var n=r("3053"),i=n.Global,s=n.trim;e.exports={name:"cookieStorage",read:a,write:u,each:c,remove:l,clearAll:h};var o=i.document;function a(e){if(!e||!f(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(o.cookie.replace(new RegExp(t),"$1"))}function c(e){for(var t=o.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(s(t[r])){var n=t[r].split("="),i=unescape(n[0]),a=unescape(n[1]);e(a,i)}}function u(e,t){e&&(o.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function l(e){e&&f(e)&&(o.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function h(){c((function(e,t){l(t)}))}function f(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(o.cookie)}},"0e54e":function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},"0e5c":function(e,t,r){var n=r("5995");r("31a0"),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(e){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var t=e;e=n.util.createBuffer();for(var r=0;r0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{this._j0=[0,0,0,0];while(r.length()>0)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];while(t.length()>0)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=e[n]>>>4*(7-r%8)&15,s=this._m[r][i];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,s=new Array(i),o=0;o>>1,i=new Array(r);i[n]=e.slice(0);var s=n>>>1;while(s>0)this.pow(i[2*s],i[s]=[]),s>>=1;s=2;while(s{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i("hash algorithm must be specified","ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(`multihash function '${e}' not yet supported`,"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},"0ead":function(e,t){var r=1e3,n=60*r,i=60*n,s=24*i,o=365.25*s;function a(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]),c=(t[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"days":case"day":case"d":return a*s;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}function c(e){return e>=s?Math.round(e/s)+"d":e>=i?Math.round(e/i)+"h":e>=n?Math.round(e/n)+"m":e>=r?Math.round(e/r)+"s":e+"ms"}function u(e){return l(e,s,"day")||l(e,i,"hour")||l(e,n,"minute")||l(e,r,"second")||e+" ms"}function l(e,t,r){if(!(e0)return a(e);if("number"===r&&!1===isNaN(e))return t.long?u(e):c(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},"0ebf":function(e,t,r){"use strict";const n=r("ba68"),i=r("d58b"),s=r("5fc2");e.exports=e=>t=>{t=t||{};const r=new n.PassThrough({objectMode:!0});return e({path:"refs/local",qs:t},(e,t)=>{if(e)return r.destroy(e);t.once("error",e=>r.destroy(e)),i(t,s.obj((function(e,t,r){r(null,{ref:e.Ref,err:e.Err})})),r)}),r}},"0eff":function(e,t,r){"use strict";(function(t){const n=r("c449"),i=r("f654"),s=r("ec12");class o{constructor(e,t,r){i(r,"A link requires a cid to point to"),this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new n(r)}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.Name}", size: ${this.Tsize}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=t.from(this._name),this._nameBuf)}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}}e.exports=s(o,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})}).call(this,r("b639").Buffer)},"0f0b":function(e,t,r){var n=r("7a03"),i="__lodash_hash_undefined__";function s(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?i:t,this}e.exports=s},"0f11":function(e,t,r){"use strict";var n=r("f40b"),i=r.n(n);i.a},"0f56":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("549e"),i=r("c1f1");function s(e,t,r,s,o){var a;e=n.arrayify(e),t=n.arrayify(t);var c,u,l=1,h=new Uint8Array(s),f=new Uint8Array(t.length+4);f.set(t);for(var d=1;d<=l;d++){f[t.length]=d>>24&255,f[t.length+1]=d>>16&255,f[t.length+2]=d>>8&255,f[t.length+3]=255&d;var p=n.arrayify(i.computeHmac(o,e,f));a||(a=p.length,u=new Uint8Array(a),l=Math.ceil(s/a),c=s-(l-1)*a),u.set(p);for(var y=1;y{const t=e.toString().split("/").pop();return"_access"===t?e:n.join(e,"/_access")};e.exports=i},"0f7e":function(e,t,r){"use strict";t.create=function(e,t,r){const n=r.storageBackends[e],i=Object.assign({},r.storageBackendOptions[e]||{});return new n(t,i)}},"0f8a":function(e,t,r){"use strict";e.exports=r("2bdd")},"0fc0":function(e,t,r){"use strict";(function(t){const n=r("ec12"),i=r("23bc"),s=r("0eff"),{serializeDAGNode:o}=r("f140"),a=r("adf6"),c=r("4706"),u=r("3e7a");class l{constructor(e,r=[],n=null){if(e||(e=t.alloc(0)),"string"===typeof e&&(e=t.from(e)),!t.isBuffer(e))throw new Error("Passed 'data' is not a buffer or a string!");if(null!==n&&"number"!==typeof n)throw new Error("Passed 'serializedSize' must be a number!");r=r.map(e=>s.isDAGLink(e)?e:s.util.createDagLinkFromB58EncodedHash(e)),r=i(r),this._data=e,this._links=r,this._serializedSize=n,this._size=null}toJSON(){return this._json||(this._json=Object.freeze({data:this.Data,links:this._links.map(e=>e.toJSON()),size:this.size})),Object.assign({},this._json)}toString(){return`DAGNode `}_invalidateCached(){this._serializedSize=null,this._size=null}addLink(e){return this._invalidateCached(),c(this,e)}rmLink(e){return this._invalidateCached(),u(this,e)}toDAGLink(e){return a(this,e)}serialize(){return o({Data:this._data,Links:this._links})}get size(){return null===this._size&&(null===this._serializedSize&&(this._serializedSize=this.serialize().length),this._size=this._links.reduce((e,t)=>e+t.Tsize,this._serializedSize)),this._size}set size(e){throw new Error("Can't set property: 'size' is immutable")}get Data(){return this._data}set Data(e){throw new Error("Can't set property: 'Data' is immutable")}get Links(){return this._links.map(e=>({Name:e.Name,Tsize:e.Tsize,Hash:e.Hash}))}set Links(e){throw new Error("Can't set property: 'Links' is immutable")}}e.exports=n(l,{className:"DAGNode",symbolName:"@ipld/js-ipld-dag-pb/dagnode"})}).call(this,r("b639").Buffer)},10:function(e,t){},1005:function(e,t,r){"use strict";(function(t){const n=r("021d"),i=r("87dd"),s="/",o=t.from(s),a=o[0];class c{constructor(e,r){if("string"===typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==r&&(r=!0),r&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new h(e.join(s))}static random(){return new h(n().replace(/-/g,""))}clean(){this._buf&&0!==this._buf.length||(this._buf=t.from(s)),this._buf[0]!==a&&(this._buf=t.concat([o,this._buf]));while(this._buf.length>1&&this._buf[this._buf.length-1]===a)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;ni)return!1}return t.length{const c=s[e];if(!c)return a(new Error("unkown cipherType passed"));if(!r)return a(new Error("unkown hashType passed"));const u=c.keySize,l=c.ivSize,h=20,f=t.from("key expansion"),d=2*(l+u+h);i.create(r,o,(e,r)=>{if(e)return a(e);r.digest(f,(e,i)=>{if(e)return a(e);const s=[];let o=0;function c(e){r.digest(t.concat([i,f]),(t,n)=>{if(t)return e(t);let a=n.length;o+a>d&&(a=d-o),s.push(n),o+=a,r.digest(i,(t,r)=>{if(t)return e(t);i=r,e()})})}function h(e){if(e)return a(e);const r=d/2,n=t.concat(s),i=n.slice(0,r),o=n.slice(r,d),c=e=>({iv:e.slice(0,l),cipherKey:e.slice(l,l+u),macKey:e.slice(l+u)});a(null,{k1:c(i),k2:c(o)})}n(()=>o{const t=new n.Encoder;return new i("/"+t.write(e.buffer).finalize(),!1)},t.keyToCid=t=>{const r=new n.Decoder,i=r.write(t.toString().slice(1)).finalize();return new s(e.from(i))}}).call(this,r("b639").Buffer)},"10b2":function(e,t,r){"use strict";(function(t){var n=r("4ea4"),i=n(r("970b")),s=n(r("5bc3")),o=r("f002"),a=o.HDNode,c=r("f28a");c.util=r("427a");var u=r("a886").SimpleSigner,l=r("aaed"),h=l.sha256,f=r("3337").ec,d=new f("secp256k1"),p=r("a4d1"),y=p.randomNonce,g=p.symEncryptBase,m=p.symDecryptBase,b="m/7696500'/0'/0'",v="m/44'/60'/0'/0",w=function(){function e(r){(0,i["default"])(this,e),this._seed=r;var n=a.fromSeed(this._seed),s=n.derivePath(b);this.signingKey=s.derivePath("0");var o=t.from(s.derivePath("2").privateKey.slice(2),"hex");this.asymEncryptionKey=c.box.keyPair.fromSecretKey(new Uint8Array(o)),this.symEncryptionKey=new Uint8Array(t.from(s.derivePath("3").privateKey.slice(2),"hex")),this.ethereumKey=n.derivePath(v).derivePath("0")}return(0,s["default"])(e,[{key:"asymEncrypt",value:function(e,t,r){r=r||y(),t=c.util.decodeBase64(t),"string"===typeof e&&(e=c.util.decodeUTF8(e));var n=c.box.keyPair(),i=c.box(e,r,t,n.secretKey);return{nonce:c.util.encodeBase64(r),ephemeralFrom:c.util.encodeBase64(n.publicKey),ciphertext:c.util.encodeBase64(i)}}},{key:"asymDecrypt",value:function(e,r,n,i){r=c.util.decodeBase64(r),e=c.util.decodeBase64(e),n=c.util.decodeBase64(n);var s=c.box.open(e,n,r,this.asymEncryptionKey.secretKey);return i?s?t.from(s):null:s?c.util.encodeUTF8(s):null}},{key:"symEncrypt",value:function(e,t){return g(e,this.symEncryptionKey,t)}},{key:"symDecrypt",value:function(e,t,r){return m(e,this.symEncryptionKey,t,r)}},{key:"getJWTSigner",value:function(){return u(this.signingKey.privateKey.slice(2))}},{key:"getDBSalt",value:function(){return h(this.signingKey.derivePath("0").privateKey.slice(2))}},{key:"getPublicKeys",value:function(t){var r=this.signingKey.publicKey.slice(2),n=this.ethereumKey.publicKey.slice(2);return t&&(r=e.uncompress(r),n=e.uncompress(n)),{signingKey:r,ethereumKey:n,asymEncryptionKey:c.util.encodeBase64(this.asymEncryptionKey.publicKey)}}},{key:"serialize",value:function(){return this._seed}}],[{key:"uncompress",value:function(e){return d.keyFromPublic(t.from(e,"hex")).getPublic(!1,"hex")}}]),e}();e.exports=w}).call(this,r("b639").Buffer)},"10d4":function(e,t,r){"use strict";const n=r("df7c"),i=r("3c43"),s=r("021d");t.filter=(e,t)=>async function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},"10d9":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r("2835"),i=r("7ce5"),s=r("aaf3"),o=()=>{},a=new i.TimeoutError;class c extends n{constructor(e){if(super(),Object.defineProperty(this,"_carryoverConcurrencyCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isIntervalIgnored",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_intervalCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_intervalCap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_interval",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_intervalEnd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_intervalId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_queueClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pendingCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_concurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isPaused",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolveEmpty",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_resolveIdle",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_throwOnTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:s.default},e),!("number"===typeof e.intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{this._onResumeInterval()},t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this._queue.dequeue()(),e&&this._initializeIntervalIfNeeded(),!0}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){while(this._tryToStartAnother());}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"===typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,t={}){return new Promise((r,n)=>{const s=async()=>{this._pendingCount++,this._intervalCount++;try{const s=void 0===this._timeout&&void 0===t.timeout?e():i.default(Promise.resolve(e()),void 0===t.timeout?this._timeout:t.timeout,()=>{(void 0===t.throwOnTimeout?this._throwOnTimeout:t.throwOnTimeout)&&n(a)});r(await s)}catch(s){n(s)}this._next()};this._queue.enqueue(s,t),this._tryToStartAnother()})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}})}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}})}get size(){return this._queue.size}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}set timeout(e){this._timeout=e}get timeout(){return this._timeout}}t.default=c},11:function(e,t){},1100:function(e,t,r){"use strict";var n=r("1631");e.exports=function(e,t,r){r||(r=t,t=null);var i=n((function(r){t=e(t,r)}),(function(e){r(e,t)}));return 2===arguments.length?function(e){e(null,(function(n,s){if(n)return r(!0===n?null:n);t=s,i(e)}))}:i}},"111a":function(e,t,r){"use strict";(function(e){const n=r("aac2"),i=r("0dec"),s=r("463c"),o=r("7b6d").Key,a=new o("version");async function c(e){if(!await i.isRepoInitialized(e))throw new n.NotInitializedRepoError(`Repo in path ${e} is not initialized!`);const t=new s(e,{extension:"",createIfMissing:!1});await t.open();const r=parseInt(await t.get(a));return await t.close(),r}async function u(t,r){const n=new s(t,{extension:"",createIfMissing:!1});await n.open(),await n.put(a,e.from(String(r))),await n.close()}t.getVersion=c,t.setVersion=u}).call(this,r("b639").Buffer)},1148:function(e,t,r){"use strict";var n=r("a691"),i=r("1d80");e.exports="".repeat||function(e){var t=String(i(this)),r="",s=n(e);if(s<0||s==1/0)throw RangeError("Wrong number of repetitions");for(;s>0;(s>>>=1)&&(t+=t))1&s&&(r+=t);return r}},"114e":function(e,t){e.exports=function(e,t){var r=e&&(e.removeEventListener||e.removeListener);function n(){"function"==typeof r&&(r.call(e,"open",i),r.call(e,"error",s))}function i(e){n(),t()}function s(e){n(),t(e)}return e.readyState>=2?t(!0):1===e.readyState?t():(e.addEventListener("open",i),void e.addEventListener("error",s))}},"11b0":function(e,t,r){function n(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}r("a4d3"),r("e01a"),r("d28b"),r("a630"),r("e260"),r("d3b7"),r("25f0"),r("3ca3"),r("ddb0"),e.exports=n},"11b1":function(e,t,r){"use strict";const n=/^((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))+$/,i=/((\d+(\.\d+)*)(ns|ms|us|µs|m|s|h))/g,s=/(ns|ms|us|µs|m|s|h)/g,o={ns:1e-6,us:.001,"µs":.001,ms:1,s:1e3,m:6e4,h:36e5};function a(e){let t=e.match(s)[0];return e=e.substring(0,e.length-t.length),parseFloat(e)*o[t]}e.exports=function(e){if("string"!==typeof e)throw new Error("the first argument must be a string");if(!n.test(e))throw new Error("invalid time");return e.match(i).reduce((e,t)=>e+a(t),0)}},"11ca":function(e,t,r){"use strict";const n=r("1c7ef"),i=n.cloneLinks,s=n.cloneData,o=n.toDAGLink,a=r("334b"),c=r("02f2"),u=r("70cf"),l=async e=>a.isDAGLink(e)?e:c.isDAGNode(e)?o(e,{}):new a(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid),h=async(e,t)=>{const r=i(e),n=s(e),o=await l(t);return r.push(o),u(n,r)};e.exports=h},"11ce":function(e,t,r){(function(t){var n,i=r("2655");n="function"===typeof setImediate?setImediate:"object"===typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)};var s=[];function o(e){if(!(this instanceof o))return"function"===typeof e?new o(e):a();var t,r=!1,c=!1,u=[],l=!1;function h(e){u.length?(l=!0,u.shift()(e||!1)):l=!1}function f(e,i){return new o((function(s){function o(r){var o=c?e:i;if("function"===typeof o){function a(){var e;try{e=o(t)}catch(r){return s.reject(r),h()}s.fulfill(e),h(!0)}r?a():n(a)}else c?(s.fulfill(t),h(r)):(s.reject(t),h(r))}u.push(o),r&&!l&&h()}))}this.then=f,function(){function n(e){r||(i(e)?e.then(n,o):(r=c=!0,t=e,h()))}function o(e){r||(r=!0,c=!1,t=e,h())}for(var a={fulfill:n,reject:o},u=0;u{let r=i.deserialize(e);const s=t.split("/").filter(Boolean);while(s.length){const e=s.shift();if(void 0===r[e]){for(const t of r.Links)if(t.Name===e)return{value:t.Hash,remainderPath:s.join("/")};throw new Error(`Object has no property '${e}'`)}if(r=r[e],n.isCID(r))return{value:r,remainderPath:s.join("/")}}return{value:r,remainderPath:""}},t.tree=function*(e){const t=i.deserialize(e);yield"Data",yield"Links";for(let r=0;r",edges:" -> "}},13:function(e,t){},1304:function(e,t,r){"use strict";const n=r("8724"),i=r("609c"),s=r("59c5"),o=r("e730");t.Key=n,t.MemoryDatastore=i,t.utils=s,t.Errors=o},"131a":function(e,t,r){var n=r("23e7"),i=r("d2bb");n({target:"Object",stat:!0},{setPrototypeOf:i})},"131d":function(e,t,r){"use strict";const n=r("83fd").Errors,i=r("34eb")("datastore:core:tiered");class s{constructor(e){this.stores=e.slice()}async open(){try{await this.stores.map(e=>e.open())}catch(e){throw n.dbOpenFailedError()}}async put(e,t){try{await Promise.all(this.stores.map(r=>r.put(e,t)))}catch(r){throw n.dbWriteFailedError()}}async get(e){for(const r of this.stores)try{const t=await r.get(e);if(t)return t}catch(t){i(t)}throw n.notFoundError()}has(e){return new Promise(async t=>{await Promise.all(this.stores.map(async r=>{const n=await r.has(e);n&&t(!0)})),t(!1)})}async delete(e){try{await Promise.all(this.stores.map(t=>t.delete(e)))}catch(t){throw n.dbDeleteFailedError()}}async close(){await Promise.all(this.stores.map(e=>e.close()))}batch(){const e=this.stores.map(e=>e.batch());return{put:(t,r)=>{e.forEach(e=>e.put(t,r))},delete:t=>{e.forEach(e=>e.delete(t))},commit:async()=>{for(const t of e)await t.commit()}}}query(e){return this.stores[this.stores.length-1].query(e)}}e.exports=s},"132c":function(e,t,r){var n=r("5995");r("31a0"),r("8f53"),r("1b43");var i=e.exports=n.pkcs1=n.pkcs1||{};function s(e,t,r){r||(r=n.md.sha1.create());for(var i="",s=Math.ceil(t/r.digestLength),o=0;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,o,a,c;"string"===typeof r?(i=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var u=Math.ceil(e.n.bitLength()/8),l=u-2*a.digestLength-2;if(t.length>l){var h=new Error("RSAES-OAEP input message length is too long.");throw h.length=t.length,h.maxLength=l,h}i||(i=""),a.update(i,"raw");for(var f=a.digest(),d="",p=l-t.length,y=0;y{const o=new n("directory"),a=new s(o.marshal(),[]),c=await i(a,t,r),u=e.path;return{cid:c,path:u,unixfs:o,node:a}};e.exports=o},1364:function(e){e.exports=JSON.parse('{"sha1":{"securityStrength":128,"outlen":160,"seedlen":440},"sha224":{"securityStrength":192,"outlen":224,"seedlen":440},"sha256":{"securityStrength":256,"outlen":256,"seedlen":440},"sha384":{"securityStrength":256,"outlen":384,"seedlen":888},"sha512":{"securityStrength":256,"outlen":512,"seedlen":888}}')},"13b0":function(e,t,r){(function(t,n){var i=r("53a8"),s=r("3eed"),o=r("46be"),a=r("7804"),c=Object.prototype.hasOwnProperty,u="start end gt gte lt lte".split(" ");function l(e){this.status="new",this.supports=s(e,{status:!0})}function h(e,t){var r={};for(var n in t)if(c.call(t,n)){var i=t[n];f(n)&&(i=e._serializeKey(i)),r[n]=i}return r}function f(e){return-1!==u.indexOf(e)}l.prototype.open=function(e,t){var r=this,n=this.status;if("function"===typeof e&&(t=e),"function"!==typeof t)throw new Error("open() requires a callback argument");"object"===typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,(function(e){if(e)return r.status=n,t(e);r.status="open",t()}))},l.prototype._open=function(e,r){t.nextTick(r)},l.prototype.close=function(e){var t=this,r=this.status;if("function"!==typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close((function(n){if(n)return t.status=r,e(n);t.status="closed",e()}))},l.prototype._close=function(e){t.nextTick(e)},l.prototype.get=function(e,r,n){if("function"===typeof r&&(n=r),"function"!==typeof n)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"===typeof r&&null!==r||(r={}),r.asBuffer=!1!==r.asBuffer,this._get(e,r,n)},l.prototype._get=function(e,r,n){t.nextTick((function(){n(new Error("NotFound"))}))},l.prototype.put=function(e,r,n,i){if("function"===typeof n&&(i=n),"function"!==typeof i)throw new Error("put() requires a callback argument");var s=this._checkKey(e)||this._checkValue(r);if(s)return t.nextTick(i,s);e=this._serializeKey(e),r=this._serializeValue(r),"object"===typeof n&&null!==n||(n={}),this._put(e,r,n,i)},l.prototype._put=function(e,r,n,i){t.nextTick(i)},l.prototype.del=function(e,r,n){if("function"===typeof r&&(n=r),"function"!==typeof n)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"===typeof r&&null!==r||(r={}),this._del(e,r,n)},l.prototype._del=function(e,r,n){t.nextTick(n)},l.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"===typeof r&&(n=r),"function"===typeof e&&(n=e),"function"!==typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(n,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(n);"object"===typeof r&&null!==r||(r={});for(var s=new Array(e.length),o=0;o(n(`New MFS root will be ${t}`),await e.repo.datastore.put(i,t.buffer),t);e.exports=s},14:function(e,t){},1405:function(e,t,r){"use strict";var n=r("4ea4"),i=n(r("a34a")),s=n(r("c973")),o=n(r("dfb7")),a=n(r("427a"));function c(e){return a.default.encodeBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function u(e){var t=a.default.decodeBase64(e);return(function(){var e=(0,s.default)(i.default.mark((function e(r){return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",c(o.default.sign.detached(a.default.decodeUTF8(r),t)));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())}e.exports=u},1421:function(e,t,r){"use strict";(function(t){const n=r("37c4"),i=r("1e83"),s=r("9efb"),o=r("e5af"),a=r("87dd"),c=a.proto((function(e){if(!(this instanceof c))return new c(e);if(null==e&&(e=""),e instanceof t)this.buffer=n.fromBuffer(e);else if("string"===typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=n.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=n.fromBuffer(e.buffer)}}),{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});c.prototype.toString=function(){return n.bufferToString(this.buffer)},c.prototype.toJSON=c.prototype.toString,c.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=t[4],e},c.prototype.inspect=function(){return""},c.prototype.protos=function(){return this.protoCodes().map(e=>Object.assign({},i(e)))},c.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;while(re.name)},c.prototype.tuples=function(){return n.bufferToTuples(this.buffer)},c.prototype.stringTuples=function(){const e=n.bufferToTuples(this.buffer);return n.tuplesToStringTuples(e)},c.prototype.encapsulate=function(e){return e=c(e),c(this.toString()+e.toString())},c.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return c(t.slice(0,r))},c.prototype.getPeerId=function(){let e=null;try{const t=this.stringTuples().filter(e=>{if(e[0]===i.names.ipfs.code)return!0});e=t.pop()[1],o.decode(e)}catch(t){e=null}return e},c.prototype.getPath=function(){let e=null;try{e=this.stringTuples().filter(e=>{const t=i(e[0]);if(t.path)return!0})[0][1]}catch(t){e=null}return e},c.prototype.equals=function(e){return this.buffer.equals(e.buffer)},c.prototype.nodeAddress=function(){const e=this.protoCodes(),t=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:r[3]}},c.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");const r="IPv6"===e.family?"ip6":"ip4";return c("/"+[r,e.address,t,e.port].join("/"))},c.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))},c.protocols=i,c.isName=function(e){return!!c.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},c.resolve=function(e,t){return c.isMultiaddr(e)&&c.isName(e)?t(new Error("not implemented yet")):t(new Error("not a valid name"))},e.exports=c}).call(this,r("b639").Buffer)},1428:function(e,t,r){function n(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function i(e){var r;function i(){if(i.enabled){var e=i,n=+new Date,s=n-(r||n);e.diff=s,e.prev=r,e.curr=n,r=n;for(var o=new Array(arguments.length),a=0;a100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]),u=(t[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return c*a;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*s;case"hours":case"hour":case"hrs":case"hr":case"h":return c*i;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}function u(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=i?Math.round(e/i)+"h":t>=n?Math.round(e/n)+"m":t>=r?Math.round(e/r)+"s":e+"ms"}function l(e){var t=Math.abs(e);return t>=s?h(e,t,s,"day"):t>=i?h(e,t,i,"hour"):t>=n?h(e,t,n,"minute"):t>=r?h(e,t,r,"second"):e+" ms"}function h(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return c(e);if("number"===r&&isFinite(e))return t.long?l(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},"14ec":function(e,t,r){var n=r("8327");function i(e,t,r){var n=e[t]+e[r],i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function s(e,t,r,n){var i=e[t]+r;r<0&&(i+=4294967296);var s=e[t+1]+n;i>=4294967296&&s++,e[t]=i,e[t+1]=s}function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,o,a){var c=f[o],u=f[o+1],l=f[a],d=f[a+1];i(h,e,t),s(h,e,c,u);var p=h[n]^h[e],y=h[n+1]^h[e+1];h[n]=y,h[n+1]=p,i(h,r,n),p=h[t]^h[r],y=h[t+1]^h[r+1],h[t]=p>>>24^y<<8,h[t+1]=y>>>24^p<<8,i(h,e,t),s(h,e,l,d),p=h[n]^h[e],y=h[n+1]^h[e+1],h[n]=p>>>16^y<<16,h[n+1]=y>>>16^p<<16,i(h,r,n),p=h[t]^h[r],y=h[t+1]^h[r+1],h[t]=y>>>31^p<<1,h[t+1]=p>>>31^y<<1}var c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],l=new Uint8Array(u.map((function(e){return 2*e}))),h=new Uint32Array(32),f=new Uint32Array(32);function d(e,t){var r=0;for(r=0;r<16;r++)h[r]=e.h[r],h[r+16]=c[r];for(h[24]=h[24]^e.t,h[25]=h[25]^e.t/4294967296,t&&(h[28]=~h[28],h[29]=~h[29]),r=0;r<32;r++)f[r]=o(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,l[16*r+0],l[16*r+1]),a(2,10,18,26,l[16*r+2],l[16*r+3]),a(4,12,20,28,l[16*r+4],l[16*r+5]),a(6,14,22,30,l[16*r+6],l[16*r+7]),a(0,10,20,30,l[16*r+8],l[16*r+9]),a(2,12,22,24,l[16*r+10],l[16*r+11]),a(4,14,16,26,l[16*r+12],l[16*r+13]),a(6,8,18,28,l[16*r+14],l[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^h[r]^h[r+16]}function p(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},n=0;n<16;n++)r.h[n]=c[n];var i=t?t.length:0;return r.h[0]^=16842752^i<<8^e,t&&(y(r,t),r.c=128),r}function y(e,t){for(var r=0;r>2]>>8*(3&r);return t}function m(e,t,r){r=r||64,e=n.normalizeInput(e);var i=p(r,t);return y(i,e),g(i)}function b(e,t,r){var i=m(e,t,r);return n.toHex(i)}e.exports={blake2b:m,blake2bHex:b,blake2bInit:p,blake2bUpdate:y,blake2bFinal:g}},15:function(e,t){},1514:function(e,t){e.exports=function(e,t,r){r=r||0;for(var n=0,i=-1,s=r;s-1&&e.length-i=32)return u(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),u(),e()}))}function c(){if(t.pools[0].messageLength>=32)return u();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),u()}function u(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r===0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function l(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var s=n.util.createBuffer();if(t)while(s.length()>16),l+=(32767&u)<<16,l+=u>>15,l=(2147483647&l)+(l>>31),f=4294967295&l;for(c=0;c<3;++c)h=f>>>(c<<3),h^=Math.floor(256*Math.random()),s.putByte(String.fromCharCode(255&h))}}return s.getBytes(e)}return t.pools=s,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,s=t.plugin.increment,o=t.plugin.formatKey,c=t.plugin.formatSeed,u=n.util.createBuffer();function l(h){if(h)return r(h);if(u.length()>=e)return r(null,u.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return n.util.nextTick((function(){a(l)}));var f=i(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=o(i(t.key,s(t.seed))),t.seed=c(i(t.key,t.seed)),n.util.setImmediate(l)}t.key=null,l()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;var a=n.util.createBuffer();while(a.length()1048575&&(t.key=null),null===t.key&&c();var u=r(t.key,t.seed);t.generated+=u.length,a.putBytes(u),t.key=s(r(t.key,i(t.seed))),t.seed=o(r(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(r){t(r)}},t.seedFileSync=l),t.collect=function(e){for(var r=e.length,n=0;n>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var r=function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))};e.addEventListener("message",r)}},t}}).call(this,r("4362"))},1547:function(e,t){function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}e.exports=r},"157d":function(e,t,r){"use strict";var n=r("8638"),i=r("5fbf"),s=r("7d44"),o=r("9e13")||0;function a(t){return n.seed(t),e.exports}function c(t){return o=t,e.exports}function u(e){return void 0!==e&&n.characters(e),n.shuffled()}function l(){return i(o)}e.exports=l,e.exports.generate=l,e.exports.seed=a,e.exports.worker=c,e.exports.characters=u,e.exports.isValid=s},1587:function(e,t,r){"use strict";const n=r("d3fa"),i=r("faa1");e.exports=e=>{const t=Object.assign(new i,{incoming:r("in"),outgoing:r("out")});return e.on("peer-mux-established",e=>{t.emit("peer:connected",e.id.toB58String())}),e.on("peer-mux-closed",e=>{t.emit("peer:closed",e.id.toB58String())}),t;function r(e){return(t,r,i)=>n(n=>(s(i,t,r,e,n.length),n))}function s(e,r,n,i,s){e.then(e=>{if(e){const o=e.id.toB58String();t.emit("message",o,r,n,i,s)}})}}},"159b":function(e,t,r){var n=r("da84"),i=r("fdbc"),s=r("17c2"),o=r("9112");for(var a in i){var c=n[a],u=c&&c.prototype;if(u&&u.forEach!==s)try{o(u,"forEach",s)}catch(l){u.forEach=s}}},"15f0":function(e,t,r){"use strict";const n=r("fdab");e.exports=(e,t)=>{const r=[];return n(e,(e,n,i)=>Promise.resolve(t(n,i)).then(e=>{r.push(e)})).then(()=>r)}},16:function(e,t){},1629:function(e,t,r){"use strict";function n(e){return e}var i=r("b6d6"),s=r("76c0");e.exports=function(e,t){e=i(e)||n;var r={};return s((function(n){var i=e(n);return r[i]?!!t:(r[i]=!0,!t)}))}},1631:function(e,t,r){"use strict";e.exports=function(e,t){var r,n;function i(s){if(r=s,n)return i.abort();(function i(){var s=!0,o=!1;while(s)if(o=!1,r(null,(function(a,c){if(o=!0,a=a||n){if(s=!1,t)t(!0===a?null:a);else if(a&&!0!==a)throw a}else e&&!1===e(c)||n?(s=!1,r(n||!0,t||function(){})):s||i()})),!o)return void(s=!1)})()}return i.abort=function(e,t){if("function"==typeof e&&(t=e,e=!0),n=e||!0,r)return r(n,t||function(){})},i}},1652:function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r("8281"),a=r("220c"),c=r("e5c1");class u{constructor(){this.data={}}async open(){}async put(e,t){this.data[e.toString()]=t}async get(e){const t=await this.has(e);if(!t)throw c.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:async()=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[]}}}query(e){let t=Object.entries(this.data);if(t=o(t,e=>({key:new a(e[0]),value:e[1]})),null!=e.prefix&&(t=n(t,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(t=e.filters.reduce((e,t)=>n(e,t),t)),Array.isArray(e.orders)&&(t=e.orders.reduce((e,t)=>i(e,t),t)),null!=e.offset){let r=0;t=n(t,()=>r++>=e.offset)}return null!=e.limit&&(t=s(t,e.limit)),!0===e.keysOnly&&(t=o(t,e=>({key:e.key}))),t}async close(){}}e.exports=u},"169a":function(e,t,r){"use strict";(function(t,n){const i=r("7048"),s=r(17),o=r("4bc2")("ipfs:mfs:utils:to-async-iterator"),{MAX_CHUNK_SIZE:a}=r("a9f3"),c=e=>{if(!e)throw i(new Error("paths must start with a leading /"),"ERR_INVALID_PATH");if("string"===typeof e||e instanceof String)return o("Content was a path"),s.createReadStream(e);if(e.length)return o("Content was array-like"),{[Symbol.asyncIterator]:function*(){yield e}};if(e[Symbol.asyncIterator])return o("Content was an async iterator"),e;if(e[Symbol.iterator])return o("Content was an iterator"),e;if(t.Blob&&e instanceof t.Blob){o("Content was an HTML5 Blob");let r=0;const i={next:()=>r>e.size?{done:!0}:new Promise((i,s)=>{const o=e.slice(r,a);r+=a;const c=new t.FileReader,u=e=>{if(c.removeEventListener("loadend",u,!1),e.error)return s(e.error);i({done:!1,value:n.from(c.result)})};c.addEventListener("loadend",u),c.readAsArrayBuffer(o)})};return{[Symbol.asyncIterator]:()=>i}}throw i(new Error(`Don't know how to convert ${e} into an async iterator`),"ERR_INVALID_PARAMS")};e.exports=c}).call(this,r("c8ba"),r("b639").Buffer)},"16e2":function(e,t,r){"use strict";(function(t){const n=r("b13c"),i=r("e009"),s=r("91f6"),o=r("cdc1"),a=s.toCallback,c=s.toBuf,u=s.fromString,l=s.fromNumberTo32BitBuf,h=(e,r)=>{o.sha2256(e,(e,n)=>{e&&r(e),o.sha2256(t.from(n),r)})};e.exports={sha1:o.sha1,sha2256:o.sha2256,sha2512:o.sha2512,sha3512:a(c(n.sha3_512)),sha3384:a(c(n.sha3_384)),sha3256:a(c(n.sha3_256)),sha3224:a(c(n.sha3_224)),shake128:a(c(n.shake_128,128)),shake256:a(c(n.shake_256,256)),keccak224:a(c(n.keccak_224)),keccak256:a(c(n.keccak_256)),keccak384:a(c(n.keccak_384)),keccak512:a(c(n.keccak_512)),murmur3128:a(c(u(i.x64.hash128))),murmur332:a(l(u(i.x86.hash32))),addBlake:r("5754"),dblSha2256:h}}).call(this,r("b639").Buffer)},"16fe":function(e,t,r){"use strict";e.exports=function(){return function(e,t){t(!0)}}},17:function(e,t){},1711:function(e,t,r){var n=r("918b");function i(e,t){var r=function(){return new n.des.Algorithm(e,t)};n.cipher.registerAlgorithm(e,r)}r("083e"),r("70c8"),r("5ee0"),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=y({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return y({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return p(r._keys,e,t,!1)},decrypt:function(e,t){return p(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=d(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],h=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function d(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,w=0;w>>4^E),E^=t,_^=t<<4,t=65535&(E>>>-16^_),_^=t,E^=t<<-16,t=858993459&(_>>>2^E),E^=t,_^=t<<2,t=65535&(E>>>-16^_),_^=t,E^=t<<-16,t=1431655765&(_>>>1^E),E^=t,_^=t<<1,t=16711935&(E>>>8^_),_^=t,E^=t<<8,t=1431655765&(_>>>1^E),E^=t,_^=t<<1,t=_<<8|E>>>20&240,_=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=t;for(var S=0;S>>26,E=E<<2|E>>>26):(_=_<<1|_>>>27,E=E<<1|E>>>27),_&=-15,E&=-15;var k=r[_>>>28]|n[_>>>24&15]|i[_>>>20&15]|s[_>>>16&15]|o[_>>>12&15]|a[_>>>8&15]|c[_>>>4&15],C=u[E>>>28]|l[E>>>24&15]|h[E>>>20&15]|f[E>>>16&15]|d[E>>>12&15]|p[E>>>8&15]|y[E>>>4&15];t=65535&(C>>>16^k),m[v++]=k^t,m[v++]=C^t<<16}}return m}function p(e,t,r,n){var i,d,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];d=252645135&(y>>>4^g),g^=d,y^=d<<4,d=65535&(y>>>16^g),g^=d,y^=d<<16,d=858993459&(g>>>2^y),y^=d,g^=d<<2,d=16711935&(g>>>8^y),y^=d,g^=d<<8,d=1431655765&(y>>>1^g),g^=d,y^=d<<1,y=y<<1|y>>>31,g=g<<1|g>>>31;for(var m=0;m>>4|g<<28)^e[w+1];d=y,y=g,g=d^(o[_>>>24&63]|c[_>>>16&63]|l[_>>>8&63]|f[63&_]|s[E>>>24&63]|a[E>>>16&63]|u[E>>>8&63]|h[63&E])}d=y,y=g,g=d}y=y>>>1|y<<31,g=g>>>1|g<<31,d=1431655765&(y>>>1^g),g^=d,y^=d<<1,d=16711935&(g>>>8^y),y^=d,g^=d<<8,d=858993459&(g>>>2^y),y^=d,g^=d<<2,d=65535&(y>>>16^g),g^=d,y^=d<<16,d=252645135&(y>>>4^g),g^=d,y^=d<<4,r[0]=y,r[1]=g}function y(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),i="DES-"+r;t=e.decrypt?n.cipher.createDecipher(i,e.key):n.cipher.createCipher(i,e.key);var s=t.start;return t.start=function(e,r){var i=null;r instanceof n.util.ByteBuffer&&(i=r,r={}),r=r||{},r.output=i,r.iv=e,s.call(t,r)},t}},1727:function(e,t,r){"use strict";(function(e){var r=Object.prototype.toString;t.isArray=function(e,t){if(!Array.isArray(e))throw TypeError(t)},t.isBoolean=function(e,t){if("[object Boolean]"!==r.call(e))throw TypeError(t)},t.isBuffer=function(t,r){if(!e.isBuffer(t))throw TypeError(r)},t.isFunction=function(e,t){if("[object Function]"!==r.call(e))throw TypeError(t)},t.isNumber=function(e,t){if("[object Number]"!==r.call(e))throw TypeError(t)},t.isObject=function(e,t){if("[object Object]"!==r.call(e))throw TypeError(t)},t.isBufferLength=function(e,t,r){if(e.length!==t)throw RangeError(r)},t.isBufferLength2=function(e,t,r,n){if(e.length!==t&&e.length!==r)throw RangeError(n)},t.isLengthGTZero=function(e,t){if(0===e.length)throw RangeError(t)},t.isNumberInInterval=function(e,t,r,n){if(e<=t||e>=r)throw RangeError(n)}}).call(this,r("b639").Buffer)},"173c":function(e,t,r){"use strict";(function(t){const n=r("ac9f"),i=r("f106"),s=r("e5af"),o=r("5e57"),a=i(r("437b"));class c{constructor(e){this._key=y(e,o.publicKeyLength)}verify(e,t,r){p(r),o.hashAndVerify(this._key,t,e,r)}marshal(){return t.from(this._key)}get bytes(){return a.PublicKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){p(e),n(this.bytes,"sha2-256",e)}}class u{constructor(e,t){this._key=y(e,o.privateKeyLength),this._publicKey=y(t,o.publicKeyLength)}sign(e,t){p(t),o.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new c(this._publicKey)}marshal(){return t.concat([t.from(this._key),t.from(this._publicKey)])}get bytes(){return a.PrivateKey.encode({Type:a.KeyType.Ed25519,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){p(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,s.encode(r))})}}function l(e,t){try{e=y(e,o.privateKeyLength+o.publicKeyLength)}catch(i){return t(i)}const r=e.slice(0,o.privateKeyLength),n=e.slice(o.privateKeyLength,e.length);t(null,new u(r,n))}function h(e){return e=y(e,o.publicKeyLength),new c(e)}function f(e,t){void 0===t&&"function"===typeof e&&(t=e),o.generateKey((e,r)=>{if(e)return t(e);let n;try{n=new u(r.secretKey,r.publicKey)}catch(e){return void t(e)}t(null,n)})}function d(e,t,r){void 0===r&&"function"===typeof t&&(r=t),o.generateKeyFromSeed(e,(e,t)=>{if(e)return r(e);let n;try{n=new u(t.secretKey,t.publicKey)}catch(e){return void r(e)}r(null,n)})}function p(e){if("function"!==typeof e)throw new Error("callback is required")}function y(e,r){if(t.isBuffer(e)&&(e=new Uint8Array(e)),!(e instanceof Uint8Array)||e.length!==r)throw new Error("Key must be a Uint8Array or Buffer of length "+r);return e}e.exports={Ed25519PublicKey:c,Ed25519PrivateKey:u,unmarshalEd25519PrivateKey:l,unmarshalEd25519PublicKey:h,generateKeyPair:f,generateKeyPairFromSeed:d}}).call(this,r("b639").Buffer)},1789:function(e,t,r){(function(n){function i(){return!("undefined"===typeof window||!window.process||"renderer"!==window.process.type)||("undefined"===typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(s=i))})),e.splice(s,0,n)}}function o(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(r){}}function c(){var e;try{e=t.storage.debug}catch(r){}return!e&&"undefined"!==typeof n&&"env"in n&&(e=Object({NODE_ENV:"production",BASE_URL:"/"}).DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=r("1428"),t.log=o,t.formatArgs=s,t.save=a,t.load=c,t.useColors=i,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(c())}).call(this,r("4362"))},"17b2":function(e,t,r){"use strict";const n=r("cfab"),i={};for(const[s,o]of Object.entries(n))void 0===i[o]&&(i[o]=s);e.exports=Object.freeze(i)},"17c2":function(e,t,r){"use strict";var n=r("b727").forEach,i=r("a640"),s=r("ae40"),o=i("forEach"),a=s("forEach");e.exports=o&&a?[].forEach:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}},"17e2":function(e,t,r){var n=r("f4d7"),i=r("4bc2")("socket.io-client:url");function s(e,t){var r=e;t=t||"undefined"!==typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"===typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e="undefined"!==typeof t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),r=n(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var s=-1!==r.host.indexOf(":"),o=s?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port,r.href=r.protocol+"://"+o+(t&&t.port===r.port?"":":"+r.port),r}e.exports=s},"17e5":function(e,t,r){var n=r("4f94");function i(e){if(!(e instanceof Object))throw new TypeError('"obj" must be an object (or inherit from it)');return s(e)}function s(e,t){for(var r in t=new n(e,t),e){var i=e[r];if(i instanceof Object&&(t.contains(i)||s(i,t)))return!0}return!1}e.exports=i},18:function(e,t){},"180b":function(e,t,r){var n=r("5995");r("c882"),r("80f7"),r("84f3"),r("ce05"),r("71c7"),r("9050"),r("8f53"),r("31a0"),r("5609");var i=n.asn1,s=e.exports=n.pkcs7=n.pkcs7||{};function o(e){var t={},r=[];if(!i.validate(e,s.asn1.recipientInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=r,o}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function c(e){for(var t=[],r=0;r0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),s=0;s=r&&o0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),s.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,s)),o.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),o])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var s=t.certificate;"string"===typeof s&&(s=n.pki.certificateFromPem(s)),r=s.issuer.attributes,i=s.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof o&&(o=n.pki.privateKeyFromPem(o));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,h=0;hn((t,r,n)=>{function i(e,t,r){if(t)return e(t);if(!r)return e(new Error("empty response"));if(0===r.length)return e(new Error("no value returned for key"));if(Array.isArray(r)&&(r=r[0]),5===r.Type)e(null,r.Extra);else{let t=new Error("key was not found (type 6)");e(t)}}"function"!==typeof r||n||(n=r,r={}),"function"===typeof r&&"function"===typeof n&&(n=r,r={}),e({path:"dht/get",args:t,qs:r},i.bind(null,n))})},"186e":function(e,t,r){"use strict";const n=r("720b"),i=r("792d"),s=r("e15f"),o=r("b838"),a=r("8e122"),c={"legacy-ipfs":s,ipfs:o,orbitdb:a},u=e=>{if(!l.isSupported(e))throw new Error(`AccessController type '${e}' is not supported`);return c[e]};class l{static get AccessController(){return n}static isSupported(e){return Object.keys(c).includes(e)}static addAccessController(e){if(!e.AccessController)throw new Error("AccessController class needs to be given as an option");if(!e.AccessController.type||"string"!==typeof e.AccessController.type)throw new Error("Given AccessController class needs to implement: static get type() { /* return a string */}.");c[e.AccessController.type]=e.AccessController}static addAccessControllers(e){const t=e.AccessControllers;if(!t)throw new Error("AccessController classes need to be given as an option");t.forEach(e=>{l.addAccessController({AccessController:e})})}static removeAccessController(e){delete c[e]}static async resolve(e,t,r={}){const{type:n,params:s}=await i.resolve(e._ipfs,t,r),o=u(n),a=await o.create(e,Object.assign({},r,s));return await a.load(s.address),a}static async create(e,t,r={}){const n=u(t),s=await n.create(e,r),o=await s.save(),a=await i.create(e._ipfs,t,o);return a}}e.exports=l},"18ac":function(e,t,r){"use strict";e.exports=i;var n=r("fab2");function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r("c3bb")(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},19:function(e,t){},1972:function(e,t,r){"use strict";var n=r("e0c5").Buffer,i=r("bce7"),s=r("c627");function o(e,t){null===e&&null===t?(this.x=this.y=null,this.inf=!0):(this.x=e,this.y=t,this.inf=!1)}o.fromPublicKey=function(e){var t,r,n=e[0];return 33!==e.length||2!==n&&3!==n?65!==e.length||4!==n&&6!==n&&7!==n?null:(t=i.fromBuffer(e.slice(1,33)),r=i.fromBuffer(e.slice(33,65)),t.ucmp(i.p)>=0||r.ucmp(i.p)>=0?null:6!==n&&7!==n||r.isOdd()===(7===n)?0!==t.redSqr().redMul(t).redIAdd7().ucmp(r.redSqr())?null:new o(t,r):null):(t=i.fromBuffer(e.slice(1,33)),t.ucmp(i.p)>=0?null:(r=t.redSqr().redMul(t).redIAdd7().redSqrt(),null===r?null:(3===n!==r.isOdd()&&(r=r.redNeg()),new o(t,r))))},o.prototype.toPublicKey=function(e){var t,r=this.x,i=this.y;return e?(t=n.alloc(33),t[0]=i.isOdd()?3:2,r.toBuffer().copy(t,1)):(t=n.alloc(65),t[0]=4,r.toBuffer().copy(t,1),i.toBuffer().copy(t,33)),t},o.fromECJPoint=function(e){if(e.inf)return new o(null,null);var t=e.z.redInvm(),r=t.redSqr(),n=e.x.redMul(r),i=e.y.redMul(r).redMul(t);return new o(n,i)},o.prototype.toECJPoint=function(){return this.inf?new s(null,null,null):new s(this.x,this.y,s.one)},o.prototype.neg=function(){return this.inf?this:new o(this.x,this.y.redNeg())},o.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(0===this.x.ucmp(e.x))return 0===this.y.ucmp(e.y)?this.dbl():new o(null,null);var t=this.y.redSub(e.y);t.isZero()||(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return new o(r,n)},o.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.isZero())return new o(null,null);var t=this.x.redSqr(),r=t.redAdd(t).redIAdd(t).redMul(e.redInvm()),n=r.redSqr().redISub(this.x.redAdd(this.x)),i=r.redMul(this.x.redSub(n)).redISub(this.y);return new o(n,i)},o.prototype.mul=function(e){for(var t=this._getNAFPoints(4),r=t.points,n=e.getNAF(t.wnd),i=new s(null,null,null),a=n.length-1;a>=0;a--){for(var c=0;a>=0&&0===n[a];a--,++c);if(a>=0&&(c+=1),i=i.dblp(c),a<0)break;var u=n[a];i=u>0?i.mixedAdd(r[u-1>>1]):i.mixedAdd(r[-u-1>>1].neg())}return o.fromECJPoint(i)},o.prototype._getNAFPoints1=function(){return{wnd:1,points:[this]}},o.prototype._getNAFPoints=function(e){var t=new Array((1<{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i("hash algorithm must be specified","ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(`multihash function '${e}' not yet supported`,"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},"1a8c":function(e,t){function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=r},"1aad":function(e,t,r){"use strict";const n=r("9f73"),i=Object.prototype.hasOwnProperty,s=Object.propertyIsEnumerable,o=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1},u=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(let n=0;n{o(t,r,l(e[r]))}),t}function f(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach(r=>{o(t,r,l(e[r]))}),t}const d=(e,t,r,n)=>(r.forEach(r=>{r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,y(e[r],t[r],n)):o(e,r,l(t[r]))}),e),p=(e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach(t=>{const a=[];for(let r=0;r-1===a.indexOf(e)),r)}),n};function y(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?p(e,t,r):n(t)&&n(e)?d(e,t,u(t),r):l(t)}e.exports=function(){const e=y(l(c),this!==a&&this||{},c);let t={foobar:{}};for(let r=0;r{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)};e.exports={fromNumberTo32BitBuf:i}},"1b2f":function(e,t,r){"use strict";e.exports='\n syntax = "proto2";\n\n package ipfs.pin;\n\n option go_package = "pb";\n\n message Set {\n optional uint32 version = 1;\n optional uint32 fanout = 2;\n optional fixed32 seed = 3;\n }\n'},"1b43":function(e,t,r){var n=r("5995");r("b3d5"),r("31a0");var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){o||a();var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,u,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,h=l&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-h));for(var f=8*i.fullMessageLength[0],d=0;d>>0,f+=u,o.putInt32(f>>>0),f=a>>>0;o.putInt32(f);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};c(p,r,o);var y=n.util.createBuffer();return y.putInt32(p.h0),y.putInt32(p.h1),y.putInt32(p.h2),y.putInt32(p.h3),y.putInt32(p.h4),y},i};var s=null,o=!1;function a(){s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),o=!0}function c(e,t,r){var n,i,s,o,a,c,u,l,h=r.length();while(h>=64){for(i=e.h0,s=e.h1,o=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,u=a^s&(o^a),n=(i<<5|i>>>27)+u+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<20;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,u=a^s&(o^a),n=(i<<5|i>>>27)+u+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<32;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<40;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<60;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s&o|a&(s^o),n=(i<<5|i>>>27)+u+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<80;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,h-=64}}},"1b69":function(e,t,r){"use strict";const n=r("fa4d"),i=r("33fc");e.exports=function(e){return n((t,r,n)=>{"function"===typeof r&&(n=r,r={}),i(e.pingPullStream(t,r),i.collect(n))})}},"1bb3":function(e,t,r){"use strict";var n=r("8707").Buffer,i=r("98e6"),s=r("e28f"),o=r("f8c1"),a=r("0286"),c=r("eda6"),u=r("8bb0");t.privateKeyVerify=function(e){var t=a.fromBuffer(e);return!(t.isOverflow()||t.isZero())},t.privateKeyExport=function(e,t){var r=a.fromBuffer(e);if(r.isOverflow()||r.isZero())throw new Error(o.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return u.mul(r).toPublicKey(t)},t.privateKeyNegate=function(e){var t=a.fromBuffer(e);return t.isZero()?n.alloc(32):(t.ucmp(a.n)>0&&t.isub(a.n),a.n.sub(t).toBuffer())},t.privateKeyModInverse=function(e){var t=a.fromBuffer(e);if(t.isOverflow()||t.isZero())throw new Error(o.EC_PRIVATE_KEY_RANGE_INVALID);return t.uinvm().toBuffer()},t.privateKeyTweakAdd=function(e,t){var r=a.fromBuffer(t);if(r.isOverflow())throw new Error(o.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(a.fromBuffer(e)),r.isOverflow()&&r.isub(a.n),r.isZero())throw new Error(o.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toBuffer()},t.privateKeyTweakMul=function(e,t){var r=a.fromBuffer(t);if(r.isOverflow()||r.isZero())throw new Error(o.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);var n=a.fromBuffer(e);return r.umul(n).ureduce().toBuffer()},t.publicKeyCreate=function(e,t){var r=a.fromBuffer(e);if(r.isOverflow()||r.isZero())throw new Error(o.EC_PUBLIC_KEY_CREATE_FAIL);return u.mul(r).toPublicKey(t)},t.publicKeyConvert=function(e,t){var r=c.fromPublicKey(e);if(null===r)throw new Error(o.EC_PUBLIC_KEY_PARSE_FAIL);return r.toPublicKey(t)},t.publicKeyVerify=function(e){return null!==c.fromPublicKey(e)},t.publicKeyTweakAdd=function(e,t,r){var n=c.fromPublicKey(e);if(null===n)throw new Error(o.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow())throw new Error(o.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var i=u.mul(t).add(n);if(i.inf)throw new Error(o.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return i.toPublicKey(r)},t.publicKeyTweakMul=function(e,t,r){var n=c.fromPublicKey(e);if(null===n)throw new Error(o.EC_PUBLIC_KEY_PARSE_FAIL);if(t=a.fromBuffer(t),t.isOverflow()||t.isZero())throw new Error(o.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return n.mul(t).toPublicKey(r)},t.publicKeyCombine=function(e,t){for(var r=new Array(e.length),n=0;n=0)&&0===n.iadd(a.psn).redMul(p).ucmp(d.x)},t.recover=function(e,t,r,i){var s=a.fromBuffer(t.slice(0,32)),l=a.fromBuffer(t.slice(32,64));if(s.isOverflow()||l.isOverflow())throw new Error(o.ECDSA_SIGNATURE_PARSE_FAIL);do{if(s.isZero()||l.isZero())break;var h=s;if(r>>1){if(h.ucmp(a.psn)>=0)break;h=s.add(a.n)}var f=n.concat([n.from([2+(1&r)]),h.toBuffer()]),d=c.fromPublicKey(f);if(null===d)break;var p=s.uinvm(),y=a.n.sub(a.fromBuffer(e)).umul(p).ureduce(),g=l.umul(p).ureduce(),m=c.fromECJPoint(u.mulAdd(y,d,g));return m.toPublicKey(i)}while(0);throw new Error(o.ECDSA_RECOVER_FAIL)},t.ecdh=function(e,r){var n=t.ecdhUnsafe(e,r,!0);return i("sha256").update(n).digest()},t.ecdhUnsafe=function(e,t,r){var n=c.fromPublicKey(e);if(null===n)throw new Error(o.EC_PUBLIC_KEY_PARSE_FAIL);var i=a.fromBuffer(t);if(i.isOverflow()||i.isZero())throw new Error(o.ECDH_FAIL);return n.mul(i).toPublicKey(r)}},"1c13":function(e,t,r){"use strict";(function(t){const n=r("2612");function i(e){return parseInt(e.toString("hex"),16)}function s(e){let r=e.toString(16);return r.length%2===1&&(r="0"+r),t.from(r,"hex")}function o(e){return t.from(n.encode(i(e)))}function a(e){return s(n.decode(e))}function c(e){return t.from(n.encode(e))}e.exports={numberToBuffer:s,bufferToNumber:i,varintBufferEncode:o,varintBufferDecode:a,varintEncode:c}}).call(this,r("b639").Buffer)},"1c1d":function(e,t){e.exports=function(e,t,r){"use asm";var n=new e.Uint8Array(r);var i=t.pushInt;var s=t.pushInt32;var o=t.pushInt32Neg;var a=t.pushInt64;var c=t.pushInt64Neg;var u=t.pushFloat;var l=t.pushFloatSingle;var h=t.pushFloatDouble;var f=t.pushTrue;var d=t.pushFalse;var p=t.pushUndefined;var y=t.pushNull;var g=t.pushInfinity;var m=t.pushInfinityNeg;var b=t.pushNaN;var v=t.pushNaNNeg;var w=t.pushArrayStart;var _=t.pushArrayStartFixed;var E=t.pushArrayStartFixed32;var S=t.pushArrayStartFixed64;var k=t.pushObjectStart;var C=t.pushObjectStartFixed;var A=t.pushObjectStartFixed32;var I=t.pushObjectStartFixed64;var T=t.pushByteString;var x=t.pushByteStringStart;var B=t.pushUtf8String;var R=t.pushUtf8StringStart;var N=t.pushSimpleUnassigned;var O=t.pushTagStart;var P=t.pushTagStart4;var D=t.pushTagStart8;var L=t.pushTagUnassigned;var M=t.pushBreak;var U=e.Math.pow;var j=0;var K=0;var F=0;function V(e){e=e|0;j=0;K=e;while((j|0)<(K|0)){F=Qe[n[j]&255](n[j]|0)|0;if((F|0)>0){break}}return F|0}function q(e){e=e|0;if(((j|0)+(e|0)|0)<(K|0)){return 0}return 1}function z(e){e=e|0;return n[e|0]<<8|n[e+1|0]|0}function H(e){e=e|0;return n[e|0]<<24|n[e+1|0]<<16|n[e+2|0]<<8|n[e+3|0]|0}function G(e){e=e|0;i(e|0);j=j+1|0;return 0}function $(e){e=e|0;if(q(1)|0){return 1}i(n[j+1|0]|0);j=j+2|0;return 0}function W(e){e=e|0;if(q(2)|0){return 1}i(z(j+1|0)|0);j=j+3|0;return 0}function Y(e){e=e|0;if(q(4)|0){return 1}s(z(j+1|0)|0,z(j+3|0)|0);j=j+5|0;return 0}function Q(e){e=e|0;if(q(8)|0){return 1}a(z(j+1|0)|0,z(j+3|0)|0,z(j+5|0)|0,z(j+7|0)|0);j=j+9|0;return 0}function J(e){e=e|0;i(-1-(e-32|0)|0);j=j+1|0;return 0}function X(e){e=e|0;if(q(1)|0){return 1}i(-1-(n[j+1|0]|0)|0);j=j+2|0;return 0}function Z(e){e=e|0;var t=0;if(q(2)|0){return 1}t=z(j+1|0)|0;i(-1-(t|0)|0);j=j+3|0;return 0}function ee(e){e=e|0;if(q(4)|0){return 1}o(z(j+1|0)|0,z(j+3|0)|0);j=j+5|0;return 0}function te(e){e=e|0;if(q(8)|0){return 1}c(z(j+1|0)|0,z(j+3|0)|0,z(j+5|0)|0,z(j+7|0)|0);j=j+9|0;return 0}function re(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(q(n|0)|0){return 1}t=j+1|0;r=(j+1|0)+(n|0)|0;T(t|0,r|0);j=r|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var i=0;if(q(1)|0){return 1}i=n[j+1|0]|0;t=j+2|0;r=(j+2|0)+(i|0)|0;if(q(i+1|0)|0){return 1}T(t|0,r|0);j=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(q(2)|0){return 1}n=z(j+1|0)|0;t=j+3|0;r=(j+3|0)+(n|0)|0;if(q(n+2|0)|0){return 1}T(t|0,r|0);j=r|0;return 0}function se(e){e=e|0;var t=0;var r=0;var n=0;if(q(4)|0){return 1}n=H(j+1|0)|0;t=j+5|0;r=(j+5|0)+(n|0)|0;if(q(n+4|0)|0){return 1}T(t|0,r|0);j=r|0;return 0}function oe(e){e=e|0;return 1}function ae(e){e=e|0;x();j=j+1|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(q(n|0)|0){return 1}t=j+1|0;r=(j+1|0)+(n|0)|0;B(t|0,r|0);j=r|0;return 0}function ue(e){e=e|0;var t=0;var r=0;var i=0;if(q(1)|0){return 1}i=n[j+1|0]|0;t=j+2|0;r=(j+2|0)+(i|0)|0;if(q(i+1|0)|0){return 1}B(t|0,r|0);j=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(q(2)|0){return 1}n=z(j+1|0)|0;t=j+3|0;r=(j+3|0)+(n|0)|0;if(q(n+2|0)|0){return 1}B(t|0,r|0);j=r|0;return 0}function he(e){e=e|0;var t=0;var r=0;var n=0;if(q(4)|0){return 1}n=H(j+1|0)|0;t=j+5|0;r=(j+5|0)+(n|0)|0;if(q(n+4|0)|0){return 1}B(t|0,r|0);j=r|0;return 0}function fe(e){e=e|0;return 1}function de(e){e=e|0;R();j=j+1|0;return 0}function pe(e){e=e|0;_(e-128|0);j=j+1|0;return 0}function ye(e){e=e|0;if(q(1)|0){return 1}_(n[j+1|0]|0);j=j+2|0;return 0}function ge(e){e=e|0;if(q(2)|0){return 1}_(z(j+1|0)|0);j=j+3|0;return 0}function me(e){e=e|0;if(q(4)|0){return 1}E(z(j+1|0)|0,z(j+3|0)|0);j=j+5|0;return 0}function be(e){e=e|0;if(q(8)|0){return 1}S(z(j+1|0)|0,z(j+3|0)|0,z(j+5|0)|0,z(j+7|0)|0);j=j+9|0;return 0}function ve(e){e=e|0;w();j=j+1|0;return 0}function we(e){e=e|0;var t=0;t=e-160|0;if(q(t|0)|0){return 1}C(t|0);j=j+1|0;return 0}function _e(e){e=e|0;if(q(1)|0){return 1}C(n[j+1|0]|0);j=j+2|0;return 0}function Ee(e){e=e|0;if(q(2)|0){return 1}C(z(j+1|0)|0);j=j+3|0;return 0}function Se(e){e=e|0;if(q(4)|0){return 1}A(z(j+1|0)|0,z(j+3|0)|0);j=j+5|0;return 0}function ke(e){e=e|0;if(q(8)|0){return 1}I(z(j+1|0)|0,z(j+3|0)|0,z(j+5|0)|0,z(j+7|0)|0);j=j+9|0;return 0}function Ce(e){e=e|0;k();j=j+1|0;return 0}function Ae(e){e=e|0;O(e-192|0|0);j=j+1|0;return 0}function Ie(e){e|0;O(e|0);j=j+1|0;return 0}function Te(e){e|0;O(e|0);j=j+1|0;return 0}function xe(e){e|0;O(e|0);j=j+1|0;return 0}function Be(e){e|0;O(e|0);j=j+1|0;return 0}function Re(e){e=e|0;O(e-192|0|0);j=j+1|0;return 0}function Ne(e){e|0;O(e|0);j=j+1|0;return 0}function Oe(e){e|0;O(e|0);j=j+1|0;return 0}function Pe(e){e|0;O(e|0);j=j+1|0;return 0}function De(e){e=e|0;if(q(1)|0){return 1}O(n[j+1|0]|0);j=j+2|0;return 0}function Le(e){e=e|0;if(q(2)|0){return 1}O(z(j+1|0)|0);j=j+3|0;return 0}function Me(e){e=e|0;if(q(4)|0){return 1}P(z(j+1|0)|0,z(j+3|0)|0);j=j+5|0;return 0}function Ue(e){e=e|0;if(q(8)|0){return 1}D(z(j+1|0)|0,z(j+3|0)|0,z(j+5|0)|0,z(j+7|0)|0);j=j+9|0;return 0}function je(e){e=e|0;N((e|0)-224|0);j=j+1|0;return 0}function Ke(e){e=e|0;d();j=j+1|0;return 0}function Fe(e){e=e|0;f();j=j+1|0;return 0}function Ve(e){e=e|0;y();j=j+1|0;return 0}function qe(e){e=e|0;p();j=j+1|0;return 0}function ze(e){e=e|0;if(q(1)|0){return 1}N(n[j+1|0]|0);j=j+2|0;return 0}function He(e){e=e|0;var t=0;var r=0;var i=1.0;var s=0.0;var o=0.0;var a=0.0;if(q(2)|0){return 1}t=n[j+1|0]|0;r=n[j+2|0]|0;if((t|0)&0x80){i=-1.0}s=+(((t|0)&0x7C)>>2);o=+(((t|0)&0x03)<<8|r);if(+s==0.0){u(+(+i*+5.9604644775390625e-8*+o))}else if(+s==31.0){if(+i==1.0){if(+o>0.0){b()}else{g()}}else{if(+o>0.0){v()}else{m()}}}else{u(+(+i*U(+2,+(+s-25.0))*+(1024.0+o)))}j=j+3|0;return 0}function Ge(e){e=e|0;if(q(4)|0){return 1}l(n[j+1|0]|0,n[j+2|0]|0,n[j+3|0]|0,n[j+4|0]|0);j=j+5|0;return 0}function $e(e){e=e|0;if(q(8)|0){return 1}h(n[j+1|0]|0,n[j+2|0]|0,n[j+3|0]|0,n[j+4|0]|0,n[j+5|0]|0,n[j+6|0]|0,n[j+7|0]|0,n[j+8|0]|0);j=j+9|0;return 0}function We(e){e=e|0;return 1}function Ye(e){e=e|0;M();j=j+1|0;return 0}var Qe=[G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,$,W,Y,Q,We,We,We,We,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,X,Z,ee,te,We,We,We,We,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ne,ie,se,oe,We,We,We,ae,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ue,le,he,fe,We,We,We,de,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,pe,ye,ge,me,be,We,We,We,ve,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,we,_e,Ee,Se,ke,We,We,We,Ce,Ae,Ae,Ae,Ae,Ae,Ae,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,Re,De,Le,Me,Ue,We,We,We,We,je,je,je,je,je,je,je,je,je,je,je,je,je,je,je,je,je,je,je,je,Ke,Fe,Ve,qe,ze,He,Ge,$e,We,We,We,Ye];return{parse:V}}},"1c27":function(e,t,r){"use strict";const n=r("f294"),i=r("faa1").EventEmitter,s=r("4bc2"),o=s("libp2p");o.error=s("libp2p:error");const a=r("000a"),c=r("fa4d"),u=r("88ae"),l=r("0512"),h=r("4a0d"),f=r("9f2e"),d=r("7fa9"),p=r("8911"),y=r("c3f4"),g=r("b126"),m=r("2db6"),b=r("5c2f"),{emitFirst:v}=r("eaa4"),w=r("647f"),_=r("510a"),E=r("76d9"),S=r("9b20"),{getPeerInfoRemote:k}=r("e5e0"),C=r("7268").validate,{codes:A}=r("a41c"),I=(e,t)=>a(new Error(`libp2p cannot ${e} when not started; state is ${t}`),A.ERR_NODE_NOT_STARTED);class T extends i{constructor(e){if(super(),this._options=C(e),this.datastore=this._options.datastore,this.peerInfo=this._options.peerInfo,this.peerBook=this._options.peerBook||new d,this._modules=this._options.modules,this._config=this._options.config,this._transport=[],this._discovery=[],this._switch=new y(this.peerInfo,this.peerBook,this._options.switch),this._switch.on("error",(...e)=>this.emit("error",...e)),this.stats=this._switch.stats,this.connectionManager=new b(this,this._options.connectionManager),this._modules.streamMuxer){const e=this._modules.streamMuxer;e.forEach(e=>this._switch.connection.addStreamMuxer(e)),this._switch.connection.reuse(),this._switch.connection.enableCircuitRelay(this._config.relay),this._switch.on("peer-mux-established",e=>{this.emit("peer:connect",e)}),this._switch.on("peer-mux-closed",e=>{this.emit("peer:disconnect",e)})}if(this._switch.on("connection:start",e=>{this.emit("connection:start",e)}),this._switch.on("connection:end",e=>{this.emit("connection:end",e)}),this._modules.connEncryption){const e=this._modules.connEncryption;e.forEach(e=>{this._switch.connection.crypto(e.tag,e.encrypt)})}if(this._modules.connProtector)this._switch.protector=this._modules.connProtector;else if(Object({NODE_ENV:"production",BASE_URL:"/"}).LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._config.dht.enabled){const e=this._modules.dht;this._dht=new e(this._switch,{datastore:this.datastore,...this._config.dht})}this._modules.pubsub&&!1!==this._config.pubsub.enabled&&(this.pubsub=S(this,this._modules.pubsub,this._config.pubsub)),this.peerRouting=w(this),this.contentRouting=_(this),this.dht=E(this),g.mount(this._switch),this.state=new n("STOPPED",{STOPPED:{start:"STARTING",stop:"STOPPED"},STARTING:{done:"STARTED",abort:"STOPPED",stop:"STOPPING"},STARTED:{stop:"STOPPING",start:"STARTED"},STOPPING:{stop:"STOPPING",done:"STOPPED"}}),this.state.on("STARTING",()=>{o("libp2p is starting"),this._onStarting()}),this.state.on("STOPPING",()=>{o("libp2p is stopping"),this._onStopping()}),this.state.on("STARTED",()=>{o("libp2p has started"),this.emit("start")}),this.state.on("STOPPED",()=>{o("libp2p has stopped"),this.emit("stop")}),this.state.on("error",e=>{o.error(e),this.emit("error",e)}),this.state.on("STARTED",()=>{this.peerBook.getAllArray().forEach(e=>{this.emit("peer:discovery",e),this._maybeConnect(e)})}),this._peerDiscovered=this._peerDiscovered.bind(this),["start","stop","dial","dialProtocol","dialFSM","hangUp","ping"].forEach(e=>{this[e]=c(this[e],{context:this})})}emit(e,...t){"error"!==e||this._events.error?super.emit(e,...t):o.error(...t)}start(e=(()=>{})){v(this,["error","start"],e),this.state("start")}stop(e=(()=>{})){v(this,["error","stop"],e),this.state("stop")}isStarted(){return!!this.state&&"STARTED"===this.state._state}dial(e,t){this.dialProtocol(e,null,t)}dialProtocol(e,t,r){if(!this.isStarted())return r(I("dial",this.state._state));"function"===typeof t&&(r=t,t=void 0),k(e,this).then(e=>{this._switch.dial(e,t,r)},r)}dialFSM(e,t,r){if(!this.isStarted())return r(I("dial",this.state._state));"function"===typeof t&&(r=t,t=void 0),k(e,this).then(e=>{this._switch.dialFSM(e,t,r)},r)}hangUp(e,t){k(e,this).then(e=>{this._switch.hangUp(e,t)},t)}ping(e,t){if(!this.isStarted())return t(I("ping",this.state._state));k(e,this).then(e=>{t(null,new g(this._switch,e))},t)}handle(e,t,r){this._switch.handle(e,t,r)}unhandle(e){this._switch.unhandle(e)}_onStarting(){if(!this._modules.transport)return this.emit("error",new Error("no transports were present")),this.state("abort");let e;const t=[],r=[];this.peerInfo.multiaddrs.toArray().forEach(e=>{e.getPeerId()||(t.push(e),r.push(e.encapsulate("/p2p/"+this.peerInfo.id.toB58String())))}),this.peerInfo.multiaddrs.replace(t,r);const n=this.peerInfo.multiaddrs.toArray();this._modules.transport.forEach(t=>{let r;r="function"===typeof t?new t({libp2p:this}):t,r.filter(n).length>0?this._switch.transport.add(r.tag||r[Symbol.toStringTag],r):m.isWebSockets(r)&&(e=r),this._transport.push(r)}),l([e=>{this.connectionManager.start(),this._switch.start(e)},t=>{e&&this._switch.transport.add(e.tag||e.constructor.name,e);const r=this.peerInfo.multiaddrs.toArray();r.forEach(e=>{e.toString().match(/\/p2p-circuit($|\/)/)||this._transport.find(t=>t.filter(e).length>0)||this.peerInfo.multiaddrs.delete(e)}),t()},e=>{this._dht?this._dht.start(()=>{this._dht.on("peer",this._peerDiscovered),e()}):e()},e=>{if(this.pubsub)return this.pubsub.start(e);e()},e=>{this._modules.peerDiscovery?this._setupPeerDiscovery(e):e()}],e=>{if(e)return o.error(e),this.emit("error",e),this.state("stop");this.state("done")})}_onStopping(){l([e=>{h(this._discovery.map(e=>(e.removeListener("peer",this._peerDiscovered),t=>e.stop(e=>{o.error("an error occurred stopping the discovery service",e),t()}))),e)},e=>{if(this.pubsub)return this.pubsub.stop(e);e()},e=>{if(this._dht)return this._dht.removeListener("peer",this._peerDiscovered),this._dht.stop(e);e()},e=>{this.connectionManager.stop(),this._switch.stop(e)},e=>{this._switch.transport.removeAll(()=>e())}],e=>{e&&(o.error(e),this.emit("error",e)),this.state("done")})}_peerDiscovered(e){e.id.toB58String()!==this.peerInfo.id.toB58String()?(e=this.peerBook.put(e),this.isStarted()&&(this.emit("peer:discovery",e),this._maybeConnect(e))):o.error(new Error(A.ERR_DISCOVERED_SELF))}_maybeConnect(e){if(!0===this._config.peerDiscovery.autoDial&&!e.isConnected()){const t=this._options.connectionManager.minPeers||0;t>Object.keys(this._switch.connection.connections).length&&(o("connecting to discovered peer"),this._switch.dialer.connect(e,e=>{e&&o.error("could not connect to discovered peer",e)}))}}_setupPeerDiscovery(e){for(const t of this._modules.peerDiscovery){let e={enabled:!0};if(t.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[t.tag]&&(e={...e,...this._config.peerDiscovery[t.tag]}),e.enabled){let r;r="function"===typeof t?new t(Object.assign({},e,{peerInfo:this.peerInfo})):t,r.on("peer",this._peerDiscovered),this._discovery.push(r)}}u(this._discovery,(e,t)=>{e.start(t)},e)}}e.exports=T,e.exports.createLibp2p=c((e,t)=>{if(e.peerInfo)return f(t,null,new T(e));p.create((r,n)=>{if(r)return t(r);e.peerInfo=n,t(null,new T(e))})})},"1c7ef":function(e,t,r){"use strict";(function(n){const i=r("334b"),{cid:s,serialize:o}=r("bda9");function a(e){let t;return e.Data&&e.Data.length>0?(t=n.alloc(e.Data.length),e.Data.copy(t)):t=n.alloc(0),t}function c(e){return e.Links.slice()}function u(e,t){return n.compare(e.nameAsBuffer,t.nameAsBuffer)}t=e.exports;const l=async(e,t={})=>{const r=o(e),n=await s(r);return new i(t.name||"",r.length,n)};t.cloneData=a,t.cloneLinks=c,t.linkSort=u,t.toDAGLink=l}).call(this,r("b639").Buffer)},"1c9b":function(e,t,r){"use strict";(function(t){function r(e,r){var s=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(r?r(e):!e||this._writableState&&this._writableState.errorEmitted||t.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?(t.nextTick(n,s,e),s._writableState&&(s._writableState.errorEmitted=!0)):r?(t.nextTick(i,s),r(e)):t.nextTick(i,s)})),this)}function n(e,t){o(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function s(){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)}function o(e,t){e.emit("error",t)}e.exports={destroy:r,undestroy:s}}).call(this,r("4362"))},"1cd4":function(e,t,r){"use strict";const n=r("334b");function i(e){return new n(e.Name||e.name||"",e.Tsize||e.Size||e.size||0,e.Hash||e.hash||e.multihash||e.cid)}t=e.exports,t.createDagLinkFromB58EncodedHash=i},"1d74":function(e,t,r){"use strict";(function(t){const n=r("9efb");function i(e){return parseInt(e.toString("hex"),16)}function s(e){let r=e.toString(16);return r.length%2===1&&(r="0"+r),t.from(r,"hex")}function o(e){return t.from(n.encode(i(e)))}function a(e){return s(n.decode(e))}e.exports={numberToBuffer:s,bufferToNumber:i,varintBufferEncode:o,varintBufferDecode:a}}).call(this,r("b639").Buffer)},"1d81":function(e,t,r){"use strict";var n,i,s=r("4ea4"),o=s(r("a34a")),a=s(r("c973")),c=s(r("970b")),u=s(r("5bc3")),l=s(r("6b58")),h=s(r("36c6")),f=s(r("3c96")),d=s(r("ed6d")),p=r("8ded"),y=r("cde5"),g=r("972c"),m=r("84b5"),b=m.createLink,v=m.validateLink,w=r("9211"),_=r("b42c"),E=r("ebfe"),S=r("f87d"),k=r("b535"),C=r("8400"),A=r("aaed"),I=r("dd35"),T=r("b3ec"),x=r("bc13"),B=r("888a"),R=r("5eec"),N=r("a886"),O=T.pinning_node,P=T.address_server_url,D=T.ipfs_options,L=function(e){function t(e,r){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,c["default"])(this,t),n=(0,l["default"])(this,(0,h["default"])(t).call(this)),n._provider=e,n._ipfs=r,g(n._ipfs,{pin:!0}),n._serverUrl=i.addressServer||P,n["public"]=null,n["private"]=null,n.verified=new k((0,f["default"])(n)),n.spaces={},n.syncDone=null,n.hasPublishedLink={},n}return(0,d["default"])(t,e),(0,u["default"])(t,[{key:"_init",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,_.create(this._ipfs,t);case 2:this.replicator=e.sent;case 3:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_load",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t,r,n,i,s,a,c,u,l=this,h=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]?h[0]:{},e.next=3,this._3id.getAddress();case 3:if(r=e.sent,!r){e.next=10;break}return e.next=7,this._getLinkedData(r);case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0={};case 11:if(n=e.t0,i=n.rootStoreAddress,s=n.did,!i){e.next=26;break}return e.next=17,this.replicator.start(i,s,{profile:!0});case 17:return e.next=19,this.replicator.rootstoreSyncDone;case 19:return e.next=21,this.replicator.getAuthData();case 21:return a=e.sent,e.next=24,this._3id.authenticate(t.spaces,{authData:a});case 24:e.next=35;break;case 26:return e.next=28,this._3id.authenticate(t.spaces);case 28:return c=this._3id.muportFingerprint+".root",e.next=31,this._3id.getPublicKeys(null,!0);case 31:return u=e.sent.signingKey,e.next=34,this.replicator["new"](c,u,this._3id.DID);case 34:this._publishRootStore(this.replicator.rootstore.address.toString());case 35:return e.t1=this.replicator.rootstore,e.next=38,this._3id.getOdbId();case 38:return e.t2=e.sent,e.t1.setIdentity.call(e.t1,e.t2),this.syncDone=this.replicator.syncDone,this._3id.events.on("new-auth-method",(function(e){l._writeRootstoreEntry(_.entryTypes.AUTH_DATA,e)})),this._3id.events.on("new-link-proof",(function(e){l._writeAddressLink(e)})),this._3id.startUpdatePolling(),this["public"]=new E(this._3id.muportFingerprint+".public",this._linkProfile.bind(this),this.replicator,this._3id),this["private"]=new S(this._3id.muportFingerprint+".private",this.replicator,this._3id),e.next=48,this["public"]._load();case 48:return e.next=50,this["private"]._load();case 50:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"auth",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t,r,n=this,i=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:[],r=i.length>1&&void 0!==i[1]?i[1]:{},this._3id){e.next=12;break}if(this._provider.is3idProvider||r.address){e.next=5;break}throw new Error("auth: address needed when 3ID provider is not used");case 5:return e.next=7,w.getIdFromEthAddress(r.address,this._provider,this._ipfs,this.replicator._orbitdb.keystore,r);case 7:return this._3id=e.sent,e.next=10,this._load(Object.assign(r,{spaces:t}));case 10:e.next=14;break;case 12:return e.next=14,this._3id.authenticate(t);case 14:return e.next=16,Promise.all(t.map(function(){var e=(0,a["default"])(o["default"].mark((function e(t){return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!n.spaces[t]){e.next=3;break}return e.next=3,n.spaces[t]._authThreads(n._3id);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 16:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"openSpace",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){var r,n=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r=n.length>1&&void 0!==n[1]?n[1]:{},!t.includes(".")){e.next=3;break}throw new Error('Invalid name: character "." not allowed');case 3:if(this._3id){e.next=5;break}throw new Error("openSpace: auth required");case 5:if(this.spaces[t]||(this.spaces[t]=new C(t,this.replicator)),this.spaces[t].isOpen){e.next=26;break}return e.prev=7,e.next=10,this.spaces[t].open(this._3id,r);case 10:return e.next=12,this.isAddressLinked();case 12:if(e.sent){e.next=14;break}this.linkAddress();case 14:e.next=24;break;case 16:if(e.prev=16,e.t0=e["catch"](7),delete this.spaces[t],!e.t0.message.includes("User denied message signature.")){e.next=23;break}throw new Error("User denied space consent.");case 23:throw new Error("An error occured while opening space: ",e.t0.message);case 24:e.next=27;break;case 26:r.onSyncDone&&r.onSyncDone();case 27:return e.abrupt("return",this.spaces[t]);case 28:case"end":return e.stop()}}),e,this,[[7,16]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"openThread",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t,r,n){return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.spaces[t]||(this.spaces[t]=new C(t,this.replicator)),e.abrupt("return",this.spaces[t].joinThread(r,n));case 2:case"end":return e.stop()}}),e,this)})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"onSyncDone",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.syncDone;case 2:t();case 3:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_publishRootStore",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){var r,n,i=this;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._3id.signJWT({rootStoreAddress:t});case 2:return r=e.sent,n=function(){var e=(0,a["default"])(o["default"].mark((function e(t){return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,A.fetchJson(i._serverUrl+"/odbAddress",{address_token:t});case 3:e.next=14;break;case 5:if(e.prev=5,e.t0=e["catch"](0),"Invalid JWT"!==e.t0.message){e.next=12;break}return e.next=10,new Promise((function(e){return setTimeout(e,300)}));case 10:return e.next=12,n(t);case 12:if(e.t0.statusCode){e.next=14;break}throw new Error(e.t0);case 14:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t){return e.apply(this,arguments)}}(),e.next=6,n(r);case 6:return e.abrupt("return",!0);case 7:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_getLinkedData",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){var r,n,i;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,A.fetchJson("".concat(this._serverUrl,"/odbAddress/").concat(t));case 3:return r=e.sent.data,n=r.rootStoreAddress,i=r.did,e.abrupt("return",{rootStoreAddress:n,did:i});case 9:if(e.prev=9,e.t0=e["catch"](0),404!==e.t0.statusCode){e.next=13;break}return e.abrupt("return",{});case 13:throw new Error("Error while getting rootstore",e.t0);case 14:case"end":return e.stop()}}),e,this,[[0,9]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"linkAddress",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t,r=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:{},this._3id){e.next=3;break}throw new Error("linkAddress: auth required");case 3:if(!t.proof){e.next=8;break}return e.next=6,this._writeAddressLink(t.proof);case 6:e.next=10;break;case 8:return e.next=10,this._linkProfile();case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"removeAddressLink",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){var r,n,i,s;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._3id){e.next=2;break}throw new Error("removeAddressLink: auth required");case 2:return t=t.toLowerCase(),e.next=5,this.isAddressLinked({address:t});case 5:if(r=e.sent,r){e.next=8;break}throw new Error("removeAddressLink: link for given address does not exist");case 8:return n={address:t,type:"delete-address-link"},i=3600,e.next=12,this._3id.signJWT(n,{expiresIn:i});case 12:return s=e.sent,e.prev=13,e.next=16,A.fetchJson(this._serverUrl+"/linkdelete",{delete_token:s});case 16:e.next=22;break;case 18:if(e.prev=18,e.t0=e["catch"](13),e.t0.statusCode){e.next=22;break}throw new Error(e.t0);case 22:return e.next=24,this._deleteAddressLink(t);case 24:return e.abrupt("return",!0);case 25:case"end":return e.stop()}}),e,this,[[13,18]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"isAddressLinked",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t,r,n,i=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},this._3id){e.next=3;break}throw new Error("isAddressLinked: auth required");case 3:return t.address&&(t.address=t.address.toLowerCase()),e.next=6,this._readAddressLinks();case 6:return r=e.sent,n=r.find((function(e){var r=!t.address||e.address.toLowerCase()===t.address;return t.type?r&&e.type===t.type:r})),e.abrupt("return",Boolean(n));case 9:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"listAddressLinks",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._3id){e.next=2;break}throw new Error("listAddressLinks: auth required");case 2:return e.next=4,this._readAddressLinks();case 4:return t=e.sent,e.abrupt("return",t.reduce((function(e,t){var r=Object.assign({},t);return r.linkId=r.entry.hash,delete r.entry,e.push(r),e}),[]));case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_writeAddressLink",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){var r;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,v(t);case 2:if(r=e.sent,r){e.next=5;break}throw new Error("tried to write invalid link proof",t);case 5:return e.next=7,this.isAddressLinked({address:r.address});case 7:if(!e.sent){e.next=9;break}return e.abrupt("return",!0);case 9:return e.next=11,this._writeRootstoreEntry(_.entryTypes.ADDRESS_LINK,t);case 11:return e.next=13,A.fetchJson(this._serverUrl+"/link",t);case 13:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_linkProfile",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t,r,n,i,s;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._3id.getAddress();case 2:return t=e.sent,e.next=5,this._readAddressLink(t);case 5:if(r=e.sent,r){e.next=27;break}if(this._provider.is3idProvider){e.next=25;break}return e.prev=8,e.next=11,b(this._3id.DID,t,this._provider);case 11:r=e.sent,e.next=17;break;case 14:throw e.prev=14,e.t0=e["catch"](8),new Error("Link consent message must be signed before adding data, to link address to store",e.t0);case 17:return e.prev=17,e.next=20,this._writeAddressLink(r);case 20:e.next=25;break;case 22:throw e.prev=22,e.t1=e["catch"](17),new Error("An error occured while publishing link:",e.t1);case 25:e.next=37;break;case 27:if(this.hasPublishedLink[r.signature]){e.next=37;break}return this.hasPublishedLink[r.signature]=!0,e.prev=29,e.next=32,A.fetchJson(this._serverUrl+"/link",r);case 32:e.next=37;break;case 34:throw e.prev=34,e.t2=e["catch"](29),new Error("An error occured while publishing link:",e.t2);case 37:return e.next=39,this["public"].get("proof_did");case 39:if(n=e.sent,!n){e.next=53;break}if(i=N.decodeJWT(n).payload.iss,!i.includes("muport")){e.next=51;break}return s={muport:n},e.t3=this["public"],e.next=47,this._3id.signJWT(s);case 47:return e.t4=e.sent,e.t5={noLink:!0},e.next=51,e.t3.set.call(e.t3,"proof_did",e.t4,e.t5);case 51:e.next=60;break;case 53:return e.t6=this["public"],e.next=56,this._3id.signJWT();case 56:return e.t7=e.sent,e.t8={noLink:!0},e.next=60,e.t6.set.call(e.t6,"proof_did",e.t7,e.t8);case 60:case"end":return e.stop()}}),e,this,[[8,14],[17,22],[29,34]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"_writeRootstoreEntry",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t,r){var n,i,s,c,u=this;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._ipfs.dag.put(r);case 2:return n=e.sent.toBaseEncodedString(),e.next=5,this._ipfs.pin.add(n);case 5:return e.next=7,this._typeCIDExists(t,n);case 7:if(i=e.sent,!i){e.next=10;break}return e.abrupt("return");case 10:s={type:t,data:n},c=this._rootstoreQueue,this._rootstoreQueue=(0,a["default"])(o["default"].mark((function e(){return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!c){e.next=3;break}return e.next=3,c;case 3:return e.next=5,u.replicator.rootstore.add(s);case 5:case"end":return e.stop()}}),e)})))();case 13:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"_typeCIDExists",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t,r){var n,i;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.replicator.rootstore.iterator({limit:-1}).collect();case 2:return n=e.sent,i=n.filter((function(e){return e.payload.value.type===t})),e.abrupt("return",Boolean(i.find((function(e){return e.data===r}))));case 5:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"_deleteAddressLink",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){var r;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=t.toLowerCase(),e.next=3,this._readAddressLink(t);case 3:if(r=e.sent,r){e.next=6;break}throw new Error("_deleteAddressLink: link for given address does not exist");case 6:return e.abrupt("return",this.replicator.rootstore.remove(r.entry.hash));case 7:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_readAddressLinks",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t,r;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.replicator.getAddressLinks();case 2:return t=e.sent,e.next=5,Promise.all(t.map(v));case 5:return r=e.sent,e.abrupt("return",r.filter(Boolean));case 7:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_readAddressLink",value:function(){var e=(0,a["default"])(o["default"].mark((function e(t){var r;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=t.toLowerCase(),e.next=3,this._readAddressLinks();case 3:return r=e.sent,e.abrupt("return",r.find((function(e){return e.address.toLowerCase()===t})));case 5:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"close",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._3id){e.next=2;break}throw new Error("close: auth required");case 2:return e.next=4,this.replicator.stop();case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"logout",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._3id){e.next=2;break}throw new Error("logout: auth required");case 2:return e.next=4,this.close();case 4:return this._3id.logout(),e.next=7,this._3id.getAddress();case 7:t=e.sent,p.remove("linkConsent_"+t);case 9:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"DID",get:function(){if(!this._3id)throw new Error("DID: auth required");return this._3id.DID}}],[{key:"create",value:function(){var e=(0,a["default"])(o["default"].mark((function e(r){var n,i,s,a=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,t.getIPFS(n);case 3:return i=e.sent,s=new t(r,i,n),e.next=7,s._init(n);case 7:return e.abrupt("return",s);case 8:case"end":return e.stop()}}),e)})));function r(t){return e.apply(this,arguments)}return r}()},{key:"openBox",value:function(){var e=(0,a["default"])(o["default"].mark((function e(r,n){var i,s,a=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i=a.length>2&&void 0!==a[2]?a[2]:{},i=Object.assign(i,{address:r}),e.next=4,t.create(n,i);case 4:return s=e.sent,e.next=7,s.auth([],i);case 7:return e.abrupt("return",s);case 8:case"end":return e.stop()}}),e)})));function r(t,r){return e.apply(this,arguments)}return r}()},{key:"isLoggedIn",value:function(e){return w.isLoggedIn(e)}},{key:"getIPFS",value:function(){var e=(0,a["default"])(o["default"].mark((function e(){var t,r,s,a=arguments;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},"undefined"!==typeof window&&(n=window.globalIPFS,i=window.globalIPFSPromise),n||i||(i=U(t.ipfs,t.iframeStore,t.ipfsOptions)),"undefined"!==typeof window&&(window.globalIPFSPromise=i),n){e.next=8;break}return e.next=7,i;case 7:n=e.sent;case 8:return"undefined"!==typeof window&&(window.globalIPFS=n),r=n,s=t.pinningNode||O,r.swarm.connect(s,(function(){})),e.abrupt("return",r);case 13:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}()}]),t}(x);function M(){var e,t={};if("undefined"!==typeof window&&window.indexedDB){var r=A.randInt(1e4);e="ipfs/root/"+r;var n=new R(e);t={storageBackends:{root:function(){return n}}}}var i=new B("ipfs",t);return{repo:i,rootPath:e}}function U(e,t,r){return j.apply(this,arguments)}function j(){return j=(0,a["default"])(o["default"].mark((function e(t,r,n){var i;return o["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t&&r&&console.warn("Warning: iframeStore true, orbit db cache in iframe, but the given ipfs object is being used, and may not be running in same iframe."),!t){e.next=5;break}return e.abrupt("return",t);case 5:return n||(i=M(),n=Object.assign(D,{repo:i.repo})),e.next=8,y.create(n);case 8:return t=e.sent,i&&"undefined"!==typeof window&&window.indexedDB&&window.indexedDB.deleteDatabase(i.rootPath),e.abrupt("return",t);case 11:case"end":return e.stop()}}),e)}))),j.apply(this,arguments)}L.idUtils=I,e.exports=L},"1d86":function(e,t,r){(function(n){r("33fc");var i=r("a761");function s(e){e.destroy?e.destroy():console.error("warning, stream-to-pull-stream: \nthe wrapped node-stream does not implement `destroy`, \nthis may cause resource leaks.")}function o(e,t,r){var o,a,c=!1;function u(){a||(a=!0,r&&r(!0===o?null:o))}function l(){c||(c=!0,f(),o?u():e(o=!0,u))}function h(t){f(),o||e(o=t,u)}function f(){t.on("finish",l),t.removeListener("close",l),t.removeListener("error",h)}t.on("close",l),t.on("finish",l),t.on("error",h),n.nextTick((function(){i((function(r){e(null,(function(e,n){if(o=o||e,!0===e)return t._isStdio?u():t.end();if(o=o||e)return s(t),u(o);if(t._isStdio)t.write(n,(function(){r()}));else{var i=t.write(n);!1===i?t.once("drain",r):r()}}))}))}))}function a(e){var t,r=!1,n=!1;function i(){var r=e.read();if(null!==r&&t){var n=t;t=null,n(null,r)}}return e.on("readable",(function(){n=!0,t&&i()})).on("end",(function(){r=!0,t&&t(r)})).on("error",(function(e){r=e,t&&t(r)})),function(e,s){t=s,r?s(r):n&&i()}}function c(e){var t,r=[],n=[],i=!1;function o(){while((r.length||t)&&n.length)n.shift()(r.length?null:t,r.shift());!r.length&&i&&(i=!1,e.resume())}return e.on("data",(function(t){r.push(t),o(),r.length&&e.pause&&(i=!0,e.pause())})),e.on("end",(function(){t=!0,o()})),e.on("close",(function(){t=!0,o()})),e.on("error",(function(e){t=e,o()})),function(r,i){if(!i)throw new Error("*must* provide cb");if(r){function a(){while(n.length)n.shift()(r);i(r)}if(t)return a();e.once("close",a),s(e)}else n.push(i),o()}}var u=c,l=function(e,t){return function(r){return o(r,e,t)}},h=function(e){return c(e)};t=e.exports=function(e,t){return e.writable&&e.write?e.readable?function(r){return o(r,e,t),c(e)}:l(e,t):h(e)},t.sink=l,t.source=h,t.read=u,t.read1=c,t.read2=a,t.duplex=function(e,t){return{source:h(e),sink:l(e,t)}},t.transform=function(e){return function(t){var r=h(e);return l(e)(t),r}}}).call(this,r("4362"))},"1dc7":function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},"1dde":function(e,t,r){var n=r("d039"),i=r("b622"),s=r("2d00"),o=i("species");e.exports=function(e){return s>=51||!n((function(){var t=[],r=t.constructor={};return r[o]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},"1df2":function(e,t,r){"use strict";const n=r("6e64"),i=n.ShardingDatastore,s=r("1a18"),o=r("e3d5"),a=r("5345"),{cidToKey:c}=r("aee5");function u(e,t){if(t.sharding){const t=new n.shard.NextToLast(2);return i.createOrOpen(e,t)}return e}function l(e){return{async*query(t){for await(const r of e.query(t))yield r},async get(t){if(!o.isCID(t))throw a(new Error("Not a valid cid"),"ERR_INVALID_CID");const r=c(t);let n;try{return n=await e.get(r),new s(n,t)}catch(i){if("ERR_NOT_FOUND"===i.code){const n=h(t);if(!n)throw i;const o=c(n),a=await e.get(o);return await e.put(r,a),new s(a,t)}throw i}},async put(t){if(!s.isBlock(t))throw new Error("invalid block");const r=c(t.cid),n=await e.has(r);if(!n)return e.put(r,t.data)},async putMany(t){const r=e.batch();for await(const n of t){const t=c(n.cid);await e.has(t)||r.put(t,n.data)}return r.commit()},async has(t){if(!o.isCID(t))throw a(new Error("Not a valid cid"),"ERR_INVALID_CID");const r=await e.has(c(t));if(r)return r;const n=h(t);return!!n&&e.has(c(n))},async delete(t){if(!o.isCID(t))throw a(new Error("Not a valid cid"),"ERR_INVALID_CID");return e.delete(c(t))},async close(){return e.close()}}}function h(e){try{return 0===e.version?e.toV1():e.toV0()}catch(t){return null}}e.exports=async(e,t)=>{const r=await u(e,t);return l(r)}},"1e35":function(e,t,r){"use strict";e.exports=function(){return Date.now()}},"1e6d":function(e,t,r){var n=r("9efb");t.encode=function e(t,r,i){t=t>=0?2*t:-2*t-1;var s=n.encode(t,r,i);return e.bytes=n.encode.bytes,s},t.decode=function e(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return n.encodingLength(e>=0?2*e:-2*e-1)}},"1e83":function(e,t,r){"use strict";function n(e){if("number"===typeof e){if(n.codes[e])return n.codes[e];throw new Error("no protocol with code: "+e)}if("string"===typeof e||e instanceof String){if(n.names[e])return n.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const i=-1;function s(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}n.lengthPrefixedVarSize=i,n.V=i,n.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,i,"ip6zone"],[53,i,"dns","resolvable"],[54,i,"dns4","resolvable"],[55,i,"dns6","resolvable"],[56,i,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,i,"unix",!1,"path"],[421,i,"p2p"],[421,i,"ipfs"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,i,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"]],n.names={},n.codes={},n.table.map(e=>{const t=s.apply(null,e);n.codes[t.code]=t,n.names[t.name]=t}),n.object=s,e.exports=n},"1ea5":function(e,t,r){"use strict";(function(t){const n=r("24f8"),i=r("b383"),s=r("f032"),o=r("0398"),a=r("82bd"); +/** + * @class CoinGecko + * @author Mark Miscavage + * @description A Node.js wrapper for the CoinGecko API with no dependencies. For more information, visit: https://www.coingecko.com/api/docs/v3 + * @example + * const CoinGecko = require('coingecko-api'); + * const CoinGeckoClient = new CoinGecko(); + * @public + * @version 1.0.10 + * @license MIT + * @kind class + */ +class c{ping(){const e="/ping";return this._request(e)}global(){const e="/global";return this._request(e)}get coins(){const e="coins";return{all:(t={})=>{const r=`/${e}`;return this._request(r,t)},list:()=>{const t=`/${e}/list`;return this._request(t)},markets:(t={})=>{const r=`/${e}/markets`;return s.isObject(t)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isString(t["vs_currency"])&&!s.isStringEmpty(t["vs_currency"])||(t.vs_currency="usd"),s.isArray(t["ids"])&&(t.ids=t.ids.join(",")),this._request(r,t)},fetch:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","coinId must be of type: String and greater than 0 characters.");const n=`/${e}/${t}`;return this._request(n,r)},fetchTickers:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","coinId must be of type: String and greater than 0 characters."),s.isArray(r["exchange_ids"])&&(r.exchange_ids=r.exchange_ids.join(","));const n=`/${e}/${t}/tickers`;return this._request(n,r)},fetchHistory:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","coinId must be of type: String and greater than 0 characters."),s.isObject(r)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isString(r["date"])&&!s.isStringEmpty(r["date"])||s._WARN_("Missing parameter","params must include `date` and be a string in format: `dd-mm-yyyy`");const n=`/${e}/${t}/history`;return this._request(n,r)},fetchMarketChart:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","coinId must be of type: String and greater than 0 characters."),s.isObject(r)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isString(r["vs_currency"])&&!s.isStringEmpty(r["vs_currency"])||(r.vs_currency="usd"),void 0==r["days"]&&(r.days=1);const n=`/${e}/${t}/market_chart`;return this._request(n,r)},fetchMarketChartRange:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","coinId must be of type: String and greater than 0 characters."),s.isObject(r)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isString(r["vs_currency"])&&!s.isStringEmpty(r["vs_currency"])||(r.vs_currency="usd"),s.isNumber(r["from"])||s._WARN_("Missing parameter","params must include `from` and be a UNIX timestamp."),s.isNumber(r["to"])||s._WARN_("Missing parameter","params must include `to` and be a UNIX timestamp.");const n=`/${e}/${t}/market_chart/range`;return this._request(n,r)},fetchStatusUpdates:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","coinId must be of type: String and greater than 0 characters.");const n=`/${e}/${t}/status_updates`;return this._request(n,r)},fetchCoinContractInfo:(t,r="ethereum")=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","contractAddress must be of type: String and greater than 0 characters."),s.isString(r)&&!s.isStringEmpty(r)||s._WARN_("Invalid parameter","assetPlatform must be of type: String and greater than 0 characters.");const n=`/${e}/${r}/contract/${t}`;return this._request(n)},fetchCoinContractMarketChart:(t,r="ethereum",n={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","contractAddress must be of type: String and greater than 0 characters."),s.isString(r)&&!s.isStringEmpty(r)||s._WARN_("Invalid parameter","assetPlatform must be of type: String and greater than 0 characters."),s.isObject(n)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isString(n["vs_currency"])&&!s.isStringEmpty(n["vs_currency"])||(n.vs_currency="usd"),void 0==n["days"]&&(n.days=1);const i=`/${e}/${r}/contract/${t}/market_chart`;return this._request(i,n)},fetchCoinContractMarketChartRange:(t,r="ethereum",n={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","contractAddress must be of type: String and greater than 0 characters."),s.isString(r)&&!s.isStringEmpty(r)||s._WARN_("Invalid parameter","assetPlatform must be of type: String and greater than 0 characters."),s.isObject(n)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isString(n["vs_currency"])&&!s.isStringEmpty(n["vs_currency"])||(n.vs_currency="usd"),void 0==n["days"]&&(n.days=1);const i=`/${e}/${r}/contract/${t}/market_chart/range`;return this._request(i,n)}}}get exchanges(){const e="exchanges";return{all:()=>{const t=`/${e}`;return this._request(t)},list:()=>{const t=`/${e}/list`;return this._request(t)},fetch:t=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","exchangeId must be of type: String and greater than 0 characters.");const r=`/${e}/${t}`;return this._request(r)},fetchTickers:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","exchangeId must be of type: String and greater than 0 characters."),s.isArray(r["coin_ids"])&&(r.coin_ids=r.coin_ids.join(","));const n=`/${e}/${t}/tickers`;return this._request(n,r)},fetchStatusUpdates:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","exchangeId must be of type: String and greater than 0 characters.");const n=`/${e}/${t}/status_updates`;return this._request(n,r)},fetchVolumeChart:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","exchangeId must be of type: String and greater than 0 characters.");const n=`/${e}/${t}/volume_chart`;return this._request(n,r)}}}get statusUpdates(){return{all:(e={})=>{const t="/status_updates";return this._request(t,e)}}}get events(){const e="events";return{all:(t={})=>{const r=`/${e}`;return this._request(r,t)},fetchCountries:()=>{const t=`/${e}/countries`;return this._request(t)},fetchTypes:()=>{const t=`/${e}/types`;return this._request(t)}}}get exchangeRates(){return{all:()=>{const e="/exchange_rates";return this._request(e)}}}get simple(){return{price:(e={})=>{s.isObject(e)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isArray(e["vs_currencies"])&&(e.vs_currencies=e.vs_currencies.join(",")),s.isString(e["vs_currencies"])&&!s.isStringEmpty(e["vs_currencies"])||(e.vs_currencies="usd"),s.isArray(e["ids"])&&(e.ids=e.ids.join(",")),s.isString(e["ids"])&&!s.isStringEmpty(e["ids"])||s._WARN_("Invalid parameter","params.ids must be of type: String or Array and greater than 0 characters.");const t="/simple/price";return this._request(t,e)},supportedVsCurrencies:()=>{const e="/simple/supported_vs_currencies";return this._request(e)},fetchTokenPrice:(e={},t="ethereum")=>{s.isObject(e)||s._WARN_("Invalid parameter","params must be of type: Object"),s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","assetPlatform must be of type: String and greater than 0 characters."),e["contract_addresses"]||s._WARN_("Missing parameter","params must include `contract_addresses` and be a of type: String or Object"),e["vs_currencies"]||s._WARN_("Missing parameter","params must include `vs_currencies` and be a of type: String or Object"),s.isArray(e["contract_addresses"])&&(e.contract_addresses=e.contract_addresses.join(",")),s.isArray(e["vs_currencies"])&&(e.vs_currencies=e.vs_currencies.join(","));const r=`/simple/token_price/${t}`;return this._request(r,e)}}}get finance(){return{fetchPlatforms:(e={})=>{const t="/finance_platforms";return this._request(t,e)},fetchProducts:(e={})=>{const t="/finance_products";return this._request(t,e)}}}get indexes(){const e="indexes";return{all:(t={})=>{const r=`/${e}`;return this._request(r,t)},fetch:t=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","indexId must be of type: String and greater than 0 characters.");const r=`/${e}/${t}`;return this._request(r)},list:()=>{const t=`/${e}/list`;return this._request(t)}}}get derivatives(){const e="derivatives";return{fetchTickers:()=>{const t=`/${e}`;return this._request(t)},allExchanges:(t={})=>{const r=`/${e}/exchanges`;return this._request(r,t)},fetchExchange:(t,r={})=>{s.isString(t)&&!s.isStringEmpty(t)||s._WARN_("Invalid parameter","exchangeId must be of type: String and greater than 0 characters.");const n=`/${e}/exchanges/${t}`;return this._request(n,r)},listExchanges:()=>{const t=`/${e}/exchanges/list`;return this._request(t)}}}_buildRequestOptions(e,t){return t=s.isObject(t)?i.stringify(t):void 0,e=void 0==t?`/api/v${o.API_VERSION}${e}`:`/api/v${o.API_VERSION}${e}?${t}`,{path:e,method:"GET",host:o.HOST,port:443,timeout:c.TIMEOUT}}_request(e,r){let i=this._buildRequestOptions(e,r);return new Promise((e,r)=>{let o=n.request(i,n=>{let i=[];n.on("data",e=>{i.push(e)}),n.on("end",()=>{try{i=t.concat(i),i=i.toString(),i.startsWith("")?s._WARN_("Invalid request","There was a problem with your request. The parameter(s) you gave are missing or incorrect."):i.startsWith("Throttled")&&s._WARN_("Throttled request","There was a problem with request limit."),i=JSON.parse(i)}catch(o){r(o)}e(a(!(n.statusCode<200||n.statusCode>=300),n.statusMessage,n.statusCode,i))})});o.on("error",e=>r(e)),o.on("timeout",()=>{o.abort(),r(new Error(`CoinGecko API request timed out. Current timeout is: ${c.TIMEOUT} milliseconds`))}),o.end()})}}c.API_VERSION=o.API_VERSION,c.REQUESTS_PER_SECOND=o.REQUESTS_PER_SECOND,c.ORDER=o.ORDER,c.STATUS_UPDATE_CATEGORY=o.STATUS_UPDATE_CATEGORY,c.STATUS_UPDATE_PROJECT_TYPE=o.STATUS_UPDATE_PROJECT_TYPE,c.EVENT_TYPE=o.EVENT_TYPE,c.TIMEOUT=o.TIMEOUT,e.exports=c}).call(this,r("b639").Buffer)},"1eca":function(e,t,r){"use strict";(function(t){const n=r("e3d5"),i=(e,r)=>{if("string"===typeof r)e._links=e._links.filter(e=>e.Name!==r);else{if(!t.isBuffer(r)&&!n.isCID(r))throw new Error("second arg needs to be a name or CID");e._links=e._links.filter(e=>!e.Hash.equals(r))}};e.exports=i}).call(this,r("b639").Buffer)},"1ef8":function(e,t,r){"use strict";const n=r("d3c3"),i=r("a796"),s=r("8f0a"),{default:o}=r("10d9"),a=r("4bc2"),c=a("libp2p-delegated-content-routing");c.error=a("libp2p-delegated-content-routing:error");const u=3e4,l={protocol:"https",port:443,host:"node0.delegate.ipfs.io"},h=4;class f{constructor(e,t){if(null==e)throw new Error("missing self peerId");this.api=Object.assign({},s(),l,t),this.dht=n(this.api),this.refs=i(this.api),this.peerId=e;const r={concurrency:h};this._httpQueue=new o(r),this._httpQueueRefs=new o(Object.assign({},r,{concurrency:2})),c(`enabled DelegatedContentRouting via ${this.api.protocol}://${this.api.host}:${this.api.port}`)}async*findProviders(e,t={}){const r=e.toBaseEncodedString();c("findProviders starts: "+r),t.maxTimeout=t.maxTimeout||u;const n=await this._httpQueue.add(()=>this.dht.findProvs(e,{timeout:`${t.maxTimeout}ms`}));for(let i=0;ithis.refs(t,{recursive:!1})),c("provide finished: "+t)}}e.exports=f},"1f17":function(e,t,r){"use strict";const n=r("7048"),i=r("8f3a"),s=r("5ffd"),o=e=>function*(t={}){const{offset:r,length:n}=s(e.length,t.offset,t.length);yield i(e,0,r,r+n)},a=async(e,t,r,i,s,a,c)=>{if(i.length)throw n(new Error(`No link named ${r} found in raw node ${e.toBaseEncodedString()}`),"ERR_NOT_FOUND");const u=await c.get(e);return{entry:{name:t,path:r,cid:e,node:u,content:o(u),depth:a}}};e.exports=a},"1f1d":function(e,t,r){"use strict";(function(t){const n=r("1a18"),i=r("e3d5"),s=r("4bb2"),o=r("8671"),a=r("c75d"),c=r("2773"),u=r("0c9a"),l=r("07a0"),{extendIterator:h}=r("8c82");class f{constructor(e){const t=s(f.defaultOptions,e);if(!t.blockService)throw new Error("Missing blockservice");this.bs=t.blockService,this.resolvers={},"function"!==typeof t.loadFormat?this.loadFormat=e=>{const t=u.print[e];throw new Error(`No resolver found for codec "${t}"`)}:this.loadFormat=t.loadFormat;for(const r of t.formats)this.addFormat(r)}addFormat(e){const t=e.codec;if(this.resolvers[e.format]){const e=u.print[t];throw new Error(`Resolver already exists for codec "${e}"`)}return this.resolvers[t]=e,this}removeFormat(e){return this.resolvers[e]&&delete this.resolvers[e],this}resolve(e,t){if(!i.isCID(e))throw new Error("`cid` argument must be a CID");if("string"!==typeof t)throw new Error("`path` argument must be a string");const r=async function*(){while(null!==e){const n=await this._getFormat(e.codec),s=await this.bs.get(e),o=n.resolver.resolve(s.data,t);t=o.remainderPath;let a=o.value;if(1===Object.keys(a).length&&"/"in a)try{a=new i(a["/"])}catch(r){a=null}e=i.isCID(a)?a:null,yield{remainderPath:t,value:a}}}.bind(this);return h(r())}async get(e){const t=await this.bs.get(e),r=await this._getFormat(t.cid.codec),n=r.util.deserialize(t.data);return n}getMany(e){if(!l.isIterable(e)||"string"===typeof e||t.isBuffer(e))throw new Error("`cids` must be an iterable of CIDs");const r=async function*(){for await(const t of e)yield this.get(t)}.bind(this);return h(r())}async put(e,t,r){if(void 0===t)throw new Error("`put` requires a format");if("number"!==typeof t)throw new Error("`format` parameter must be number (multicodec)");const i=await this._getFormat(t),o={hashAlg:i.defaultHashAlg,cidVersion:1,onlyHash:!1},a=s(o,r),c={cidVersion:a.cidVersion,hashAlg:a.hashAlg,onlyHash:a.onlyHash},u=i.util.serialize(e),l=await i.util.cid(u,c);if(!a.onlyHash){const e=new n(u,l);await this.bs.put(e)}return l}putMany(e,r,n){if(!l.isIterable(e)||"string"===typeof e||t.isBuffer(e))throw new Error("`nodes` must be an iterable");if(void 0===r)throw new Error("`put` requires a format");if("number"!==typeof r)throw new Error("`format` parameter must be number (multicodec)");let i,o;const a=async function*(){for await(const t of e){if(void 0===i){o=await this._getFormat(r);const e={hashAlg:o.defaultHashAlg,cidVersion:1,onlyHash:!1};i=s(e,n)}yield this.put(t,r,i)}}.bind(this);return h(a())}async remove(e){return this.bs.delete(e)}removeMany(e){if(!l.isIterable(e)||"string"===typeof e||t.isBuffer(e))throw new Error("`cids` must be an iterable of CIDs");const r=async function*(){for await(const t of e)yield this.remove(t)}.bind(this);return h(r())}tree(e,t,r){"object"===typeof t&&(r=t,t=void 0),t=t||"";const n={recursive:!1},o=s(n,r),a=async(e,t)=>{const r=await this._getFormat(e.cid.codec),n=r.resolver.resolve(e.data,t);return i.isCID(n.value)?n.value:null},c=async function*(){const r=[];let n;const i=[{cid:e,basePath:""}];let s;while(r.length>0||i.length>0){if(0===r.length&&i.length>0){({cid:e,basePath:s}=i.shift());const t=await this._getFormat(e.codec);n=await this.bs.get(e);const o=t.resolver.tree(n.data);r.push(...o)}const c=r.shift();let u=s+c;o.recursive&&(e=await a(n,c),null!==e&&i.push({cid:e,basePath:u+"/"})),u.startsWith(t)&&u.length>t.length&&(t.length>0&&(u=u.slice(t.length+1)),yield u)}}.bind(this);return h(c())}async _getFormat(e){if("string"===typeof e){const t=e.toUpperCase().replace(/-/g,"_");e=u[t]}if(this.resolvers[e])return this.resolvers[e];const t=await this.loadFormat(e);return this.addFormat(t),t}}f.defaultOptions={formats:[o,a,c]},e.exports=f}).call(this,r("b639").Buffer)},"1f39":function(e,t,r){"use strict";const n=r("faa1"),i=r("26a6"),s=r("d720");class o extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(e=>{this._stats[e]=i(0),this._movingAverages[e]={},this._options.movingAverageIntervals.forEach(t=>{const r=this._movingAverages[e][t]=s(t);r.push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,t){this._enabled&&(this._queue.push([e,t,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;while(this._queue.length){const t=e=this._queue.shift();this._applyOp(t)}this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach(r=>{this._updateFrequencyFor(r,t,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/t*1e3;let o=this._movingAverages[e];o||(o=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(e=>{let t=o[e];t||(t=o[e]=s(e)),t.push(r,i)})}_applyOp(e){const t=e[0],r=e[1];if("number"!==typeof r)throw new Error("invalid increment number:",r);let n;n=Object.prototype.hasOwnProperty.call(this._stats,t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=n.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}e.exports=o},"1f47":function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i=Array.isArray,s=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),o=function(e){while(e.length>1){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var n=[],s=0;s=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?i+=n.charAt(o):a<128?i+=s[a]:a<2048?i+=s[192|a>>6]+s[128|63&a]:a<55296||a>=57344?i+=s[224|a>>12]+s[128|a>>6&63]+s[128|63&a]:(o+=1,a=65536+((1023&a)<<10|1023&n.charCodeAt(o)),i+=s[240|a>>18]+s[128|a>>12&63]+s[128|a>>6&63]+s[128|63&a])}return i},f=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n0;return l(e,o,a,(function(e){n||(n=e),e&&s.forEach(h),o||(s.forEach(h),i(n))}))}));return t.reduce(f)}e.exports=p},20:function(e,t){},2007:function(e,t,r){var n=r("9070"),i=r("7a7a"),s=r("e39a"),o=r("464c"),a=r("eb5c");function c(e){var t=-1,r=null==e?0:e.length;this.clear();while(++tnew n.Entry(e,s.kMaxPriority-r,t));i.forEach(e=>{e.cancel?r?this.wantlist.removeForce(e.cid):this.wantlist.remove(e.cid):(this._log("adding to wl"),this.wantlist.add(e.cid,e.priority))});for(const n of this.peers.values())n.addEntries(i)}_startPeerHandler(e){let t=this.peers.get(e.toB58String());if(t)return void t.refcnt++;t=new o(this._peerId,e,this.network);const r=new n(!0);for(const n of this.wantlist.entries())r.addEntry(n[1].cid,n[1].priority);return t.addMessage(r),this.peers.set(e.toB58String(),t),t}_stopPeerHandler(e){const t=this.peers.get(e.toB58String());t&&(t.refcnt--,t.refcnt>0||this.peers.delete(e.toB58String()))}wantBlocks(e){this._addEntries(e,!1)}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(){this.timer=setInterval(()=>{this._log("resend full-wantlist");const e=new n(!0);this.wantlist.forEach(t=>{e.addEntry(t.cid,t.priority)}),this.peers.forEach(t=>t.addMessage(e))},6e4)}stop(){this.peers.forEach(e=>this.disconnected(e.peerId)),clearInterval(this.timer)}}},2046:function(e,t){e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},2054:function(e,t,r){"use strict";(function(t){const n=r("ba1f"),i=r("956c"),s=r("2612"),o=r("0774"),a=r("c449"),c=r("ec12"),u=Symbol.for("nodejs.util.inspect.custom"),l=c.proto((function(e){if(!(this instanceof l))return new l(e);if(null==e&&(e=""),e instanceof t)this.buffer=n.fromBuffer(e);else if("string"===typeof e||e instanceof String){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.buffer=n.fromString(e)}else{if(!(e.buffer&&e.protos&&e.protoCodes))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.buffer=n.fromBuffer(e.buffer)}}),{className:"Multiaddr",symbolName:"@multiformats/js-multiaddr/multiaddr"});l.prototype.toString=function(){return n.bufferToString(this.buffer)},l.prototype.toJSON=l.prototype.toString,l.prototype.toOptions=function(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?"ipv4":"ipv6",e.host=t[2],e.transport=t[3],e.port=parseInt(t[4]),e},l.prototype[u]=function(){return""},l.prototype.inspect=function(){return""},l.prototype.protos=function(){return this.protoCodes().map(e=>Object.assign({},i(e)))},l.prototype.protoCodes=function(){const e=[],t=this.buffer;let r=0;while(re.name)},l.prototype.tuples=function(){return n.bufferToTuples(this.buffer)},l.prototype.stringTuples=function(){const e=n.bufferToTuples(this.buffer);return n.tuplesToStringTuples(e)},l.prototype.encapsulate=function(e){return e=l(e),l(this.toString()+e.toString())},l.prototype.decapsulate=function(e){e=e.toString();const t=this.toString(),r=t.lastIndexOf(e);if(r<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return l(t.slice(0,r))},l.prototype.decapsulateCode=function(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return l(n.tuplesToBuffer(t.slice(0,r)));return this},l.prototype.getPeerId=function(){let e=null;try{const t=this.stringTuples().filter(e=>{if(e[0]===i.names.ipfs.code)return!0});e=t.pop()[1],e=o.encode(new a(e).multihash)}catch(t){e=null}return e},l.prototype.getPath=function(){let e=null;try{e=this.stringTuples().filter(e=>{const t=i(e[0]);if(t.path)return!0})[0][1]}catch(t){e=null}return e},l.prototype.equals=function(e){return this.buffer.equals(e.buffer)},l.prototype.nodeAddress=function(){const e=this.protoCodes(),t=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:parseInt(r[3])}},l.fromNodeAddress=function(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");const r="IPv6"===e.family?"ip6":"ip4";return l("/"+[r,e.address,t,e.port].join("/"))},l.prototype.isThinWaistAddress=function(e){const t=(e||this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))},l.protocols=i,l.isName=function(e){return!!l.isMultiaddr(e)&&e.protos().some(e=>e.resolvable)},l.resolve=function(e){return l.isMultiaddr(e)&&l.isName(e)?Promise.reject(new Error("not implemented yet")):Promise.reject(Error("not a valid name"))},e.exports=l}).call(this,r("b639").Buffer)},2072:function(e,t,r){const n=r("f0e0"),i=r("0d07"),s=r("f269"),o=r("6ecd");e.exports={OdbIdentityProvider:n,ModeratorAccessController:i,ThreadAccessController:s,LegacyIPFS3BoxAccessController:o}},"2091e":function(e,t,r){"use strict";const n=r("f106"),i=n(r("c545")),s=i.Data,o=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],a=["directory","hamt-sharded-directory"];function c(e,t){if(!(this instanceof c))return new c(e,t);if(-1===o.indexOf(e))throw new Error("Type: "+e+" is not valid");this.type=e,this.data=t,this.blockSizes=[],this.addBlockSize=e=>{this.blockSizes.push(e)},this.removeBlockSize=e=>{this.blockSizes.splice(e,1)},this.fileSize=()=>{if(a.indexOf(this.type)>=0)return;let e=0;return this.blockSizes.forEach(t=>{e+=t}),t&&(e+=t.length),e},this.marshal=()=>{let e;switch(this.type){case"raw":e=s.DataType.Raw;break;case"directory":e=s.DataType.Directory;break;case"file":e=s.DataType.File;break;case"metadata":e=s.DataType.Metadata;break;case"symlink":e=s.DataType.Symlink;break;case"hamt-sharded-directory":e=s.DataType.HAMTShard;break;default:throw new Error(`Unkown type: "${this.type}"`)}let t=this.fileSize(),r=this.data;this.data&&this.data.length||(r=void 0);let n=this.blockSizes;return this.blockSizes&&this.blockSizes.length||(n=void 0),s.encode({Type:e,Data:r,filesize:t,blocksizes:n,hashType:this.hashType,fanout:this.fanout})}}c.unmarshal=e=>{const t=s.decode(e);t.Data||(t.Data=void 0);const r=new c(o[t.Type],t.Data);return r.blockSizes=t.blocksizes,r},e.exports=c},"20b8":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,c.default)(t||o.default),!(0,i.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function n(t){var n=(0,p.default)(e[r++]);t.push((0,f.default)(s)),n.apply(null,t)}function s(i){if(i||r===e.length)return t.apply(null,arguments);n((0,l.default)(arguments,1))}n([])};var n=r("cdca"),i=y(n),s=r("c1cd"),o=y(s),a=r("0924"),c=y(a),u=r("6307"),l=y(u),h=r("ba12"),f=y(h),d=r("76bf"),p=y(d);function y(e){return e&&e.__esModule?e:{default:e}}e.exports=t["default"]},"20ba":function(e,t,r){"use strict";(function(t){const{Key:n}=r("7b6d"),{Record:i}=r("7943"),{encodeBase32:s}=r("7397"),o=r("7048"),a=r("4bc2"),c=a("ipfs:ipns:offline-datastore");c.error=a("ipfs:ipns:offline-datastore:error");class u{constructor(e){this._repo=e}async put(e,r){if(!t.isBuffer(e))throw o(new Error("Offline datastore key must be a buffer"),"ERR_INVALID_KEY");if(!t.isBuffer(r))throw o(new Error("Offline datastore value must be a buffer"),"ERR_INVALID_VALUE");let n;try{n=this._routingKey(e)}catch(a){throw c.error(a),o(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}const s=new i(e,r);return this._repo.datastore.put(n,s.serialize())}async get(e){if(!t.isBuffer(e))throw o(new Error("Offline datastore key must be a buffer"),"ERR_INVALID_KEY");let r;try{r=this._routingKey(e)}catch(a){throw c.error(a),o(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}const n=await this._repo.datastore.get(r);let s;try{s=i.deserialize(n)}catch(a){throw c.error(a),a}return s.value}_routingKey(e){return new n("/"+s(e),!1)}}e.exports=u}).call(this,r("b639").Buffer)},"20bc":function(e,t,r){var n=r("e0c5").Buffer;function i(e,t,r){var n,i,o,a=-1,c=8,u=0;while(++a>a%8,e._prev=s(e._prev,r?i:o);return u}function s(e,t){var r=e.length,i=-1,s=n.allocUnsafe(e.length);e=n.concat([e,n.from([t])]);while(++i>7;return s}t.encrypt=function(e,t,r){var s=t.length,o=n.allocUnsafe(s),a=-1;while(++a{let t;for await(const r of e)t=r;return t};e.exports=n},"20d6":function(e,t,r){var n=r("9a16"),i=r("0937"),s=n(i,"Map");e.exports=s},"20d8":function(e,t,r){"use strict";(function(t){const n=r("670b"),i=r("c14d");class s extends n{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,r,n){return super.createInt64(e,t,r,n).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,r,n){return super.createInt64Neg(e,t,r,n).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return i.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,r,n){const i=super.createFloatSingle(e,t,r,n);return`${i}_2`}createFloatDouble(e,t,r,n,i,s,o,a){const c=super.createFloatDouble(e,t,r,n,i,s,o,a);return`${c}_3`}createByteString(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`h'${r}`}createByteStringFromHeap(e,r){const n=t.from(super.createByteStringFromHeap(e,r)).toString("hex");return`h'${n}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const r=super.createArray(e,t);return-1===t?`[_ ${r.join(", ")}]`:`[${r.join(", ")}]`}createMap(e,t){const r=super.createMap(e),n=Array.from(r.keys()).reduce(o(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createObject(e,t){const r=super.createObject(e),n=Object.keys(r).reduce(o(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createUtf8String(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`"${r}"`}createUtf8StringFromHeap(e,r){const n=t.from(super.createUtf8StringFromHeap(e,r)).toString("utf8");return`"${n}"`}static diagnose(e,r){"string"===typeof e&&(e=t.from(e,r||"hex"));const n=new s;return n.decodeFirst(e)}}function o(e){return(t,r)=>t?`${t}, ${r}: ${e[r]}`:`${r}: ${e[r]}`}e.exports=s}).call(this,r("b639").Buffer)},"20df":function(e,t,r){"use strict";(function(t){e.exports=function(e){return{encode(e){return"string"===typeof e?t.from(e).toString("hex"):e.toString("hex")},decode(r){for(let t of r)if(e.indexOf(t)<0)throw new Error("invalid base16 character");return t.from(r,"hex")}}}}).call(this,r("b639").Buffer)},"20e2":function(e,t,r){"use strict";var n=r("1727"),i=r("b93e"),s=r("5380");function o(e,t){return void 0===e?t:(n.isBoolean(e,s.COMPRESSED_TYPE_INVALID),e)}e.exports=function(e){return{privateKeyVerify:function(t){return n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),32===t.length&&e.privateKeyVerify(t)},privateKeyExport:function(t,r){n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,s.EC_PRIVATE_KEY_LENGTH_INVALID),r=o(r,!0);var a=e.privateKeyExport(t,r);return i.privateKeyExport(t,a,r)},privateKeyImport:function(t){if(n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),t=i.privateKeyImport(t),t&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error(s.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(t){return n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,s.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyNegate(t)},privateKeyModInverse:function(t){return n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,s.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyModInverse(t)},privateKeyTweakAdd:function(t,r){return n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,s.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,s.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,s.TWEAK_LENGTH_INVALID),e.privateKeyTweakAdd(t,r)},privateKeyTweakMul:function(t,r){return n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,s.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,s.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,s.TWEAK_LENGTH_INVALID),e.privateKeyTweakMul(t,r)},publicKeyCreate:function(t,r){return n.isBuffer(t,s.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(t,32,s.EC_PRIVATE_KEY_LENGTH_INVALID),r=o(r,!0),e.publicKeyCreate(t,r)},publicKeyConvert:function(t,r){return n.isBuffer(t,s.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,s.EC_PUBLIC_KEY_LENGTH_INVALID),r=o(r,!0),e.publicKeyConvert(t,r)},publicKeyVerify:function(t){return n.isBuffer(t,s.EC_PUBLIC_KEY_TYPE_INVALID),e.publicKeyVerify(t)},publicKeyTweakAdd:function(t,r,i){return n.isBuffer(t,s.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,s.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,s.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,s.TWEAK_LENGTH_INVALID),i=o(i,!0),e.publicKeyTweakAdd(t,r,i)},publicKeyTweakMul:function(t,r,i){return n.isBuffer(t,s.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(t,33,65,s.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,s.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,s.TWEAK_LENGTH_INVALID),i=o(i,!0),e.publicKeyTweakMul(t,r,i)},publicKeyCombine:function(t,r){n.isArray(t,s.EC_PUBLIC_KEYS_TYPE_INVALID),n.isLengthGTZero(t,s.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i{if(t){if(e.return)try{await e.return()}catch(i){return r(i)}return r(t)}let n;try{n=await e.next()}catch(i){return r(i)}if(n.done)return r(!0);r(null,n.value)}}s.source=s,s.transform=s.through=e=>t=>s(e(i(t))),s.duplex=e=>({sink:s.sink(e.sink),source:s(e.source)}),s.sink=e=>t=>{e({[Symbol.asyncIterator](){return this},next:()=>new Promise((e,r)=>{t(null,(t,n)=>!0===t?e({done:!0,value:n}):t?r(t):void e({done:!1,value:n}))}),return:()=>new Promise((e,r)=>{t(!0,(t,n)=>{if(t&&!0!==t)return r(t);e({done:!0,value:n})})}),throw:e=>new Promise((r,n)=>{t(e,(e,t)=>{if(e&&!0!==e)return n(e);r({done:!0,value:t})})})})},e.exports=s},"21b4":function(e,t,r){"use strict";const n=r("c8d3"),{DIAL_ABORTED:i,ERR_DENIED:s}=r("a10a"),o=r("9f2e"),a=r("c59f"),c=r("4bc2"),u=c("libp2p:switch:dial");function l({protocol:e,connection:t,callback:r}){if(!e)return r();t.shake(e,(e,n)=>{if(!n)return r(e);n.setPeerInfo(t.theirPeerInfo),r(null,n)})}u.error=c("libp2p:switch:dial:error");class h{constructor(e,t,r){this.id=e,this.switch=t,this._queue=[],this.denylisted=null,this.denylistCount=0,this.isRunning=!1,this.onStopped=r}get length(){return this._queue.length}add(e,t,r){if(!this.isDialAllowed())return o(r,s());this._queue.push({protocol:e,useFSM:t,callback:r})}isDialAllowed(){return!this.denylisted||Date.now()>this.denylisted&&(this.denylisted=null,!0)}start(){return!this.isRunning&&(u("starting dial queue to %s",this.id),this.isRunning=!0,this._run(),!0)}stop(){this.isRunning&&(u("stopping dial queue to %s",this.id),this.isRunning=!1,this.onStopped(this.id))}abort(){while(this.length>0){const e=this._queue.shift();e.callback(i())}this.stop()}denylist(){if(this.denylistCount++,this.denylistCount>=this.switch.dialer.DENY_ATTEMPTS)return void(this.denylisted=1/0);let e=this.switch.dialer.DENY_TTL*Math.pow(this.denylistCount,3);const t=.9*e,r=1.1*e;e=Math.floor(Math.random()*(r-t)+t),this.denylisted=Date.now()+e,this.abort()}_getOrCreateConnection(e){let t=this.switch.connection.getOne(this.id),r=!1;return t||(t=new n({_switch:this.switch,peerInfo:e,muxer:null,conn:null}),this.switch.connection.add(t),t.once("connected",()=>t.protect()),t.once("private",()=>t.encrypt()),t.once("encrypted",()=>t.upgrade()),r=!0),{connectionFSM:t,didCreate:r}}_run(){if(this.length<1||!this.isRunning)return u("stopping the queue for %s",this.id),this.stop();const e=a(()=>{u("starting next dial to %s",this.id),this._run()}),t=this.switch._peerBook.get(this.id),r=this._queue.shift(),{connectionFSM:n,didCreate:i}=this._getOrCreateConnection(t);if(r.useFSM&&o(r.callback,null,n),["MUXED","CONNECTED"].includes(n.getState()))return r.connection=n,l(r),void e();n.once("error",e=>{r.callback(e),t.protocols.size>0&&t.isConnected()||this.denylist()}),n.once("close",()=>{e()}),n.once("muxed",()=>{this.denylistCount=0,r.connection=n,l(r),e()}),n.once("unmuxed",()=>{this.denylistCount=0,r.connection=n,l(r),e()}),i&&n.dial()}}e.exports=h},"21d6":function(e,t,r){var n=r("6b4f"),i=Object.prototype,s=i.hasOwnProperty,o=i.toString,a=n?n.toStringTag:void 0;function c(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(c){}var i=o.call(e);return n&&(t?e[a]=r:delete e[a]),i}e.exports=c},22:function(e,t){},2204:function(e,t,r){"use strict";function n(e){return e}var i=r("b6d6"),s=r("1631");e.exports=function(e,t){var r=!1;return t?e=i(e)||n:(t=e,e=n),s((function(n){if(e(n))return r=!0,t(null,n),!1}),(function(e){r||t(!0===e?null:e,null)}))}},"220c":function(e,t,r){"use strict";(function(t){const n=r("c64e"),i=r("ec12"),s="/",o=t.from(s),a=o[0];class c{constructor(e,r){if("string"===typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==r&&(r=!0),r&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new h(e.join(s))}static random(){return new h(n().replace(/-/g,""))}clean(){this._buf&&0!==this._buf.length||(this._buf=t.from(s)),this._buf[0]!==a&&(this._buf=t.concat([o,this._buf]));while(this._buf.length>1&&this._buf[this._buf.length-1]===a)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;ni)return!1}return t.length + * https://github.com/rvagg/prr + * License: MIT + */ +(function(t,r,n){e.exports?e.exports=n():r[t]=n()})("prr",this,(function(){var e="function"==typeof Object.defineProperty?function(e,t,r){return Object.defineProperty(e,t,r),e}:function(e,t,r){return e[t]=r.value,e},t=function(e,t){var r="object"==typeof t,n=!r&&"string"==typeof t,i=function(e){return r?!!t[e]:!!n&&t.indexOf(e[0])>-1};return{enumerable:i("enumerable"),configurable:i("configurable"),writable:i("writable"),value:e}},r=function(r,n,i,s){var o;if(s=t(i,s),"object"==typeof n){for(o in n)Object.hasOwnProperty.call(n,o)&&(s.value=n[o],e(r,o,s));return r}return e(r,n,s)};return r}))},2236:function(e,t){function r(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t{})}){s.isCID(e)||(e=new s(e));const n=e=>async()=>{const{value:s}=await this.dag.get(e,{preload:t});if(r(e),"dag-pb"===e.codec)i.addAll(s.Links.map(e=>n(e.Hash)));else if("dag-cbor"===e.codec)for(const[e,t]of l(s))i.add(n(t))},i=new o({concurrency:g});i.add(n(e)),await i.onIdle()}directKeys(){return Array.from(this.directPins,e=>new s(e).buffer)}recursiveKeys(){return Array.from(this.recursivePins,e=>new s(e).buffer)}async getIndirectKeys({preload:e}){const t=new Set;for(const r of this.recursiveKeys())await this._walkDag({cid:new s(r),preload:e||!1,onCid:e=>{e=e.toString(),this.recursivePins.has(e)||t.add(e)}});return Array.from(t)}async flushPins(){const[e,r]=await Promise.all([this.pinset.storeSet(this.directKeys()).then(e=>new i(w.direct,e.node.size,e.cid)),this.pinset.storeSet(this.recursiveKeys()).then(e=>new i(w.recursive,e.node.size,e.cid)),this.dag.put(new n(t.alloc(0)),{version:0,format:u.DAG_PB,hashAlg:u.SHA2_256,preload:!1})]),s=new n(t.alloc(0),[e,r]),o=await this.dag.put(s,{version:0,format:u.DAG_PB,hashAlg:u.SHA2_256,preload:!1});await this.repo.datastore.put(b,o.buffer),this.log(`Flushed pins with root: ${o}`)}async load(){const e=await this.repo.datastore.has(b);if(!e)return;const t=await this.repo.datastore.get(b),r=await this.dag.get(new s(t),"",{preload:!1}),[n,i]=await Promise.all([this.pinset.loadSet(r.value,w.recursive),this.pinset.loadSet(r.value,w.direct)]);this.directPins=new Set(i.map(e=>f(e))),this.recursivePins=new Set(n.map(e=>f(e))),this.log("Loaded pins from the datastore")}async isPinnedWithType(e,t){const r=f(e),{recursive:n,direct:i,all:a}=w;if((t===n||t===a)&&this.recursivePins.has(r))return{key:r,pinned:!0,reason:n};if(t===n)return{key:r,pinned:!1};if((t===i||t===a)&&this.directPins.has(r))return{key:r,pinned:!0,reason:i};if(t===i)return{key:r,pinned:!1};const c=new o({concurrency:m});let u;return c.addAll(this.recursiveKeys().map(e=>(e=new s(e),async()=>{const t=await this.pinset.hasDescendant(e,r);t&&(u=e,c.clear())}))),await c.onIdle(),{key:r,pinned:Boolean(u),reason:u}}async getInternalBlocks(){let e;try{e=await this.repo.datastore.get(b)}catch(i){if(i.code===y)return this.log("No pinned blocks"),[];throw new Error(`Could not get pin sets root from datastore: ${i.message}`)}const t=new s(e),r=await this.dag.get(t,"",{preload:!1}),n=await this.pinset.getInternalCids(r.value);return n.concat(t)}async fetchCompleteDag(e,t){await this._walkDag({cid:e,preload:t.preload})}static checkPinType(e){if("string"!==typeof e||!Object.keys(w).includes(e))return v(e)}}_.PinTypes=w,e.exports=_}).call(this,r("b639").Buffer)},23:function(e,t){},2304:function(e,t,r){e.exports=r("27a7")},"230c":function(e,t,r){"use strict";var n=r("c3bb"),i=r("f522").AbstractIterator,s=r("2f06"),o=r("d13e"),a=r("a6a3"),c=function(){};function u(e,t,r){if(i.call(this,e),this._limit=r.limit,this._count=0,this._callback=null,this._cache=[],this._completed=!1,this._aborted=!1,this._error=null,this._transaction=null,this._keyAsBuffer=r.keyAsBuffer,this._valueAsBuffer=r.valueAsBuffer,0!==this._limit){try{var n=this.createKeyRange(r)}catch(s){return void(this._completed=!0)}this.createIterator(t,n,r.reverse)}else this._completed=!0}e.exports=u,n(u,i),u.prototype.createKeyRange=function(e){var t=s.lowerBound(e),r=s.upperBound(e),n=s.lowerBoundExclusive(e),i=s.upperBoundExclusive(e);return void 0!==t&&void 0!==r?IDBKeyRange.bound(t,r,n,i):void 0!==t?IDBKeyRange.lowerBound(t,n):void 0!==r?IDBKeyRange.upperBound(r,i):null},u.prototype.createIterator=function(e,t,r){var n=this,i=this.db.db.transaction([e],"readonly"),s=i.objectStore(e),o=s.openCursor(t,r?"prev":"next");o.onsuccess=function(e){var t=e.target.result;t&&n.onItem(t)},this._transaction=i,i.onabort=function(){n.onAbort(n._transaction.error||new Error("aborted by user"))},i.oncomplete=function(){n.onComplete()}},u.prototype.onItem=function(e){this._cache.push(e.key,e.value),(this._limit<=0||++this._count0){var r=this._cache.shift(),n=this._cache.shift();this._keyAsBuffer&&(r=o(r)),this._valueAsBuffer&&(n=o(n)),a((function(){e(null,r,n)}))}else this._completed?a(e):this._callback=e},u.prototype._end=function(e){if(this._aborted||this._completed){var t=this._error;a((function(){e(t)}))}else this.onItem=c,this.onAbort=e,this.onComplete=e}},"231e":function(e,t,r){"use strict";const n=r("70e3");e.exports={createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},2366:function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);function i(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}e.exports=i},2377:function(e,t,r){(function(t,n){var i; +/* + * [hi-base32]{@link https://github.com/emn178/hi-base32} + * + * @version 0.5.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */(function(){"use strict";var s="object"===typeof window?window:{},o=!s.HI_BASE32_NO_NODE_JS&&"object"===typeof t&&t.versions&&t.versions.node;o&&(s=n);var a=!s.HI_BASE32_NO_COMMON_JS&&"object"===typeof e&&e.exports,c=r("3c35"),u="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),l={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},h=[0,0,0,0,0,0,0,0],f=function(e,t){t.length>10&&(t="..."+t.substr(-10));var r=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw r.position=e,r},d=function(e){var t,r,n="",i=e.length,s=0,o=0;while(s191&&t<=223?(r=31&t,o=1):t<=239?(r=15&t,o=2):t<=247?(r=7&t,o=3):f(s,n);for(var a=0;a191)&&f(s,n),r<<=6,r+=63&t;r>=55296&&r<=57343&&f(s,n),r>1114111&&f(s,n),r<=65535?n+=String.fromCharCode(r):(r-=65536,n+=String.fromCharCode(55296+(r>>10)),n+=String.fromCharCode(56320+(1023&r)))}return n},p=function(e){if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");e=e.replace(/=/g,"");for(var t,r,n,i,s,o,a,c,u=[],h=0,f=e.length,d=0,p=f>>3<<3;d>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|s>>>1),u[h++]=255&(s<<7|o<<2|a>>>3),u[h++]=255&(a<<5|c);var y=f-p;return 2===y?(t=l[e.charAt(d++)],r=l[e.charAt(d++)],u[h++]=255&(t<<3|r>>>2)):4===y?(t=l[e.charAt(d++)],r=l[e.charAt(d++)],n=l[e.charAt(d++)],i=l[e.charAt(d++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4)):5===y?(t=l[e.charAt(d++)],r=l[e.charAt(d++)],n=l[e.charAt(d++)],i=l[e.charAt(d++)],s=l[e.charAt(d++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|s>>>1)):7===y&&(t=l[e.charAt(d++)],r=l[e.charAt(d++)],n=l[e.charAt(d++)],i=l[e.charAt(d++)],s=l[e.charAt(d++)],o=l[e.charAt(d++)],a=l[e.charAt(d++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|s>>>1),u[h++]=255&(s<<7|o<<2|a>>>3)),u},y=function(e){for(var t,r,n,i,s,o="",a=e.length,c=0,l=5*parseInt(a/5);c>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[31&(n<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-l;return 1===h?(t=e.charCodeAt(c),o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e.charCodeAt(c++),r=e.charCodeAt(c),o+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[r<<4&31]+"===="):3===h?(t=e.charCodeAt(c++),r=e.charCodeAt(c++),n=e.charCodeAt(c),o+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[n<<1&31]+"==="):4===h&&(t=e.charCodeAt(c++),r=e.charCodeAt(c++),n=e.charCodeAt(c++),i=e.charCodeAt(c),o+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[31&(n<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o},g=function(e){var t,r,n,i,s,o,a,c=!1,l="",f=0,d=0,p=e.length;do{for(h[0]=h[5],h[1]=h[6],h[2]=h[7],a=d;f>6,h[a++]=128|63&o):o<55296||o>=57344?(h[a++]=224|o>>12,h[a++]=128|o>>6&63,h[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++f)),h[a++]=240|o>>18,h[a++]=128|o>>12&63,h[a++]=128|o>>6&63,h[a++]=128|63&o);a-d,d=a-5,f===p&&++f,f>p&&a<6&&(c=!0),t=h[0],a>4?(r=h[1],n=h[2],i=h[3],s=h[4],l+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[31&(n<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s]):1===a?l+=u[t>>>3]+u[t<<2&31]+"======":2===a?(r=h[1],l+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[r<<4&31]+"===="):3===a?(r=h[1],n=h[2],l+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[n<<1&31]+"==="):(r=h[1],n=h[2],i=h[3],l+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[31&(n<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"=")}while(!c);return l},m=function(e){for(var t,r,n,i,s,o="",a=e.length,c=0,l=5*parseInt(a/5);c>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[31&(n<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-l;return 1===h?(t=e[c],o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e[c++],r=e[c],o+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[r<<4&31]+"===="):3===h?(t=e[c++],r=e[c++],n=e[c],o+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[n<<1&31]+"==="):4===h&&(t=e[c++],r=e[c++],n=e[c++],i=e[c],o+=u[t>>>3]+u[31&(t<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|n>>>4)]+u[31&(n<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o},b=function(e,t){var r="string"!==typeof e;return r&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),r?m(e):t?y(e):g(e)},v=function(e,t){if(!t)return d(p(e));if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var r,n,i,s,o,a,c,u,h="",f=e.indexOf("=");-1===f&&(f=e.length);for(var y=0,g=f>>3<<3;y>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|c>>>3))+String.fromCharCode(255&(c<<5|u));var m=f-g;return 2===m?(r=l[e.charAt(y++)],n=l[e.charAt(y++)],h+=String.fromCharCode(255&(r<<3|n>>>2))):4===m?(r=l[e.charAt(y++)],n=l[e.charAt(y++)],i=l[e.charAt(y++)],s=l[e.charAt(y++)],h+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))):5===m?(r=l[e.charAt(y++)],n=l[e.charAt(y++)],i=l[e.charAt(y++)],s=l[e.charAt(y++)],o=l[e.charAt(y++)],h+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))):7===m&&(r=l[e.charAt(y++)],n=l[e.charAt(y++)],i=l[e.charAt(y++)],s=l[e.charAt(y++)],o=l[e.charAt(y++)],a=l[e.charAt(y++)],c=l[e.charAt(y++)],h+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|c>>>3))),h},w={encode:b,decode:v};v.asBytes=p,a?e.exports=w:(s.base32=w,c&&(i=function(){return w}.call(w,r,w,e),void 0===i||(e.exports=i)))})()}).call(this,r("4362"),r("c8ba"))},2388:function(e,t,r){"use strict";function n(e,t,r){e.emit("stream",t,r)}function i(e,t){e.emit("error",t)}e.exports.emitError=i,e.exports.emitStream=n},"2388f":function(e,t){function r(e,t){return e===t||e!==e&&t!==t}e.exports=r},"239c":function(e,t,r){e.exports=r("5cb7")},"23bc":function(e,t,r){"use strict";(function(t){const n=r("7e03"),i=(e,r)=>t.compare(e.nameAsBuffer,r.nameAsBuffer),s=e=>n(e,i);e.exports=s}).call(this,r("b639").Buffer)},24:function(e,t){},2411:function(e,t,r){"use strict";(function(e){const n=r("748a"),i=r("ea91");t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(r){return e(r)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(i){return t(i)}t(null,r)})},t.hashAndSign=function(t,r,s){i(()=>{s(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,s){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(o){return s(o)}s(null,i)})}}).call(this,r("b639").Buffer)},2424:function(e,t,r){"use strict";r.r(t);var n=r("28a7");r.d(t,"default",(function(){return n["c"]})),r.d(t,"HTTPError",(function(){return n["a"]})),r.d(t,"TimeoutError",(function(){return n["b"]}))},"245c":function(e,t,r){"use strict";const n=r("09a4"),i=r("e62b").version;e.exports=function(e){return n(async()=>({id:e._peerInfo.id.toB58String(),publicKey:e._peerInfo.id.pubKey.bytes.toString("base64"),addresses:e._peerInfo.multiaddrs.toArray().map(e=>e.toString()).filter(e=>e.indexOf("ipfs")>=0).sort(),agentVersion:`js-ipfs/${i}`,protocolVersion:"9000"}))}},2462:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=(0,o.default)(e);return(0,i.default)((function(e,t){r(e[0],t)}),t,1)};var n=r("9d97"),i=a(n),s=r("76bf"),o=a(s);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t["default"]},"247b":function(e,t,r){"use strict";(function(e){const n=r("a261"),i=r("f982"),s=r("a0e5").bignum,o=r("5cdc"),a=o.toBase64,c=o.toBn,u={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=function(t,r){i(n.subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]).then(r=>{const s=(s,o,a)=>{let c;"function"===typeof o&&(a=o,o=void 0),c=o?n.subtle.importKey("jwk",d(t,o),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):Promise.resolve(r.privateKey);const l=Promise.all([n.subtle.importKey("jwk",f(t,s),{name:"ECDH",namedCurve:t},!1,[]),c]);i(l.then(e=>n.subtle.deriveBits({name:"ECDH",namedCurve:t,public:e[0]},e[1],u[t])).then(t=>e.from(t)),a)};return n.subtle.exportKey("jwk",r.publicKey).then(e=>({key:h(e),genSharedKey:s}))}),r)};const l={"P-256":32,"P-384":48,"P-521":66};function h(t){const r=l[t.crv];return e.concat([e.from([4]),c(t.x).toArrayLike(e,"be",r),c(t.y).toArrayLike(e,"be",r)],1+2*r)}function f(t,r){const n=l[t];if(!r.slice(0,1).equals(e.from([4])))throw new Error("Invalid key format");const i=new s(r.slice(1,n+1)),o=new s(r.slice(1+n));return{kty:"EC",crv:t,x:a(i,n),y:a(o,n),ext:!0}}function d(e,t){const r=f(e,t.public);return r.d=a(new s(t.private)),r}}).call(this,r("b639").Buffer)},2498:function(e,t,r){var n=r("918b");r("91bb"),r("5ee0");var i=n.asn1,s=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=s;var o={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};s.contentInfoValidator=o;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};s.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},s.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};s.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},s.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},"24d2":function(e,t,r){(function(r,n){"use strict";var i={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function s(e){if(!Array.isArray(e)&&!ArrayBuffer.isView(e))return!1;for(var t=0;t255)return!1;return!0}function o(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function a(e,t){return e<>>32-t}function c(e){return e^=e>>>16,e=o(e,2246822507),e^=e>>>13,e=o(e,3266489909),e^=e>>>16,e}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function l(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function h(e,t){return t%=64,32===t?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function f(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=l(e,[4283543511,3981806797]),e=d(e,[0,e[0]>>>1]),e=l(e,[3301882366,444984403]),e=d(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){if(i.inputValidation&&!s(e))return n;t=t||0;for(var r=e.length%4,u=e.length-r,l=t,h=0,f=3432918353,d=461845907,p=0;p>>0},i.x86.hash128=function(e,t){if(i.inputValidation&&!s(e))return n;t=t||0;for(var r=e.length%16,u=e.length-r,l=t,h=t,f=t,d=t,p=0,y=0,g=0,m=0,b=597399067,v=2869860233,w=951274213,_=2716044179,E=0;E>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(d>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){if(i.inputValidation&&!s(e))return n;t=t||0;for(var r=e.length%16,o=e.length-r,a=[0,t],c=[0,t],y=[0,0],g=[0,0],m=[2277735313,289559509],b=[1291169091,658871167],v=0;v>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)+("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)},e.exports&&(t=e.exports=i),t.murmurHash3=i})()},"24d5":function(e,t,r){"use strict";const n=r("0bda"),i=r("4bc2"),s=r("e3d5"),o=r("4503"),a=r("8d9e"),c=r("ca60"),u=i("ipfs:preload");u.error=i("ipfs:preload:error"),e.exports=e=>{const t=e._options.preload||{};if(t.enabled=Boolean(t.enabled),t.addresses=t.addresses||[],!t.enabled||!t.addresses.length){u("preload disabled");const e=()=>{};return e.start=()=>{},e.stop=()=>{},e}let r=!0,i=[];const l=t.addresses.map(n),h=async e=>{try{if(r)throw new Error(`preload ${e} but preloader is not started`);"string"!==typeof e&&(e=new s(e).toString());const n=o(l);let h=!1;const f=Date.now();for(const s of n){if(r)throw new Error(`preload aborted for ${e}`);let n;try{n=new a,i=i.concat(n),await c(`${s}/api/v0/refs?r=true&arg=${encodeURIComponent(e)}`,{signal:n.signal}),h=!0}catch(t){"aborted"!==t.type&&u.error(t)}finally{i=i.filter(e=>e!==n)}if(h)break}u(`${h?"":"un"}successfully preloaded ${e} in ${Date.now()-f}ms`)}catch(t){u.error(t)}};return h.start=()=>{r=!1},h.stop=()=>{r=!0,u(`aborting ${i.length} pending preload request(s)`),i.forEach(e=>e.abort()),i=[]},h}},"24e6":function(e,t,r){"use strict";const n=r("7048"),i={"dag-pb":r("5051"),raw:r("1f17"),"dag-cbor":r("521b")},s=(e,t,r,o,a,c)=>{const u=i[e.codec];if(!u)throw n(new Error(`No resolver for codec ${e.codec}`),"ERR_NO_RESOLVER");return u(e,t,r,o,s,a,c)};e.exports=s},25:function(e,t){},"252b":function(e,t,r){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,s=9007199254740991,o="[object Arguments]",a="[object Function]",c="[object GeneratorFunction]",u="[object Symbol]",l=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/,f=/^\./,d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p=/[\\^$.*+?()[\]{}|]/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,m=/^(?:0|[1-9]\d*)$/,b="object"==typeof t&&t&&t.Object===Object&&t,v="object"==typeof self&&self&&self.Object===Object&&self,w=b||v||Function("return this")();function _(e,t){return null==e?void 0:e[t]}function E(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}var S=Array.prototype,k=Function.prototype,C=Object.prototype,A=w["__core-js_shared__"],I=function(){var e=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),T=k.toString,x=C.hasOwnProperty,B=C.toString,R=RegExp("^"+T.call(x).replace(p,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=w.Symbol,O=C.propertyIsEnumerable,P=S.splice,D=ue(w,"Map"),L=ue(Object,"create"),M=N?N.prototype:void 0,U=M?M.toString:void 0;function j(e){var t=-1,r=e?e.length:0;this.clear();while(++t-1}function Q(e,t){var r=this.__data__,n=ne(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function J(e){var t=-1,r=e?e.length:0;this.clear();while(++t-1&&e%1==0&&e-1&&e%1==0&&e<=s}function Ae(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ie(e){return!!e&&"object"==typeof e}function Te(e){return"symbol"==typeof e||Ie(e)&&B.call(e)==u}function xe(e){return null==e?"":oe(e)}function Be(e,t){return null!=e&&le(e,t,ie)}e.exports=Be}).call(this,r("c8ba"))},2579:function(e,t,r){"use strict";var n=r("b80a"),i=r("fd47");e.exports=function(e){if(!n(e.then))throw new TypeError("Expected a promise");return function(t){e.then((function(e){i(t,null,e)}),(function(e){i(t,e)}))}}},"25d9":function(e,t){e.exports=o;var r=128,n=127,i=~n,s=Math.pow(2,31);function o(e,t,n){t=t||[],n=n||0;var a=n;while(e>=s)t[n++]=255&e|r,e/=128;while(e&i)t[n++]=255&e|r,e>>>=7;return t[n]=0|e,o.bytes=n-a+1,t}},"25e6":function(e,t,r){var n=r("dae2"),i=r("021d"),s=i;s.v1=n,s.v4=i,e.exports=s},"25ee":function(e,t,r){(function(t){var r="Input must be an string, Buffer or Uint8Array";function n(e){var n;if(e instanceof Uint8Array)n=e;else if(e instanceof t)n=new Uint8Array(e);else{if("string"!==typeof e)throw new Error(r);n=new Uint8Array(t.from(e,"utf8"))}return n}function i(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")}function s(e){return(4294967296+e).toString(16).substring(1)}function o(e,t,r){for(var n="\n"+e+" = ",i=0;i{Object(c["defineReadOnly"])(this,e,t[e])})}_startPending(){l.warn("WARNING: API provider does not support pending filters")}getSigner(e){return l.throwError("API provider does not support signing",o["Logger"].errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return l.throwError("not implemented; sub-classes must override getUrl",o["Logger"].errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const f=new o["Logger"](a["a"]),d="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p extends h{static getApiKey(e){return null==e?d:(e&&"string"!==typeof e&&f.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/jsonrpc/";break;case"ropsten":r="eth-ropsten.alchemyapi.io/jsonrpc/";break;case"rinkeby":r="eth-rinkeby.alchemyapi.io/jsonrpc/";break;case"kovan":r="eth-kovan.alchemyapi.io/jsonrpc/";break;default:f.throwArgumentError("unsupported network","network",arguments[0])}return"https://"+r+t}}const y=new o["Logger"](a["a"]);class g extends h{static getApiKey(e){return null!=e&&y.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="https://cloudflare-eth.com/";break;default:y.throwArgumentError("unsupported network","network",arguments[0])}return r}}var m=r("549e"),b=r("baf7"),v=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n["throw"](e))}catch(t){s(t)}}function c(e){e.done?r(e.value):i(e.value).then(o,a)}c((n=n.apply(e,t||[])).next())}))};const w=new o["Logger"](a["a"]);function _(e){const t=[];for(let r in e){if(null==e[r])continue;let n=Object(m["hexlify"])(e[r]);({gasLimit:!0,gasPrice:!0,nonce:!0,value:!0})[r]&&(n=Object(m["hexValue"])(n)),t.push(r+"="+n)}return t.join("&")}function E(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1!=e.status||"OK"!=e.message){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}return e.result}function S(e){if("2.0"!=e.jsonrpc){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function k(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}class C extends s["a"]{constructor(e,t){w.checkNew(new.target,C),super(e);let r="invalid";this.network&&(r=this.network.name);let n=null;switch(r){case"homestead":n="https://api.etherscan.io";break;case"ropsten":n="https://api-ropsten.etherscan.io";break;case"rinkeby":n="https://api-rinkeby.etherscan.io";break;case"kovan":n="https://api-kovan.etherscan.io";break;case"goerli":n="https://api-goerli.etherscan.io";break;default:throw new Error("unsupported network")}Object(c["defineReadOnly"])(this,"baseUrl",n),Object(c["defineReadOnly"])(this,"apiKey",t)}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return v(this,void 0,void 0,(function*(){let n=this.baseUrl,i="";this.apiKey&&(i+="&apikey="+this.apiKey);const s=(e,t)=>v(this,void 0,void 0,(function*(){this.emit("debug",{action:"request",request:e,provider:this});const r=yield Object(b["a"])(e,null,t||S);return this.emit("debug",{action:"response",request:e,response:Object(c["deepCopy"])(r),provider:this}),r}));switch(e){case"getBlockNumber":return n+="/api?module=proxy&action=eth_blockNumber"+i,s(n);case"getGasPrice":return n+="/api?module=proxy&action=eth_gasPrice"+i,s(n);case"getBalance":return n+="/api?module=account&action=balance&address="+t.address,n+="&tag="+t.blockTag+i,s(n,E);case"getTransactionCount":return n+="/api?module=proxy&action=eth_getTransactionCount&address="+t.address,n+="&tag="+t.blockTag+i,s(n);case"getCode":return n+="/api?module=proxy&action=eth_getCode&address="+t.address,n+="&tag="+t.blockTag+i,s(n,S);case"getStorageAt":return n+="/api?module=proxy&action=eth_getStorageAt&address="+t.address,n+="&position="+t.position,n+="&tag="+t.blockTag+i,s(n,S);case"sendTransaction":return n+="/api?module=proxy&action=eth_sendRawTransaction&hex="+t.signedTransaction,n+=i,s(n).catch(e=>{throw e.responseText&&(e.responseText.toLowerCase().indexOf("insufficient funds")>=0&&w.throwError("insufficient funds",o["Logger"].errors.INSUFFICIENT_FUNDS,{}),e.responseText.indexOf("same hash was already imported")>=0&&w.throwError("nonce has already been used",o["Logger"].errors.NONCE_EXPIRED,{}),e.responseText.indexOf("another transaction with same nonce")>=0&&w.throwError("replacement fee too low",o["Logger"].errors.REPLACEMENT_UNDERPRICED,{})),e});case"getBlock":if(t.blockTag)return n+="/api?module=proxy&action=eth_getBlockByNumber&tag="+t.blockTag,t.includeTransactions?n+="&boolean=true":n+="&boolean=false",n+=i,s(n);throw new Error("getBlock by blockHash not implmeneted");case"getTransaction":return n+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+t.transactionHash,n+=i,s(n);case"getTransactionReceipt":return n+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+t.transactionHash,n+=i,s(n);case"call":{let e=_(t.transaction);if(e&&(e="&"+e),n+="/api?module=proxy&action=eth_call"+e,"latest"!==t.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");return n+=i,s(n)}case"estimateGas":{let e=_(t.transaction);return e&&(e="&"+e),n+="/api?module=proxy&action=eth_estimateGas&"+e,n+=i,s(n)}case"getLogs":{if(n+="/api?module=logs&action=getLogs",t.filter.fromBlock&&(n+="&fromBlock="+k(t.filter.fromBlock)),t.filter.toBlock&&(n+="&toBlock="+k(t.filter.toBlock)),t.filter.address&&(n+="&address="+t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&w.throwError("unsupported topic count",o["Logger"].errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length)){const e=t.filter.topics[0];"string"===typeof e&&66===e.length||w.throwError("unsupported topic format",o["Logger"].errors.UNSUPPORTED_OPERATION,{topic0:e}),n+="&topic0="+e}n+=i;const e=yield s(n,E);let r={};for(let t=0;t(n+="/api?module=account&action=txlist&address="+e,n+="&startblock="+t,n+="&endblock="+r,n+="&sort=asc"+i,this.emit("debug",{action:"request",request:n,provider:this}),Object(b["a"])(n,null,E).then(e=>{this.emit("debug",{action:"response",request:n,response:Object(c["deepCopy"])(e),provider:this});let t=[];return e.forEach(e=>{["contractAddress","to"].forEach((function(t){""==e[t]&&delete e[t]})),null==e.creates&&null!=e.contractAddress&&(e.creates=e.contractAddress);let r=this.formatter.transactionResponse(e);e.timeStamp&&(r.timestamp=parseInt(e.timeStamp)),t.push(r)}),t})))}}var A=r("d4c7"),I=r("3a17"),T=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n["throw"](e))}catch(t){s(t)}}function c(e){e.done?r(e.value):i(e.value).then(o,a)}c((n=n.apply(e,t||[])).next())}))};const x=new o["Logger"](a["a"]);function B(){return(new Date).getTime()}function R(e){let t=null;for(let r=0;rO(e)));if("object"===typeof e){const t=Object.keys(e);return t.sort(),"{"+t.map(t=>{let r=e[t];return r="function"===typeof r?"[function]":O(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let P=1;function D(e){return new Promise(t=>{const r=setTimeout(t,e);r.unref&&r.unref()})}function L(e,t){const r={provider:e.provider,weight:e.weight};return e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function M(e,t){return function(r){const n={};r.forEach(t=>{const r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++});const i=Object.keys(n);for(let e=0;e=t)return r.result}}}function U(e,t,r){let n=O;switch(t){case"getBlockNumber":return function(t){const r=t.map(e=>e.result);let n=Math.ceil(N(t.map(e=>e.result)));return r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){const t=e.map(e=>e.result);return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return N(e.map(e=>e.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:(e=Object(c["shallowCopy"])(e),e.confirmations=-1,O(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:(e=Object(c["shallowCopy"])(e),e.transactions=e.transactions.map(e=>(e=Object(c["shallowCopy"])(e),e.confirmations=-1,e)),O(e))}:function(e){return null==e?null:O(e)};break;default:throw new Error("unknown method: "+t)}return M(n,e.quorum)}function j(e,t,r){switch(t){case"getBlockNumber":case"getGasPrice":return e[t]();case"getEtherPrice":if(e.getEtherPrice)return e.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return e[t](r.address,r.blockTag||"latest");case"getStorageAt":return e.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return e[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return e[t](r.transaction);case"getTransaction":case"getTransactionReceipt":return e[t](r.transactionHash);case"getLogs":return e.getLogs(r.filter)}return x.throwError("unknown method error",o["Logger"].errors.UNKNOWN_ERROR,{method:t,params:r})}class K extends s["a"]{constructor(e,t){x.checkNew(new.target,K),0===e.length&&x.throwArgumentError("missing providers","providers",e);const r=e.map((e,t)=>{if(n["b"].isProvider(e))return Object.freeze({provider:e,weight:1,stallTimeout:750,priority:1});const r=Object(c["shallowCopy"])(e);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=750),null==r.weight&&(r.weight=1);const i=r.weight;return(i%1||i>512||i<1)&&x.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${t}].weight`,i),Object.freeze(r)}),i=r.reduce((e,t)=>e+t.weight,0);null==t?t=i/2:t>i&&x.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);const s=R(r.map(e=>e.provider.network));if(s)super(s);else{const e=Promise.all(r.map(e=>e.provider.getNetwork())).then(e=>R(e));super(e)}Object(c["defineReadOnly"])(this,"providerConfigs",Object.freeze(r)),Object(c["defineReadOnly"])(this,"quorum",t),this._highestBlockNumber=-1}perform(e,t){return T(this,void 0,void 0,(function*(){if("sendTransaction"===e)return Promise.all(this.providerConfigs.map(e=>e.provider.sendTransaction(t.signedTransaction).then(e=>e.hash,e=>e))).then(e=>{for(let t=0;tObject(c["shallowCopy"])(e)));n.sort((e,t)=>e.priority-t.priority);let i=0;while(1){const s=B();let o=n.filter(e=>e.runner&&s-e.starte+t.weight,0);while(o{r.staller=null}),r.runner=j(r.provider,e,t).then(n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:L(r,B()),request:{method:e,params:Object(c["deepCopy"])(t)},provider:this})},n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:L(r,B()),request:{method:e,params:Object(c["deepCopy"])(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:s,backend:L(r,null),request:{method:e,params:Object(c["deepCopy"])(t)},provider:this}),o+=r.weight}const a=[];n.forEach(e=>{!e.done&&e.runner&&(a.push(e.runner),e.staller&&a.push(e.staller))}),a.length&&(yield Promise.race(a));const u=n.filter(e=>e.done&&null==e.error);if(u.length>=this.quorum){const e=r(u);if(void 0!==e)return e}if(0===n.filter(e=>!e.done).length)break}return x.throwError("failed to meet quorum",o["Logger"].errors.SERVER_ERROR,{method:e,params:t,results:n.map(e=>L(e)),provider:this})}))}}var F=r("3d68");const V=new o["Logger"](a["a"]),q="84842078b09946638c03157f83405213";class z extends h{static getApiKey(e){const t={apiKey:q,projectId:q,projectSecret:null};return null==e?t:("string"===typeof e?t.projectId=e:null!=e.projectSecret?("string"!==typeof e.projectId&&V.throwArgumentError("projectSecret requires a projectId","projectId",e.projectId),"string"!==typeof e.projectSecret&&V.throwArgumentError("invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId,t)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="mainnet.infura.io";break;case"ropsten":r="ropsten.infura.io";break;case"rinkeby":r="rinkeby.infura.io";break;case"kovan":r="kovan.infura.io";break;case"goerli":r="goerli.infura.io";break;default:V.throwError("unsupported network",o["Logger"].errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={url:"https://"+r+"/v3/"+t.projectId};return null!=t.projectSecret&&(n.user="",n.password=t.projectSecret),n}}const H=new o["Logger"](a["a"]),G="ETHERS_JS_SHARED";class $ extends h{static getApiKey(e){return e&&"string"!==typeof e&&H.throwArgumentError("invalid apiKey","apiKey",e),e||G}static getUrl(e,t){H.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:H.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const W=new o["Logger"](a["a"]);class Y extends u["a"]{constructor(e,t){W.checkNew(new.target,Y),super(e.host||e.path||"",t),e&&(e.sendAsync?this._sendAsync=e.sendAsync.bind(e):e.send&&(this._sendAsync=e.send.bind(e))),this._sendAsync||W.throwArgumentError("invalid web3Provider","web3Provider",e),Object(c["defineReadOnly"])(this,"provider",e)}send(e,t){return"eth_sign"==e&&this.provider.isMetaMask&&(e="personal_sign",t=[t[1],t[0]]),new Promise((r,n)=>{const i={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this._sendAsync(i,(function(e,t){if(e)n(e);else{if(t.error){const e=new Error(t.error.message);return e.code=t.error.code,e.data=t.error.data,void n(e)}r(t.result)}}))})}}var Q=r("7f06");r.d(t,"getDefaultProvider",(function(){return X})),r.d(t,"Provider",(function(){return n["b"]})),r.d(t,"BaseProvider",(function(){return s["a"]})),r.d(t,"FallbackProvider",(function(){return K})),r.d(t,"AlchemyProvider",(function(){return p})),r.d(t,"CloudflareProvider",(function(){return g})),r.d(t,"EtherscanProvider",(function(){return C})),r.d(t,"InfuraProvider",(function(){return z})),r.d(t,"JsonRpcProvider",(function(){return u["a"]})),r.d(t,"NodesmithProvider",(function(){return $})),r.d(t,"Web3Provider",(function(){return Y})),r.d(t,"IpcProvider",(function(){return F["a"]})),r.d(t,"JsonRpcSigner",(function(){return u["b"]})),r.d(t,"getNetwork",(function(){return i["a"]})),r.d(t,"Formatter",(function(){return Q["a"]}));const J=new o["Logger"](a["a"]);function X(e,t){null==e&&(e="homestead");const r=Object(i["a"])(e);return r&&r._defaultProvider||J.throwError("unsupported getDefaultProvider network",o["Logger"].errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:K,AlchemyProvider:p,CloudflareProvider:g,EtherscanProvider:C,InfuraProvider:z,JsonRpcProvider:u["a"],NodesmithProvider:$,Web3Provider:Y,IpcProvider:F["a"]},t)}},2612:function(e,t,r){e.exports={encode:r("af3a"),decode:r("fa45"),encodingLength:r("61f1")}},26137:function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=self.crypto||self.msCrypto;e.exports=e=>{if("undefined"===typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return async t=>{switch(e){case"sha1":return n.from(await i.subtle.digest({name:"SHA-1"},t));case"sha2-256":return n.from(await i.subtle.digest({name:"SHA-256"},t));case"sha2-512":return n.from(await i.subtle.digest({name:"SHA-512"},t));case"dbl-sha2-256":{const e=await i.subtle.digest({name:"SHA-256"},t);return n.from(await i.subtle.digest({name:"SHA-256"},e))}default:throw new Error(`${e} is not a supported algorithm`)}}}},2632:function(e,t,r){"use strict";(function(t){const n=r("09a4"),i=r("6f12");e.exports=function(e){return n.variadic((async function(r,n){return t.concat(await i(e._catAsyncIterator(r,n)))}))}}).call(this,r("b639").Buffer)},2644:function(e,t,r){"use strict";const n=r("81f3");function i(e,t,r){"function"===typeof e.pipe?n(e,(e,n)=>{if(e)return r(e);t(n,r)}):t(e,r)}e.exports=i},2655:function(e,t){function r(e){return e&&"function"===typeof e.then}e.exports=r},"268b":function(e,t,r){"use strict";const n=r("cff5"),i=r("8b60"),s=r("9941"),o="sha2-256";e.exports=e=>{const t=32;function r(t){const r=(e,r)=>s(()=>t(e,r));let i;do{i=e(32)}while(!n.privateKeyVerify(i));r(null,i)}function a(e,t,r){const a=(e,t)=>s(()=>r(e,t));i.digest(t,o,(t,r)=>{if(t)return a(t);try{const t=n.sign(r,e),i=n.signatureExport(t.signature);return a(null,i)}catch(t){a(t)}})}function c(e,t,r,a){const c=(e,t)=>s(()=>a(e,t));i.digest(r,o,(r,i)=>{if(r)return c(r);try{t=n.signatureImport(t);const r=n.verify(i,t,e);return c(null,r)}catch(r){c(r)}})}function u(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)}function l(e){return n.publicKeyConvert(e,!1)}function h(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}function f(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")}function d(e){return h(e),n.publicKeyCreate(e)}return{generateKey:r,privateKeyLength:t,hashAndSign:a,hashAndVerify:c,compressPublicKey:u,decompressPublicKey:l,validatePrivateKey:h,validatePublicKey:f,computePublicKey:d}}},"26a6":function(e,t,r){var n;(function(i){"use strict";var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",h=1e14,f=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t,r,n,i=L.prototype={constructor:L,toString:null,valueOf:null},s=new L(1),C=20,A=4,I=-7,T=21,x=-1e7,B=1e7,R=!1,N=1,O=0,P={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},D="0123456789abcdefghijklmnopqrstuvwxyz";function L(e,t){var i,s,a,u,h,p,y,g,m=this;if(!(m instanceof L))return new L(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>B?m.c=m.e=null:e.e=10;h/=10,u++);return void(u>B?m.c=m.e=null:(m.e=u,m.c=[e]))}g=String(e)}else{if(!o.test(g=String(e)))return n(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(u<0&&(u=h),u+=+g.slice(h+1),g=g.substring(0,h)):u<0&&(u=g.length)}else{if(_(t,2,D.length,"Base"),10==t)return m=new L(e),K(m,C+m.e+1,A);if(g=String(e),p="number"==typeof e){if(0*e!=0)return n(m,g,p,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,L.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(i=D.slice(0,t),u=h=0,y=g.length;hu){u=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,u=0;continue}return n(m,String(e),p,t)}p=!1,g=r(g,t,10,m.s),(u=g.indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(h=0;48===g.charCodeAt(h);h++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(h,++y)){if(y-=h,p&&L.DEBUG&&y>15&&(e>d||e!==c(e)))throw Error(l+m.s*e);if((u=u-h-1)>B)m.c=m.e=null;else if(u=T)?S(c,o):k(c,o,"0");else if(e=K(new L(e),t,r),s=e.e,c=v(e.c),a=c.length,1==n||2==n&&(t<=s||s<=I)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if(t+=s-a,t>0)for(s+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function U(e,t){for(var r,n=1,i=new L(e[0]);n=10;i/=10,n++);return(r=n+r*f-1)>B?e.c=e.e=null:r=10;u/=10,i++);if(s=t-i,s<0)s+=f,o=t,l=g[d=0],y=l/m[i-o-1]%10|0;else if(d=a((s+1)/f),d>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));l=y=0,i=1,s%=f,o=s-f+1}else{for(l=u=g[d],i=1;u>=10;u/=10,i++);s%=f,o=s-f+i,y=o<0?0:l/m[i-o-1]%10|0}if(n=n||t<0||null!=g[d+1]||(o<0?l:l%m[i-o-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(s>0?o>0?l/m[i-o]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=m[(f-t%f)%f],e.e=-t||0):g[0]=e.e=0,e;if(0==s?(g.length=d,u=1,d--):(g.length=d+1,u=m[f-s],g[d]=o>0?c(l/m[i-o]%m[o])*u:0),n)for(;;){if(0==d){for(s=1,o=g[0];o>=10;o/=10,s++);for(o=g[0]+=u,u=1;o>=10;o/=10,u++);s!=u&&(e.e++,g[0]==h&&(g[0]=1));break}if(g[d]+=u,g[d]!=h)break;g[d--]=0,u=1}for(s=g.length;0===g[--s];g.pop());}e.e>B?e.c=e.e=null:e.e=T?S(t,r):k(t,r,"0"),e.s<0?"-"+t:t)}return L.clone=m,L.ROUND_UP=0,L.ROUND_DOWN=1,L.ROUND_CEIL=2,L.ROUND_FLOOR=3,L.ROUND_HALF_UP=4,L.ROUND_HALF_DOWN=5,L.ROUND_HALF_EVEN=6,L.ROUND_HALF_CEIL=7,L.ROUND_HALF_FLOOR=8,L.EUCLID=9,L.config=L.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(r=e[t],_(r,0,g,t),C=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(r=e[t],_(r,0,8,t),A=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&(r=e[t],r&&r.pop?(_(r[0],-g,0,t),_(r[1],0,g,t),I=r[0],T=r[1]):(_(r,-g,g,t),I=-(T=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if(r=e[t],r&&r.pop)_(r[0],-g,-1,t),_(r[1],1,g,t),x=r[0],B=r[1];else{if(_(r,-g,g,t),!r)throw Error(u+t+" cannot be zero: "+r);x=-(B=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if(r=e[t],r!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw R=!r,Error(u+"crypto unavailable");R=r}else R=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(r=e[t],_(r,0,9,t),N=r),e.hasOwnProperty(t="POW_PRECISION")&&(r=e[t],_(r,0,g,t),O=r),e.hasOwnProperty(t="FORMAT")){if(r=e[t],"object"!=typeof r)throw Error(u+t+" not an object: "+r);P=r}if(e.hasOwnProperty(t="ALPHABET")){if(r=e[t],"string"!=typeof r||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);D=r}}return{DECIMAL_PLACES:C,ROUNDING_MODE:A,EXPONENTIAL_AT:[I,T],RANGE:[x,B],CRYPTO:R,MODULO_MODE:N,POW_PRECISION:O,FORMAT:P,ALPHABET:D}},L.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!L.DEBUG)return!0;var t,r,n=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if(t=(i+1)%f,t<1&&(t+=f),String(n[0]).length==t){for(t=0;t=h||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(u+"Invalid BigNumber: "+e)},L.maximum=L.max=function(){return U(arguments,i.lt)},L.minimum=L.min=function(){return U(arguments,i.gt)},L.random=function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return c(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var r,n,i,o,l,h=0,d=[],y=new L(s);if(null==e?e=C:_(e,0,g),o=a(e/f),R)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(o*=2));h>>11),l>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),r[h]=n[0],r[h+1]=n[1]):(d.push(l%1e14),h+=2);h=o/2}else{if(!crypto.randomBytes)throw R=!1,Error(u+"crypto unavailable");for(r=crypto.randomBytes(o*=7);h=9e15?crypto.randomBytes(7).copy(r,h):(d.push(l%1e14),h+=7);h=o/7}if(!R)for(;h=10;l/=10,h++);hr-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,s,o,a){var c,u,l,h,f,d,p,y,g=n.indexOf("."),m=C,b=A;for(g>=0&&(h=O,O=0,n=n.replace(".",""),y=new L(i),d=y.pow(n.length-g),O=h,y.c=r(k(v(d.c),d.e,"0"),10,s,e),y.e=y.c.length),p=r(n,i,s,a?(c=D,e):(c=e,D)),l=h=p.length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--l:(d.c=p,d.e=l,d.s=o,d=t(d,y,m,b,s),p=d.c,f=d.r,l=d.e),u=l+m+1,g=p[u],h=s/2,f=f||u<0||null!=p[u+1],f=b<4?(null!=g||f)&&(0==b||b==(d.s<0?3:2)):g>h||g==h&&(4==b||f||6==b&&1&p[u-1]||b==(d.s<0?8:7)),u<1||!p[0])n=f?k(c.charAt(1),-m,c.charAt(0)):c.charAt(0);else{if(p.length=u,f)for(--s;++p[--u]>s;)p[u]=0,u||(++l,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,n="";g<=h;n+=c.charAt(p[g++]));n=k(n,l,c.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,s,o,a=0,c=e.length,u=t%y,l=t/y|0;for(e=e.slice();c--;)s=e[c]%y,o=e[c]/y|0,n=l*s+o*u,i=u*s+n%y*y+a,a=(i/r|0)+(n/y|0)+l*o,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;it[i]?1:-1;break}return s}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,s,o,a){var u,l,d,p,y,g,m,v,w,_,E,S,k,C,A,I,T,x=n.s==i.s?1:-1,B=n.c,R=i.c;if(!B||!B[0]||!R||!R[0])return new L(n.s&&i.s&&(B?!R||B[0]!=R[0]:R)?B&&0==B[0]||!R?0*x:x/0:NaN);for(v=new L(x),w=v.c=[],l=n.e-i.e,x=s+l+1,a||(a=h,l=b(n.e/f)-b(i.e/f),x=x/f|0),d=0;R[d]==(B[d]||0);d++);if(R[d]>(B[d]||0)&&l--,x<0)w.push(1),p=!0;else{for(C=B.length,I=R.length,d=0,x+=2,y=c(a/(R[0]+1)),y>1&&(R=e(R,y,a),B=e(B,y,a),I=R.length,C=B.length),k=I,_=B.slice(0,I),E=_.length;E=a/2&&A++;do{if(y=0,u=t(R,_,I,E),u<0){if(S=_[0],I!=E&&(S=S*a+(_[1]||0)),y=c(S/A),y>1){y>=a&&(y=a-1),g=e(R,y,a),m=g.length,E=_.length;while(1==t(g,_,m,E))y--,r(g,I=10;x/=10,d++);K(v,s+(v.e=d+l*f-1)+1,o,p)}else v.e=l,v.r=+p;return v}}(),n=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,r=/^\.([^.]+)$/,n=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(s,o,a,c){var l,h=a?o:o.replace(i,"");if(n.test(h))s.s=isNaN(h)?null:h<0?-1:1;else{if(!a&&(h=h.replace(e,(function(e,t,r){return l="x"==(r=r.toLowerCase())?16:"b"==r?2:8,c&&c!=l?e:t})),c&&(l=c,h=h.replace(t,"$1").replace(r,"0.$1")),o!=h))return new L(h,l);if(L.DEBUG)throw Error(u+"Not a"+(c?" base "+c:"")+" number: "+o);s.s=null}s.c=s.e=null}}(),i.absoluteValue=i.abs=function(){var e=new L(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return w(this,new L(e,t))},i.decimalPlaces=i.dp=function(e,t){var r,n,i,s=this;if(null!=e)return _(e,0,g),null==t?t=A:_(t,0,8),K(new L(s),e+s.e+1,t);if(!(r=s.c))return null;if(n=((i=r.length-1)-b(this.e/f))*f,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},i.dividedBy=i.div=function(e,r){return t(this,new L(e,r),C,A)},i.dividedToIntegerBy=i.idiv=function(e,r){return t(this,new L(e,r),0,1)},i.exponentiatedBy=i.pow=function(e,t){var r,n,i,o,l,h,d,p,y,g=this;if(e=new L(e),e.c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+F(e));if(null!=t&&(t=new L(t)),h=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return y=new L(Math.pow(+F(g),h?2-E(e):+F(e))),t?y.mod(t):y;if(d=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new L(NaN);n=!d&&g.isInteger()&&t.isInteger(),n&&(g=g.mod(t))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||h&&g.c[1]>=24e7:g.c[0]<8e13||h&&g.c[0]<=9999975e7)))return o=g.s<0&&E(e)?-0:0,g.e>-1&&(o=1/o),new L(d?1/o:o);O&&(o=a(O/f+2))}for(h?(r=new L(.5),d&&(e.s=1),p=E(e)):(i=Math.abs(+F(e)),p=i%2),y=new L(s);;){if(p){if(y=y.times(g),!y.c)break;o?y.c.length>o&&(y.c.length=o):n&&(y=y.mod(t))}if(i){if(i=c(i/2),0===i)break;p=i%2}else if(e=e.times(r),K(e,e.e+1,1),e.e>14)p=E(e);else{if(i=+F(e),0===i)break;p=i%2}g=g.times(g),o?g.c&&g.c.length>o&&(g.c.length=o):n&&(g=g.mod(t))}return n?y:(d&&(y=s.div(y)),t?y.mod(t):o?K(y,O,A,l):y)},i.integerValue=function(e){var t=new L(this);return null==e?e=A:_(e,0,8),K(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return 0===w(this,new L(e,t))},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return w(this,new L(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return 1===(t=w(this,new L(e,t)))||0===t},i.isInteger=function(){return!!this.c&&b(this.e/f)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return w(this,new L(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return-1===(t=w(this,new L(e,t)))||0===t},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&0==this.c[0]},i.minus=function(e,t){var r,n,i,s,o=this,a=o.s;if(e=new L(e,t),t=e.s,!a||!t)return new L(NaN);if(a!=t)return e.s=-t,o.plus(e);var c=o.e/f,u=e.e/f,l=o.c,d=e.c;if(!c||!u){if(!l||!d)return l?(e.s=-t,e):new L(d?o:NaN);if(!l[0]||!d[0])return d[0]?(e.s=-t,e):new L(l[0]?o:3==A?-0:0)}if(c=b(c),u=b(u),l=l.slice(),a=c-u){for((s=a<0)?(a=-a,i=l):(u=c,i=d),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(s=(a=l.length)<(t=d.length))?a:t,a=t=0;t0)for(;t--;l[r++]=0);for(t=h-1;n>a;){if(l[--n]=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=c,s=i+o;s>i;)u=E[--o]%w,l=E[o]/w|0,a=g*u+l*p,u=p*u+a%w*w+m[s]+r,r=(u/v|0)+(a/w|0)+g*l,m[s--]=u%v;m[s]=r}return r?++n:m.splice(0,1),j(e,m,n)},i.negated=function(){var e=new L(this);return e.s=-e.s||null,e},i.plus=function(e,t){var r,n=this,i=n.s;if(e=new L(e,t),t=e.s,!i||!t)return new L(NaN);if(i!=t)return e.s=-t,n.minus(e);var s=n.e/f,o=e.e/f,a=n.c,c=e.c;if(!s||!o){if(!a||!c)return new L(i/0);if(!a[0]||!c[0])return c[0]?e:new L(a[0]?n:0*i)}if(s=b(s),o=b(o),a=a.slice(),i=s-o){for(i>0?(o=s,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for(i=a.length,t=c.length,i-t<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++o),j(e,a,o)},i.precision=i.sd=function(e,t){var r,n,i,s=this;if(null!=e&&e!==!!e)return _(e,1,g),null==t?t=A:_(t,0,8),K(new L(s),e,t);if(!(r=s.c))return null;if(i=r.length-1,n=i*f+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},i.shiftedBy=function(e){return _(e,-d,d),this.times("1e"+e)},i.squareRoot=i.sqrt=function(){var e,r,n,i,s,o=this,a=o.c,c=o.s,u=o.e,l=C+4,h=new L("0.5");if(1!==c||!a||!a[0])return new L(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);if(c=Math.sqrt(+F(o)),0==c||c==1/0?(r=v(a),(r.length+u)%2==0&&(r+="0"),c=Math.sqrt(+r),u=b((u+1)/2)-(u<0||u%2),c==1/0?r="1e"+u:(r=c.toExponential(),r=r.slice(0,r.indexOf("e")+1)+u),n=new L(r)):n=new L(c+""),n.c[0])for(u=n.e,c=u+l,c<3&&(c=0);;)if(s=n,n=h.times(s.plus(t(o,s,l,1))),v(s.c).slice(0,c)===(r=v(n.c)).slice(0,c)){if(n.e0&&y>0){for(s=y%a||a,h=p.substr(0,s);s0&&(h+=l+p.slice(s)),d&&(h="-"+h)}n=f?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):h}return(r.prefix||"")+n+(r.suffix||"")},i.toFraction=function(e){var r,n,i,o,a,c,l,h,d,y,g,m,b=this,w=b.c;if(null!=e&&(l=new L(e),!l.isInteger()&&(l.c||1!==l.s)||l.lt(s)))throw Error(u+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+F(l));if(!w)return new L(b);for(r=new L(s),d=n=new L(s),i=h=new L(s),m=v(w),a=r.e=m.length-b.e-1,r.c[0]=p[(c=a%f)<0?f+c:c],e=!e||l.comparedTo(r)>0?a>0?r:d:l,c=B,B=1/0,l=new L(m),h.c[0]=0;;){if(y=t(l,r,0,1),o=n.plus(y.times(i)),1==o.comparedTo(e))break;n=i,i=o,d=h.plus(y.times(o=d)),h=o,r=l.minus(y.times(o=r)),l=o}return o=t(e.minus(n),i,0,1),h=h.plus(o.times(d)),n=n.plus(o.times(i)),h.s=d.s=b.s,a*=2,g=t(d,i,a,A).minus(b).abs().comparedTo(t(h,n,a,A).minus(b).abs())<1?[d,i]:[h,n],B=c,g},i.toNumber=function(){return+F(this)},i.toPrecision=function(e,t){return null!=e&&_(e,1,g),M(this,e,t,2)},i.toString=function(e){var t,n=this,i=n.s,s=n.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=I||s>=T?S(v(n.c),s):k(v(n.c),s,"0"):10===e?(n=K(new L(n),C+s+1,A),t=k(v(n.c),n.e,"0")):(_(e,2,D.length,"Base"),t=r(k(v(n.c),s,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},i.valueOf=i.toJSON=function(){return F(this)},i._isBigNumber=!0,null!=e&&L.set(e),L}function b(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,s=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=s.length)?c:u,o=0;os[o]^r?1:-1;return c==u?0:c>u^r?1:-1}function _(e,t,r,n){if(er||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return b(e.e/f)==t&&e.c[t]%2!=0}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function k(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),u=new Uint32Array(16),l=new Uint32Array(16);function h(e,t){var r=0;for(r=0;r<8;r++)u[r]=e.h[r],u[r+8]=a[r];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),r=0;r<16;r++)l[r]=i(e.b,4*r);for(r=0;r<10;r++)s(0,4,8,12,l[c[16*r+0]],l[c[16*r+1]]),s(1,5,9,13,l[c[16*r+2]],l[c[16*r+3]]),s(2,6,10,14,l[c[16*r+4]],l[c[16*r+5]]),s(3,7,11,15,l[c[16*r+6]],l[c[16*r+7]]),s(0,5,10,15,l[c[16*r+8]],l[c[16*r+9]]),s(1,6,11,12,l[c[16*r+10]],l[c[16*r+11]]),s(2,7,8,13,l[c[16*r+12]],l[c[16*r+13]]),s(3,4,9,14,l[c[16*r+14]],l[c[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=u[r]^u[r+8]}function f(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(d(n,t),n.c=64),n}function d(e,t){for(var r=0;r>2]>>8*(3&r)&255;return t}function y(e,t,r){r=r||32,e=n.normalizeInput(e);var i=f(r,t);return d(i,e),p(i)}function g(e,t,r){var i=y(e,t,r);return n.toHex(i)}e.exports={blake2s:y,blake2sHex:g,blake2sInit:f,blake2sUpdate:d,blake2sFinal:p}},"26d5":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=self.crypto||self.msCrypto;e.exports=e=>{if("undefined"===typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return async t=>{switch(e){case"sha1":return n.from(await i.subtle.digest({name:"SHA-1"},t));case"sha2-256":return n.from(await i.subtle.digest({name:"SHA-256"},t));case"sha2-512":return n.from(await i.subtle.digest({name:"SHA-512"},t));case"dbl-sha2-256":{const e=await i.subtle.digest({name:"SHA-256"},t);return n.from(await i.subtle.digest({name:"SHA-256"},e))}default:throw new Error(`${e} is not a supported algorithm`)}}}},27:function(e,t){},"276e":function(e,t,r){"use strict";(function(t){const n=r("c64e"),i=r("ec12"),s="/",o=t.from(s),a=o[0];class c{constructor(e,r){if("string"===typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==r&&(r=!0),r&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new h(e.join(s))}static random(){return new h(n().replace(/-/g,""))}clean(){this._buf&&0!==this._buf.length||(this._buf=t.from(s)),this._buf[0]!==a&&(this._buf=t.concat([o,this._buf]));while(this._buf.length>1&&this._buf[this._buf.length-1]===a)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;ni)return!1}return t.length65536)throw new Error("Port number is not in range(1, 65536)");const s=f(i);return t.concat([n,s])}function v(e){const r=e.split(":");if(2!==r.length)throw new Error("failed to parse onion addr: "+r+" does not contain a port number");if(56!==r[0].length)throw new Error("failed to parse onion addr: "+r[0]+" not a Tor onion3 address.");const n=t.from(a.decode.asBytes(r[0].toUpperCase())),i=parseInt(r[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");const s=f(i);return t.concat([n,s])}function w(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=a.encode(t).toString("ascii").toLowerCase(),i=d(r);return n+":"+i}e.exports=u,u.toString=function(e,t){switch(e=s(e),e.code){case 4:case 41:return h(t);case 6:case 273:case 33:case 132:return d(t);case 53:case 54:case 55:case 56:case 400:return y(t);case 421:return m(t);case 444:return w(t);case 445:return w(t);default:return t.toString("hex")}},u.toBuffer=function(e,r){switch(e=s(e),e.code){case 4:return l(r);case 41:return l(r);case 6:case 273:case 33:case 132:return f(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:return p(r);case 421:return g(r);case 444:return b(r);case 445:return v(r);default:return t.from(r,"hex")}}}).call(this,r("b639").Buffer)},2773:function(e,t,r){"use strict";const n=r("e3d5"),i=r("1a76"),s=r("0c9a");e.exports={codec:s.RAW,defaultHashAlg:s.SHA2_256,resolver:{resolve:(e,t)=>({value:e,remainderPath:""}),tree:e=>({done:!0})},util:{deserialize:e=>e,serialize:e=>e,cid:async(t,r)=>{const o={cidVersion:1,hashAlg:e.exports.defaultHashAlg},a=Object.assign(o,r),c=await i(t,a.hashAlg),u=s.print[e.exports.codec],l=new n(a.cidVersion,u,c);return l}}}},2776:function(e,t,r){(function(t,n){var i=r("0bac"),s=r("7ec1"),o=r("f7ae"),a=r("d7a8"),c=Object.prototype.hasOwnProperty,u="start end gt gte lt lte".split(" ");function l(e){this.status="new",this.supports=s(e,{status:!0})}function h(e,t){var r={};for(var n in t)if(c.call(t,n)){var i=t[n];f(n)&&(i=e._serializeKey(i)),r[n]=i}return r}function f(e){return-1!==u.indexOf(e)}l.prototype.open=function(e,t){var r=this,n=this.status;if("function"===typeof e&&(t=e),"function"!==typeof t)throw new Error("open() requires a callback argument");"object"===typeof e&&null!==e||(e={}),e.createIfMissing=!1!==e.createIfMissing,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,(function(e){if(e)return r.status=n,t(e);r.status="open",t()}))},l.prototype._open=function(e,r){t.nextTick(r)},l.prototype.close=function(e){var t=this,r=this.status;if("function"!==typeof e)throw new Error("close() requires a callback argument");this.status="closing",this._close((function(n){if(n)return t.status=r,e(n);t.status="closed",e()}))},l.prototype._close=function(e){t.nextTick(e)},l.prototype.get=function(e,r,n){if("function"===typeof r&&(n=r),"function"!==typeof n)throw new Error("get() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"===typeof r&&null!==r||(r={}),r.asBuffer=!1!==r.asBuffer,this._get(e,r,n)},l.prototype._get=function(e,r,n){t.nextTick((function(){n(new Error("NotFound"))}))},l.prototype.put=function(e,r,n,i){if("function"===typeof n&&(i=n),"function"!==typeof i)throw new Error("put() requires a callback argument");var s=this._checkKey(e)||this._checkValue(r);if(s)return t.nextTick(i,s);e=this._serializeKey(e),r=this._serializeValue(r),"object"===typeof n&&null!==n||(n={}),this._put(e,r,n,i)},l.prototype._put=function(e,r,n,i){t.nextTick(i)},l.prototype.del=function(e,r,n){if("function"===typeof r&&(n=r),"function"!==typeof n)throw new Error("del() requires a callback argument");var i=this._checkKey(e);if(i)return t.nextTick(n,i);e=this._serializeKey(e),"object"===typeof r&&null!==r||(r={}),this._del(e,r,n)},l.prototype._del=function(e,r,n){t.nextTick(n)},l.prototype.batch=function(e,r,n){if(!arguments.length)return this._chainedBatch();if("function"===typeof r&&(n=r),"function"===typeof e&&(n=e),"function"!==typeof n)throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return t.nextTick(n,new Error("batch(array) requires an array argument"));if(0===e.length)return t.nextTick(n);"object"===typeof r&&null!==r||(r={});for(var s=new Array(e.length),o=0;o{let t=0,r=e.node.size||e.node.length;return e.unixfs&&(r=e.unixfs.fileSize(),t=a[e.unixfs.type]),{cid:e.cid,name:e.name,type:t,size:r}};e.exports=e=>async function*(t=o,r={}){"object"!==typeof t||t instanceof String||(r=t,t=o),r=i(r,c);const a=await s(e,t),l=await n(a.mfsPath,e.ipld);if(l.unixfs&&l.unixfs.type.includes("directory"))for await(const e of l.content(r))yield u(e);else yield u(l)}},"27a7":function(e,t,r){(function(r,n){"use strict";var i={version:"3.0.1",x86:{},x64:{}};function s(e,t){return(65535&e)*t+(((e>>>16)*t&65535)<<16)}function o(e,t){return e<>>32-t}function a(e){return e^=e>>>16,e=s(e,2246822507),e^=e>>>13,e=s(e,3266489909),e^=e>>>16,e}function c(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function u(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]}function l(e,t){return t%=64,32===t?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function h(e,t){return t%=64,0===t?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=u(e,[4283543511,3981806797]),e=f(e,[0,e[0]>>>1]),e=u(e,[3301882366,444984403]),e=f(e,[0,e[0]>>>1]),e}i.x86.hash32=function(e,t){e=e||"",t=t||0;for(var r=e.length%4,n=e.length-r,i=t,c=0,u=3432918353,l=461845907,h=0;h>>0},i.x86.hash128=function(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=t,c=t,u=t,l=t,h=0,f=0,d=0,p=0,y=597399067,g=2869860233,m=951274213,b=2716044179,v=0;v>>0).toString(16)).slice(-8)+("00000000"+(c>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)},i.x64.hash128=function(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=[0,t],s=[0,t],o=[0,0],a=[0,0],p=[2277735313,289559509],y=[1291169091,658871167],g=0;g>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)},e.exports&&(t=e.exports=i),t.murmurHash3=i})()},"27cd":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var n=r("9868"),i=d(n),s=r("532e"),o=d(s),a=r("2cf9"),c=d(a),u=r("c1cd"),l=d(u),h=r("76bf"),f=d(h);function d(e){return e&&e.__esModule?e:{default:e}}function p(e,t,r,n){var i=new Array(t.length);e(t,(function(e,t,n){r(e,(function(e,r){i[t]=!!r,n(e)}))}),(function(e){if(e)return n(e);for(var r=[],s=0;s{for(const n of r.topics)if(n===e){t.push(r.msgID);break}});return t}shift(){const e=this.history[this.history.length-1];e.forEach(e=>{this.msgs.delete(e.msgID)}),this.history.pop(),this.history.unshift([])}}e.exports={CacheEntry:i,MessageCache:s}},"282f":function(e,t,r){var n=r("5995");r("31a0"),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){e&&this._input.putBuffer(e);while(!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},2835:function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i="~";function s(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,r,n,s){if("function"!==typeof r)throw new TypeError("The listener must be a function");var a=new o(r,n||e,s),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function c(e,t){0===--e._eventsCount?e._events=new s:delete e._events[t]}function u(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},u.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,o=new Array(s);n{t=Object(o["arrayify"])(t);const r=t.slice(0,16),n=t.slice(16,32),i=t.slice(32,64),a=new p.a.Counter(m),c=new p.a.ModeOfOperation.ctr(r,a),_=Object(o["arrayify"])(c.encrypt(s)),k=Object(u["a"])(Object(o["concat"])([n,_])),C={address:e.address.substring(2).toLowerCase(),id:B.a.v4({random:b}),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Object(o["hexlify"])(m).substring(2)},ciphertext:Object(o["hexlify"])(_).substring(2),kdf:"scrypt",kdfparams:{salt:Object(o["hexlify"])(g).substring(2),n:v,dklen:32,p:S,r:E},mac:k.substring(2)}};if(l){const e=Object(h["randomBytes"])(16),t=new p.a.Counter(e),r=new p.a.ModeOfOperation.ctr(i,t),n=Object(o["arrayify"])(r.encrypt(l)),s=new Date,a=s.getUTCFullYear()+"-"+w(s.getUTCMonth()+1,2)+"-"+w(s.getUTCDate(),2)+"T"+w(s.getUTCHours(),2)+"-"+w(s.getUTCMinutes(),2)+"-"+w(s.getUTCSeconds(),2)+".0Z";C["x-ethers"]={client:y,gethFilename:"UTC--"+a+"--"+C.address,mnemonicCounter:Object(o["hexlify"])(e).substring(2),mnemonicCiphertext:Object(o["hexlify"])(n).substring(2),path:f,locale:d,version:"0.1"}}return JSON.stringify(C)})}function U(e,t,r){if(A(e)){r&&r(0);const n=C(e,t);return r&&r(1),Promise.resolve(n)}return I(e)?L(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}const j="wallet/5.0.0-beta.137";r.d(t,"Wallet",(function(){return q})),r.d(t,"verifyMessage",(function(){return z}));const K=new m["Logger"](j);function F(e){return null!=e&&Object(o["isHexString"])(e.privateKey,32)&&null!=e.address}function V(e){const t=e.mnemonic;return t&&t.phrase}class q extends s["a"]{constructor(e,t){if(K.checkNew(new.target,q),super(),F(e)){const t=new f["a"](e.privateKey);if(Object(l["defineReadOnly"])(this,"_signingKey",()=>t),Object(l["defineReadOnly"])(this,"address",Object(R["a"])(this.publicKey)),this.address!==Object(n["a"])(e.address)&&K.throwArgumentError("privateKey/address mismatch","privateKey","[REDCACTED]"),V(e)){const t=e.mnemonic;Object(l["defineReadOnly"])(this,"_mnemonic",()=>({phrase:t.phrase,path:t.path||c["defaultPath"],locale:t.locale||"en"}));const r=this.mnemonic,n=c["HDNode"].fromMnemonic(r.phrase,null,r.locale).derivePath(r.path);Object(R["a"])(n.privateKey)!==this.address&&K.throwArgumentError("mnemonic/address mismatch","privateKey","[REDCACTED]")}else Object(l["defineReadOnly"])(this,"_mnemonic",()=>null)}else{if(f["a"].isSigningKey(e))"secp256k1"!==e.curve&&K.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),Object(l["defineReadOnly"])(this,"_signingKey",()=>e);else{const t=new f["a"](e);Object(l["defineReadOnly"])(this,"_signingKey",()=>t)}Object(l["defineReadOnly"])(this,"_mnemonic",()=>null),Object(l["defineReadOnly"])(this,"address",Object(R["a"])(this.publicKey))}t&&!i["b"].isProvider(t)&&K.throwArgumentError("invalid provider","provider",t),Object(l["defineReadOnly"])(this,"provider",t||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new q(this,e)}signTransaction(e){return Object(l["resolveProperties"])(e).then(e=>{if(null!=e.from){if(Object(n["a"])(e.from)!==this.address)throw new Error("transaction from address mismatch");delete e.from}const t=this._signingKey().signDigest(Object(u["a"])(Object(R["d"])(e)));return Object(R["d"])(e,t)})}signMessage(e){return Promise.resolve(Object(o["joinSignature"])(this._signingKey().signDigest(Object(a["hashMessage"])(e))))}encrypt(e,t,r){if("function"!==typeof t||r||(r=t,t={}),r&&"function"!==typeof r)throw new Error("invalid callback");return t||(t={}),M(this,e,t,r)}static createRandom(e){let t=Object(h["randomBytes"])(16);e||(e={}),e.extraEntropy&&(t=Object(o["arrayify"])(Object(o["hexDataSlice"])(Object(u["a"])(Object(o["concat"])([t,e.extraEntropy])),0,16)));const r=Object(c["entropyToMnemonic"])(t,e.locale);return q.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return U(e,t,r).then(e=>new q(e))}static fromMnemonic(e,t,r){return t||(t=c["defaultPath"]),new q(c["HDNode"].fromMnemonic(e,null,r).derivePath(t))}}function z(e,t){return Object(R["c"])(Object(a["hashMessage"])(e),t)}},"289f":function(e,t,r){"use strict";(function(t){const n=r("021d"),i=r("87dd"),s="/",o=t.from(s),a=o[0];class c{constructor(e,r){if("string"===typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==r&&(r=!0),r&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new f(e.join(s))}static random(){return new f(n().replace(/-/g,""))}clean(){this._buf&&0!==this._buf.length||(this._buf=t.from(s)),this._buf[0]!==a&&(this._buf=t.concat([o,this._buf]));while(this._buf.length>1&&this._buf[this._buf.length-1]===a)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;ni)return!1}return t.lengthe.namespaces()))])}}function u(e){const t=e.split(":");return t.length<2?"":t.slice(0,-1).join(":")}function l(e){const t=e.split(":");return t[t.length-1]}function h(e){return[].concat(...e)}const f=i(c,{className:"Key",symbolName:"@ipfs/interface-datastore/key"});e.exports=f}).call(this,r("b639").Buffer)},"28a7":function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return p})),r.d(t,"b",(function(){return y})); +/*! MIT License © Sindre Sorhus */ +const n={};{const t=t=>{let r;if("undefined"!==typeof self&&self&&t in self&&(r=self),"undefined"!==typeof window&&window&&t in window&&(r=window),"undefined"!==typeof e&&e&&t in e&&(r=e),"undefined"!==typeof globalThis&&globalThis&&(r=globalThis),"undefined"===typeof r)return;const n=r[t];return"function"===typeof n?n.bind(r):n},r=["document","Headers","Request","Response","ReadableStream","fetch","AbortController","FormData"],i={};for(const e of r)i[e]={get(){return t(e)}};Object.defineProperties(n,i)}const i=e=>null!==e&&"object"===typeof e,s="function"===typeof n.AbortController,o="function"===typeof n.ReadableStream,a="function"===typeof n.FormData,c=(...e)=>{let t={};for(const r of e)if(Array.isArray(r))Array.isArray(t)||(t=[]),t=[...t,...r];else if(i(r))for(let[e,n]of Object.entries(r))i(n)&&Reflect.has(t,e)&&(n=c(t[e],n)),t={...t,[e]:n};return t},u=["get","post","put","patch","head","delete"],l={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},h=new Set(["get","put","head","delete","options","trace"]),f=new Set([408,413,429,500,502,503,504]),d=new Set([413,429,503]);class p extends Error{constructor(e){super(e.statusText),this.name="HTTPError",this.response=e}}class y extends Error{constructor(){super("Request timed out"),this.name="TimeoutError"}}const g=(e,t,r)=>(r>2147483647&&t(new RangeError("The `timeout` option cannot be greater than 2147483647")),setTimeout(e,r)),m=e=>new Promise((t,r)=>g(t,r,e)),b=(e,t,r)=>new Promise((n,i)=>{const o=g(()=>{s&&r.abort(),i(new y)},i,t);e.then(n).catch(i).then(()=>{clearTimeout(o)})}),v=e=>u.includes(e)?e.toUpperCase():e,w={limit:2,methods:h,statusCodes:f,afterStatusCodes:d},_=e=>{if("number"===typeof e)return{...w,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...w,...e,methods:e.methods?new Set(e.methods):w.methods,statusCodes:e.statusCodes?new Set(e.statusCodes):w.statusCodes,afterStatusCodes:d}};class E{constructor(e,{timeout:t=1e4,hooks:r,throwHttpErrors:i=!0,searchParams:u,json:h,retry:f={},...d}){if(this._retryCount=0,this._options={method:"get",credentials:"same-origin",retry:_(f),...d},e instanceof n.Request)this._input=e,this._options={...this._options,method:d.method||e.method,headers:d.headers||e.headers,body:d.body||e.body,credentials:d.credentials||e.credentials};else{if(!(e instanceof URL||"string"===typeof e))throw new TypeError("`input` must be a string, URL, or Request");if(this._input=String(e||""),this._options.prefixUrl=String(this._options.prefixUrl||""),this._options.prefixUrl&&this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");if(this._options.prefixUrl&&!this._options.prefixUrl.endsWith("/")&&(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input,u){const e=new URL(this._input,n.document&&n.document.baseURI);if("string"===typeof u||URLSearchParams&&u instanceof URLSearchParams)e.search=u;else{if(!Object.values(u).every(e=>"number"===typeof e||"string"===typeof e))throw new Error("The `searchParams` option must be either a string, `URLSearchParams` instance or an object with string and number values");e.search=new URLSearchParams(u).toString()}this._input=e.toString()}}s&&(this.abortController=new n.AbortController,this._options.signal&&this._options.signal.addEventListener("abort",()=>{this.abortController.abort()}),this._options.signal=this.abortController.signal),this._options.method=v(this._options.method),this._timeout=t,this._hooks=c({beforeRequest:[],beforeRetry:[],afterResponse:[]},r),this._throwHttpErrors=i;const y=new n.Headers(this._options.headers||{});if((a&&this._options.body instanceof n.FormData||this._options.body instanceof URLSearchParams)&&y.has("content-type"))throw new Error(`The \`content-type\` header cannot be used with a ${this._options.body.constructor.name} body. It will be set automatically.`);if(h){if(this._options.body)throw new Error("The `json` option cannot be used with the `body` option");y.set("content-type","application/json"),this._options.body=JSON.stringify(h)}this._options.headers=y;const g=async()=>{await m(1);let e=await this._fetch();for(const t of this._hooks.afterResponse){const r=await t(this._input,this._options,e.clone());r instanceof n.Response&&(e=r)}if(!e.ok&&this._throwHttpErrors)throw new p(e);if(this._options.onDownloadProgress){if("function"!==typeof this._options.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!o)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return this._stream(e.clone(),this._options.onDownloadProgress)}return e},b=this._options.retry.methods.has(this._options.method.toLowerCase()),w=b?this._retry(g):g();for(const[n,s]of Object.entries(l))w[n]=async()=>(y.set("accept",s),(await w).clone()[n]());return w}_calculateRetryDelay(e){if(this._retryCount++,this._retryCountthis._options.retry.maxRetryAfter?0:e}if(413===e.response.status)return 0}const t=.3;return t*2**(this._retryCount-1)*1e3}return 0}async _retry(e){try{return await e()}catch(t){const r=this._calculateRetryDelay(t);if(0!==r&&this._retryCount>0){await m(r);for(const e of this._hooks.beforeRetry)await e(this._input,this._options,t,this._retryCount);return this._retry(e)}if(this._throwHttpErrors)throw t}}async _fetch(){for(const e of this._hooks.beforeRequest){const t=await e(this._input,this._options);if(t instanceof Response)return t}return!1===this._timeout?n.fetch(this._input,this._options):b(n.fetch(this._input,this._options),this._timeout,this.abortController)}_stream(e,t){const r=Number(e.headers.get("content-length"))||0;let i=0;return new n.Response(new n.ReadableStream({start(n){const s=e.body.getReader();async function o(){const{done:e,value:a}=await s.read();if(e)n.close();else{if(t){i+=a.byteLength;const e=0===r?0:i/r;t({percent:e,transferredBytes:i,totalBytes:r},a)}n.enqueue(a),o()}}t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array),o()}}))}}const S=(...e)=>{for(const t of e)if((!i(t)||Array.isArray(t))&&"undefined"!==typeof t)throw new TypeError("The `options` argument must be an object");return c({},...e)},k=e=>{const t=(t,r)=>new E(t,S(e,r));for(const r of u)t[r]=(t,n)=>new E(t,S(e,n,{method:r}));return t.create=e=>k(S(e)),t.extend=t=>k(S(e,t)),t};t["c"]=k()}).call(this,r("c8ba"))},"28d3":function(e,t,r){"use strict";(function(t){function r(e,r){var s=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(o,this,e)):t.nextTick(o,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!r&&e?s._writableState?s._writableState.errorEmitted?t.nextTick(i,s):(s._writableState.errorEmitted=!0,t.nextTick(n,s,e)):t.nextTick(n,s,e):r?(t.nextTick(i,s),r(e)):t.nextTick(i,s)})),this)}function n(e,t){o(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function s(){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)}function o(e,t){e.emit("error",t)}function a(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}e.exports={destroy:r,undestroy:s,errorOrDestroy:a}}).call(this,r("4362"))},"28d37":function(e,t,r){var n=r("9bc4"),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,o=n((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,(function(e,r,n,i){t.push(n?i.replace(s,"$1"):r||e)})),t}));e.exports=o},"28e5":function(e,t,r){"use strict";const n=r("c59f"),i=r("21b4"),{DIAL_ABORTED:s}=r("a10a"),o=r("9f2e"),a=r("65b6"),{QUARTER_HOUR:c,PRIORITY_HIGH:u}=r("0d8d"),l=r("4bc2"),h=l("libp2p:switch:dial:manager"),f=()=>{};class d{constructor(e){this._queue=new Set,this._coldCallQueue=new Set,this._dialingQueues=new Set,this._queues={},this.switch=e,this._cleanInterval=a(this._clean.bind(this),c),this.start()}_clean(){const e=Object.values(this._queues);e.forEach(e=>{if(e.denylisted===1/0)return e.abort(),void delete this._queues[e.id];if(!e.denylisted&&!e.isRunning&&e.length<1){let r=!1;try{const t=this.switch._peerBook.get(e.id);r=Boolean(t.isConnected())}catch(t){}r||(e.abort(),delete this._queues[e.id])}}),this._cleanInterval.reschedule(c)}start(){this.isRunning=!0}stop(){this.isRunning=!1,this._queue.clear(),this._coldCallQueue.clear(),this._cleanInterval.clear();const e=Object.values(this._queues);e.forEach(e=>{e.abort(),delete this._queues[e.id]})}add({peerInfo:e,protocol:t,options:r,callback:i}){i=i?n(i):f;const a=this.getQueue(e);if(r.priority>u){if(this._coldCallQueue.size>=this.switch.dialer.MAX_COLD_CALLS)return o(i,s());if(this._queue.has(a.id))return o(i,s())}a.add(t,r.useFSM,i),e.isConnected()?a.start():a.isDialAllowed()&&(a.isRunning||(r.priority<=u?(this._queue.add(a.id),this._coldCallQueue.delete(a.id)):this._coldCallQueue.add(a.id)),this.run())}run(){if(this.isRunning&&this._dialingQueues.size0?(e=this._queue.values().next(),this._queue.delete(e.value)):this._coldCallQueue.size>0&&(e=this._coldCallQueue.values().next(),this._coldCallQueue.delete(e.value)),e.done)return;const t=this._queues[e.value];if(!t)return void h("missing queue %s, maybe it was aborted?",e.value);this._dialingQueues.add(t.id),t.start()}}clearDenylist(e){const t=this.getQueue(e);t.denylisted=null,t.denylistCount=0}_onQueueStopped(e){this._dialingQueues.delete(e),this.run()}getQueue(e){const t=e.id.toB58String();return this._queues[t]=this._queues[t]||new i(t,this.switch,this._onQueueStopped.bind(this)),this._queues[t]}}e.exports=d},2957:function(e,t,r){e.exports=r.p+"media/Kaytranada10.6fd40029.mp3"},"297e":function(e,t){function r(e,t,r,n){var i=e.length,s=r+(n?1:-1);while(n?s--:++si(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}}).call(this,r("b639").Buffer)},"29c7":function(e,t,r){"use strict";function n(e,t,r){const n=e===t;r(null,n)}e.exports=n},"29e1":function(e,t,r){"use strict";(function(t){e.exports=l;var n=r("f522").AbstractLevelDOWN,i=r("c3bb"),s=r("230c"),o=r("d13e"),a=r("a6a3"),c=r("f689"),u="level-js-";function l(e,t){if(!(this instanceof l))return new l(e,t);if(n.call(this),t=t||{},"string"!==typeof e)throw new Error("constructor requires a location string argument");this.location=e,this.prefix=null==t.prefix?u:t.prefix,this.version=parseInt(t.version||1,10)}i(l,n),l.binaryKeys=c.binaryKeys(indexedDB),l.arrayKeys=c.arrayKeys(indexedDB),l.prototype._open=function(e,t){var r=indexedDB.open(this.prefix+this.location,this.version),n=this;r.onerror=function(){t(r.error||new Error("unknown error"))},r.onsuccess=function(){n.db=r.result,t()},r.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(n.location)||t.createObjectStore(n.location)}},l.prototype.store=function(e){var t=this.db.transaction([this.location],e);return t.objectStore(this.location)},l.prototype.await=function(e,t){var r=e.transaction;r.onabort=function(){t(r.error||new Error("aborted by user"))},r.oncomplete=function(){t(null,e.result)}},l.prototype._get=function(e,t,r){var n=this.store("readonly");try{var i=n.get(e)}catch(s){return a((function(){r(s)}))}this.await(i,(function(e,n){return e?r(e):void 0===n?r(new Error("NotFound")):(t.asBuffer&&(n=o(n)),void r(null,n))}))},l.prototype._del=function(e,t,r){var n=this.store("readwrite");try{var i=n.delete(e)}catch(s){return a((function(){r(s)}))}this.await(i,r)},l.prototype._put=function(e,t,r,n){var i=this.store("readwrite");try{var s=i.put(t,e)}catch(o){return a((function(){n(o)}))}this.await(s,n)},l.prototype._serializeKey=function(e){return t.isBuffer(e)?l.binaryKeys?e:e.toString():Array.isArray(e)?l.arrayKeys?e.map(this._serializeKey,this):String(e):e},l.prototype._serializeValue=function(e){return e},l.prototype._iterator=function(e){return new s(this,this.location,e)},l.prototype._batch=function(e,t,r){if(0===e.length)return a(r);var n,i=this.store("readwrite"),s=i.transaction,o=0;function c(){var t=e[o++],r=t.key;try{var a="del"===t.type?i.delete(r):i.put(t.value,r)}catch(u){return n=u,void s.abort()}o0&&void 0!==arguments[0]&&arguments[0];function t(t){var r=t.r,n=t.s,i=t.recoveryParam,s=a.Buffer.alloc(e?65:64);if(a.Buffer.from(r,"hex").copy(s,0),a.Buffer.from(n,"hex").copy(s,32),e){if(void 0===i)throw new Error("Signer did not return a recoveryParam");s[64]=i}return o.default.encode(s)}return(function(){var e=(0,s.default)(i.default.mark((function e(r,n){var s;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,n(r);case 2:return s=e.sent,e.abrupt("return",t(s));case 4:case"end":return e.stop()}}),e,this)})));function r(t,r){return e.apply(this,arguments)}return r}())}function u(){return function(){var e=(0,s.default)(i.default.mark((function e(t,r){return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",r(t));case 1:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()}var l={ES256K:c(),"ES256K-R":c(!0),Ed25519:u()};function h(e){var t=l[e];if(!t)throw new Error("Unsupported algorithm ".concat(e));return t}e.exports=h},"2a68":function(e,t,r){"use strict";e.exports=function(){return function(e,t){t(!0)}}},"2abf":function(e,t,r){var n=r("7b77"),i=r("7be9");e.exports=function(){var e=n(),t=i();return{source:e,sink:t,resolve:function(r){e.resolve(r.source),t.resolve(r.sink)}}}},"2abf3":function(e,t,r){"use strict";e.exports="\nmessage RPC {\n repeated SubOpts subscriptions = 1;\n repeated Message msgs = 2;\n\n message SubOpts {\n optional bool subscribe = 1; // subscribe or unsubcribe\n optional string topicID = 2;\n }\n\n message Message {\n optional bytes from = 1;\n optional bytes data = 2;\n optional bytes seqno = 3;\n repeated string topicIDs = 4;\n optional bytes signature = 5;\n optional bytes key = 6;\n }\n}"},"2b3e":function(e,t,r){var n=r("d0b2"),i=r("98c9"),s=Object.prototype,o=s.hasOwnProperty,a=s.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(e){return i(e)&&o.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},"2b65":function(e,t){e.exports=function(e){if(e){if("function"===typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"===typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"===typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}},"2bbd":function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r("917c"),a=r("276e"),c=r("8859");class u{constructor(){this.data={}}async open(){}async put(e,t){this.data[e.toString()]=t}async get(e){const t=await this.has(e);if(!t)throw c.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:async()=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[]}}}query(e){let t=Object.entries(this.data);if(t=o(t,e=>({key:new a(e[0]),value:e[1]})),null!=e.prefix&&(t=n(t,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(t=e.filters.reduce((e,t)=>n(e,t),t)),Array.isArray(e.orders)&&(t=e.orders.reduce((e,t)=>i(e,t),t)),null!=e.offset){let r=0;t=n(t,()=>r++>=e.offset)}return null!=e.limit&&(t=s(t,e.limit)),!0===e.keysOnly&&(t=o(t,e=>({key:e.key}))),t}async close(){}}e.exports=u},"2bbf":function(e,t,r){"use strict";const n="[a-fA-F\\d:]",i=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${n})|(?<=${n})(?=\\s|$))`:"",s="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",o="[a-fA-F\\d]{1,4}",a=`\n(\n(?:${o}:){7}(?:${o}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${o}:){6}(?:${s}|:${o}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${o}:){5}(?::${s}|(:${o}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${o}:){4}(?:(:${o}){0,1}:${s}|(:${o}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${o}:){3}(?:(:${o}){0,2}:${s}|(:${o}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${o}:){2}(?:(:${o}){0,3}:${s}|(:${o}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${o}:){1}(?:(:${o}){0,4}:${s}|(:${o}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::${o}){0,5}:${s}|(?::${o}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),c=e=>e&&e.exact?new RegExp(`(?:^${s}$)|(?:^${a}$)`):new RegExp(`(?:${i(e)}${s}${i(e)})|(?:${i(e)}${a}${i(e)})`,"g");c.v4=e=>e&&e.exact?new RegExp(`^${s}$`):new RegExp(`${i(e)}${s}${i(e)}`,"g"),c.v6=e=>e&&e.exact?new RegExp(`^${a}$`):new RegExp(`${i(e)}${a}${i(e)}`,"g"),e.exports=c},"2bdd":function(e,t,r){"use strict";const n=r("f654"),i=r("770a"),s={stat:r("5f7e")},o={cp:r("6da9"),flush:r("d2f9"),mkdir:r("c9b5"),mv:r("3faa9"),rm:r("be69")},a={write:r("8904"),read:r("40ee"),ls:r("2794")},c=({options:e,mfs:t,operations:r,lock:n})=>{Object.keys(r).forEach(i=>{t[i]=n(r[i](e))})},u={repoOwner:!0,ipld:null,repo:null};e.exports=e=>{const{repoOwner:t}=Object.assign({},u||{},e);n(e.ipld,"MFS requires an IPLD instance"),n(e.blocks,"MFS requires an BlockStore instance"),n(e.datastore,"MFS requires a DataStore instance"),e.repo={blocks:e.blocks,datastore:e.datastore};const r=i(t),l=e=>r.readLock(e),h=e=>r.writeLock(e),f={};return c({options:e,mfs:f,operations:s,lock:l}),c({options:e,mfs:f,operations:o,lock:h}),Object.keys(a).forEach(t=>{f[t]=a[t](e)}),f}},"2bff":function(e,t,r){"use strict";(function(t,n){var i;e.exports=x,x.ReadableState=T;r("faa1").EventEmitter;var s=function(e,t){return e.listeners(t).length},o=r("5329"),a=r("b639").Buffer,c=t.Uint8Array||function(){};function u(e){return a.from(e)}function l(e){return a.isBuffer(e)||e instanceof c}var h,f=r(10);h=f&&f.debuglog?f.debuglog("stream"):function(){};var d,p,y=r("821b"),g=r("1c9b"),m=r("6a87"),b=m.getHighWaterMark,v=r("93bc").codes,w=v.ERR_INVALID_ARG_TYPE,_=v.ERR_STREAM_PUSH_AFTER_EOF,E=v.ERR_METHOD_NOT_IMPLEMENTED,S=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,k=r("7f9c"),C=k.emitExperimentalWarning;r("c3bb")(x,o);var A=["error","close","destroy","pause","resume"];function I(e,t,r){if("function"===typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function T(e,t,n){i=i||r("53b2"),e=e||{},"boolean"!==typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=b(this,e,"readableHighWaterMark",n),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r("7d72").StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function x(e){if(i=i||r("53b2"),!(this instanceof x))return new x(e);var t=this instanceof i;this._readableState=new T(e,this,t),this.readable=!0,e&&("function"===typeof e.read&&(this._read=e.read),"function"===typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function B(e,t,r,n,i){h("readableAddChunk",t);var s,o=e._readableState;if(null===t)o.reading=!1,L(e,o);else if(i||(s=N(o,t)),s)e.emit("error",s);else if(o.objectMode||t&&t.length>0)if("string"===typeof t||o.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=u(t)),n)o.endEmitted?e.emit("error",new S):R(e,o,t,!0);else if(o.ended)e.emit("error",new _);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?R(e,o,t,!1):j(e,o)):R(e,o,t,!1)}else n||(o.reading=!1,j(e,o));return!o.ended&&(o.length=O?e=O:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function D(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=P(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function L(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?M(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,U(e)))}}function M(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(h("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(U,e))}function U(e){var t=e._readableState;h("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,G(e)}function j(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(K,e,t))}function K(e,t){while(!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function q(e){h("readable nexttick read 0"),e.read(0)}function z(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(H,e,t))}function H(e,t){h("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),G(e),t.flowing&&!t.reading&&e.read(0)}function G(e){var t=e._readableState;h("flow",t.flowing);while(t.flowing&&null!==e.read());}function $(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function W(e){var t=e._readableState;h("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(Y,t,e))}function Y(e,t){h("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Q(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return h("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?W(this):M(this),null;if(e=D(e,t),0===e&&t.ended)return 0===t.length&&W(this),null;var n,i=t.needReadable;return h("need readable",i),(0===t.length||t.length-e0?$(e,t):null,null===n?(t.needReadable=!0,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&W(this)),null!==n&&this.emit("data",n),n},x.prototype._read=function(e){this.emit("error",new E("_read()"))},x.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,h("pipe count=%d opts=%j",i.pipesCount,t);var o=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr,a=o?u:b;function c(e,t){h("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,d())}function u(){h("onend"),e.end()}i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",c);var l=F(r);e.on("drain",l);var f=!1;function d(){h("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",l),e.removeListener("error",y),e.removeListener("unpipe",c),r.removeListener("end",u),r.removeListener("end",b),r.removeListener("data",p),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l()}function p(t){h("ondata");var n=e.write(t);h("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==Q(i.pipes,e))&&!f&&(h("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function y(t){h("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",m),b()}function m(){h("onfinish"),e.removeListener("close",g),b()}function b(){h("unpipe"),r.unpipe(e)}return r.on("data",p),I(e,"error",y),e.once("close",g),e.once("finish",m),e.emit("pipe",r),i.flowing||(h("pipe resume"),r.resume()),e},x.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,h("on readable",i.length,i.reading),i.length?M(this):i.reading||n.nextTick(q,this))),r},x.prototype.addListener=x.prototype.on,x.prototype.removeListener=function(e,t){var r=o.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(V,this),r},x.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(V,this),t},x.prototype.resume=function(){var e=this._readableState;return e.flowing||(h("resume"),e.flowing=!e.readableListening,z(this,e)),e.paused=!1,this},x.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},x.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(h("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){if(h("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!==i&&void 0!==i)&&(r.objectMode||i&&i.length)){var s=t.push(i);s||(n=!0,e.pause())}})),e)void 0===this[i]&&"function"===typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s0?n(null,o.shift()):r=n}return e.addEventListener("message",(function(e){var t=e.data;if(i(t)&&(t=n.from(t)),r)return r(null,t);o.push(t)})),e.addEventListener("close",(function(e){s||r&&r(s=!0)})),e.addEventListener("error",(function(e){s||(s=e,a||(a=!0,t&&t(e)),r&&r(s))})),e.addEventListener("open",(function(e){a||s||(a=!0)})),c}},"2c49":function(e,t){const r=window.XMLHttpRequest;e.exports=r},"2c93":function(e,t,r){(function(t){const n=r("faa1").EventEmitter,i=r("e063"),{WORKER_REQUEST_READ_LOCK:s,WORKER_RELEASE_READ_LOCK:o,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:c,WORKER_RELEASE_WRITE_LOCK:u,MASTER_GRANT_WRITE_LOCK:l}=r("2046");let h;const f=(e,t,r,n,i)=>(s,o)=>{o&&o.type===r&&e.emit(t,o.name,()=>(s.send({type:i,name:o.name,identifier:o.identifier}),new Promise(e=>{const t=r=>{r&&r.type===n&&r.identifier===o.identifier&&(s.removeListener("message",t),e())};s.on("message",t)})))},d=(e,r,n,s)=>()=>{const o=i.generate();return t.send({type:r,identifier:o,name:e}),new Promise(r=>{const i=a=>{a&&a.type===n&&a.identifier===o&&(t.removeListener("message",i),r(()=>{t.send({type:s,identifier:o,name:e})}))};t.on("message",i)})};e.exports=e=>{try{if(h=r(16),!Object.keys(h).length)return}catch(t){return}if(h.isMaster||e.singleProcess){const e=new n;return h.on("message",f(e,"requestReadLock",s,o,a)),h.on("message",f(e,"requestWriteLock",c,u,l)),e}return{isWorker:!0,readLock:e=>d(e,s,a,o),writeLock:e=>d(e,c,l,u)}}}).call(this,r("4362"))},"2cdb":function(e,t,r){"use strict";const n=r("c449"),i=r("85b8");t.resolve=(e,t)=>{let r=i.deserialize(e);const s=t.split("/").filter(Boolean);while(s.length){const e=s.shift();if(void 0===r[e]){for(const t of r.Links)if(t.Name===e)return{value:t.Hash,remainderPath:s.join("/")};throw new Error(`Object has no property '${e}'`)}if(r=r[e],n.isCID(r))return{value:r,remainderPath:s.join("/")}}return{value:r,remainderPath:""}},t.tree=function*(e){const t=i.deserialize(e);yield"Data",yield"Links";for(let r=0;r{const t=c.logger(e.peerInfo.id,"rpc:get-providers");async function r(r,s){let u;try{u=new n(s.key)}catch(g){throw o(new Error(`Invalid CID: ${g.message}`),"ERR_INVALID_CID")}t("%s",u.toBaseEncodedString());const l=c.bufferToKey(u.buffer),[h,f,d]=await Promise.all([e.datastore.has(l),e.providers.getProviders(u),e._betterPeersToQueryAsync(s,r)]),p=f.map(t=>e.peerBook.has(t)?e.peerBook.get(t):e.peerBook.put(new i(t)));h&&p.push(e.peerInfo);const y=new a(s.type,s.key,s.clusterLevel);return p.length>0&&(y.providerPeers=p),d.length>0&&(y.closerPeers=d),t("got %s providers %s closerPeers",p.length,d.length),y}return function(e,t,n){s(r(e,t))(n)}}},"2d6f":function(e,t,r){"use strict"; +/*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */e.exports=a,e.exports.format=c,e.exports.parse=u;var n=/\B(?=(\d{3})+(?!\d))/g,i=/(?:\.0*|(\.[^0]+)0+)$/,s={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},o=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function a(e,t){return"string"===typeof e?u(e):"number"===typeof e?c(e,t):null}function c(e,t){if(!Number.isFinite(e))return null;var r=Math.abs(e),o=t&&t.thousandsSeparator||"",a=t&&t.unitSeparator||"",c=t&&void 0!==t.decimalPlaces?t.decimalPlaces:2,u=Boolean(t&&t.fixedDecimals),l=t&&t.unit||"";l&&s[l.toLowerCase()]||(l=r>=s.pb?"PB":r>=s.tb?"TB":r>=s.gb?"GB":r>=s.mb?"MB":r>=s.kb?"KB":"B");var h=e/s[l.toLowerCase()],f=h.toFixed(c);return u||(f=f.replace(i,"$1")),o&&(f=f.replace(n,o)),f+a+l}function u(e){if("number"===typeof e&&!isNaN(e))return e;if("string"!==typeof e)return null;var t,r=o.exec(e),n="b";return r?(t=parseFloat(r[1]),n=r[4].toLowerCase()):(t=parseInt(e,10),n="b"),Math.floor(s[n]*t)}},"2db6":function(e,t,r){"use strict";const n=r("eeb3"),i=r("cf8f"),s=r("87dd"),o=r("e24c").Connection,a=r("0bda"),c=r("4bc2"),u=c("libp2p:websockets:dialer"),l=r("063e");class h{dial(e,t,r){"function"===typeof t&&(r=t,t={}),r=r||function(){};const i=a(e);u("dialing %s",i);const s=n(i,{binary:!0,onConnect:e=>{r(e)}}),c=new o(s);return c.getObservedAddrs=t=>t(null,[e]),c.close=e=>s.close(e),c}createListener(e,t){return"function"===typeof e&&(t=e,e={}),l(e,t)}filter(e){return Array.isArray(e)||(e=[e]),e.filter(e=>!e.protoNames().includes("p2p-circuit")&&("function"===typeof e.decapsulateCode?e=e.decapsulateCode(421):e.protoNames().includes("ipfs")&&(e=e.decapsulate("ipfs")),i.WebSockets.matches(e)||i.WebSocketsSecure.matches(e)))}}e.exports=s(h,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},"2dce":function(e,t,r){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function(e,t,r){if("string"!==typeof t)throw new Error("Input must be string");for(var s,o,a=t.length,c=0,u=0;ur)return t.slice(0,u-o.length+1)}return t}},"2dee":function(e,t,r){"use strict";(function(t){const n=r("e782"),i=r("7a79");function s(e,t,r,i){if("function"===typeof r&&(i=r,r=void 0),!i)throw new Error("Missing callback");s.digest(e,t,r,(e,s)=>{if(e)return i(e);i(null,n.encode(s,t,r))})}e.exports=s,s.Buffer=t,s.multihash=n,s.digest=function(e,t,r,n){if("function"===typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i,o=n;r&&(o=(e,t)=>{if(e)return n(e);n(null,t.slice(0,r))});try{i=s.createHash(t)}catch(a){return o(a)}i(e,o)},s.createHash=function(e){if(e=n.coerceCode(e),!s.functions[e])throw new Error("multihash function "+e+" not yet supported");return s.functions[e]},s.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(s.functions)}).call(this,r("b639").Buffer)},"2e00":function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.hasNextTick=t.hasSetImmediate=void 0,t.fallback=u,t.wrap=l;var n=r("dea4"),i=s(n);function s(e){return e&&e.__esModule?e:{default:e}}var o,a=t.hasSetImmediate="function"===typeof setImmediate&&setImmediate,c=t.hasNextTick="object"===typeof e&&"function"===typeof e.nextTick;function u(e){setTimeout(e,0)}function l(e){return function(t){var r=(0,i.default)(arguments,1);e((function(){t.apply(null,r)}))}}o=a?setImmediate:c?e.nextTick:u,t.default=l(o)}).call(this,r("4362"))},"2e15":function(e,t,r){"use strict";class n extends Error{constructor(e){super(e),this.name="LockExistsError",this.code=n.code}}n.code="ERR_LOCK_EXISTS",t.LockExistsError=n;class i extends Error{constructor(e){super(e),this.name="NotFoundError",this.code=i.code}}i.code="ERR_NOT_FOUND",t.NotFoundError=i;class s extends Error{constructor(e){super(e),this.name="InvalidRepoVersionError",this.code=s.code}}s.code="ERR_INVALID_REPO_VERSION",t.InvalidRepoVersionError=s,t.ERR_REPO_NOT_INITIALIZED="ERR_REPO_NOT_INITIALIZED",t.ERR_REPO_ALREADY_OPEN="ERR_REPO_ALREADY_OPEN",t.ERR_REPO_ALREADY_CLOSED="ERR_REPO_ALREADY_CLOSED"},"2e53":function(e,t,r){"use strict";(function(t){const n=r("e2e5"),i=r("7c2b"),{Key:s}=r("9a94"),o=r("f929"),a=r("b1aa"),c=r("e782"),u=r("7048"),l=r("fa4d"),h=r("4bc2"),f=h("jsipns");f.error=h("jsipns:error");const d=r("3958"),{parseRFC3339:p}=r("a816"),y=r("c1a6"),g=c.names.id,m="/ipns/",b=(e,t,r,n)=>{const s=new i(Date.now()+Number(n)).toString(),o=d.ValidityType.EOL;return w(e,t,r,s,o)},v=(e,t,r,n)=>{const i=d.ValidityType.EOL;return w(e,t,r,n,i)},w=async(e,t,r,n,i)=>{const s=await I(e,t,i,n),o={value:t,signature:s,validityType:i,validity:n,sequence:r};return f(`ipns entry for ${t} created`),o},_=async(e,t)=>{const{value:r,validityType:n,validity:i}=t,s=x(r,n,i);let o;try{o=await l(e.verify,{context:e})(s,t.signature)}catch(a){o=!1}if(!o)throw f.error("record signature verification failed"),u(new Error("record signature verification failed"),y.ERR_SIGNATURE_VERIFICATION);if(n===d.ValidityType.EOL){let e;try{e=p(i.toString())}catch(c){throw f.error("unrecognized validity format (not an rfc3339 format)"),u(new Error("unrecognized validity format (not an rfc3339 format)"),y.ERR_UNRECOGNIZED_FORMAT)}if(e{if(!e||!e.bytes||!t){const e=new Error("one or more of the provided parameters are not defined");throw f.error(e),u(e,y.ERR_UNDEFINED_PARAMETER)}let r,n;try{r=await l(a.createFromPubKey)(e.bytes)}catch(i){throw u(i,y.ERR_PEER_ID_FROM_PUBLIC_KEY)}try{n=B(r)}catch(i){throw f.error(i),u(i,y.ERR_PUBLIC_KEY_FROM_ID)}if(n)return null;try{t.pubKey=o.keys.marshalPublicKey(e)}catch(i){throw f.error(i),i}return t},S=(e,t)=>{if(!t||!e){const e=new Error("one or more of the provided parameters are not defined");throw f.error(e),u(e,y.ERR_UNDEFINED_PARAMETER)}if(t.pubKey){let e;try{e=o.keys.unmarshalPublicKey(t.pubKey)}catch(r){throw f.error(r),r}return e}if(e.pubKey)return e.pubKey;throw Object.assign(new Error("no public key is available"),{code:y.ERR_UNDEFINED_PARAMETER})},k=e=>n(e,"RFC4648",{padding:!1}),C=e=>new s(`/ipns/${k(e)}`),A=e=>{const r=t.from("/pk/"),n=t.from("/ipns/");return{routingPubKey:new s(t.concat([r,e])),pkKey:new s(k(t.concat([r,e]))),routingKey:new s(t.concat([n,e])),ipnsKey:new s(k(t.concat([n,e])))}},I=(e,t,r,n)=>{try{const i=x(t,r,n);return l(e.sign,{context:e})(i)}catch(i){throw f.error("record signature creation failed"),u(new Error("record signature creation failed: "+i.message),y.ERR_SIGNATURE_CREATION)}},T=e=>{if("0"===e.toString())return"EOL";const t=new Error(`unrecognized validity type ${e.toString()}`);throw f.error(t),u(t,y.ERR_UNRECOGNIZED_VALIDITY)},x=(e,r,n)=>{const i=t.from(e),s=t.from(T(r)),o=t.from(n);return t.concat([i,o,s])},B=e=>{const t=c.decode(e.id);return t.code!==g?null:o.keys.unmarshalPublicKey(t.digest)},R=d.encode,N=d.decode,O={validate:async(e,t)=>{const r=N(e),n=t.slice("/ipns/".length),i=a.createFromBytes(n),s=S(i,r);return await _(s,r),!0},select:(e,t)=>{const r=N(e),n=N(t);return r.sequence>n.sequence?0:1}};e.exports={create:b,createWithExpiration:v,validate:_,embedPublicKey:E,extractPublicKey:S,getLocalKey:C,getIdKeys:A,marshal:R,unmarshal:N,validator:O,namespace:m,namespaceLength:m.length}}).call(this,r("b639").Buffer)},"2e81":function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r("5e27"),a=r("c368"),c=r("4547");class u{constructor(){this.data={}}async open(){}async put(e,t){this.data[e.toString()]=t}async get(e){const t=await this.has(e);if(!t)throw c.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:async()=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[]}}}query(e){let t=Object.entries(this.data);if(t=o(t,e=>({key:new a(e[0]),value:e[1]})),null!=e.prefix&&(t=n(t,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(t=e.filters.reduce((e,t)=>n(e,t),t)),Array.isArray(e.orders)&&(t=e.orders.reduce((e,t)=>i(e,t),t)),null!=e.offset){let r=0;t=n(t,()=>r++>=e.offset)}return null!=e.limit&&(t=s(t,e.limit)),!0===e.keysOnly&&(t=o(t,e=>({key:e.key}))),t}async close(){}}e.exports=u},"2e97":function(e,t,r){"use strict";const n=r("efb7");async function*i(e,t,r){yield await s(e,t,r)}async function s(e,t,r){const i=[];for await(const s of n(e,r.maxChildrenPerNode))i.push(await t(s));return i.length>1?s(i,t,r):i[0]}e.exports=i},"2ea6":function(e,t,r){"use strict";(function(e){const n=r("682d"),i=r("e31f"),s=r("ffc2"),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=(t,r,s)=>{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),s)};t.create=function(e,t,r){const c=o[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:c}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:s[e]})),r)}}).call(this,r("b639").Buffer)},"2edf":function(e,t,r){e.exports=r("1ea5")},"2f06":function(e,t,r){(function(e){function r(e){return void 0!==e&&""!==e}function n(e,t){return Object.hasOwnProperty.call(e,t)}function i(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(t,r){if(e.isBuffer(t)){for(var n=Math.min(t.length,r.length),i=0;ir?1:0};var s=t.lowerBoundKey=function(e){return i(e,"gt")||i(e,"gte")||i(e,"min")||(e.reverse?i(e,"end"):i(e,"start"))||void 0},o=t.lowerBound=function(e,t){var r=s(e);return r?e[r]:t},a=t.lowerBoundInclusive=function(e){return!n(e,"gt")},c=t.upperBoundInclusive=function(e){return!n(e,"lt")},u=t.lowerBoundExclusive=function(e){return!a(e)},l=t.upperBoundExclusive=function(e){return!c(e)},h=t.upperBoundKey=function(e){return i(e,"lt")||i(e,"lte")||i(e,"max")||(e.reverse?i(e,"start"):i(e,"end"))||void 0},f=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function d(e){return e}t.start=function(e,t){return e.reverse?f(e,t):o(e,t)},t.end=function(e,t){return e.reverse?o(e,t):f(e,t)},t.startInclusive=function(e){return e.reverse?c(e):a(e)},t.endInclusive=function(e){return e.reverse?a(e):c(e)},t.toLtgt=function(e,r,i,s,o){r=r||{},i=i||d;var a=arguments.length>3,c=t.lowerBoundKey(e),u=t.upperBoundKey(e);return c?"gt"===c?r.gt=i(e.gt,!1):r.gte=i(e[c],!1):a&&(r.gte=i(s,!1)),u?"lt"===u?r.lt=i(e.lt,!0):r.lte=i(e[u],!0):a&&(r.lte=i(o,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),n(r,"max")&&delete r.max,n(r,"min")&&delete r.min,n(r,"start")&&delete r.start,n(r,"end")&&delete r.end,r},t.contains=function(e,n,i){i=i||t.compare;var s=o(e);if(r(s)){var a=i(n,s);if(a<0||0===a&&u(e))return!1}var c=f(e);if(r(c)){a=i(n,c);if(a>0||0===a&&l(e))return!1}return!0},t.filter=function(e,r){return function(n){return t.contains(e,n,r)}}}).call(this,r("b639").Buffer)},"2f07":function(e,t,r){var n=r("5887"),i=r("0c4e"),s=r("e0c5").Buffer,o=r("715d"),a=r("5190"),c=r("d7d8"),u=r("4eef"),l=r("c3bb");function h(e,t,r){a.call(this),this._cache=new d,this._cipher=new c.AES(t),this._prev=s.from(r),this._mode=e,this._autopadding=!0}l(h,a),h.prototype._update=function(e){var t,r;this._cache.add(e);var n=[];while(t=this._cache.get())r=this._mode.encrypt(this,t),n.push(r);return s.concat(n)};var f=s.alloc(16,16);function d(){this.cache=s.allocUnsafe(0)}function p(e,t,r){var a=n[e.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"===typeof t&&(t=s.from(t)),t.length!==a.key/8)throw new TypeError("invalid key length "+t.length);if("string"===typeof r&&(r=s.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===a.type?new o(a.module,t,r):"auth"===a.type?new i(a.module,t,r):new h(a.module,t,r)}function y(e,t){var r=n[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=u(t,!1,r.key,r.iv);return p(e,i.key,i.iv)}h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},d.prototype.add=function(e){this.cache=s.concat([this.cache,e])},d.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},d.prototype.flush=function(){var e=16-this.cache.length,t=s.allocUnsafe(e),r=-1;while(++r{const o=i.digest({name:e},r);if("function"!==typeof o.then)return o.onerror=()=>{s(new Error(`hashing data using ${e}`))},void(o.oncomplete=e=>{s(null,e.target.result)});n(o.then(e=>t.from(new Uint8Array(e))),s)}}function a(e,t){o("SHA-1")(e,t)}function c(e,t){o("SHA-256")(e,t)}function u(e,t){o("SHA-512")(e,t)}e.exports={sha1:a,sha2256:c,sha2512:u}}).call(this,r("b639").Buffer)},"2f79":function(e,t,r){"use strict";const n=r("55cd"),i=r("8049"),s=i.toBase64,o=i.toBn,a=n.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())})),c=n.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid({"1.2.840.113549.1.1.1":"rsa"}),this.key("none").optional().null_(),this.key("curve").optional().objid(),this.key("params").optional().seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()))})),u=n.define("RSAPublicKey",(function(){this.seq().obj(this.key("algorithm").use(c),this.key("subjectPublicKey").bitstr())})),l=n.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));t.pkcs1ToJwk=function(e){const t=a.decode(e,"der");return{kty:"RSA",n:s(t.modulus),e:s(t.publicExponent),d:s(t.privateExponent),p:s(t.prime1),q:s(t.prime2),dp:s(t.exponent1),dq:s(t.exponent2),qi:s(t.coefficient),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){return a.encode({version:0,modulus:o(e.n),publicExponent:o(e.e),privateExponent:o(e.d),prime1:o(e.p),prime2:o(e.q),exponent1:o(e.dp),exponent2:o(e.dq),coefficient:o(e.qi)},"der")},t.pkixToJwk=function(e){const t=u.decode(e,"der"),r=l.decode(t.subjectPublicKey.data,"der");return{kty:"RSA",n:s(r.modulus),e:s(r.publicExponent),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){return u.encode({algorithm:{algorithm:"rsa",none:null},subjectPublicKey:{data:l.encode({modulus:o(e.n),publicExponent:o(e.e)},"der")}},"der")}},"2fd8":function(e,t,r){"use strict";const n=r("1005"),i=r("eb33"),s=r("45d0"),o=r("b116");t.Key=n,t.MemoryDatastore=i,t.utils=s,t.Errors=o},"2fe8":function(e,t,r){(function(t){const n=r("d733"),i=r("e3d5"),s=r("1a18"),o=r("17e5"),a=r("63e1"),c=r("3022").promisify,u=c(a),l=42;function h(e){return"string"===typeof e?e=new i(e).buffer:i.isCID(e)&&(e=e.buffer),new n.Tagged(l,t.concat([t.from("00","hex"),e]))}function f(e){let r;try{r=o(e)}catch(s){r=!1}if(r)throw new Error("The object passed has circular references");function n(e){if(!e||t.isBuffer(e)||"string"===typeof e)return e;if(Array.isArray(e))return e.map(n);if(i.isCID(e))return h(e);const r=Object.keys(e);if(1===r.length&&"/"===r[0])return h(e["/"]);if(r.length>0){const t={};return r.forEach(r=>{"object"===typeof e[r]?t[r]=n(e[r]):t[r]=e[r]}),t}return e}return n(e)}e.exports=e=>{let t=new n.Decoder({tags:{[l]:e=>(e=e.slice(1),new i(e))},size:e});const r=e=>t.decodeFirst(e),o=e=>{let t=f(e);return n.encode(t)},a=async(e,t="sha2-256")=>{let r=o(e),n=await u(r,t),a=new i(1,"dag-cbor",n);return new s(r,a)};return{serialize:o,deserialize:r,mkblock:a}}}).call(this,r("b639").Buffer)},"2ff2":function(e,t,r){"use strict";const n=r("af8e"),i=r("96a8"),s=r("0774"),o=r("ea91"),a=r("e7ba"),c=i(r("eee0"));r("508d"),r("b6fe");const u=r("f0a0");class l{constructor(e){this._key=e}verify(e,t,r){m(r),a.hashAndVerify(this._key,t,e,r)}marshal(){return a.utils.jwkToPkix(this._key)}get bytes(){return c.PublicKey.encode({Type:c.KeyType.RSA,Data:this.marshal()})}encrypt(e,t){return h(()=>a.encrypt(this._key,e),t)}equals(e){return this.bytes.equals(e.bytes)}hash(e){m(e),n(this.bytes,"sha2-256",e)}}function h(e,t){let r;try{r=e()}catch(n){t(n)}return t(null,r)}class f{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return a.getRandomValues(16)}sign(e,t){m(t),a.hashAndSign(this._key,e,t)}get public(){if(!this._publicKey)throw new Error("public key not provided");return new l(this._publicKey)}decrypt(e,t){h(()=>a.decrypt(this._key,e),t)}marshal(){return a.utils.jwkToPkcs1(this._key)}get bytes(){return c.PrivateKey.encode({Type:c.KeyType.RSA,Data:this.marshal()})}equals(e){return this.bytes.equals(e.bytes)}hash(e){m(e),n(this.bytes,"sha2-256",e)}id(e){this.public.hash((t,r)=>{if(t)return e(t);e(null,s.encode(r))})}export(e,t,r){"function"===typeof t&&(r=t,t=e,e="pkcs-8"),m(r),o(()=>{let n=null,i=null;try{const r=new u.util.ByteBuffer(this.marshal()),s=u.asn1.fromDer(r),o=u.pki.privateKeyFromAsn1(s);if("pkcs-8"===e){const e={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};i=u.pki.encryptRsaPrivateKey(o,t,e)}else n=new Error(`Unknown export format '${e}'`)}catch(s){n=s}r(n,i)})}}function d(e,t){const r=a.utils.pkcs1ToJwk(e);a.unmarshalPrivateKey(r,(e,r)=>{if(e)return t(e);t(null,new f(r.privateKey,r.publicKey))})}function p(e){const t=a.utils.pkixToJwk(e);return new l(t)}function y(e,t){a.unmarshalPrivateKey(e,(e,r)=>{if(e)return t(e);t(null,new f(r.privateKey,r.publicKey))})}function g(e,t){a.generateKey(e,(e,r)=>{if(e)return t(e);t(null,new f(r.privateKey,r.publicKey))})}function m(e){if("function"!==typeof e)throw new Error("callback is required")}e.exports={RsaPublicKey:l,RsaPrivateKey:f,unmarshalRsaPublicKey:p,unmarshalRsaPrivateKey:d,generateKeyPair:g,fromJwk:y}},"300a":function(e,t,r){"use strict";(function(t){const n=r("e3d5");e.exports=function(e){if(t.isBuffer(e))return new n(e).toString();if(n.isCID(e))return e.toString();if("string"!==typeof e)throw new Error("unexpected cid type: "+typeof e);return new n(e.split("/")[0]),e}}).call(this,r("b639").Buffer)},3053:function(e,t,r){(function(t){var r=o(),n=a(),i=c(),s="undefined"!==typeof window?window:t;function o(){return Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i("hash algorithm must be specified","ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(`multihash function '${e}' not yet supported`,"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},"309b":function(e,t,r){"use strict";t.defined=function(e){return null!==e&&void 0!==e&&("number"!==typeof e||!isNaN(e))}},"30ae":function(e,t,r){(function(t){var n=r("d485");e.exports=s,e.exports.source=function(e){return s(null,e)},e.exports.sink=function(e){return s(e,null)};var i="undefined"===typeof setImmediate?t.nextTick:setImmediate;function s(e,t){e&&"object"===typeof e&&(t=e.source,e=e.sink);var r,s,o,a=[],c=[],u=new n;u.writable=u.readable=!0,u.write=function(e){return a.length?a.shift()(null,e):c.push(e),a.length||(s=!0),!!a.length},u.end=function(){t?c.length?y():t(r=!0,a.length?a.shift():function(){}):a.length&&a.shift()(!0)},u.source=function(e,t){c.length?(t(null,c.shift()),c.length||u.emit("drain")):((r=r||e)?t(r):a.push(t),s&&(s=!1,u.emit("drain")))},e&&(o=e(u.source)),o&&!t&&(t=o);var l=[],h=!1,f=!1;if(u.sink=function(e){t=e,i(y)},t){u.sink(t),u.paused=!0;var d=u.on.bind(u);u.on=(e,t)=>{var r=d(e,t);return"data"===e&&u.paused&&i(u.resume.bind(u)),r};var p=u.pipe.bind(u);u.pipe=function(e,t){var r=p(e,t);return u.paused&&u.resume(),r}}function y(){if(!1,t&&!f){while(l.length&&!u.paused)u.emit("data",l.shift());if(!u.paused){if(h)return u.emit("end");f=!0,t(null,(function e(n,i){f=!1,u.paused?(!0===n?h=n:n?u.emit("error",n):l.push(i),!0):n&&!0!==(r=n)?u.emit("error",n):(r=r||n)?u.emit("end"):(u.emit("data",i),f=!0,t(null,e))}))}}}return u.pause=function(){return u.paused=!0,u},u.resume=function(){return u.paused=!1,y(),u},u.destroy=function(){!r&&t&&t(r=!0,(function(){})),r=!0,a.length&&a.shift()(!0),u.emit("close")},u}}).call(this,r("4362"))},3136:function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("670f"),s=r("354e"),o=r("d183");async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error(`multihash function '${e}' not yet supported`),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},3156:function(e,t,r){r("a4d3"),r("99af"),r("4de4"),r("4160"),r("e439"),r("b64b"),r("159b");var n=r("9523");function i(e){for(var t=1;t>>t^e<<32-t}var a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),u=new Uint32Array(16),l=new Uint32Array(16);function h(e,t){var r=0;for(r=0;r<8;r++)u[r]=e.h[r],u[r+8]=a[r];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),r=0;r<16;r++)l[r]=i(e.b,4*r);for(r=0;r<10;r++)s(0,4,8,12,l[c[16*r+0]],l[c[16*r+1]]),s(1,5,9,13,l[c[16*r+2]],l[c[16*r+3]]),s(2,6,10,14,l[c[16*r+4]],l[c[16*r+5]]),s(3,7,11,15,l[c[16*r+6]],l[c[16*r+7]]),s(0,5,10,15,l[c[16*r+8]],l[c[16*r+9]]),s(1,6,11,12,l[c[16*r+10]],l[c[16*r+11]]),s(2,7,8,13,l[c[16*r+12]],l[c[16*r+13]]),s(3,4,9,14,l[c[16*r+14]],l[c[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=u[r]^u[r+8]}function f(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(a),b:new Uint32Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(d(n,t),n.c=64),n}function d(e,t){for(var r=0;r>2]>>8*(3&r)&255;return t}function y(e,t,r){r=r||32,e=n.normalizeInput(e);var i=f(r,t);return d(i,e),p(i)}function g(e,t,r){var i=y(e,t,r);return n.toHex(i)}e.exports={blake2s:y,blake2sHex:g,blake2sInit:f,blake2sUpdate:d,blake2sFinal:p}},"31a0":function(e,t,r){(function(t,n,i){var s=r("5995"),o=r("3bdc"),a=e.exports=s.util=s.util||{};function c(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(a.isArrayBuffer(e)||a.isArrayBufferView(e))if("undefined"!==typeof i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r15?(i=Date.now(),c(e)):(r.push(e),1===r.length&&o.setAttribute("a",s=!s))}}a.nextTick=a.setImmediate})(),a.isNodejs="undefined"!==typeof t&&t.versions&&t.versions.node,a.globalScope=function(){return a.isNodejs?n:"undefined"===typeof self?window:self}(),a.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},a.isArrayBufferView=function(e){return e&&a.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},a.ByteBuffer=u,a.ByteStringBuffer=u;var l=4096;function h(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=a.isArrayBuffer(e),n=a.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}a.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>l&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},a.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);var r=this.data;while(t>0)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},a.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},a.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(a.encodeUtf8(e))},a.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},a.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},a.ByteStringBuffer.prototype.putInt=function(e,t){c(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},a.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},a.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},a.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},a.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var e=a.createBuffer(this.data);return e.read=this.read,e},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},a.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},a.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},a.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},a.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},a.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(e,t){c(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},a.DataBuffer.prototype.putSignedInt=function(e,t){return c(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},a.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},a.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},a.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return r},a.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s,n},a.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(e,t){var r,n,i,s="",o="",a=0;while(a>2),s+=f.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=f.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":f.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s,o},a.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");var t,r,n,i,s="",o=0;while(o>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},a.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},a.decodeUtf8=function(e){return decodeURIComponent(escape(e))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},a.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},a.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,s=0;s>2),s+=f.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=f.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":f.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s,o},a.binary.base64.decode=function(e,t,r){var n,i,s,o,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;var c=0,u=r;while(c>4,64!==s&&(a[u++]=(15&i)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},a.binary.base58.encode=function(e,t){return a.binary.baseN.encode(e,p,t)},a.binary.base58.decode=function(e,t){return a.binary.baseN.decode(e,p,t)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(e,t,r){e=a.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,s=0;s0?(i=r[n].substring(0,o),s=r[n].substring(o+1)):(i=r[n],s=null),i in t||(t[i]=[]),i in Object.prototype||null===s||t[i].push(unescape(s))}return t};return"undefined"===typeof e?(null===E&&(E="undefined"!==typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=E):t=r(e),t},a.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var s=""===r?{}:a.getQueryVariables(r);return{pathString:t,queryString:r,path:i,query:s}},a.makeRequest=function(e){var t=a.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return"undefined"===typeof e?t.path:t.path[e]},getQuery:function(e,r){var n;return"undefined"===typeof e?n=t.query:(n=t.query[e],n&&"undefined"!==typeof r&&(n=n[r])),n},getQueryLast:function(e,t){var n,i=r.getQuery(e);return n=i?i[i.length-1]:t,n}};return r},a.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},a.setPath=function(e,t,r){if("object"===typeof e&&null!==e){var n=0,i=t.length;while(n0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},a.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+a:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-u).toFixed(s).slice(2):"")},a.formatSize=function(e){return e=e>=1073741824?a.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?a.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?a.formatNumber(e/1024,0)+" KiB":a.formatNumber(e,0)+" bytes",e},a.bytesFromIP=function(e){return-1!==e.indexOf(".")?a.bytesFromIPv4(e):-1!==e.indexOf(":")?a.bytesFromIPv6(e):null},a.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=a.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},a.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in a&&!e.update)return t(null,a.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,t(null,a.cores);if("undefined"===typeof Worker)return a.cores=1,t(null,a.cores);if("undefined"===typeof Blob)return a.cores=2,t(null,a.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;while(Date.now()a.st&&i.sti.st&&a.st(e=e||new Error("Cannot open database"),n(e,"ERR_DB_OPEN_FAILED")),e.exports.dbDeleteFailedError=e=>(e=e||new Error("Delete failed"),n(e,"ERR_DB_DELETE_FAILED")),e.exports.dbWriteFailedError=e=>(e=e||new Error("Write failed"),n(e,"ERR_DB_WRITE_FAILED")),e.exports.notFoundError=e=>(e=e||new Error("Not Found"),n(e,"ERR_NOT_FOUND"))},3267:function(e,t,r){"use strict";const n=r("fa4d"),i=r("2644"),s=r("1421"),o=r("b1aa"),a=r("8911");e.exports=e=>n((t,r,n)=>{"function"!==typeof r||n||(n=r,r={}),"function"===typeof r&&"function"===typeof n&&(n=r,r={});const c=(e,t)=>{Array.isArray(e)||(e=[e]);let r=[];e.forEach(e=>{4===e.Type&&e.Responses.forEach(e=>{const t=new a(o.createFromB58String(e.ID));e.Addrs&&e.Addrs.forEach(e=>{const r=s(e);t.multiaddrs.add(r)}),r.push(t)})}),t(null,r)};e({path:"dht/findprovs",args:t.toString(),qs:r},(e,t)=>{if(e)return n(e);i(t,c,n)})})},"326a":function(e,t,r){"use strict";const n=r("4bc2"),i=r("7048"),s=r("09a4"),o=r("6158"),a=n("ipfs:name-pubsub");a.error=n("ipfs:name-pubsub:error");const c=e=>{try{return Boolean(u(e))}catch(t){return!1}},u=e=>{if(!e._ipns||!e._options.EXPERIMENTAL.ipnsPubsub)throw i(new Error("IPNS pubsub subsystem is not enabled"),"ERR_IPNS_PUBSUB_NOT_ENABLED");if(o.isIpnsPubsubDatastore(e._ipns.routing))return e._ipns.routing;const t=(e._ipns.routing.stores||[]).find(e=>o.isIpnsPubsubDatastore(e));if(!t)throw i(new Error("IPNS pubsub datastore not found"),"ERR_PUBSUB_DATASTORE_NOT_FOUND");return t};e.exports=function(e){return{state:s(async()=>({enabled:c(e)})),cancel:s(async t=>{const r=u(e);return r.cancel(t)}),subs:s(async()=>{const t=u(e);return t.getSubscriptions()})}}},3276:function(e,t,r){"use strict";e.exports="\n// topicCID = cid(merkledag_protobuf(topicDescriptor)); (not the topic.name)\nmessage TopicDescriptor {\n optional string name = 1;\n optional AuthOpts auth = 2;\n optional EncOpts enc = 2;\n\n message AuthOpts {\n optional AuthMode mode = 1;\n repeated bytes keys = 2; // root keys to trust\n\n enum AuthMode {\n NONE = 0; // no authentication, anyone can publish\n KEY = 1; // only messages signed by keys in the topic descriptor are accepted\n WOT = 2; // web of trust, certificates can allow publisher set to grow\n }\n }\n\n message EncOpts {\n optional EncMode mode = 1;\n repeated bytes keyHashes = 2; // the hashes of the shared keys used (salted)\n\n enum EncMode {\n NONE = 0; // no encryption, anyone can read\n SHAREDKEY = 1; // messages are encrypted with shared key\n WOT = 2; // web of trust, certificates can allow publisher set to grow\n }\n }\n}"},"32c0":function(e,t){function r(){var e,t=new Promise((function(t,r){e=function(e,n){e?r(e):t(n)}}));return e.promise=t,e}e.exports=r},"334b":function(e,t,r){"use strict";(function(n){const i=r("c449"),s=r("f654"),o=r("ec12"),a=r("41fe");class c{constructor(e,t,r){s(r,"A link requires a cid to point to"),this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new i(r),a.hidePrivateFields(this),a.addEnumerableGetters(this,["Hash","Name","Tsize"])}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.Name}", size: ${this.Tsize}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=n.from(this._name),this._nameBuf)}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}}t=e.exports=o(c,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"}),t.util=r("1cd4")}).call(this,r("b639").Buffer)},3387:function(e,t,r){var n=r("7a03"),i="__lodash_hash_undefined__",s=Object.prototype,o=s.hasOwnProperty;function a(e){var t=this.__data__;if(n){var r=t[e];return r===i?void 0:r}return o.call(t,e)?t[e]:void 0}e.exports=a},"33ae":function(e,t,r){"use strict";const n=r("73b5"),i=r("c591"),s=r("4bc2"),o=r("0b0f"),a=r("449a"),c=r("50b0"),u=s("pull-plex");function l(e,t){const r=new a(!t),s=n();i(e,r,s,e);const o=new c(e,r);return o.once("error",e=>{u.err("got error",e),s.abort(e)}),o.on("close",()=>{u("closing muxer"),s.abort()}),o}u.err=s("pull-plex:err"),t=e.exports=l,t.pullMplex=a,t.multicodec=o,t.dialer=e=>l(e,!1),t.listener=e=>l(e,!0)},"33b3":function(e,t,r){"use strict";function n(e){return e}var i=r("64f1"),s=r("90de");e.exports=function(e,t){var r=!1;return t?e=i(e)||n:(t=e,e=n),s((function(n){if(e(n))return r=!0,t(null,n),!1}),(function(e){r||t(!0===e?null:e,null)}))}},"33d8":function(e,t,r){"use strict";e.exports={}},"33fc":function(e,t,r){"use strict";e.exports=function e(t){var r=arguments.length;if("function"===typeof t&&1===t.length){for(var n=new Array(r),i=0;ii[r?e[r]:e]=!0;e.forEach(s);var o=(e,t)=>{var s=void 0!==i[r?t[r]:t],o=void 0!==n[r?t[r]:t];return s||o||(e.push(t),n[r?t[r]:t]=!0),e};return t.reduce(o,[])}e.exports=n},"34c0":function(e,t,r){var n=r("1514");e.exports=function(e,t,r){var i=-1,s=[],o=r?t.length:0;while((i=n(e,t))>-1)s.push(e.slice(0,i+o)),e=e.slice(i+t.length,e.length);return s.push(e),s}},"34eb":function(e,t,r){(function(n){function i(){return!("undefined"===typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"===typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)}function o(...e){return"object"===typeof console&&console.log&&console.log(...e)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}}function c(){let e;try{e=t.storage.getItem("debug")}catch(r){}return!e&&"undefined"!==typeof n&&"env"in n&&(e=Object({NODE_ENV:"production",BASE_URL:"/"}).DEBUG),e}function u(){try{return localStorage}catch(e){}}t.log=o,t.formatArgs=s,t.save=a,t.load=c,t.useColors=i,t.storage=u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r("dc90")(t);const{formatters:l}=e.exports;l.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r("4362"))},3524:function(e,t,r){var{relative:n}=r("e2a8"),i={http:"ws",https:"wss"},s="ws";e.exports=function(e,t){return n(e,t,i,s)}},"354e":function(e,t,r){"use strict";(function(e){const n=r("0774"),i=r("479a");t.names=i.names,t.codes=i.codes,t.defaultLengths=i.defaultLengths;const s=r("2612");function o(e){t.decode(e)}t.toHexString=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return t.toString("hex")},t.fromHexString=function(t){return e.from(t,"hex")},t.toB58String=function(t){if(!e.isBuffer(t))throw new Error("must be passed a buffer");return n.encode(t)},t.fromB58String=function(t){let r=t;return e.isBuffer(t)&&(r=t.toString()),e.from(n.decode(r))},t.decode=function(r){if(!e.isBuffer(r))throw new Error("multihash must be a Buffer");if(r.length<3)throw new Error("multihash too short. must be > 3 bytes.");const n=s.decode(r);if(!t.isValidCode(n))throw new Error(`multihash unknown function code: 0x${n.toString(16)}`);r=r.slice(s.decode.bytes);const o=s.decode(r);if(o<1)throw new Error(`multihash invalid length: 0x${o.toString(16)}`);if(r=r.slice(s.decode.bytes),r.length!==o)throw new Error(`multihash length inconsistent: 0x${r.toString("hex")}`);return{code:n,name:i.codes[n],length:o,digest:r}},t.encode=function(r,n,i){if(!r||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");const o=t.coerceCode(n);if(!e.isBuffer(r))throw new Error("digest should be a Buffer");if(null==i&&(i=r.length),i&&r.length!==i)throw new Error("digest length should be equal to specified length.");return e.concat([e.from(s.encode(o)),e.from(s.encode(i)),r])},t.coerceCode=function(e){let r=e;if("string"===typeof e){if(void 0===i.names[e])throw new Error(`Unrecognized hash function named: ${e}`);r=i.names[e]}if("number"!==typeof r)throw new Error(`Hash function code should be a number. Got: ${r}`);if(void 0===i.codes[r]&&!t.isAppCode(r))throw new Error(`Unrecognized function code: ${r}`);return r},t.isAppCode=function(e){return e>0&&e<16},t.isValidCode=function(e){return!!t.isAppCode(e)||!!i.codes[e]},t.validate=o,t.prefix=function(e){return o(e),e.slice(0,2)}}).call(this,r("b639").Buffer)},3554:function(e,t,r){"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.getPrototypeOf({})}},3580:function(e,t,r){"use strict";const n=r("fb92").Key,i=r("fb92").Errors,s=r("fb92").utils,o=s.filter,a=s.take,c=s.sortAll,u=s.replaceStartWith,l=r("6429");class h{constructor(e){this.mounts=e.slice()}open(){return Promise.all(this.mounts.map(e=>e.datastore.open()))}_lookup(e){for(let t of this.mounts)if(t.prefix.toString()===e.toString()||t.prefix.isAncestorOf(e)){const r=u(e.toString(),t.prefix.toString());return{datastore:t.datastore,mountpoint:t.prefix,rest:new n(r)}}}put(e,t){const r=this._lookup(e);if(null==r)throw i.dbWriteFailedError(new Error("No datastore mounted for this key"));return r.datastore.put(r.rest,t)}get(e){const t=this._lookup(e);if(null==t)throw i.notFoundError(new Error("No datastore mounted for this key"));return t.datastore.get(t.rest)}has(e){const t=this._lookup(e);return null!=t&&t.datastore.has(t.rest)}delete(e){const t=this._lookup(e);if(null==t)throw i.dbDeleteFailedError(new Error("No datastore mounted for this key"));return t.datastore.delete(t.rest)}close(){return Promise.all(this.mounts.map(e=>e.datastore.close()))}batch(){const e={},t=t=>{const r=this._lookup(t);if(null==r)throw new Error("No datastore mounted for this key");const n=r.mountpoint.toString();return null==e[n]&&(e[n]=r.datastore.batch()),{batch:e[n],rest:r.rest}};return{put:(e,r)=>{const n=t(e);n.batch.put(n.rest,r)},delete:e=>{const r=t(e);r.batch.delete(r.rest)},commit:()=>Promise.all(Object.keys(e).map(t=>e[t].commit()))}}query(e){const t=this.mounts.map(t=>{const r=new l(t.datastore,{convert:e=>{throw new Error("should never be called")},invert:e=>t.prefix.child(e)});let n;return null!=e.prefix&&(n=u(e.prefix,t.prefix.toString())),r.query({prefix:n,filters:e.filters,keysOnly:e.keysOnly})});let r=f(t);if(e.filters&&e.filters.forEach(e=>{r=o(r,e)}),e.orders&&e.orders.forEach(e=>{r=c(r,e)}),null!=e.offset){let t=0;r=o(r,()=>t++>=e.offset)}return null!=e.limit&&(r=a(r,e.limit)),r}}function f(e){return async function*(){let t=e.map(()=>!1);while(!t.every(Boolean))for(const[r,n]of e.entries()){const e=await n.next();e.done?t[r]=!0:yield e.value}}()}e.exports=h},"363c":function(e,t,r){"use strict";const n=r("80f8");e.exports=function(e){return function(t,r){return n.readable(async function*(){for await(const i of e._getAsyncIterator(t,r))i.content&&(i.content=n.readable(i.content())),yield i}(),{objectMode:!0})}}},3676:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var n=r("c1cd"),i=a(n),s=r("76bf"),o=a(s);function a(e){return e&&e.__esModule?e:{default:e}}function c(e,t,r,n){n=n||i.default,t=t||[];var s=[],a=0,c=(0,o.default)(r);e(t,(function(e,t,r){var n=a++;c(e,(function(e,t){s[n]=t,r(e)}))}),(function(e){n(e,s)}))}e.exports=t["default"]},"36a2":function(e,t,r){"use strict";(function(t){const n=r("b1aa"),i=r("4bb2"),s=r("09a4"),o=r("fa4d"),a=r("708c"),c=r("a818"),{DAGNode:u}=r("c75d"),l=r("2091e"),h=r("0c9a"),f=r("467e"),d=r("20ba"),p=r(15),{profiles:y}=r("94f7");function g(e,r){return r.privateKey?(e.log("using user-supplied private-key"),"object"===typeof r.privateKey?r.privateKey:o(n.createFromPrivKey)(t.from(r.privateKey,"base64"))):(r.log(`generating ${r.bits}-bit RSA keypair...`,!1),e.log("generating peer id: %s bits",r.bits),o(n.create)({bits:r.bits}))}async function m(e,t){if("uninitialized"!==e.state.state())throw new Error("Not able to init from state: "+e.state.state());if(e.state.init(),e.log("init"),t.repo)return void(e._repo=t.repo);t.emptyRepo=t.emptyRepo||!1,t.bits=Number(t.bits)||2048,t.log=t.log||function(){};const r=i(a(),e._options.config);v(e,r,t);const n=await e._repo.exists();if(e.log("repo exists?",n),!0===n)throw Error("repo already exists");const s=await g(e,t);e.log("identity generated"),r.Identity={PeerID:s.toB58String(),PrivKey:s.privKey.bytes.toString("base64")};const o=s.privKey;if(t.pass&&(r.Keychain=c.generateOptions()),t.log("done"),t.log("peer identity: "+r.Identity.PeerID),await e._repo.init(r),await e._repo.open(),e.log("repo opened"),t.pass){e.log("creating keychain");const n=Object.assign({passPhrase:t.pass},r.Keychain);e._keychain=new c(e._repo.keys,n),await e._keychain.importPeer("self",{privKey:o})}const u=new d(e._repo);return e._ipns=new f(u,e._repo.datastore,e._peerInfo,e._keychain,e._options),b(e,o,t)}async function b(e,t,r){if(r.emptyRepo)return;e.log("adding assets");const n=new u(new l("directory").marshal()),i=await e.dag.put(n,{version:0,format:h.DAG_PB,hashAlg:h.SHA2_256,preload:!1});return await e._ipns.initializeKeyspace(t,i.toBaseEncodedString()),e.log("Initialised keyspace"),"function"===typeof p?(e.log("Adding default assets"),p(e,r.log)):void 0}function v(e,t,r){if(r.profiles)for(const n of r.profiles){const r=y[n];if(!r)throw new Error(`Could not find profile with name '${n}'`);e.log(`applying profile ${n}`),r.transform(t)}}e.exports=function(e){return s.variadic(async t=>{t=t||{},await m(e,t),e.log("Created repo"),await e.preStart(),e.log("Done pre-start"),e.state.initialized(),e.emit("init")})}}).call(this,r("b639").Buffer)},"36c6":function(e,t,r){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}r("3410"),r("131a"),e.exports=n},3709:function(e,t,r){(function(t){function r(e){if("object"!==typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}r.prototype.next=function(e){var r=this;if("function"!==typeof e)throw new Error("next() requires a callback argument");return r._ended?(t.nextTick(e,new Error("cannot call next() after end()")),r):r._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),r):(r._nexting=!0,r._next((function(){r._nexting=!1,e.apply(null,arguments)})),r)},r.prototype._next=function(e){t.nextTick(e)},r.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},r.prototype._seek=function(e){},r.prototype.end=function(e){if("function"!==typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},r.prototype._end=function(e){t.nextTick(e)},e.exports=r}).call(this,r("4362"))},"371e":function(e,t,r){"use strict";var n=r("4ea4"),i=n(r("a34a")),s=n(r("c973")),o=r("aaed"),a=o.fetchText,c=o.getMessageConsent,u=r("a886"),l=r("288a"),h=l.verifyMessage,f=r("b3ec"),d=r("aaed"),p=r("972c");r("b37b")["default"](),r("0397")();var y=f.profile_server_url,g=function(e){return{dag:{get:function(){var t=(0,s["default"])(i["default"].mark((function t(r){var n;return i["default"].wrap((function(t){while(1)switch(t.prev=t.next){case 0:return n="".concat(e,"/did-doc?cid=").concat(encodeURIComponent(r)),t.abrupt("return",d.fetchJson(n));case 2:case"end":return t.stop()}}),t)})));function r(e){return t.apply(this,arguments)}return r}()}}};p(g(y),{pin:!1}),e.exports={verifyGithub:function(){var e=(0,s["default"])(i["default"].mark((function e(t,r){var n,s,o,c;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n="string"===typeof t?[t]:t,r&&""!==r.trim()){e.next=3;break}return e.abrupt("return",null);case 3:return e.next=5,a(r);case 5:if(s=e.sent,o=n.reduce((function(e,t){return e||-1!==s.indexOf(t)}),!1),o){e.next=9;break}throw new Error("Gist File provided does not contain the correct DID of the user");case 9:return c=r.split("/")[3],e.abrupt("return",{username:c,proof:r});case 11:case"end":return e.stop()}}),e)})));function t(t,r){return e.apply(this,arguments)}return t}(),verifyTwitter:function(){var e=(0,s["default"])(i["default"].mark((function e(t,r){var n,s,o;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n="string"===typeof t?[t]:t,r){e.next=3;break}return e.abrupt("return",null);case 3:return e.next=5,u.verifyJWT(r);case 5:if(s=e.sent,n.includes(s.payload.sub)){e.next=8;break}throw new Error("Verification not valid for given user");case 8:if(o=s.payload.claim,o.twitter_handle&&o.twitter_proof){e.next=11;break}throw new Error("The claim for your twitter is not correct");case 11:return e.abrupt("return",{username:o.twitter_handle,proof:o.twitter_proof,verifiedBy:s.payload.iss});case 12:case"end":return e.stop()}}),e)})));function t(t,r){return e.apply(this,arguments)}return t}(),verifyEmail:function(){var e=(0,s["default"])(i["default"].mark((function e(t,r){var n,s,o;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n="string"===typeof t?[t]:t,r){e.next=3;break}return e.abrupt("return",null);case 3:return e.next=5,u.verifyJWT(r);case 5:if(s=e.sent,n.includes(s.payload.sub)){e.next=8;break}throw new Error("Verification not valid for given user");case 8:if(o=s.payload.claim,o.email_address){e.next=11;break}throw new Error("The claim for your email address is not correct");case 11:return e.abrupt("return",{email_address:o.email_address,verifiedBy:s.payload.iss});case 12:case"end":return e.stop()}}),e)})));function t(t,r){return e.apply(this,arguments)}return t}(),verifyDID:function(){var e=(0,s["default"])(i["default"].mark((function e(t){var r,n,s,o;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,u.verifyJWT(t);case 2:if(r=e.sent,n=r.payload.muport,s={},!n){e.next=10;break}return e.next=8,u.verifyJWT(n);case 8:o=e.sent.payload.iss,s.muport=o;case 10:return s.did=r.payload.iss,e.abrupt("return",s);case 12:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}(),verifyEthereum:function(){var e=(0,s["default"])(i["default"].mark((function e(t,r){var n,s,o;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if("string"===typeof r?[r]:r,n=t.version?t.message:t["consent_msg"],s=t.version?t.signature:t["consent_signature"],o=c(r),n===o){e.next=6;break}throw new Error('Invalid consent message, got: "'.concat(n,'", expected: "').concat(o,'"'));case 6:return e.abrupt("return",h(n,s));case 7:case"end":return e.stop()}}),e)})));function t(t,r){return e.apply(this,arguments)}return t}()}},"3768b":function(e,t,r){"use strict";const n=r("87c4"),i=r("980c2"),s=r("79ea"),o=r("d8ac");t.Key=n,t.MemoryDatastore=i,t.utils=s,t.Errors=o},3798:function(e,t,r){var n=r("918b");r("5ee0");var i=e.exports=n.pem=n.pem||{};function s(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(o=i);return t}function o(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},i+=s(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},i+=s(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=s(r)),e.headers)for(var o=0;oasync t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError(`${e} is not a supported algorithm`)}};e.exports={sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r("ae8a")}},"37c4":function(e,t,r){"use strict";(function(t){const n=r("276f"),i=r("1e83"),s=r("9efb");function o(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw w("invalid address: "+e);if(o.path){t.push([s,v(r.slice(n).join("/"))]);break}t.push([s,r[n]])}else t.push([s])}return t}function a(e){const t=[];return e.map(e=>{const r=_(e);t.push(r.name),e.length>1&&t.push(e[1])}),v(t.join("/"))}function c(e){return e.map(e=>{Array.isArray(e)||(e=[e]);const t=_(e);return e.length>1?[t.code,n.toBuffer(t.code,e[1])]:[t.code]})}function u(e){return e.map(e=>{const t=_(e);return e.length>1?[t.code,n.toString(t.code,e[1])]:[t.code]})}function l(e){return g(t.concat(e.map(e=>{const r=_(e);let n=t.from(s.encode(r.code));return e.length>1&&(n=t.concat([n,e[1]])),n})))}function h(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=s.decode(t);return e+s.decode.bytes}}function f(e){const t=[];let r=0;while(re.length)throw w("Invalid address buffer: "+e.toString("hex"));t.push([n,u])}return t}function d(e){const t=f(e),r=u(t);return a(r)}function p(e){e=v(e);const t=o(e),r=c(t);return l(r)}function y(e){return p(e)}function g(e){const r=m(e);if(r)throw r;return t.from(e)}function m(e){try{f(e)}catch(t){return t}}function b(e){return void 0===m(e)}function v(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function w(e){return new Error("Error parsing address: "+e)}function _(e){const t=i(e[0]);return t}e.exports={stringToStringTuples:o,stringTuplesToString:a,tuplesToStringTuples:u,stringTuplesToTuples:c,bufferToTuples:f,tuplesToBuffer:l,bufferToString:d,stringToBuffer:p,fromString:y,fromBuffer:g,validateBuffer:m,isValidBuffer:b,cleanPath:v,ParseError:w,protoFromTuple:_,sizeForAddr:h}}).call(this,r("b639").Buffer)},"37dd":function(e,t,r){"use strict";const n=(e,t)=>0;e.exports=n},3814:function(e,t,r){(function(t){var n=r("918b");r("5ee0");var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(5));var s=e.exports=n.prng=n.prng||{};s.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,s=new Array(32),o=0;o<32;++o)s[o]=r.create();function a(e){if(t.pools[0].messageLength>=32)return u(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),u(),e()}))}function c(){if(t.pools[0].messageLength>=32)return u();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),u()}function u(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r===0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function l(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var s=n.util.createBuffer();if(t)while(s.length()>16),l+=(32767&u)<<16,l+=u>>15,l=(2147483647&l)+(l>>31),f=4294967295&l;for(c=0;c<3;++c)h=f>>>(c<<3),h^=Math.floor(256*Math.random()),s.putByte(String.fromCharCode(255&h))}}return s.getBytes(e)}return t.pools=s,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,s=t.plugin.increment,o=t.plugin.formatKey,c=t.plugin.formatSeed,u=n.util.createBuffer();function l(h){if(h)return r(h);if(u.length()>=e)return r(null,u.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return n.util.nextTick((function(){a(l)}));var f=i(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=o(i(t.key,s(t.seed))),t.seed=c(i(t.key,t.seed)),n.util.setImmediate(l)}t.key=null,l()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;var a=n.util.createBuffer();while(a.length()1048575&&(t.key=null),null===t.key&&c();var u=r(t.key,t.seed);t.generated+=u.length,a.putBytes(u),t.key=s(r(t.key,i(t.seed))),t.seed=o(r(t.key,t.seed))}return a.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(r){t(r)}},t.seedFileSync=l),t.collect=function(e){for(var r=e.length,n=0;n>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var r=function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))};e.addEventListener("message",r)}},t}}).call(this,r("4362"))},3846:function(e,t,r){"use strict";e.exports={pk:r("fc86")}},3849:function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("ec4e"),s=45569,o=45633,a={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},c={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},u=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}},3866:function(e,t,r){"use strict";const n=r("33fc"),i=r("f1fd"),s=r("f2a1"),o=r("d260"),a=r("4bc2")("ipfs:gc:lock");class c{constructor(e,t){t=t||{},this.mutex=new o(e,{...t,log:a})}readLock(){return this.mutex.readLock()}writeLock(){return this.mutex.writeLock()}pullReadLock(e){return this.pullLock("readLock",e)}pullWriteLock(e){return this.pullLock("writeLock",e)}pullLock(e,t){const r=new u(this.mutex,e);return n(r.take(),t(),r.release())}}class u{constructor(e,t){this.mutex=e,this.type=t,this.releaseLock=null}take(){return s((e,t)=>{if(this.releaseLock)return t(null,e);this.mutex[this.type]().then(r=>{this.releaseLock=r,t(null,e)},t)})}release(){return i(null,e=>{this.releaseLock(e)})}}e.exports=c},3897:function(e,t,r){var n=r("1789")("socket.io-parser"),i=r("6a63"),s=r("8183"),o=r("4398"),a=r("4720");function c(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=c,t.Decoder=d;var u=t.ERROR+'"encode error"';function l(e){var r=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(r+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(r+=e.nsp+","),null!=e.id&&(r+=e.id),null!=e.data){var i=h(e.data);if(!1===i)return u;r+=i}return n("encoded %j as %s",e,r),r}function h(e){try{return JSON.stringify(e)}catch(t){return!1}}function f(e,t){function r(e){var r=s.deconstructPacket(e),n=l(r.packet),i=r.buffers;i.unshift(n),t(i)}s.removeBlobs(e,r)}function d(){this.reconstructor=null}function p(e){var r=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return m("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){var s="";while("-"!==e.charAt(++r))if(s+=e.charAt(r),r==e.length)break;if(s!=Number(s)||"-"!==e.charAt(r))throw new Error("Illegal attachments");i.attachments=Number(s)}if("/"===e.charAt(r+1)){i.nsp="";while(++r){var a=e.charAt(r);if(","===a)break;if(i.nsp+=a,r===e.length)break}}else i.nsp="/";var c=e.charAt(r+1);if(""!==c&&Number(c)==c){i.id="";while(++r){a=e.charAt(r);if(null==a||Number(a)!=a){--r;break}if(i.id+=e.charAt(r),r===e.length)break}i.id=Number(i.id)}if(e.charAt(++r)){var u=y(e.substr(r)),l=!1!==u&&(i.type===t.ERROR||o(u));if(!l)return m("invalid payload");i.data=u}return n("decoded %s as %j",e,i),i}function y(e){try{return JSON.parse(e)}catch(t){return!1}}function g(e){this.reconPack=e,this.buffers=[]}function m(e){return{type:t.ERROR,data:"parser error: "+e}}c.prototype.encode=function(e,r){if(n("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)f(e,r);else{var i=l(e);r([i])}},i(d.prototype),d.prototype.add=function(e){var r;if("string"===typeof e)r=p(e),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type?(this.reconstructor=new g(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!a(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,this.emit("decoded",r))}},d.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},g.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},g.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},"38d4":function(e,t){try{e.exports="undefined"!==typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(r){e.exports=!1}},3902:function(e,t,r){"use strict";const n=r("5575"),i=r("e3d5"),{DAGNode:s}=r("c75d"),{normalizePath:o}=r("861c"),{Format:a}=r("12dd"),{Errors:c}=r("7b6d"),u=c.notFoundError().code;function l(e,t,r){const i=o(t),s=i.split("/"),a=s[0];if(!n.cid(a))throw new Error(`Error resolving path '${i}': '${a}' is not a valid CID`);return!1!==r.preload&&e._preload(a),"/ipfs/"+i}async function*h(e,t,r){const n=await e.resolve(t),i=n.split("/"),s=i[2];for await(const o of d(e,s,r.maxDepth,r.unique))o.parent&&(o.isDuplicate||(yield{ref:f(o.parent.cid,o.node.cid,o.node.name,r.format)}))}function f(e,t,r,n){let i=n.replace(//g,e.toString());return i=i.replace(//g,t.toString()),i=i.replace(//g,r),i}async function*d(e,t,r,n){const i=new Set;async function*s(t,o){const a=o+1;if(!(a>r))try{for(const r of await p(e,t.cid))yield{parent:t,node:r,isDuplicate:n&&i.has(r.cid.toString())},n&&i.add(r.cid.toString()),yield*s(r,a)}catch(c){throw c.code===u&&(c.message=`Could not find object with CID: ${t.cid}`),c}}yield*s({cid:t},0)}async function p(e,t){const r=await e._ipld.get(new i(t));return s.isDAGNode(r)?r.Links.map(({Name:e,Hash:t})=>({name:e,cid:new i(t)})):y(r)}function y(e,t=""){let r=[];for(const[n,s]of Object.entries(e))i.isCID(s)?r.push({name:t+n,cid:s}):"object"===typeof s&&(r=r.concat(y(s,t+n+"/")));return r}e.exports=function(e){return async function*(t,r){if(r=r||{},0===r.maxDepth)return;if(r.edges&&r.format&&r.format!==a.default)throw new Error("Cannot set edges to true and also specify format");r.format=r.edges?a.edges:r.format||a.default,"number"!==typeof r.maxDepth&&(r.maxDepth=r.recursive?1/0:1);const n=Array.isArray(t)?t:[t],i=n.map(t=>l(e,t,r));for(const s of i)yield*h(e,s,r)}}},3909:function(e,t,r){"use strict";const n=r("0b54"),i=async(e,t,r)=>n(new Array(e).fill(),(e,r)=>t(r),r);e.exports=i,e.exports.default=i},3958:function(e,t,r){"use strict";const n=r("f106"),i='\nmessage IpnsEntry {\n enum ValidityType {\n\t\tEOL = 0; // setting an EOL says "this record is valid until..."\n\t}\n\n required bytes value = 1;\n\trequired bytes signature = 2;\n\n\toptional ValidityType validityType = 3;\n\toptional bytes validity = 4;\n\n\toptional uint64 sequence = 5;\n\n\toptional uint64 ttl = 6;\n\n\t// in order for nodes to properly validate a record upon receipt, they need the public\n\t// key associated with it. For old RSA keys, its easiest if we just send this as part of\n\t// the record itself. For newer ed25519 keys, the public key can be embedded in the\n\t// peerID, making this field unnecessary.\n\toptional bytes pubKey = 7;\n}\n';e.exports=n(i).IpnsEntry},"39cd":function(e,t,r){var n=r("e0c5").Buffer,i=r("ff48");function s(e,t,r){var s=t.length,o=i(t,e._cache);return e._cache=e._cache.slice(s),e._prev=n.concat([e._prev,r?t:o]),o}t.encrypt=function(e,t,r){var i,o=n.allocUnsafe(0);while(t.length){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=n.allocUnsafe(0)),!(e._cache.length<=t.length)){o=n.concat([o,s(e,t,r)]);break}i=e._cache.length,o=n.concat([o,s(e,t.slice(0,i),r)]),t=t.slice(i)}return o}},"3a17":function(e,t,r){"use strict";var n=r("399f"),i=r("549e"),s=r("ffb2");const o="bignumber/5.0.0-beta.135",a=new s["Logger"](o),c={},u=9007199254740991;class l{constructor(e,t){a.checkNew(new.target,l),e!==c&&a.throwError("cannot call consturtor directly; use BigNumber.from",s["Logger"].errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return f(d(this).fromTwos(e))}toTwos(e){return f(d(this).toTwos(e))}abs(){return"-"===this._hex[0]?l.from(this._hex.substring(1)):this}add(e){return f(d(this).add(d(e)))}sub(e){return f(d(this).sub(d(e)))}div(e){const t=l.from(e);return t.isZero()&&p("division by zero","div"),f(d(this).div(d(e)))}mul(e){return f(d(this).mul(d(e)))}mod(e){return f(d(this).mod(d(e)))}pow(e){return f(d(this).pow(d(e)))}maskn(e){return f(d(this).maskn(e))}eq(e){return d(this).eq(d(e))}lt(e){return d(this).lt(d(e))}lte(e){return d(this).lte(d(e))}gt(e){return d(this).gt(d(e))}gte(e){return d(this).gte(d(e))}isZero(){return d(this).isZero()}toNumber(){try{return d(this).toNumber()}catch(e){p("overflow","toNumber",this.toString())}return null}toString(){return 0!==arguments.length&&a.throwError("bigNumber.toString does not accept parameters",s["Logger"].errors.UNEXPECTED_ARGUMENT,{}),d(this).toString(10)}toHexString(){return this._hex}static from(e){return e instanceof l?e:"string"===typeof e?e.match(/-?0x[0-9a-f]+/i)?new l(c,h(e)):e.match(/^-?[0-9]+$/)?new l(c,h(new n["BN"](e))):a.throwArgumentError("invalid BigNumber string","value",e):"number"===typeof e?(e%1&&p("underflow","BigNumber.from",e),(e>=u||e<=-u)&&p("overflow","BigNumber.from",e),l.from(String(e))):"bigint"===typeof e?l.from(e.toString()):Object(i["isBytes"])(e)?l.from(Object(i["hexlify"])(e)):e._hex&&Object(i["isHexString"])(e._hex)?l.from(e._hex):e.toHexString&&(e=e.toHexString(),"string"===typeof e)?l.from(e):a.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function h(e){if("string"!==typeof e)return h(e.toString(16));if("-"===e[0])return e=e.substring(1),"-"===e[0]&&a.throwArgumentError("invalid hex","value",e),e=h(e),"0x00"===e?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";e.length%2&&(e="0x0"+e.substring(2));while(e.length>4&&"0x00"===e.substring(0,4))e="0x"+e.substring(4);return e}function f(e){return l.from(h(e))}function d(e){const t=l.from(e).toHexString();return"-"===t[0]?new n["BN"]("-"+t.substring(3),16):new n["BN"](t.substring(2),16)}function p(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),a.throwError(e,s["Logger"].errors.NUMERIC_FAULT,n)}new s["Logger"](o),l.from(0),l.from(-1);let y="0";while(y.length<256)y+=y;r.d(t,"a",(function(){return l}))},"3a70":function(e,t,r){var n=r("5995");r("31a0");var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],s=[1,2,3,5],o=function(e,t){return e<>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"===typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&u]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,u,l,h=!1,f=null,d=null,p=null,y=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(i=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=o(e[u],s[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(i=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],s[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var n=f.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var i=0;i=8)g([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var n=8===f.length()?8:8-f.length();f.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===f.length(),t))if(e)t=e(8,d,!r);else{var i=d.length(),s=d.at(i-1);s>i?t=!1:d.truncate(s)}return t}},m};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},"3a7b":function(e,t,r){for(var n=r("e2ec"),i=[],s={},o=0;o<256;o++)i[o]=(o+256).toString(16).substr(1),s[i[o]]=o;function a(e,t,r){var n=t&&r||0,i=0;t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,(function(e){i<16&&(t[n+i++]=s[e])}));while(i<16)t[n+i++]=0;return t}function c(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}var u=n(),l=[1|u[0],u[1],u[2],u[3],u[4],u[5]],h=16383&(u[6]<<8|u[7]),f=0,d=0;function p(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var s=void 0!==e.clockseq?e.clockseq:h,o=void 0!==e.msecs?e.msecs:(new Date).getTime(),a=void 0!==e.nsecs?e.nsecs:d+1,u=o-f+(a-d)/1e4;if(u<0&&void 0===e.clockseq&&(s=s+1&16383),(u<0||o>f)&&void 0===e.nsecs&&(a=0),a>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=o,d=a,h=s,o+=122192928e5;var p=(1e4*(268435455&o)+a)%4294967296;i[n++]=p>>>24&255,i[n++]=p>>>16&255,i[n++]=p>>>8&255,i[n++]=255&p;var y=o/4294967296*1e4&268435455;i[n++]=y>>>8&255,i[n++]=255&y,i[n++]=y>>>24&15|16,i[n++]=y>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var g=e.node||l,m=0;m<6;m++)i[n+m]=g[m];return t||c(i)}function y(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||n)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var o=0;o<16;o++)t[i+o]=s[o];return t||c(s)}var g=y;g.v1=p,g.v4=y,g.parse=a,g.unparse=c,e.exports=g},"3a90":function(e,t,r){"use strict";const n=r("239c"),i=r("c044"),s=r("4bc2"),o=r("fa4d"),a=r("8945"),c=s("libp2p:dht:peer-queue");class u{static async fromPeerId(e){const t=await o(t=>a.convertPeerId(e,t))();return new u(t)}static async fromKey(e){const t=await o(t=>a.convertBuffer(e,t))();return new u(t)}constructor(e){c("create: %b",e),this.from=e,this.heap=new n(a.xorCompare)}async enqueue(e){c("enqueue %s",e.toB58String());const t=await o(t=>a.convertPeerId(e,t))(),r={id:e,distance:i(this.from,t)};this.heap.push(r)}dequeue(){const e=this.heap.pop();return c("dequeue %s",e.id.toB58String()),e.id}get length(){return this.heap.size()}}e.exports=u},"3a9a":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=self.crypto||self.msCrypto;e.exports=e=>{if("undefined"===typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return async t=>{switch(e){case"sha1":return n.from(await i.subtle.digest({name:"SHA-1"},t));case"sha2-256":return n.from(await i.subtle.digest({name:"SHA-256"},t));case"sha2-512":return n.from(await i.subtle.digest({name:"SHA-512"},t));case"dbl-sha2-256":{const e=await i.subtle.digest({name:"SHA-256"},t);return n.from(await i.subtle.digest({name:"SHA-256"},e))}default:throw new Error(`${e} is not a supported algorithm`)}}}},"3b1c":function(e,t,r){"use strict";var n=r("399f"),i=r("549e"),s=r("3a17"),o=r("6f5a"),a=r("e165"),c=r("ffb2");const u="address/5.0.0-beta.134";r.d(t,"a",(function(){return m})),r.d(t,"b",(function(){return b}));const l=new c["Logger"](u);function h(e){Object(i["isHexString"])(e,20)||l.throwArgumentError("invalid address","address",e),e=e.toLowerCase();const t=e.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=t[i].charCodeAt(0);const n=Object(i["arrayify"])(Object(o["a"])(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(15&n[i>>1])>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}const f=9007199254740991;function d(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const p={};for(let v=0;v<10;v++)p[String(v)]=String(v);for(let v=0;v<26;v++)p[String.fromCharCode(65+v)]=String(10+v);const y=Math.floor(d(f));function g(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let t=e.split("").map(e=>p[e]).join("");while(t.length>=y){let e=t.substring(0,y);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);while(r.length<2)r="0"+r;return r}function m(e){let t=null;if("string"!==typeof e&&l.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=h(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&l.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){e.substring(2,4)!==g(e)&&l.throwArgumentError("bad icap checksum","address",e),t=new n["BN"](e.substring(4),36).toString(16);while(t.length<40)t="0"+t;t=h("0x"+t)}else l.throwArgumentError("invalid address","address",e);return t}function b(e){let t=null;try{t=m(e.from)}catch(n){l.throwArgumentError("missing from address","transaction",e)}const r=Object(i["stripZeros"])(Object(i["arrayify"])(s["a"].from(e.nonce).toHexString()));return m(Object(i["hexDataSlice"])(Object(o["a"])(Object(a["b"])([t,r])),12))}},"3b1f":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var n=r("bcdf"),i=h(n),s=r("dea4"),o=h(s),a=r("ac7e"),c=h(a),u=r("691e"),l=h(u);function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r){r=(0,c.default)(r||i.default);var n=(0,l.default)(t);if(!e())return r(null);var s=function(t){if(t)return r(t);if(e())return n(s);var i=(0,o.default)(arguments,1);r.apply(null,[null].concat(i))};n(s)}e.exports=t["default"]},"3b27":function(e,t,r){"use strict";e.exports={repoVersion:7}},"3b66":function(e,t,r){"use strict";const n=r("e3d5"),i=r("0c9a"),s=r("3074");t=e.exports,t.codec=i.DAG_PB,t.defaultHashAlg=i.SHA2_256;const o=async(e,r)=>{const o={cidVersion:1,hashAlg:t.defaultHashAlg},a=Object.assign(o,r),c=await s(e,a.hashAlg),u=i.print[t.codec],l=new n(a.cidVersion,u,c);return l};t.cid=o},"3ba4":function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);function i(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}e.exports=i},"3bd5":function(e,t,r){"use strict";const n=r("33fc"),i=r("03b2"),s=r("5b39"),o=r("4bc2"),a=o("libp2p:secio");a.error=o("libp2p:secio:error");const c=r("e822"),u=r("ab24");e.exports=function(e,t){a("3. finish - start");const r=e.protocols,o=e.shake.rest(),l=s({timeout:e.timeout},e=>{if(e)throw e});n(o,c.createUnboxStream(r.remote.cipher,r.remote.mac),l,c.createBoxStream(r.local.cipher,r.local.mac),o),l.handshake.write(e.proposal.in.rand),l.handshake.read(e.proposal.in.rand.length,(r,n)=>{const s=r=>{a.error(r),e.secure.resolve({source:i(r),sink(e){}}),t(r)};if(r)return s(r);try{u.verifyNonce(e,n)}catch(r){return s(r)}a("3. finish - finish"),e.secure.resolve(l.handshake.rest()),t()})}},"3bd8":function(e,t,r){"use strict";const n={util:r("5ee0"),pki:r("aecb"),jsbn:r("8e82")};function i(e){var t=n.util.decode64((e+"===".slice((e.length+3)%4)).replace(/-/g,"+").replace(/_/g,"/"));return new n.jsbn.BigInteger(n.util.bytesToHex(t),16)}function s(e,t){return t.map(t=>i(e[t]))}function o(e){return n.pki.setRsaPrivateKey(...s(e,["n","e","d","p","q","dp","dq","qi"]))}function a(e){return n.pki.privateKeyToPem(o(e))}function c(e){return n.pki.setRsaPublicKey(...s(e,["n","e"]))}function u(e){return n.pki.publicKeyToPem(c(e))}e.exports={jwk2pub:c,jwk2pubPem:u,jwk2priv:o,jwk2privPem:a}},"3bdc":function(e,t,r){(function(t){var r={};e.exports=r;var n={};function i(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r0)s.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[s[r]];return c}r.encode=function(e,t,r){if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!==typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var s=0,o=t.length,a=t.charAt(0),c=[0];for(s=0;s0)c.push(l%o),l=l/o|0}for(s=0;0===e[s]&&s=0;--s)n+=t[c[s]]}else n=i(e,t);if(r){var h=new RegExp(".{1,"+r+"}","g");n=n.match(h).join("\r\n")}return n},r.decode=function(e,r){if("string"!==typeof e)throw new TypeError('"input" must be a string.');if("string"!==typeof r)throw new TypeError('"alphabet" must be a string.');var i=n[r];if(!i){i=n[r]=[];for(var s=0;s>=8;while(h>0)c.push(255&h),h>>=8}for(var f=0;e[f]===a&&f(e=e||new Error("Cannot open database"),n(e,"ERR_DB_OPEN_FAILED")),e.exports.dbDeleteFailedError=e=>(e=e||new Error("Delete failed"),n(e,"ERR_DB_DELETE_FAILED")),e.exports.dbWriteFailedError=e=>(e=e||new Error("Write failed"),n(e,"ERR_DB_WRITE_FAILED")),e.exports.notFoundError=e=>(e=e||new Error("Not Found"),n(e,"ERR_NOT_FOUND"))},"3bf8":function(e,t,r){"use strict";e.exports=e=>r("8a3f")(e)},"3c0e":function(e,t,r){"use strict";const n=r("daf7");class i{constructor(e){this.partner=e,this.wantlist=new n,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=(new Date).getTime(),this.accounting.bytesRecv+=e}wants(e,t){this.wantlist.add(e,t)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.contains(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}}e.exports=i},"3c1a":function(e,t,r){e.exports=r.p+"img/lock.7aee2123.svg"},"3c1c":function(module,exports,__webpack_require__){"use strict";const fs="object"===typeof window||"object"===typeof self?null:eval('require("fs")'),level=__webpack_require__("cf59"),crypto=__webpack_require__("ff5f"),secp256k1=__webpack_require__("2330"),LRU=__webpack_require__("4128"),Buffer=__webpack_require__("8707").Buffer,{verifier:verifier}=__webpack_require__("720a");function createStore(e="./keystore"){return fs&&fs.mkdirSync&&fs.mkdirSync(e,{recursive:!0}),level(e)}const verifiedCache=new LRU(1e3);class Keystore{constructor(e={}){"string"===typeof e?this._store=createStore(e):"function"===typeof e.open?this._store=e:"string"===typeof e.store?this._store=createStore(e.store):this._store=e.store||createStore(),this._cache=e.cache||new LRU(100)}async open(){return this._store?(await this._store.open(),Promise.resolve()):Promise.reject(new Error("Keystore: No store found to open"))}async close(){this._store&&await this._store.close()}async hasKey(e){if(!e)throw new Error("id needed to check a key");if(this._store.status&&"open"!==this._store.status)return Promise.resolve(null);let t=!1;try{let r=this._cache.get(e)||await this._store.get(e);t=void 0!==r&&null!==r}catch(r){console.error("Error: ENOENT: no such file or directory")}return t}async createKey(e){if(!e)throw new Error("id needed to create a key");if(this._store.status&&"open"!==this._store.status)return Promise.resolve(null);const t=()=>new Promise((e,t)=>{crypto.keys.generateKeyPair("secp256k1",256,(r,n)=>{r||e(n),t(r)})}),r=await t(),n=secp256k1.publicKeyConvert(r.public.marshal(),!1),i={publicKey:n.toString("hex"),privateKey:r.marshal().toString("hex")};try{await this._store.put(e,JSON.stringify(i))}catch(s){console.log(s)}return this._cache.set(e,i),r}async getKey(e){if(!e)throw new Error("id needed to get a key");if(this._store||await this.open(),this._store.status&&"open"!==this._store.status)return Promise.resolve(null);const t=this._cache.get(e);let r;try{r=t||await this._store.get(e)}catch(s){}if(!r)return;const n=t||JSON.parse(r);if(!n)return;t||this._cache.set(e,n);const i=e=>new Promise((t,r)=>{crypto.keys.supportedKeys.secp256k1.unmarshalSecp256k1PrivateKey(e,(e,n)=>{e||t(n),r(e)})});return i(Buffer.from(n.privateKey,"hex"))}async sign(e,t){if(!e)throw new Error("No signing key given");if(!t)throw new Error("Given input data was undefined");return Buffer.isBuffer(t)||(t=Buffer.from(t)),new Promise((r,n)=>{e.sign(t,(e,t)=>{e||r(t.toString("hex")),n(e)})})}getPublic(e,t={}){const r=["hex","buffer"],n="undefined"===typeof t.decompress||t.decompress,i=t.format||"hex";if(-1===r.indexOf(i))throw new Error("Supported formats are `hex` and `buffer`");let s=e.public.marshal();return n&&(s=secp256k1.publicKeyConvert(s,!1)),"buffer"===i?s:s.toString("hex")}async verify(e,t,r,n="v1"){return Keystore.verify(e,t,r,n)}static async verify(e,t,r,n="v1"){const i=verifiedCache.get(e);let s=!1;if(i){const e=(e,t,r)=>{let n;return n="v0"===r?0===Buffer.compare(Buffer.alloc(30,e),Buffer.alloc(30,t)):Buffer.isBuffer(t)?0===Buffer.compare(e,t):e===t,n};s=i.publicKey===t&&e(i.data,r,n)}else{const i=await verifier(n).verify(e,t,r);s=i,i&&verifiedCache.set(e,{publicKey:t,data:r})}return s}}module.exports=Keystore},"3c3f":function(e,t){e.exports={name:"memoryStorage",read:n,write:i,each:s,remove:o,clearAll:a};var r={};function n(e){return r[e]}function i(e,t){r[e]=t}function s(e){for(var t in r)r.hasOwnProperty(t)&&e(r[t],t)}function o(e){delete r[e]}function a(e){r={}}},"3c57":function(e,t,r){"use strict";(function(t){const n=r("f106"),i=r("f654"),s=n(r("061f")).Record,o=r("90f6");class a{constructor(e,r,n){e&&i(t.isBuffer(e),"key must be a Buffer"),r&&i(t.isBuffer(r),"value must be a buffer"),this.key=e,this.value=r,this.timeReceived=n}serialize(){return s.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&o.toRFC3339(this.timeReceived)}}static deserialize(e){const t=s.decode(e);return a.fromDeserialized(t)}static fromDeserialized(e){let t;e.timeReceived&&(t=o.parseRFC3339(e.timeReceived));const r=new a(e.key,e.value,t);return r}}e.exports=a}).call(this,r("b639").Buffer)},"3c7d":function(e,t,r){"use strict";const n=r("f256"),i=r("8d3f"),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function o(e,t,r,o,a){const c=s[a];if(!c)throw new Error(`Hash '${a}' is unknown or not supported`);const u=n(e,t,r,o,c);return i.encode64(u)}e.exports=o},"3c96":function(e,t){function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}e.exports=r},"3ca3":function(e,t,r){"use strict";var n=r("6547").charAt,i=r("69f3"),s=r("7dd0"),o="String Iterator",a=i.set,c=i.getterFor(o);s(String,"String",(function(e){a(this,{type:o,string:String(e),index:0})}),(function(){var e,t=c(this),r=t.string,i=t.index;return i>=r.length?{value:void 0,done:!0}:(e=n(r,i),t.index+=e.length,{value:e,done:!1})}))},"3cdd":function(e,t){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},"3ce6":function(e,t,r){var n=r("5995");r("b3d5"),r("31a0");var i=e.exports=n.hmac=n.hmac||{};i.create=function(){var e=null,t=null,r=null,i=null,s={start:function(s,o){if(null!==s)if("string"===typeof s){if(s=s.toLowerCase(),!(s in n.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');t=n.md.algorithms[s].create()}else t=s;if(null===o)o=e;else{if("string"===typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var a=o;o=n.util.createBuffer();for(var c=0;ct.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),u=o.length();for(c=0;c1&&this._buf[this._buf.length-1]===a)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;ni)return!1}return t.length"),e.oneof&&(r="");var n=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return n&&(n=" ["+n+"]"),t.push((r?r+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+n+";"),t},n=function(e,t){t.push("message "+e.name+" {"),e.enums||(e.enums=[]),e.enums.forEach((function(e){t.push(i(e,[]))})),e.messages||(e.messages=[]),e.messages.forEach((function(e){t.push(n(e,[]))}));var s={};return e.fields||(e.fields=[]),e.fields.forEach((function(e){e.oneof?(s[e.oneof]||(s[e.oneof]=[]),s[e.oneof].push(r(e,[]))):t.push(r(e,[]))})),Object.keys(s).forEach((function(e){s[e].unshift("oneof "+e+" {"),s[e].push("}"),t.push(s[e])})),t.push("}",""),t},i=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var r=o(e.options,[]);return r.length>1&&t.push(r.slice(0,-1)),Object.keys(e.values).map((function(r){var n=s(e.values[r]);t.push([r+" = "+n+";"])})),t.push("}",""),t},s=function(e,t){var r=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");r&&(r=" ["+r+"]");var n=e.value+r;return n},o=function(e,t){var r=Object.keys(e);return r.forEach((function(r){var n=e[r];~r.indexOf(".")&&(r="("+r+")");var i=typeof n;"object"===i?(n=a(n,[]),n.length&&t.push("option "+r+" = {",n,"};")):("string"===i&&"optimize_for"!==r&&(n='"'+n+'"'),t.push("option "+r+" = "+n+";"))})),r.length>0&&t.push(""),t},a=function(e,t){var r=Object.keys(e);return r.forEach((function(r){var n=e[r],i=typeof n;"object"===i?Array.isArray(n)?n.forEach((function(e){e=a(e,[]),e.length&&t.push(r+" {",e,"}")})):(n=a(n,[]),n.length&&t.push(r+" {",n,"}")):("string"===i&&(n='"'+n+'"'),t.push(r+": "+n))})),t},c=function(e,t){return t.push("service "+e.name+" {"),e.options||(e.options={}),o(e.options,t),e.methods||(e.methods=[]),e.methods.forEach((function(e){t.push(u(e,[]))})),t.push("}",""),t},u=function(e,t){var r="rpc "+e.name+"(";e.client_streaming&&(r+="stream "),r+=e.input_type+") returns (",e.server_streaming&&(r+="stream "),r+=e.output_type+")",e.options||(e.options={});var n=o(e.options,[]);return n.length>1?t.push(r+" {",n.slice(0,-1),"}"):t.push(r+";"),t},l=function(e){return function(t){return Array.isArray(t)?t.map(l(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.options||(e.options={}),o(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){i(e,t)})),e.messages||(e.messages=[]),e.messages.forEach((function(e){n(e,t)})),e.services&&e.services.forEach((function(e){c(e,t)})),t.map(l("")).join("\n")}},"3d4d":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("2e00"),i=s(n);function s(e){return e&&e.__esModule?e:{default:e}}t.default=i.default,e.exports=t["default"]},"3d5a":function(e,t,r){"use strict";const n=r("0e38");e.exports=function(e){if(!e||"number"!==typeof e)throw new Error("first argument must be a Number bigger than 0");return n(e)}},"3d68":function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return l}));var n=r("33d8"),i=r.n(n),s=r("9bda"),o=r("ffb2"),a=r("4a45"),c=r("3e80");const u=new o["Logger"](a["a"]);class l extends c["a"]{constructor(e,t){u.checkNew(new.target,l),null==e&&u.throwError("missing path",o["Logger"].errors.MISSING_ARGUMENT,{arg:"path"}),super("ipc://"+e,t),Object(s["defineReadOnly"])(this,"path",e)}send(t,r){let n=JSON.stringify({method:t,params:r,id:42,jsonrpc:"2.0"});return new Promise((t,r)=>{let s=e.alloc(0),o=i.a.connect(this.path);o.on("data",t=>{s=e.concat([s,t])}),o.on("end",()=>{try{t(JSON.parse(s.toString()).result),o.destroy()}catch(e){r(e),o.destroy()}}),o.on("error",e=>{r(e),o.destroy()}),o.write(n),o.end()})}}}).call(this,r("b639").Buffer)},"3d73":function(e,t,r){(function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function y(e,t,r,n,i){var s,o=0;for(s=0;s>>8)-1}function g(e,t,r,n){return y(e,t,r,n,16)}function m(e,t,r,n){return y(e,t,r,n,32)}function b(e,t,r,n){for(var i,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=s,E=o,S=a,k=c,C=u,A=l,I=h,T=f,x=d,B=p,R=y,N=g,O=m,P=b,D=v,L=w,M=0;M<20;M+=2)i=_+O|0,C^=i<<7|i>>>25,i=C+_|0,x^=i<<9|i>>>23,i=x+C|0,O^=i<<13|i>>>19,i=O+x|0,_^=i<<18|i>>>14,i=A+E|0,B^=i<<7|i>>>25,i=B+A|0,P^=i<<9|i>>>23,i=P+B|0,E^=i<<13|i>>>19,i=E+P|0,A^=i<<18|i>>>14,i=R+I|0,D^=i<<7|i>>>25,i=D+R|0,S^=i<<9|i>>>23,i=S+D|0,I^=i<<13|i>>>19,i=I+S|0,R^=i<<18|i>>>14,i=L+N|0,k^=i<<7|i>>>25,i=k+L|0,T^=i<<9|i>>>23,i=T+k|0,N^=i<<13|i>>>19,i=N+T|0,L^=i<<18|i>>>14,i=_+k|0,E^=i<<7|i>>>25,i=E+_|0,S^=i<<9|i>>>23,i=S+E|0,k^=i<<13|i>>>19,i=k+S|0,_^=i<<18|i>>>14,i=A+C|0,I^=i<<7|i>>>25,i=I+A|0,T^=i<<9|i>>>23,i=T+I|0,C^=i<<13|i>>>19,i=C+T|0,A^=i<<18|i>>>14,i=R+B|0,N^=i<<7|i>>>25,i=N+R|0,x^=i<<9|i>>>23,i=x+N|0,B^=i<<13|i>>>19,i=B+x|0,R^=i<<18|i>>>14,i=L+D|0,O^=i<<7|i>>>25,i=O+L|0,P^=i<<9|i>>>23,i=P+O|0,D^=i<<13|i>>>19,i=D+P|0,L^=i<<18|i>>>14;_=_+s|0,E=E+o|0,S=S+a|0,k=k+c|0,C=C+u|0,A=A+l|0,I=I+h|0,T=T+f|0,x=x+d|0,B=B+p|0,R=R+y|0,N=N+g|0,O=O+m|0,P=P+b|0,D=D+v|0,L=L+w|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=E>>>0&255,e[5]=E>>>8&255,e[6]=E>>>16&255,e[7]=E>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255,e[32]=x>>>0&255,e[33]=x>>>8&255,e[34]=x>>>16&255,e[35]=x>>>24&255,e[36]=B>>>0&255,e[37]=B>>>8&255,e[38]=B>>>16&255,e[39]=B>>>24&255,e[40]=R>>>0&255,e[41]=R>>>8&255,e[42]=R>>>16&255,e[43]=R>>>24&255,e[44]=N>>>0&255,e[45]=N>>>8&255,e[46]=N>>>16&255,e[47]=N>>>24&255,e[48]=O>>>0&255,e[49]=O>>>8&255,e[50]=O>>>16&255,e[51]=O>>>24&255,e[52]=P>>>0&255,e[53]=P>>>8&255,e[54]=P>>>16&255,e[55]=P>>>24&255,e[56]=D>>>0&255,e[57]=D>>>8&255,e[58]=D>>>16&255,e[59]=D>>>24&255,e[60]=L>>>0&255,e[61]=L>>>8&255,e[62]=L>>>16&255,e[63]=L>>>24&255}function v(e,t,r,n){for(var i,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=s,E=o,S=a,k=c,C=u,A=l,I=h,T=f,x=d,B=p,R=y,N=g,O=m,P=b,D=v,L=w,M=0;M<20;M+=2)i=_+O|0,C^=i<<7|i>>>25,i=C+_|0,x^=i<<9|i>>>23,i=x+C|0,O^=i<<13|i>>>19,i=O+x|0,_^=i<<18|i>>>14,i=A+E|0,B^=i<<7|i>>>25,i=B+A|0,P^=i<<9|i>>>23,i=P+B|0,E^=i<<13|i>>>19,i=E+P|0,A^=i<<18|i>>>14,i=R+I|0,D^=i<<7|i>>>25,i=D+R|0,S^=i<<9|i>>>23,i=S+D|0,I^=i<<13|i>>>19,i=I+S|0,R^=i<<18|i>>>14,i=L+N|0,k^=i<<7|i>>>25,i=k+L|0,T^=i<<9|i>>>23,i=T+k|0,N^=i<<13|i>>>19,i=N+T|0,L^=i<<18|i>>>14,i=_+k|0,E^=i<<7|i>>>25,i=E+_|0,S^=i<<9|i>>>23,i=S+E|0,k^=i<<13|i>>>19,i=k+S|0,_^=i<<18|i>>>14,i=A+C|0,I^=i<<7|i>>>25,i=I+A|0,T^=i<<9|i>>>23,i=T+I|0,C^=i<<13|i>>>19,i=C+T|0,A^=i<<18|i>>>14,i=R+B|0,N^=i<<7|i>>>25,i=N+R|0,x^=i<<9|i>>>23,i=x+N|0,B^=i<<13|i>>>19,i=B+x|0,R^=i<<18|i>>>14,i=L+D|0,O^=i<<7|i>>>25,i=O+L|0,P^=i<<9|i>>>23,i=P+O|0,D^=i<<13|i>>>19,i=D+P|0,L^=i<<18|i>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=R>>>0&255,e[9]=R>>>8&255,e[10]=R>>>16&255,e[11]=R>>>24&255,e[12]=L>>>0&255,e[13]=L>>>8&255,e[14]=L>>>16&255,e[15]=L>>>24&255,e[16]=I>>>0&255,e[17]=I>>>8&255,e[18]=I>>>16&255,e[19]=I>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=B>>>0&255,e[29]=B>>>8&255,e[30]=B>>>16&255,e[31]=B>>>24&255}function w(e,t,r,n){b(e,t,r,n)}function _(e,t,r,n){v(e,t,r,n)}var E=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,r,n,i,s,o){var a,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=s[c];while(i>=64){for(w(l,u,o,E),c=0;c<64;c++)e[t+c]=r[n+c]^l[c];for(a=1,c=8;c<16;c++)a=a+(255&u[c])|0,u[c]=255&a,a>>>=8;i-=64,t+=64,n+=64}if(i>0)for(w(l,u,o,E),c=0;c=64){for(w(c,a,i,E),o=0;o<64;o++)e[t+o]=c[o];for(s=1,o=8;o<16;o++)s=s+(255&a[o])|0,a[o]=255&s,s>>>=8;r-=64,t+=64}if(r>0)for(w(c,a,i,E),o=0;o>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),s=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|s<<12),this.r[5]=s>>>1&8190,o=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(s>>>14|o<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(o>>>11|a<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,t,r,n,i,s){var o=new I(s);return o.update(r,n,i),o.finish(e,t),0}function x(e,t,r,n,i,s){var o=new Uint8Array(16);return T(o,0,r,n,i,s),g(e,t,o,0)}function B(e,t,r,n,i){var s;if(r<32)return-1;for(A(e,0,t,0,r,n,i),T(e,16,e,32,r-32,e),s=0;s<16;s++)e[s]=0;return 0}function R(e,t,r,n,i){var s,o=new Uint8Array(32);if(r<32)return-1;if(C(o,0,32,n,i),0!==x(t,16,t,32,r-32,o))return-1;for(A(e,0,t,0,r,n,i),s=0;s<32;s++)e[s]=0;return 0}function N(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function P(e,t,r){for(var n,i=~(r-1),s=0;s<16;s++)n=i&(e[s]^t[s]),e[s]^=n,t[s]^=n}function D(e,r){var n,i,s,o=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(O(a),O(a),O(a),i=0;i<2;i++){for(o[0]=a[0]-65517,n=1;n<15;n++)o[n]=a[n]-65535-(o[n-1]>>16&1),o[n-1]&=65535;o[15]=a[15]-32767-(o[14]>>16&1),s=o[15]>>16&1,o[14]&=65535,P(a,o,1-s)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function L(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return D(r,e),D(n,t),m(r,0,n,0)}function M(e){var t=new Uint8Array(32);return D(t,e),1&t[0]}function U(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function j(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function K(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function F(e,t,r){var n,i,s=0,o=0,a=0,c=0,u=0,l=0,h=0,f=0,d=0,p=0,y=0,g=0,m=0,b=0,v=0,w=0,_=0,E=0,S=0,k=0,C=0,A=0,I=0,T=0,x=0,B=0,R=0,N=0,O=0,P=0,D=0,L=r[0],M=r[1],U=r[2],j=r[3],K=r[4],F=r[5],V=r[6],q=r[7],z=r[8],H=r[9],G=r[10],$=r[11],W=r[12],Y=r[13],Q=r[14],J=r[15];n=t[0],s+=n*L,o+=n*M,a+=n*U,c+=n*j,u+=n*K,l+=n*F,h+=n*V,f+=n*q,d+=n*z,p+=n*H,y+=n*G,g+=n*$,m+=n*W,b+=n*Y,v+=n*Q,w+=n*J,n=t[1],o+=n*L,a+=n*M,c+=n*U,u+=n*j,l+=n*K,h+=n*F,f+=n*V,d+=n*q,p+=n*z,y+=n*H,g+=n*G,m+=n*$,b+=n*W,v+=n*Y,w+=n*Q,_+=n*J,n=t[2],a+=n*L,c+=n*M,u+=n*U,l+=n*j,h+=n*K,f+=n*F,d+=n*V,p+=n*q,y+=n*z,g+=n*H,m+=n*G,b+=n*$,v+=n*W,w+=n*Y,_+=n*Q,E+=n*J,n=t[3],c+=n*L,u+=n*M,l+=n*U,h+=n*j,f+=n*K,d+=n*F,p+=n*V,y+=n*q,g+=n*z,m+=n*H,b+=n*G,v+=n*$,w+=n*W,_+=n*Y,E+=n*Q,S+=n*J,n=t[4],u+=n*L,l+=n*M,h+=n*U,f+=n*j,d+=n*K,p+=n*F,y+=n*V,g+=n*q,m+=n*z,b+=n*H,v+=n*G,w+=n*$,_+=n*W,E+=n*Y,S+=n*Q,k+=n*J,n=t[5],l+=n*L,h+=n*M,f+=n*U,d+=n*j,p+=n*K,y+=n*F,g+=n*V,m+=n*q,b+=n*z,v+=n*H,w+=n*G,_+=n*$,E+=n*W,S+=n*Y,k+=n*Q,C+=n*J,n=t[6],h+=n*L,f+=n*M,d+=n*U,p+=n*j,y+=n*K,g+=n*F,m+=n*V,b+=n*q,v+=n*z,w+=n*H,_+=n*G,E+=n*$,S+=n*W,k+=n*Y,C+=n*Q,A+=n*J,n=t[7],f+=n*L,d+=n*M,p+=n*U,y+=n*j,g+=n*K,m+=n*F,b+=n*V,v+=n*q,w+=n*z,_+=n*H,E+=n*G,S+=n*$,k+=n*W,C+=n*Y,A+=n*Q,I+=n*J,n=t[8],d+=n*L,p+=n*M,y+=n*U,g+=n*j,m+=n*K,b+=n*F,v+=n*V,w+=n*q,_+=n*z,E+=n*H,S+=n*G,k+=n*$,C+=n*W,A+=n*Y,I+=n*Q,T+=n*J,n=t[9],p+=n*L,y+=n*M,g+=n*U,m+=n*j,b+=n*K,v+=n*F,w+=n*V,_+=n*q,E+=n*z,S+=n*H,k+=n*G,C+=n*$,A+=n*W,I+=n*Y,T+=n*Q,x+=n*J,n=t[10],y+=n*L,g+=n*M,m+=n*U,b+=n*j,v+=n*K,w+=n*F,_+=n*V,E+=n*q,S+=n*z,k+=n*H,C+=n*G,A+=n*$,I+=n*W,T+=n*Y,x+=n*Q,B+=n*J,n=t[11],g+=n*L,m+=n*M,b+=n*U,v+=n*j,w+=n*K,_+=n*F,E+=n*V,S+=n*q,k+=n*z,C+=n*H,A+=n*G,I+=n*$,T+=n*W,x+=n*Y,B+=n*Q,R+=n*J,n=t[12],m+=n*L,b+=n*M,v+=n*U,w+=n*j,_+=n*K,E+=n*F,S+=n*V,k+=n*q,C+=n*z,A+=n*H,I+=n*G,T+=n*$,x+=n*W,B+=n*Y,R+=n*Q,N+=n*J,n=t[13],b+=n*L,v+=n*M,w+=n*U,_+=n*j,E+=n*K,S+=n*F,k+=n*V,C+=n*q,A+=n*z,I+=n*H,T+=n*G,x+=n*$,B+=n*W,R+=n*Y,N+=n*Q,O+=n*J,n=t[14],v+=n*L,w+=n*M,_+=n*U,E+=n*j,S+=n*K,k+=n*F,C+=n*V,A+=n*q,I+=n*z,T+=n*H,x+=n*G,B+=n*$,R+=n*W,N+=n*Y,O+=n*Q,P+=n*J,n=t[15],w+=n*L,_+=n*M,E+=n*U,S+=n*j,k+=n*K,C+=n*F,A+=n*V,I+=n*q,T+=n*z,x+=n*H,B+=n*G,R+=n*$,N+=n*W,O+=n*Y,P+=n*Q,D+=n*J,s+=38*_,o+=38*E,a+=38*S,c+=38*k,u+=38*C,l+=38*A,h+=38*I,f+=38*T,d+=38*x,p+=38*B,y+=38*R,g+=38*N,m+=38*O,b+=38*P,v+=38*D,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=w+i+65535,i=Math.floor(n/65536),w=n-65536*i,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=w+i+65535,i=Math.floor(n/65536),w=n-65536*i,s+=i-1+37*(i-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=h,e[7]=f,e[8]=d,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=b,e[14]=v,e[15]=w}function V(e,t){F(e,t,t)}function q(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)V(i,i),2!==n&&4!==n&&F(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function z(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)V(i,i),1!==n&&F(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function H(e,r,n){var i,s,o=new Uint8Array(32),a=new Float64Array(80),u=t(),l=t(),h=t(),f=t(),d=t(),p=t();for(s=0;s<31;s++)o[s]=r[s];for(o[31]=127&r[31]|64,o[0]&=248,U(a,n),s=0;s<16;s++)l[s]=a[s],f[s]=u[s]=h[s]=0;for(u[0]=f[0]=1,s=254;s>=0;--s)i=o[s>>>3]>>>(7&s)&1,P(u,l,i),P(h,f,i),j(d,u,h),K(u,u,h),j(h,l,f),K(l,l,f),V(f,d),V(p,u),F(u,h,u),F(h,l,d),j(d,u,h),K(u,u,h),V(l,u),K(h,f,p),F(u,h,c),j(u,u,f),F(h,h,u),F(u,f,p),F(f,l,a),V(l,d),P(u,l,i),P(h,f,i);for(s=0;s<16;s++)a[s+16]=u[s],a[s+32]=h[s],a[s+48]=l[s],a[s+64]=f[s];var y=a.subarray(32),g=a.subarray(16);return q(y,y),F(g,g,y),D(e,g),0}function G(e,t){return H(e,t,s)}function $(e,t){return n(t,32),G(e,t)}function W(e,t,r){var n=new Uint8Array(32);return H(n,r,t),_(e,i,n,E)}I.prototype.blocks=function(e,t,r){var n,i,s,o,a,c,u,l,h,f,d,p,y,g,m,b,v,w,_,E=this.fin?0:2048,S=this.h[0],k=this.h[1],C=this.h[2],A=this.h[3],I=this.h[4],T=this.h[5],x=this.h[6],B=this.h[7],R=this.h[8],N=this.h[9],O=this.r[0],P=this.r[1],D=this.r[2],L=this.r[3],M=this.r[4],U=this.r[5],j=this.r[6],K=this.r[7],F=this.r[8],V=this.r[9];while(r>=16)n=255&e[t+0]|(255&e[t+1])<<8,S+=8191&n,i=255&e[t+2]|(255&e[t+3])<<8,k+=8191&(n>>>13|i<<3),s=255&e[t+4]|(255&e[t+5])<<8,C+=8191&(i>>>10|s<<6),o=255&e[t+6]|(255&e[t+7])<<8,A+=8191&(s>>>7|o<<9),a=255&e[t+8]|(255&e[t+9])<<8,I+=8191&(o>>>4|a<<12),T+=a>>>1&8191,c=255&e[t+10]|(255&e[t+11])<<8,x+=8191&(a>>>14|c<<2),u=255&e[t+12]|(255&e[t+13])<<8,B+=8191&(c>>>11|u<<5),l=255&e[t+14]|(255&e[t+15])<<8,R+=8191&(u>>>8|l<<8),N+=l>>>5|E,h=0,f=h,f+=S*O,f+=k*(5*V),f+=C*(5*F),f+=A*(5*K),f+=I*(5*j),h=f>>>13,f&=8191,f+=T*(5*U),f+=x*(5*M),f+=B*(5*L),f+=R*(5*D),f+=N*(5*P),h+=f>>>13,f&=8191,d=h,d+=S*P,d+=k*O,d+=C*(5*V),d+=A*(5*F),d+=I*(5*K),h=d>>>13,d&=8191,d+=T*(5*j),d+=x*(5*U),d+=B*(5*M),d+=R*(5*L),d+=N*(5*D),h+=d>>>13,d&=8191,p=h,p+=S*D,p+=k*P,p+=C*O,p+=A*(5*V),p+=I*(5*F),h=p>>>13,p&=8191,p+=T*(5*K),p+=x*(5*j),p+=B*(5*U),p+=R*(5*M),p+=N*(5*L),h+=p>>>13,p&=8191,y=h,y+=S*L,y+=k*D,y+=C*P,y+=A*O,y+=I*(5*V),h=y>>>13,y&=8191,y+=T*(5*F),y+=x*(5*K),y+=B*(5*j),y+=R*(5*U),y+=N*(5*M),h+=y>>>13,y&=8191,g=h,g+=S*M,g+=k*L,g+=C*D,g+=A*P,g+=I*O,h=g>>>13,g&=8191,g+=T*(5*V),g+=x*(5*F),g+=B*(5*K),g+=R*(5*j),g+=N*(5*U),h+=g>>>13,g&=8191,m=h,m+=S*U,m+=k*M,m+=C*L,m+=A*D,m+=I*P,h=m>>>13,m&=8191,m+=T*O,m+=x*(5*V),m+=B*(5*F),m+=R*(5*K),m+=N*(5*j),h+=m>>>13,m&=8191,b=h,b+=S*j,b+=k*U,b+=C*M,b+=A*L,b+=I*D,h=b>>>13,b&=8191,b+=T*P,b+=x*O,b+=B*(5*V),b+=R*(5*F),b+=N*(5*K),h+=b>>>13,b&=8191,v=h,v+=S*K,v+=k*j,v+=C*U,v+=A*M,v+=I*L,h=v>>>13,v&=8191,v+=T*D,v+=x*P,v+=B*O,v+=R*(5*V),v+=N*(5*F),h+=v>>>13,v&=8191,w=h,w+=S*F,w+=k*K,w+=C*j,w+=A*U,w+=I*M,h=w>>>13,w&=8191,w+=T*L,w+=x*D,w+=B*P,w+=R*O,w+=N*(5*V),h+=w>>>13,w&=8191,_=h,_+=S*V,_+=k*F,_+=C*K,_+=A*j,_+=I*U,h=_>>>13,_&=8191,_+=T*M,_+=x*L,_+=B*D,_+=R*P,_+=N*O,h+=_>>>13,_&=8191,h=(h<<2)+h|0,h=h+f|0,f=8191&h,h>>>=13,d+=h,S=f,k=d,C=p,A=y,I=g,T=m,x=b,B=v,R=w,N=_,t+=16,r-=16;this.h[0]=S,this.h[1]=k,this.h[2]=C,this.h[3]=A,this.h[4]=I,this.h[5]=T,this.h[6]=x,this.h[7]=B,this.h[8]=R,this.h[9]=N},I.prototype.finish=function(e,t){var r,n,i,s,o=new Uint16Array(10);if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,o[0]=this.h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this.h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,n=(1^r)-1,s=0;s<10;s++)o[s]&=n;for(n=~n,s=0;s<10;s++)this.h[s]=this.h[s]&n|o[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,s=1;s<8;s++)i=(this.h[s]+this.pad[s]|0)+(i>>>16)|0,this.h[s]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},I.prototype.update=function(e,t,r){var n,i;if(this.leftover){for(i=16-this.leftover,i>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128){for(E=0;E<16;E++)S=8*E+W,B[E]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],R[E]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(E=0;E<80;E++)if(i=N,s=O,o=P,a=D,c=L,u=M,l=U,h=j,f=K,d=F,p=V,y=q,g=z,m=H,b=G,v=$,k=j,C=$,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=(L>>>14|z<<18)^(L>>>18|z<<14)^(z>>>9|L<<23),C=(z>>>14|L<<18)^(z>>>18|L<<14)^(L>>>9|z<<23),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=L&M^~L&U,C=z&H^~z&G,A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=Z[2*E],C=Z[2*E+1],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=B[E%16],C=R[E%16],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,w=65535&T|x<<16,_=65535&A|I<<16,k=w,C=_,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=(N>>>28|K<<4)^(K>>>2|N<<30)^(K>>>7|N<<25),C=(K>>>28|N<<4)^(N>>>2|K<<30)^(N>>>7|K<<25),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=N&O^N&P^O&P,C=K&F^K&V^F&V,A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,h=65535&T|x<<16,v=65535&A|I<<16,k=a,C=y,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=w,C=_,A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,a=65535&T|x<<16,y=65535&A|I<<16,O=i,P=s,D=o,L=a,M=c,U=u,j=l,N=h,F=f,V=d,q=p,z=y,H=g,G=m,$=b,K=v,E%16===15)for(S=0;S<16;S++)k=B[S],C=R[S],A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=B[(S+9)%16],C=R[(S+9)%16],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,w=B[(S+1)%16],_=R[(S+1)%16],k=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7,C=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,w=B[(S+14)%16],_=R[(S+14)%16],k=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6,C=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,B[S]=65535&T|x<<16,R[S]=65535&A|I<<16;k=N,C=K,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[0],C=t[0],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[0]=N=65535&T|x<<16,t[0]=K=65535&A|I<<16,k=O,C=F,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[1],C=t[1],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[1]=O=65535&T|x<<16,t[1]=F=65535&A|I<<16,k=P,C=V,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[2],C=t[2],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[2]=P=65535&T|x<<16,t[2]=V=65535&A|I<<16,k=D,C=q,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[3],C=t[3],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[3]=D=65535&T|x<<16,t[3]=q=65535&A|I<<16,k=L,C=z,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[4],C=t[4],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[4]=L=65535&T|x<<16,t[4]=z=65535&A|I<<16,k=M,C=H,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[5],C=t[5],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[5]=M=65535&T|x<<16,t[5]=H=65535&A|I<<16,k=U,C=G,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[6],C=t[6],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[6]=U=65535&T|x<<16,t[6]=G=65535&A|I<<16,k=j,C=$,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[7],C=t[7],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[7]=j=65535&T|x<<16,t[7]=$=65535&A|I<<16,W+=128,n-=128}return n}function te(e,t,r){var n,i=new Int32Array(8),s=new Int32Array(8),o=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,s[0]=4089235720,s[1]=2227873595,s[2]=4271175723,s[3]=1595750129,s[4]=2917565137,s[5]=725511199,s[6]=4215389547,s[7]=327033209,ee(i,s,t,r),r%=128,n=0;n=0;--i)n=r[i/8|0]>>(7&i)&1,ne(e,t,n),re(t,e),re(e,e),ne(e,t,n)}function oe(e,r){var n=[t(),t(),t(),t()];N(n[0],h),N(n[1],f),N(n[2],a),F(n[3],h,f),se(e,n,r)}function ae(e,r,i){var s,o=new Uint8Array(64),a=[t(),t(),t(),t()];for(i||n(r,32),te(o,r,32),o[0]&=248,o[31]&=127,o[31]|=64,oe(a,o),ie(e,a),s=0;s<32;s++)r[s+32]=e[s];return 0}var ce=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ue(e,t){var r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*ce[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ce[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function le(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ue(e,r)}function he(e,r,n,i){var s,o,a=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),h=[t(),t(),t(),t()];te(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(s=0;s>7&&K(e[0],o,e[0]),F(e[3],e[0],e[1]),0)}function de(e,r,n,i){var s,o=new Uint8Array(32),a=new Uint8Array(64),c=[t(),t(),t(),t()],u=[t(),t(),t(),t()];if(n<64)return-1;if(fe(u,i))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(Ie),t=new Uint8Array(Te);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Oe(e),e.length!==Te)throw new Error("bad secret key size");for(var t=new Uint8Array(Ie),r=0;r0;return r.bytes=1,n};return o(0,t,r,e)}(),t.int32=function(){var e=function(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,i>2147483647?i-4294967296:i},t=function(e){return n.encodingLength(e<0?e+4294967296:e)};return o(0,n.encode,e,t)}(),t.int64=function(){var e=function(t,r){var i=n.decode(t,r);if(i>=Math.pow(2,63)){var o=9;while(255===t[r+o-1])o--;o=o||9;var a=s.allocUnsafe(o);t.copy(a,0,r,r+o),a[o-1]=127&a[o-1],i=-1*n.decode(a,0),e.bytes=10}else e.bytes=n.decode.bytes;return i},t=function(e,r,i){if(e<0){var s=i+9;n.encode(-1*e,r,i),i+=n.encode.bytes-1,r[i]=128|r[i];while(i"ls"!==e),c=a.length,u=a.reduce((e,r)=>{const n=t.from(r+"\n"),i=o.encodingLength(n.length);return e+i},0),l=t.concat([t.from(o.encode(c)),t.from(o.encode(u)),t.from("\n")]),h=a.map(e=>t.from(e+"\n"));n(i([l].concat(h)),s.encode(),r)}e.exports=a}).call(this,r("b639").Buffer)},"3e0d":function(e,t,r){(function(t){function r(e){if("object"!==typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}r.prototype.next=function(e){var r=this;if("function"!==typeof e)throw new Error("next() requires a callback argument");return r._ended?(t.nextTick(e,new Error("cannot call next() after end()")),r):r._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),r):(r._nexting=!0,r._next((function(){r._nexting=!1,e.apply(null,arguments)})),r)},r.prototype._next=function(e){t.nextTick(e)},r.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},r.prototype._seek=function(e){},r.prototype.end=function(e){if("function"!==typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},r.prototype._end=function(e){t.nextTick(e)},e.exports=r}).call(this,r("4362"))},"3e1e":function(e,t,r){"use strict";var n=r("4b5a"),i=r("3f5a"),s=r("2d12");for(var o in t=e.exports=r("bf0b"),t.pull=t,n)t[o]=n[o];for(var o in s)t[o]=s[o];for(var o in i)t[o]=i[o]},"3e21":function(e,t,r){"use strict";const n=r("e302");class i{constructor(e){this.lru=n(e)}get(e){const t=this.lru.get(e);if(t)return t.expire&&t.expiree.key.toString()!==o.toString(),e=>e.key.toString()!==a.toString()]};if(null!=e.prefix&&t.filters.push(t=>this._invertKey(t.key).toString().startsWith(e.prefix)),null!=e.filters){const r=e.filters.map(e=>t=>e(Object.assign({},t,{key:this._invertKey(t.key)})));t.filters=t.filters.concat(r)}return null!=e.orders&&(t.orders=e.orders.map(e=>async t=>{t.forEach(e=>{e.key=this._invertKey(e.key)});const r=await e(t);return r.forEach(e=>{e.key=this._convertKey(e.key)}),r})),this.child.query(t)}close(){return this.child.close()}}e.exports=c}).call(this,r("b639").Buffer)},"3e7a":function(e,t,r){"use strict";(function(t){const n=r("c449"),i=(e,r)=>{if("string"===typeof r)e._links=e._links.filter(e=>e.Name!==r);else{if(!t.isBuffer(r)&&!n.isCID(r))throw new Error("second arg needs to be a name or CID");e._links=e._links.filter(e=>!e.Hash.equals(r))}};e.exports=i}).call(this,r("b639").Buffer)},"3e80":function(e,t,r){"use strict";r.d(t,"b",(function(){return b})),r.d(t,"a",(function(){return _}));var n=r("7ca5"),i=r("3a17"),s=r("549e"),o=r("9bda"),a=r("8e19"),c=r("baf7"),u=r("ffb2"),l=r("4a45"),h=r("bc79"),f=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n["throw"](e))}catch(t){s(t)}}function c(e){e.done?r(e.value):i(e.value).then(o,a)}c((n=n.apply(e,t||[])).next())}))};const d=new u["Logger"](l["a"]);function p(e){return new Promise((function(t){setTimeout((function(){t()}),e)}))}function y(e){if(e.error){let t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function g(e){return e?e.toLowerCase():e}const m={};class b extends n["a"]{constructor(e,t,r){if(d.checkNew(new.target,b),super(),e!==m)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Object(o["defineReadOnly"])(this,"provider",t),null==r&&(r=0),"string"===typeof r?(Object(o["defineReadOnly"])(this,"_address",this.provider.formatter.address(r)),Object(o["defineReadOnly"])(this,"_index",null)):"number"===typeof r?(Object(o["defineReadOnly"])(this,"_index",r),Object(o["defineReadOnly"])(this,"_address",null)):d.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return d.throwError("cannot alter JSON-RPC Signer connection",u["Logger"].errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new v(m,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&d.throwError("unknown account #"+this._index,u["Logger"].errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=Object(o["shallowCopy"])(e);let t=this.getAddress().then(e=>(e&&(e=e.toLowerCase()),e));if(null==e.gasLimit){let r=Object(o["shallowCopy"])(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return Promise.all([Object(o["resolveProperties"])(e),t]).then(e=>{let t=e[0],r=this.provider.constructor.hexlifyTransaction(t);return r.from=e[1],this.provider.send("eth_sendTransaction",[r]).then(e=>e,e=>{throw e.responseText&&(e.responseText.indexOf("insufficient funds")>=0&&d.throwError("insufficient funds",u["Logger"].errors.INSUFFICIENT_FUNDS,{transaction:t}),e.responseText.indexOf("nonce too low")>=0&&d.throwError("nonce has already been used",u["Logger"].errors.NONCE_EXPIRED,{transaction:t}),e.responseText.indexOf("replacement transaction underpriced")>=0&&d.throwError("replacement fee too low",u["Logger"].errors.REPLACEMENT_UNDERPRICED,{transaction:t})),e})})}signTransaction(e){return d.throwError("signing transactions is unsupported",u["Logger"].errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return this.sendUncheckedTransaction(e).then(e=>Object(c["b"])(()=>this.provider.getTransaction(e).then(t=>{if(null!==t)return this.provider._wrapTransaction(t,e)}),{onceBlock:this.provider}).catch(t=>{throw t.transactionHash=e,t}))}signMessage(e){let t="string"===typeof e?Object(a["c"])(e):e;return this.getAddress().then(e=>this.provider.send("eth_sign",[e.toLowerCase(),Object(s["hexlify"])(t)]))}unlock(e){let t=this.provider;return this.getAddress().then((function(r){return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class v extends b{sendTransaction(e){return this.sendUncheckedTransaction(e).then(e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)}))}}const w={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};class _ extends h["a"]{constructor(e,t){d.checkNew(new.target,_);const r=Object(o["getStatic"])(new.target,"getNetwork");if("string"===typeof e&&null===t){const n=r(e);t=n,e=null}if(t)super(t);else{const e=new Promise((e,t)=>{setTimeout(()=>f(this,void 0,void 0,(function*(){let n=null;try{n=yield this.send("eth_chainId",[])}catch(s){try{n=yield this.send("net_version",[])}catch(s){}}if(null!=n)try{return e(r(i["a"].from(n).toNumber()))}catch(s){console.log("e3",s)}t(d.makeError("could not detect network",u["Logger"].errors.NETWORK_ERROR))})),0)});super(e)}e||(e="http://localhost:8545"),this.connection="string"===typeof e?Object.freeze({url:e}):Object.freeze(Object(o["shallowCopy"])(e)),this._nextId=42}getSigner(e){return new b(m,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(e=>this.formatter.address(e)))}send(e,t){let r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};return this.emit("debug",{action:"request",request:Object(o["deepCopy"])(r),provider:this}),Object(c["a"])(this.connection,JSON.stringify(r),y).then(e=>(this.emit("debug",{action:"response",request:r,response:e,provider:this}),e))}perform(e,t){switch(e){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[g(t.address),t.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[g(t.address),t.blockTag]);case"getCode":return this.send("eth_getCode",[g(t.address),t.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[g(t.address),t.position,t.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[t.signedTransaction]).catch(e=>{throw e.responseText&&(e.responseText.indexOf("insufficient funds")>0&&d.throwError("insufficient funds",u["Logger"].errors.INSUFFICIENT_FUNDS,{}),e.responseText.indexOf("nonce too low")>0&&d.throwError("nonce has already been used",u["Logger"].errors.NONCE_EXPIRED,{}),e.responseText.indexOf("replacement transaction underpriced")>0&&d.throwError("replacement fee too low",u["Logger"].errors.REPLACEMENT_UNDERPRICED,{})),e});case"getBlock":return t.blockTag?this.send("eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]):t.blockHash?this.send("eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]):d.throwArgumentError("invalid block tag or block hash","params",t);case"getTransaction":return this.send("eth_getTransactionByHash",[t.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[t.transactionHash]);case"call":{const e=Object(o["getStatic"])(this.constructor,"hexlifyTransaction");return this.send("eth_call",[e(t.transaction,{from:!0}),t.blockTag])}case"estimateGas":{const e=Object(o["getStatic"])(this.constructor,"hexlifyTransaction");return this.send("eth_estimateGas",[e(t.transaction,{from:!0})])}case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=g(t.filter.address)),this.send("eth_getLogs",[t.filter]);default:break}return d.throwError(e+" not implemented",u["Logger"].errors.NOT_IMPLEMENTED,{operation:e})}_startPending(){if(null!=this._pendingFilter)return;let e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;let n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return p(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch(e=>{})}return n(),r})).catch(e=>{})}_stopPending(){this._pendingFilter=null}static hexlifyTransaction(e,t){const r=Object(o["shallowCopy"])(w);if(t)for(let i in t)t[i]&&(r[i]=!0);Object(o["checkProperties"])(e,r);const n={};return["gasLimit","gasPrice","nonce","value"].forEach((function(t){if(null==e[t])return;const r=Object(s["hexValue"])(e[t]);"gasLimit"===t&&(t="gas"),n[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(n[t]=Object(s["hexlify"])(e[t]))})),n}}},"3e9a":function(e,t,r){"use strict";const n=7;function i(e,t){return e+s(t)}function s(e){let t=e;return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),16843009*(t+(t>>4)&252645135)>>24}function o(e,t){return e[0]-t[0]}function a(e){return e[1]}e.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,t){let r=this._internalPositionFor(e,!1);if(void 0===t)-1!==r&&(this._unsetInternalPos(r),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let n=!1;-1===r?(r=this._data.length,this._setBit(e),this._changedData=!0):n=!0,this._setInternalPos(r,e,t,n),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();const t=this._internalPositionFor(e,!0);if(-1!==t)return this._data[t][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){const e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let t=0;while(t=this._bitArrays.length)return-1;const o=this._bitArrays[r],a=e-r*n,c=(o&1<0;if(!c)return-1;const u=this._bitArrays.slice(0,r).reduce(i,0),l=~(4294967295<=t)i.push(s);else if(i[0][0]<=t)i.unshift(s);else{const e=Math.round(i.length/2);this._data=i.slice(0,e).concat(s).concat(i.slice(e))}else this._data.push(s);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(o),this._changedData=!1}bitField(){const e=[];let t,r=8,n=0,i=0;const s=this._bitArrays.slice();while(s.length||n){0===n&&(t=s.shift(),n=7);const o=Math.min(n,r),a=~(255<>>=o,n-=o,r-=o,r&&(n||s.length)||(e.push(i),i=0,r=8)}for(var o=e.length-1;o>0;o--){const t=e[o];if(0!==t)break;e.pop()}return e}compactArray(){return this._sortData(),this._data.map(a)}}},"3ee6":function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},"3eed":function(e,t,r){"use strict";var n=r("53a8"),i=r("d8ab");e.exports=function(){var e=n.apply(null,arguments);return i(e,{bufferKeys:e.bufferKeys||!1,snapshots:e.snapshots||!1,permanence:e.permanence||!1,seek:e.seek||!1,clear:e.clear||!1,status:e.status||!1,createIfMissing:e.createIfMissing||!1,errorIfExists:e.errorIfExists||!1,deferredOpen:e.deferredOpen||!1,openCallback:e.openCallback||!1,promises:e.promises||!1,streams:e.streams||!1,encodings:e.encodings||!1,additionalMethods:n(e.additionalMethods)})}},"3f13":function(e,t,r){"use strict";const n=t;n.der=r("ebe6"),n.pem=r("b108")},"3f5a":function(e,t,r){"use strict";e.exports={drain:r("90de"),onEnd:r("acee"),log:r("19ff"),find:r("33b3"),reduce:r("ef02"),collect:r("f0c2"),concat:r("5b4a")}},"3f64":function(e,t,r){"use strict";const n=r("f106"),i=r("1a18"),s=r("ff59"),o=r("e3d5"),a=r("bd14"),c=r("41d6"),u=r("63e1"),l=n(r("49c5")),h=r("aa69");class f{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map}get empty(){return 0===this.blocks.size&&0===this.wantlist.size}addEntry(e,t,r){const n=e.toString("base58btc"),i=this.wantlist.get(n);i?(i.priority=t,i.cancel=Boolean(r)):this.wantlist.set(n,new h(e,t,r))}addBlock(e){const t=e.cid.toString("base58btc");this.blocks.set(t,e)}cancel(e){const t=e.toString("base58btc");this.wantlist.delete(t),this.addEntry(e,0,!0)}serializeToBitswap100(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},blocks:Array.from(this.blocks.values()).map(e=>e.data)};return this.full&&(e.wantlist.full=!0),l.Message.encode(e)}serializeToBitswap110(){const e={wantlist:{entries:Array.from(this.wantlist.values()).map(e=>({block:e.cid.buffer,priority:Number(e.priority),cancel:Boolean(e.cancel)}))},payload:[]};return this.full&&(e.wantlist.full=!0),this.blocks.forEach(t=>{e.payload.push({prefix:t.cid.prefix,data:t.data})}),l.Message.encode(e)}equals(e){const t=(e,t)=>{if(e.equals&&"function"===typeof e.equals)return e.equals(t)};return!(this.full!==e.full||!s(this.wantlist,e.wantlist,t)||!s(this.blocks,e.blocks,t))}get[Symbol.toStringTag](){const e=Array.from(this.wantlist.keys()),t=Array.from(this.blocks.keys());return`BitswapMessage `}}f.deserialize=async e=>{const t=l.Message.decode(e),r=t.wantlist&&t.wantlist.full||!1,n=new f(r);return t.wantlist&&t.wantlist.entries.forEach(e=>{const t=new o(e.block);n.addEntry(t,e.priority,e.cancel)}),t.blocks.length>0?(await Promise.all(t.blocks.map(async e=>{const t=await u(e,"sha2-256"),r=new o(t);n.addBlock(new i(e,r))})),n):t.payload.length>0?(await Promise.all(t.payload.map(async e=>{if(!e.prefix||!e.data)return;const t=c(e.prefix),r=t[0],s=t[1],l=t[2],h=await u(e.data,l),f=new o(r,a[s.toString("16")],h);n.addBlock(new i(e.data,f))})),n):n},f.Entry=h,e.exports=f},"3f6e":function(e){e.exports=JSON.parse('{"sha1":{"securityStrength":128,"outlen":160,"seedlen":440},"sha224":{"securityStrength":192,"outlen":224,"seedlen":440},"sha256":{"securityStrength":256,"outlen":256,"seedlen":440},"sha384":{"securityStrength":256,"outlen":384,"seedlen":888},"sha512":{"securityStrength":256,"outlen":512,"seedlen":888}}')},"3f70":function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},"3f74":function(e,t,r){"use strict";function n(e,t){const r={message:"Create a new 3Box profile\n\n- \nYour unique profile ID is "+e};return t&&(r.timestamp=Math.floor((new Date).getTime()/1e3),r.message+=" \nTimestamp: "+r.timestamp),r}function i(e,t){return{jsonrpc:"2.0",id:1,method:e,params:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.getConsentMessage=n,t.encodeRpcCall=i},"3faa":function(e,t,r){"use strict";const n=r("9efb"),i=r("33fc"),s=r("d3fa"),o=r("d1ae"),a=r("f277"),c=r("0841"),u=r("e24c").Connection,l=r("72af"),h=r("bc1b"),f=r("c59f"),d=r("1287").PROTOCOL_ID;class p{constructor(){this.conn=null,this.log=l.log.dialer()}handle(e,t){this.log("dialer handle conn"),t=f(t);const r=h(d,(r,n)=>{if(r)return t(r);this.log("handshake success"),this.conn=new u(n,e),t()},this.log);try{i(e,r,e)}catch(n){this.log.error(n),t(n)}}select(e,t){if(this.log("dialer select "+e),t=f(t),!this.conn)return t(new Error("multistream handshake has not finalized yet"));const r=h(e,(e,r)=>{if(e)return this.conn=new u(r,this.conn),t(e);t(null,new u(r,this.conn))},this.log);i(this.conn,r,this.conn)}ls(e){e=f(e);const t=h("ls",(t,r)=>{if(t)return e(t);i(r,c.decode(),g(r),s(y),o((t,r)=>{if(t)return e(t);e(null,r.slice(1))}))},this.log);i(this.conn,t,this.conn)}}function y(e){return e.toString().slice(0,-1)}function g(e){let t=!0,r=0;return a(e=>t?(n.decode(e),r=n.decode(e,n.decode.bytes),!0):r-- >0)}e.exports=p},"3faa9":function(e,t,r){"use strict";const n=r("0503"),i=r("4d9e"),s=r("6da9"),o=r("be69"),a={parents:!1,recursive:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256",shardSplitThreshold:1e3};e.exports=e=>async function(...t){Array.isArray(t[0])&&(t=t[0].concat(t.slice(1)));const{sources:r}=await i(e,t),c=n(t,a),u=r.map(e=>e.path).concat(c),l=r.slice(0,-1).map(e=>e.path).concat(Object.assign(c,{recursive:!0}));await s(e).apply(null,u),await o(e).apply(null,l)}},"3fd3":function(e,t,r){"use strict";const n=r("fa4d");e.exports=e=>n((t,r,n,i)=>{"function"!==typeof n||i||(i=n,n={}),"function"===typeof n&&"function"===typeof i&&(i=n,n={}),e({path:"dht/put",args:[t,r],qs:n},i)})},"3fd8":function(e,t,r){"use strict";(function(t){const n=r("34c0"),i=r("6874"),s=(e,r)=>{const s=r.key,o=n(s,t.from("/"));if(o.length<3)return;const a=e[o[1].toString()];if(!a){const e="Invalid record keytype";throw i(e,"ERR_INVALID_RECORD_KEY_TYPE")}return a.func(s,r.value)};e.exports={verifyRecord:s,validators:r("ec6f")}}).call(this,r("b639").Buffer)},"3ff7":function(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},4041:function(e,t,r){"use strict";t.ERR_WS_STAR_WEBSOCKET_CONNECTION="ERR_WS_STAR_WEBSOCKET_CONNECTION"},4064:function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("1c55"),s=r("416a"),o=r("26d5"),{fromNumberTo32BitBuf:a}=r("9c49"),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError(`${e} is not a supported algorithm`)}};e.exports={sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r("5a38")}},4069:function(e,t,r){"use strict";var n=r("bfbc"),i=r.n(n);i.a},"406d":function(e,t,r){"use strict";const n=r("0841"),i=r("c591"),s=r("09a4"),o=r("3f64"),a=r("c6c3"),c=r("f65f").logger,u="/ipfs/bitswap/1.0.0",l="/ipfs/bitswap/1.1.0";class h{constructor(e,t,r,n){this._log=c(e.peerInfo.id,"network"),r=r||{},this.libp2p=e,this.bitswap=t,this.b100Only=r.b100Only||!1,this._stats=n,this._running=!1}start(){this._running=!0,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this.libp2p.handle(u,this._onConnection),this.b100Only||this.libp2p.handle(l,this._onConnection),this.libp2p.on("peer:connect",this._onPeerConnect),this.libp2p.on("peer:disconnect",this._onPeerDisconnect),this.libp2p.peerBook.getAllArray().filter(e=>e.isConnected()).forEach(e=>this._onPeerConnect(e))}stop(){this._running=!1,this.libp2p.unhandle(u),this.b100Only||this.libp2p.unhandle(l),this.libp2p.removeListener("peer:connect",this._onPeerConnect),this.libp2p.removeListener("peer:disconnect",this._onPeerDisconnect)}_onConnection(e,t){this._running&&(this._log("incomming new bitswap connection: %s",e),i(t,n.decode(),i.asyncMap((e,t)=>s(o.deserialize)(e,t)),i.asyncMap((e,r)=>{t.getPeerInfo((t,n)=>{if(t)return r(t);s(this.bitswap._receiveMessage.bind(this.bitswap))(n.id,e,r)})}),i.onEnd(e=>{this._log("ending connection"),e&&this.bitswap._receiveError(e)})))}_onPeerConnect(e){this._running&&this.bitswap._onPeerConnected(e.id)}_onPeerDisconnect(e){this._running&&this.bitswap._onPeerDisconnected(e.id)}findProviders(e,t){return this.libp2p.contentRouting.findProviders(e,{maxTimeout:a.providerRequestTimeout,maxNumProviders:t})}async findAndConnect(e){const t=await this.findProviders(e,a.maxProvidersPerRequest);this._log("connecting to providers",t.map(e=>e.id.toB58String())),await Promise.all(t.map(e=>this.connectTo(e)))}async provide(e){await this.libp2p.contentRouting.provide(e)}async sendMessage(e,t){if(!this._running)throw new Error("network isn't running");const r=e.toB58String()?e.toB58String():e.id.toB58String();this._log("sendMessage to %s",r,t);const{conn:n,protocol:i}=await this._dialPeer(e);let s;switch(i){case u:s=t.serializeToBitswap100();break;case l:s=t.serializeToBitswap110();break;default:throw new Error("Unknown protocol: "+i)}f(n,s,this._log),this._updateSentStats(e,t.blocks)}async connectTo(e){if(!this._running)throw new Error("network isn't running");return this.libp2p.dial(e)}async _dialPeer(e){try{return{conn:await this.libp2p.dialProtocol(e,l),protocol:l}}catch(t){return{conn:await this.libp2p.dialProtocol(e,u),protocol:u}}}_updateSentStats(e,t){const r=e.toB58String();this._stats&&(t.forEach(e=>this._stats.push(r,"dataSent",e.data.length)),this._stats.push(r,"blocksSent",t.size))}}function f(e,t,r){i(i.values([t]),n.encode(),e.conn,i.onEnd(e=>{e&&r(e)}))}e.exports=h},"406d8":function(e,t,r){"use strict";e.exports="// An IPFS MerkleDAG Link\nmessage PBLink {\n\n // multihash of the target object\n optional bytes Hash = 1;\n\n // utf string name. should be unique per object\n optional string Name = 2;\n\n // cumulative size of target object\n optional uint64 Tsize = 3;\n}\n\n// An IPFS MerkleDAG Node\nmessage PBNode {\n\n // refs to other objects\n repeated PBLink Links = 2;\n\n // opaque user data\n optional bytes Data = 1;\n}"},4089:function(e,t,r){"use strict";var n=r("fbca"),i=r("bda8");e.exports=function(){var e=i();if(n.supportsDescriptors){var t=Object.getOwnPropertyDescriptor(e,"globalThis");(!t||t.configurable&&(t.enumerable||t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!1})}else"object"===typeof globalThis&&globalThis===e||(e.globalThis=e);return e}},"408a":function(e,t,r){var n=r("c6b6");e.exports=function(e){if("number"!=typeof e&&"Number"!=n(e))throw TypeError("Incorrect invocation");return+e}},"40a6":function(e,t){function r(e){return e&&"function"===typeof e.then}e.exports=r},"40b3":function(e,t,r){"use strict";const n=r("f69d"),i={16:"aes-128-ctr",32:"aes-256-ctr"};t.create=function(e,t,r){const s=i[e.length];if(!s)return r(new Error("Invalid key length"));const o=n.createCipheriv(s,e,t),a=n.createDecipheriv(s,e,t),c={encrypt(e,t){t(null,o.update(e))},decrypt(e,t){t(null,a.update(e))}};r(null,c)}},"40df":function(e,t,r){"use strict";e.exports=function(){var e,t;function r(r){if("function"!==typeof r)throw new Error("read must be function");if(e)throw new Error("already piped");if(e=r,t){var n=t;t=null,e.apply(null,n)}}function n(r,n){e?e(r,n):t=[r,n]}return{source:n,sink:r}}},"40e4":function(e,t,r){"use strict";const n=(e="")=>(e.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean);e.exports=n},"40ee":function(e,t,r){"use strict";const n=r("d4c4"),i=r("0503"),s=r("fd9e"),o=r("7048"),a={offset:0,length:1/0};e.exports=e=>function(t,r={}){return r=i(r,a),{[Symbol.asyncIterator]:async function*(){const i=await s(e,t),a=await n(i.mfsPath,e.ipld);if("file"!==a.unixfs.type)throw o(new Error(`${t} was not a file`),"ERR_NOT_FILE");if(!a.content)throw o(new Error(`Could not load content stream from ${t}`),"ERR_NO_CONTENT");for await(const e of a.content({offset:r.offset,length:r.length}))yield e}}}},4120:function(e,t){function r(e){return e!==e}e.exports=r},4128:function(e,t,r){var n=r("faa1"),i=r("3fb5");function s(e){if(!(this instanceof s))return new s(e);"number"===typeof e&&(e={max:e}),e||(e={}),n.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=e.max||1e3,this.maxAge=e.maxAge||0}e.exports=s,i(s,n.EventEmitter),Object.defineProperty(s.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),s.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},s.prototype.remove=function(e){if("string"!==typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];return delete this.cache[e],this._unlink(e,t.prev,t.next),t.value}},s.prototype._unlink=function(e,t,r){this.length--,0===this.length?this.head=this.tail=null:this.head===e?(this.head=t,this.cache[this.head].next=null):this.tail===e?(this.tail=r,this.cache[this.tail].prev=null):(this.cache[t].next=r,this.cache[r].prev=t)},s.prototype.peek=function(e){if(this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return t.value}},s.prototype.set=function(e,t){var r;if("string"!==typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){if(r=this.cache[e],r.value=t,this.maxAge&&(r.modified=Date.now()),e===this.head)return t;this._unlink(e,r.prev,r.next)}else r={value:t,modified:0,next:null,prev:null},this.maxAge&&(r.modified=Date.now()),this.cache[e]=r,this.length===this.max&&this.evict();return this.length++,r.next=null,r.prev=this.head,this.head&&(this.cache[this.head].next=e),this.head=e,this.tail||(this.tail=e),t},s.prototype._checkAge=function(e,t){return!(this.maxAge&&Date.now()-t.modified>this.maxAge)||(this.remove(e),this.emit("evict",{key:e,value:t.value}),!1)},s.prototype.get=function(e){if("string"!==typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return this.head!==e&&(e===this.tail?(this.tail=t.next,this.cache[this.tail].prev=null):this.cache[t.prev].next=t.next,this.cache[t.next].prev=t.prev,this.cache[this.head].next=e,t.prev=this.head,t.next=null,this.head=e),t.value}},s.prototype.evict=function(){if(this.tail){var e=this.tail,t=this.remove(this.tail);this.emit("evict",{key:e,value:t})}}},4160:function(e,t,r){"use strict";var n=r("23e7"),i=r("17c2");n({target:"Array",proto:!0,forced:[].forEach!=i},{forEach:i})},"416a":function(e,t,r){e.exports=r("24d2")},4172:function(e,t,r){"use strict";(function(t){const n=r("b1aa"),{Message:i}=r("b317"),s=t.from("libp2p-pubsub:");function o(e,r,n){const o=t.concat([s,i.encode(r)]);e.privKey.sign(o,(t,i)=>{if(t)return n(t);n(null,{...r,signature:i,key:e.pubKey.bytes})})}function a(e,r){let n={...e};delete n.signature,delete n.key;const o=t.concat([s,i.encode(n)]);c(e,(t,n)=>{if(t)return r(t,!1);n.verify(o,e.signature,r)})}function c(e,t){if(e.key)n.createFromPubKey(e.key,(r,n)=>r?t(r,null):n.isEqual(e.from)?t(null,n.pubKey):void t(new Error("Public Key does not match the originator")));else{{const r=n.createFromBytes(e.from);if(r.pubKey)return t(null,r.pubKey)}t(new Error("Could not get the public key from the originator id"))}}e.exports={messagePublicKey:c,signMessage:o,SignPrefix:s,verifySignature:a}}).call(this,r("b639").Buffer)},"41b8":function(e,t,r){"use strict";const n=r("ae33").Reporter,i=r("0617").EncoderBuffer,s=r("0617").DecoderBuffer,o=r("da3e"),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],c=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),u=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function l(e,t,r){const n={};this._baseState=n,n.name=r,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n["default"]=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}e.exports=l;const h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];l.prototype.clone=function(){const e=this._baseState,t={};h.forEach((function(r){t[r]=e[r]}));const r=new this.constructor(t.parent);return r._baseState=t,r},l.prototype._wrap=function(){const e=this._baseState;c.forEach((function(t){this[t]=function(){const r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},l.prototype._init=function(e){const t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),o.equal(t.children.length,1,"Root node can have only one child")},l.prototype._useArgs=function(e){const t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(o(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(o(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!==typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r})),t})))},u.forEach((function(e){l.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),a.forEach((function(e){l.prototype[e]=function(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}})),l.prototype.use=function(e){o(e);const t=this._baseState;return o(null===t.use),t.use=e,this},l.prototype.optional=function(){const e=this._baseState;return e.optional=!0,this},l.prototype.def=function(e){const t=this._baseState;return o(null===t["default"]),t["default"]=e,t.optional=!0,this},l.prototype.explicit=function(e){const t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},l.prototype.implicit=function(e){const t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},l.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},l.prototype.key=function(e){const t=this._baseState;return o(null===t.key),t.key=e,this},l.prototype.any=function(){const e=this._baseState;return e.any=!0,this},l.prototype.choice=function(e){const t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},l.prototype.contains=function(e){const t=this._baseState;return o(null===t.use),t.contains=e,this},l.prototype._decode=function(e,t){const r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));let n,i=r["default"],o=!0,a=null;if(null!==r.key&&(a=e.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(o=this._peekTag(e,n,r.any),e.isError(o))return o}else{const n=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),o=!0}catch(c){o=!1}e.restore(n)}}if(r.obj&&o&&(n=e.enterObject()),o){if(null!==r.explicit){const t=this._decodeTag(e,r.explicit);if(e.isError(t))return t;e=t}const n=e.offset;if(null===r.use&&null===r.choice){let t;r.any&&(t=e.save());const n=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(n))return n;r.any?i=e.raw(t):e=n}if(t&&t.track&&null!==r.tag&&t.track(e.path(),n,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new s(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(n,t)}}return r.obj&&o&&(i=e.leaveObject(n)),null===r.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,r.key,i),i},l.prototype._decodeGeneric=function(e,t,r){const n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},l.prototype._getUse=function(e,t){const r=this._baseState;return r.useDecoder=this._use(e,t),o(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},l.prototype._decodeChoice=function(e,t){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(s){const o=e.save(),a=r.choice[s];try{const r=a._decode(e,t);if(e.isError(r))return!1;n={type:s,value:r},i=!0}catch(c){return e.restore(o),!1}return!0}),this),i?n:e.error("Choice not matched")},l.prototype._createEncoderBuffer=function(e){return new i(e,this.reporter)},l.prototype._encode=function(e,t,r){const n=this._baseState;if(null!==n["default"]&&n["default"]===e)return;const i=this._encodeValue(e,t,r);return void 0===i||this._skipDefault(i,t,r)?void 0:i},l.prototype._encodeValue=function(e,t,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);let s=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i["default"])return;e=i["default"]}let o=null,a=!1;if(i.any)s=this._createEncoderBuffer(e);else if(i.choice)s=this._encodeChoice(e,t);else if(i.contains)o=this._getUse(i.contains,r)._encode(e,t),a=!0;else if(i.children)o=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");const n=t.enterKey(r._baseState.key);if("object"!==typeof e)return t.error("Child expected, but input is not object");const i=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),i}),this).filter((function(e){return e})),o=this._createEncoderBuffer(o);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,o=this._createEncoderBuffer(e.map((function(r){const n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)}),r))}else null!==i.use?s=this._getUse(i.use,r)._encode(e,t):(o=this._encodePrimitive(i.tag,e),a=!0);if(!i.any&&null===i.choice){const e=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===e?null===i.use&&t.error("Tag could be omitted only for .use()"):null===i.use&&(s=this._encodeComposite(e,a,r,o))}return null!==i.explicit&&(s=this._encodeComposite(i.explicit,!1,"context",s)),s},l.prototype._encodeChoice=function(e,t){const r=this._baseState,n=r.choice[e.type];return n||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},l.prototype._encodePrimitive=function(e,t){const r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},l.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},l.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},"41d6":function(e,t,r){"use strict";(function(t){const n=r("9efb");e.exports=e=>{if(!t.isBuffer(e))throw new Error("arg needs to be a buffer");let r=[];while(e.length>0){const t=n.decode(e);r.push(t),e=e.slice(n.decode.bytes)}return r}}).call(this,r("b639").Buffer)},"41dd":function(e,t,r){"use strict";const n=r("b5bc"),i=r("9a72"),s=r("f929"),o=r("fa2f"),a=r("fa4d"),c=r("be41"),u=r("7048"),l="/pkcs8/",h="/info/",f={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},d={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function p(e){return!!e&&("string"===typeof e&&e===n(e.trim()))}async function y(e){const t=200,r=1e3,n=Math.random()*(r-t)+t;throw await new Promise(e=>setTimeout(e,n)),e}function g(e){return new o.Key(l+e)}function m(e){return new o.Key(h+e)}class b{constructor(e,t){if(!e)throw new Error("store is required");this.store=e;const r=i(d,t);if(!r.passPhrase||r.passPhrase.length<20)throw new Error("passPhrase must be least 20 characters");if(r.dek.keyLengthn})}get cms(){return new c(this)}static generateOptions(){const e=Object.assign({},d),t=3*Math.ceil(f.minSaltLength/3);return e.dek.salt=s.randomBytes(t).toString("base64"),e}static get options(){return d}async createKey(e,t,r){const n=this;if(!p(e)||"self"===e)return y(u(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if("string"!==typeof t)return y(u(new Error(`Invalid key type '${t}'`),"ERR_INVALID_KEY_TYPE"));if(!Number.isSafeInteger(r))return y(u(new Error(`Invalid key size '${r}'`),"ERR_INVALID_KEY_SIZE"));const i=g(e),o=await n.store.has(i);if(o)return y(u(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));switch(t.toLowerCase()){case"rsa":if(r<2048)return y(u(new Error(`Invalid RSA key size ${r}`),"ERR_INVALID_KEY_SIZE"));break;default:break}let c;try{const o=await a(s.keys.generateKeyPair,{context:s.keys})(t,r),u=await a(o.id,{context:o})(),l=await a(o.export,{context:o})(this._());c={name:e,id:u};const h=n.store.batch();h.put(i,l),h.put(m(e),JSON.stringify(c)),await h.commit()}catch(l){return y(l)}return c}async listKeys(){const e=this,t={prefix:h},r=[];for await(const n of e.store.query(t))r.push(JSON.parse(n.value));return r}async findKeyById(e){try{const t=await this.listKeys();return t.find(t=>t.id===e)}catch(t){return y(t)}}async findKeyByName(e){if(!p(e))return y(u(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const t=m(e);try{const e=await this.store.get(t);return JSON.parse(e.toString())}catch(r){return y(u(new Error(`Key '${e}' does not exist. ${r.message}`),"ERR_KEY_NOT_FOUND"))}}async removeKey(e){const t=this;if(!p(e)||"self"===e)return y(u(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const r=g(e),n=await t.findKeyByName(e),i=t.store.batch();return i.delete(r),i.delete(m(e)),await i.commit(),n}async renameKey(e,t){const r=this;if(!p(e)||"self"===e)return y(u(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!p(t)||"self"===t)return y(u(new Error(`Invalid new key name '${t}'`),"ERR_NEW_KEY_NAME_INVALID"));const n=g(e),i=g(t),s=m(e),o=m(t),a=await r.store.has(i);if(a)return y(u(new Error(`Key '${t}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{let e=await this.store.get(n);const a=e.toString();e=await r.store.get(s);const c=JSON.parse(e.toString());c.name=t;const u=r.store.batch();return u.put(i,a),u.put(o,JSON.stringify(c)),u.delete(n),u.delete(s),await u.commit(),c}catch(c){return y(c)}}async exportKey(e,t){if(!p(e))return y(u(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return y(u(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));const r=g(e);try{const e=await this.store.get(r),n=e.toString(),i=await a(s.keys.import,{context:s.keys})(n,this._());return a(i.export,{context:i})(t)}catch(n){return y(n)}}async importKey(e,t,r){const n=this;if(!p(e)||"self"===e)return y(u(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return y(u(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED"));const i=g(e),o=await n.store.has(i);if(o)return y(u(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));let c,l;try{c=await a(s.keys.import,{context:s.keys})(t,r)}catch(d){return y(u(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"))}try{l=await a(c.id,{context:c})(),t=await a(c.export,{context:c})(this._())}catch(d){return y(d)}const h={name:e,id:l},f=n.store.batch();return f.put(i,t),f.put(m(e),JSON.stringify(h)),await f.commit(),h}async importPeer(e,t){const r=this;if(!p(e))return y(u(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t||!t.privKey)return y(u(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));const n=t.privKey,i=g(e),s=await r.store.has(i);if(s)return y(u(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{const t=await a(n.id,{context:n})(),s=await a(n.export,{context:n})(this._()),o={name:e,id:t},c=r.store.batch();return c.put(i,s),c.put(m(e),JSON.stringify(o)),await c.commit(),o}catch(o){return y(o)}}async _getPrivateKey(e){if(!p(e))return y(u(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));try{const t=g(e),r=await this.store.get(t);return r.toString()}catch(t){return y(u(new Error(`Key '${e}' does not exist. ${t.message}`),"ERR_KEY_NOT_FOUND"))}}}e.exports=b},"41f2":function(e,t,r){var n=r("4bbf"),i=r("54bc"),s=r("04e4"),o=r("7a85"),a=r("9071");function c(e){var t=-1,r=null==e?0:e.length;this.clear();while(++t{for(const r of t){let t,n=e;while(void 0===t){if(n=Object.getPrototypeOf(n),null===n)throw new Error(`no getter named '${r}' found`);t=Object.getOwnPropertyDescriptor(n,r)}if(void 0===t.get)throw new Error(`no getter named '${r}' found`);Object.defineProperty(e,r,{enumerable:!0,get:t.get})}},i=e=>{for(const t in e)"_"===t[0]&&Object.defineProperty(e,t,{enumerable:!1})};e.exports={addEnumerableGetters:n,hidePrivateFields:i}},4223:function(e,t,r){"use strict";const n=t;n._reverse=function(e){const t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);const n=e[r];t[n]=r})),t},n.der=r("f1cb")},"427a":function(e,t,r){(function(t){(function(t,r){"use strict";e.exports?e.exports=r():t.nacl?t.nacl.util=r():(t.nacl={},t.nacl.util=r())})(this,(function(){"use strict";var e={};function r(e){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(e){if("string"!==typeof e)throw new TypeError("expected string");var t,r=unescape(encodeURIComponent(e)),n=new Uint8Array(r.length);for(t=0;t=255)throw new TypeError("Alphabet too long");var t=new Uint8Array(256);t.fill(255);for(var r=0;r>>0,h=new Uint8Array(l);while(s!==c){for(var f=t[s],d=0,p=l-1;(0!==f||d>>0,h[p]=f%o>>>0,f=f/o>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,s++}var y=l-i;while(y!==l&&0===h[y])y++;for(var g=a.repeat(r);y>>0,l=new Uint8Array(u);while(e[r]){var h=t[e.charCodeAt(r)];if(255===h)return;for(var f=0,d=u-1;(0!==h||f>>0,l[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");s=f,r++}if(" "!==e[r]){var p=u-s;while(p!==u&&0===l[p])p++;var y=n.allocUnsafe(i+(u-p));y.fill(0,0,i);var g=i;while(p!==u)y[g++]=l[p++];return y}}}function f(e){var t=h(e);if(t)return t;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:h,decode:f}}e.exports=i},"42b7":function(e,t,r){"use strict";(function(t){const n=r("021d"),i=r("87dd"),s="/",o=t.from(s),a=o[0];class c{constructor(e,r){if("string"===typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==r&&(r=!0),r&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new h(e.join(s))}static random(){return new h(n().replace(/-/g,""))}clean(){this._buf&&0!==this._buf.length||(this._buf=t.from(s)),this._buf[0]!==a&&(this._buf=t.concat([o,this._buf]));while(this._buf.length>1&&this._buf[this._buf.length-1]===a)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;ni)return!1}return t.length0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";var t=this.head,r=""+t.data;while(t=t.next)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return l.alloc(0);var t=l.allocUnsafe(e>>>0),r=this.head,n=0;while(r)p(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(s===i.length?n+=i:n+=i.slice(0,e),e-=s,0===e){s===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),r=this.head,n=1;r.data.copy(t),e-=r.data.length;while(r=r.next){var i=r.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),e-=s,0===e){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,t}},{key:d,value:function(e,t){return f(this,i({},t,{depth:0,customInspect:!1}))}}]),e}()},4338:function(e,t,r){"use strict";var n=r("0286");function i(e,t,r){null===e&&null===t&&null===r?(this.x=i.one,this.y=i.one,this.z=i.zero):(this.x=e,this.y=t,this.z=r),this.zOne=this.z===i.one}i.zero=n.fromNumber(0),i.one=n.fromNumber(1),i.prototype.neg=function(){return this.inf?this:new i(this.x,this.y.redNeg(),this.z)},i.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(r),o=this.y.redMul(t).redMul(e.z),a=e.y.redMul(r).redMul(this.z),c=n.redSub(s),u=o.redSub(a);if(c.isZero())return u.isZero()?this.dbl():new i(null,null,null);var l=c.redSqr(),h=n.redMul(l),f=l.redMul(c),d=u.redSqr().redIAdd(f).redISub(h).redISub(h),p=u.redMul(h.redISub(d)).redISub(o.redMul(f)),y=this.z.redMul(e.z).redMul(c);return new i(d,p,y)},i.prototype.mixedAdd=function(e){if(this.inf)return e.toECJPoint();if(e.inf)return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),c=s.redSub(o);if(a.isZero())return c.isZero()?this.dbl():new i(null,null,null);var u=a.redSqr(),l=r.redMul(u),h=u.redMul(a),f=c.redSqr().redIAdd(h).redISub(l).redISub(l),d=c.redMul(l.redISub(f)).redISub(s.redMul(h)),p=this.z.redMul(a);return new i(f,d,p)},i.prototype.dbl=function(){if(this.inf)return this;var e,t,r;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),a=this.x.redAdd(s).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var c=n.redAdd(n).redIAdd(n),u=c.redSqr().redISub(a).redISub(a),l=o.redIAdd(o).redIAdd(o).redIAdd(o);e=u,t=c.redMul(a.redISub(u)).redISub(l),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),f=this.y.redSqr(),d=f.redSqr(),p=this.x.redAdd(f).redSqr().redISub(h).redISub(d);p=p.redIAdd(p);var y=h.redAdd(h).redIAdd(h),g=y.redSqr(),m=d.redIAdd(d).redIAdd(d).redIAdd(d);e=g.redISub(p).redISub(p),t=y.redMul(p.redISub(e)).redISub(m),r=this.y.redMul(this.z),r=r.redIAdd(r)}return new i(e,t,r)},i.prototype.dblp=function(e){if(0===e||this.inf)return this;for(var t=this,r=0;ri(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}}).call(this,r("b639").Buffer)},4404:function(e,t,r){"use strict";const n={util:r("8d3f"),pki:r("96f7"),jsbn:r("fdf7")};function i(e){var t=n.util.decode64((e+"===".slice((e.length+3)%4)).replace(/-/g,"+").replace(/_/g,"/"));return new n.jsbn.BigInteger(n.util.bytesToHex(t),16)}function s(e,t){return t.map(t=>i(e[t]))}function o(e){return n.pki.setRsaPrivateKey(...s(e,["n","e","d","p","q","dp","dq","qi"]))}function a(e){return n.pki.privateKeyToPem(o(e))}function c(e){return n.pki.setRsaPublicKey(...s(e,["n","e"]))}function u(e){return n.pki.publicKeyToPem(c(e))}e.exports={jwk2pub:c,jwk2pubPem:u,jwk2priv:o,jwk2privPem:a}},4406:function(e,t,r){var n=r("5303");function i(e){return null==e?"":n(e)}e.exports=i},4434:function(e,t,r){"use strict";var n=r("4ea4"),i=n(r("a34a")),s=n(r("9523")),o=n(r("c973")),a=n(r("970b")),c=n(r("5bc3"));function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t1&&void 0!==o[1]?o[1]:{},e.next=3,this._get(t);case 3:if(n=e.sent,n){e.next=6;break}return e.abrupt("return",n);case 6:if(!r.metadata){e.next=9;break}return s=this._extractMetadata(n),e.abrupt("return",l({},s,{value:n.value}));case 9:return e.abrupt("return",n.value);case 10:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getMetadata",value:function(){var e=(0,o["default"])(i["default"].mark((function e(t){var r;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._get(t);case 2:if(r=e.sent,r){e.next=5;break}return e.abrupt("return",r);case 5:return e.abrupt("return",this._extractMetadata(r));case 6:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"set",value:function(){var e=(0,o["default"])(i["default"].mark((function e(t,r){var n;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return f(t,"key"),this._requireLoad(),this._replicator.ensureConnected(this._db.address.toString()),n=(new Date).getTime(),e.next=6,this._db.put(t,{value:r,timeStamp:n});case 6:return e.abrupt("return",!0);case 7:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setMultiple",value:function(){var e=(0,o["default"])(i["default"].mark((function e(t,r){var n=this;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return d(t,r),this._requireLoad(),this._replicator.ensureConnected(this._db.address.toString()),e.prev=3,e.next=6,t.reduce(function(){var e=(0,o["default"])(i["default"].mark((function e(t,s,o){var a;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t;case 2:return f(s,"key"),a=(new Date).getTime(),e.abrupt("return",n._db.put(s,{value:r[o],timeStamp:a}));case 5:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),Promise.resolve());case 6:return e.abrupt("return",!0);case 9:throw e.prev=9,e.t0=e["catch"](3),new Error(e.t0);case 12:case"end":return e.stop()}}),e,this,[[3,9]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"remove",value:function(){var e=(0,o["default"])(i["default"].mark((function e(t){return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return f(t,"key"),this._requireLoad(),this._replicator.ensureConnected(this._db.address.toString()),e.next=5,this._db.del(t);case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_extractMetadata",value:function(e){var t=Math.floor(e.timeStamp/1e3);return{timestamp:t}}},{key:"_get",value:function(){var e=(0,o["default"])(i["default"].mark((function e(t){return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this._requireLoad(),e.abrupt("return",this._db.get(t));case 2:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_sync",value:function(){var e=(0,o["default"])(i["default"].mark((function e(){return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this._requireLoad(),e.next=3,this._replicator.syncDB(this._db);case 3:return e.abrupt("return",this._db.address.toString());case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_load",value:function(){var e=(0,o["default"])(i["default"].mark((function e(t){var r,n,s,o=this;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._3id=t||this._3id,r=this._replicator.listStoreAddresses().find((function(e){return e.includes(o._name)})),!r){e.next=8;break}return e.next=5,this._replicator.getStore(r);case 5:this._db=e.sent,e.next=14;break;case 8:return e.next=10,this._3id.getPublicKeys(this._space,!0);case 10:return n=e.sent.signingKey,e.next=13,this._replicator.addKVStore(this._name,n,Boolean(this._space),this._3id.getSubDID(this._space));case 13:this._db=e.sent;case 14:return e.next=16,this._3id.getOdbId(this._space);case 16:return s=e.sent,this._db.setIdentity(s),e.abrupt("return",this._db.address.toString());case 19:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_requireLoad",value:function(){if(!this._db)throw new Error("_load must be called before interacting with the store")}},{key:"close",value:function(){var e=(0,o["default"])(i["default"].mark((function e(){return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this._requireLoad(),e.next=3,this._db.close();case 3:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"all",value:function(){var e=(0,o["default"])(i["default"].mark((function e(){var t,r,n,s=this,o=arguments;return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},this._requireLoad(),r=this._db.all,n={},Object.keys(r).map((function(e){var i=r[e];t.metadata?n[e]=l({},s._extractMetadata(i),{value:i.value}):n[e]=i.value})),e.abrupt("return",n);case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"log",value:function(){var e=(0,o["default"])(i["default"].mark((function e(){return i["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",this._db._oplog.values.map((function(e){return{op:e.payload.op,key:e.payload.key,value:e.payload.value?e.payload.value.value:null,timeStamp:e.payload.value?e.payload.value.timeStamp:null}})));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}]),e}();e.exports=p},4442:function(e,t,r){var n=r("3053"),i=n.Global;e.exports={name:"oldIE-userDataStorage",write:u,read:l,each:h,remove:f,clearAll:d};var s="storejs",o=i.document,a=g(),c=(i.navigator?i.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function u(e,t){if(!c){var r=y(e);a((function(e){e.setAttribute(r,t),e.save(s)}))}}function l(e){if(!c){var t=y(e),r=null;return a((function(e){r=e.getAttribute(t)})),r}}function h(e){a((function(t){for(var r=t.XMLDocument.documentElement.attributes,n=r.length-1;n>=0;n--){var i=r[n];e(t.getAttribute(i.name),i.name)}}))}function f(e){var t=y(e);a((function(e){e.removeAttribute(t),e.save(s)}))}function d(){a((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(s);for(var r=t.length-1;r>=0;r--)e.removeAttribute(t[r].name);e.save(s)}))}var p=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function y(e){return e.replace(/^\d/,"___$&").replace(p,"___")}function g(){if(!o||!o.documentElement||!o.documentElement.addBehavior)return null;var e,t,r,n="script";try{t=new ActiveXObject("htmlfile"),t.open(),t.write("<"+n+">document.w=window'),t.close(),e=t.w.frames[0].document,r=e.createElement("div")}catch(i){r=o.createElement("div"),e=o.body}return function(t){var n=[].slice.call(arguments,0);n.unshift(r),e.appendChild(r),r.addBehavior("#default#userData"),r.load(s),t.apply(this,n),e.removeChild(r)}}},"445d":function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r("bd4b");function i(t,r){return void 0===r&&(r="utf8"),e.isBuffer(t)?a(t.toString("base64")):a(e.from(t,r).toString("base64"))}function s(t,r){return void 0===r&&(r="utf8"),e.from(o(t),"base64").toString(r)}function o(e){return e=e.toString(),n.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function a(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(t){return e.from(o(t),"base64")}var u=i;u.encode=i,u.decode=s,u.toBase64=o,u.fromBase64=a,u.toBuffer=c,t.default=u}).call(this,r("b639").Buffer)},"448a":function(e,t,r){var n=r("2236"),i=r("11b0"),s=r("0676");function o(e){return n(e)||i(e)||s()}e.exports=o},"449a":function(e,t,r){"use strict";(function(t){const n=r("c591"),i=r("76d6"),s=r("ecd4"),o=r("e028"),a=r("9f2e"),c=r("faa1"),u=r("4bc2"),{emitError:l,emitStream:h}=r("2388"),{Types:f,MAX_MSG_SIZE:d}=r("d27a"),p=r("f574"),y=r("d5453"),g=u("pull-plex");g.err=u("pull-plex:err");class m extends c{constructor(e){super(),"boolean"===typeof e&&(e={initiator:e}),e={initiator:!0,onChan:null,maxChannels:1e4,maxMsgSize:d,lazy:!1,...e},this._maxChannels=e.maxChannels,this._maxMsgSize=e.maxMsgSize,this._lazy=e.lazy,this._initiator=Boolean(e.initiator),this._chanId=0,this._inChannels=new Array(this._maxChannels/2),this._outChannels=new Array(this._maxChannels/2),this._endedRemote=!1,this._endedLocal=!1,this._chandata=i(e=>{this._log("mplex ended"),this._endedRemote=!0,this.close(e)}),e.onChan&&this.on("stream",t=>e.onChan(t,t.id)),this.source=n(this._chandata,y.encode());const t=this;this.sink=n(s((function(e){if(e&&e.length>=t._maxMsgSize)return a(l,t,new Error("message too large!")),this.queue(null);this.queue(e)})),y.decode(),e=>{const r=o(()=>{e(null,(e,n)=>{if(!t._endedLocal){if(!0===e)return t.close();if(e)return t.destroy(e);t._handle(n),r()}})});r()})}_log(e,t){g({op:e,initiator:this._initiator,endedLocal:this._endedLocal,endedRemote:this._endedRemote,data:t&&t.toString()||""})}get initiator(){return this._initiator}close(e){if(this._log("close",e),this.destroyed)return;e&&a(l,this,e),e=e||"Underlying stream has been closed",this._endedLocal=!0;const t=Array.prototype.concat(this._outChannels,this._inChannels);for(let r of t)r&&r.close(e);this.emit("close")}get destroyed(){return this._endedRemote&&this._endedLocal}destroy(e){e=e||new Error("Underlying stream has been closed"),this._chandata.end(e),this.close(e)}push(e){e.data&&t.byteLength(e.data)>this._maxMsgSize&&this._chandata.end(new Error("message too large!")),this._chandata.push(e)}createStream(e){"number"===typeof e&&(e=e.toString());const t=this._newStream(null,!0,!1,e,this._outChannels);return this._lazy||t.openChan(e),t}_newStream(e,t,r,n,i){if(this.chanSize>=this._maxChannels)return void this.emit("error",new Error("max channels exceeded"));if("string"===typeof t&&(n=t,t=!1,r=!1),"string"===typeof r&&(n=r,r=!1),e="number"===typeof e?e:this._chanId++,i[e])return void this.emit("error",new Error(`channel with id ${e} already exist!`));const s=new p({id:e,name:n,plex:this,initiator:t,open:r||!1});return this._addChan(e,s,i)}_addChan(e,t,r){return t.once("close",()=>{r[e]=null}),t.once("error",e=>{g.err("channel error",e)}),r[e]=t,t}get chanSize(){return this._inChannels.size+this._outChannels.size}_handle(e){this._log("_handle",e);const{id:t,type:r,data:n}=e;switch(r){case f.NEW:{const e=this._newStream(t,!1,!0,n.toString(),this._inChannels);a(h,this,e,t);break}case f.OUT_MESSAGE:case f.IN_MESSAGE:{const e=1&r?this._outChannels:this._inChannels,i=e[t];i&&i.push(n);break}case f.OUT_CLOSE:case f.IN_CLOSE:{const e=1&r?this._outChannels:this._inChannels,n=e[t];n&&n.close();break}case f.OUT_RESET:case f.IN_RESET:{const e=1&r?this._outChannels:this._inChannels,n=e[t];n&&n.destroy();break}default:a(l,this,new Error("Invalid message type"))}}}e.exports=m}).call(this,r("b639").Buffer)},"44bd":function(e,t,r){"use strict";const n=r("faa1"),i=r("3e1e"),s=r("71ad"),o=r("83f1"),a=r("f5be"),c=r("6d6a"),u=r("d7fa");e.exports=class extends n{constructor(e,t,r){super(),this._id=e,this._ipfs=t,this._room=r,this._connection=null,this._connecting=!1}push(e){this._connection?this._connection.push(a(e)):(this.once("connect",()=>this.push(e)),this._connecting||this._getConnection())}stop(){this._connection&&this._connection.end()}_getConnection(){this._connecting=!0,this._getPeerAddresses(this._id,(e,t)=>{e?this.emit("error",e):t.length?u(this._ipfs).dialProtocol(t[0],o,(e,t)=>{if(e)return void this.emit("disconnect");this._connecting=!1;const r=s();this._connection=r,i(r,t,i.onEnd(()=>{delete this._connection,this.emit("disconnect")})),this.emit("connect",r)}):this.emit("disconnect")})}_getPeerAddresses(e,t){this._ipfs.swarm.peers((r,n)=>{r?t(r):t(null,n.filter(t=>c(t.peer)===e).map(e=>e.peer))})}}},4503:function(e,t,r){"use strict";e.exports=function(e){if(!Array.isArray(e))throw new TypeError("Expected Array, got "+typeof e);var t,r,n=e.length,i=e.slice();while(n)t=Math.floor(Math.random()*n--),r=i[n],i[n]=i[t],i[t]=r;return i}},4514:function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},4547:function(e,t,r){"use strict";const n=r("4d31");e.exports.dbOpenFailedError=e=>(e=e||new Error("Cannot open database"),n(e,"ERR_DB_OPEN_FAILED")),e.exports.dbDeleteFailedError=e=>(e=e||new Error("Delete failed"),n(e,"ERR_DB_DELETE_FAILED")),e.exports.dbWriteFailedError=e=>(e=e||new Error("Write failed"),n(e,"ERR_DB_WRITE_FAILED")),e.exports.notFoundError=e=>(e=e||new Error("Not Found"),n(e,"ERR_NOT_FOUND"))},4559:function(e,t,r){"use strict";const n=r("092e");e.exports=e=>{const t=n(e);return{get:r("e587")(t),put:r("3fd3")(t),findProvs:r("4c7e")(t),findPeer:r("b0e9")(t),provide:r("bf4d")(t),query:r("493a")(t)}}},4562:function(e,t,r){"use strict";(function(t){const n=r("0bc9");e.exports=function(e){return function(t){return t instanceof i?t:new i(t,e)}};class i{constructor(e,r){if("string"!==typeof e&&!t.isBuffer(e))throw new Error("can only hash strings or buffers");this._value=e,this._hashFn=r,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let t=e;while(this._availableBits0){const e=this._buffers[this._currentBufferIndex],n=Math.min(e.availableBits(),t),i=e.take(n);r=(r<0){const e=this._buffers[this._currentBufferIndex],r=Math.min(e.totalBits()-e.availableBits(),t);e.untake(r),t-=r,this._availableBits+=r,this._currentBufferIndex>0&&e.totalBits()===e.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;const e=this._depth?this._value+this._depth:this._value,t=await this._hashFn(e),r=new n(t);this._buffers.push(r),this._availableBits+=r.availableBits()}}}).call(this,r("b639").Buffer)},4573:function(e,t,r){"use strict";const n=r("09a4"),i=r("7048"),s=r("19e5"),{resolvePath:o}=r("ad58"),a=r("22df"),c=a.PinTypes;e.exports=e=>{const t=e.dag,r=new a(e._repo,t),u={add:n.variadic(async(n,i)=>{i=i||{};const s=!1!==i.recursive,a=await o(e.object,n),c=async()=>{const e=[];for(const o of a){const n=o.toBaseEncodedString();if(s){if(r.recursivePins.has(n)){e.push(n);continue}await r.fetchCompleteDag(n,{preload:i.preload}),e.push(n)}else{if(r.recursivePins.has(n))throw new Error(`${n} already pinned recursively`);r.directPins.has(n)||await t.get(o,{preload:i.preload}),e.push(n)}}const n=s?r.recursivePins:r.directPins;return e.forEach(e=>n.add(e)),await r.flushPins(),e.map(e=>({hash:e}))},u=Boolean(i.lock);if(!u)return c();const l=await e._gcLock.readLock();try{await c()}finally{l()}}),rm:n.variadic(async(t,n)=>{n=n||{};const a=null==n.recursive||n.recursive;if(n.cidBase&&!s.names.includes(n.cidBase))throw i(new Error("invalid multibase"),"ERR_INVALID_MULTIBASE");const u=await o(e.object,t),l=await e._gcLock.readLock(),h=[];try{for(const e of u){const t=await r.isPinnedWithType(e,c.all),{pinned:n,reason:i}=t,s=e.toBaseEncodedString();if(!n)throw new Error(`${s} is not pinned`);switch(i){case c.recursive:if(!a)throw new Error(`${s} is pinned recursively`);h.push(s);break;case c.direct:h.push(s);break;default:throw new Error(`${s} is pinned indirectly under ${i}`)}}return h.forEach(e=>{a&&r.recursivePins.has(e)?r.recursivePins.delete(e):r.directPins.delete(e)}),await r.flushPins(),e.log(`Removed pins: ${h}`),h.map(e=>({hash:e}))}finally{l()}}),ls:n.variadic(async(t,n)=>{n=n||{};let i=c.all;if(t&&t.type&&(n=t,t=null),n.type){i=n.type,"string"===typeof n.type&&(i=n.type.toLowerCase());const e=a.checkPinType(i);if(e)throw e}if(t){const n=await o(e.object,t),s=[];for(const e of n){const{key:t,reason:n,pinned:o}=await r.isPinnedWithType(e,i);if(o)switch(n){case c.direct:case c.recursive:s.push({hash:t,type:n});break;default:s.push({hash:t,type:`${c.indirect} through ${n}`})}}if(!s.length)throw new Error(`path '${t}' is not pinned`);return s}let s=[];if(i!==c.direct&&i!==c.all||(s=s.concat(Array.from(r.directPins).map(e=>({type:c.direct,hash:e})))),i!==c.recursive&&i!==c.all||(s=s.concat(Array.from(r.recursivePins).map(e=>({type:c.recursive,hash:e})))),i===c.indirect||i===c.all){const e=await r.getIndirectKeys(n);return s=s.filter(({hash:t})=>!e.includes(t)||e.includes(t)&&!r.directPins.has(t)).concat(e.map(e=>({type:c.indirect,hash:e}))),s}return s}),pinManager:r};return u}},"45b0":function(e,t,r){const n=r("924f");e.exports=class{constructor(e){this.hwm=e||16,this.head=new n(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new n(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}},"45d0":function(e,t,r){"use strict";const n=r("df7c"),i=r("3c43"),s=r("021d");t.filter=(e,t)=>async function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},"45f5":function(e,t,r){"use strict";e.exports=function(e){var t=0;return e=e||1/0,function(r,n){return r?n&&n(r):t>e?n(!0):void n(null,t++)}}},"460c":function(e,t,r){var n=r("c3bb"),i=r("02a6"),s=r("9d8a"),o=r("e0c5").Buffer,a=new Array(160);function c(){this.init(),this._w=a,s.call(this,128,112)}n(c,i),c.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},c.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=c},"463c":function(e,t,r){"use strict";(function(t){const{Key:n,Errors:i,utils:s}=r("adc0"),{filter:o,map:a,take:c,sortAll:u}=s;class l{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r("d508"),this.db=n(e,{...t,valueEncoding:"binary",compression:!1})}async open(){try{await this.db.open()}catch(e){throw i.dbOpenFailedError(e)}}async put(e,t){try{await this.db.put(e.toString(),t)}catch(r){throw i.dbWriteFailedError(r)}}async get(e){let t;try{t=await this.db.get(e.toString())}catch(r){if(r.notFound)throw i.notFoundError(r);throw i.dbWriteFailedError(r)}return t}async has(e){try{await this.db.get(e.toString())}catch(t){if(t.notFound)return!1;throw t}return!0}async delete(e){try{await this.db.del(e.toString())}catch(t){throw i.dbDeleteFailedError(t)}}close(){return this.db.close()}batch(){const e=[];return{put:(t,r)=>{e.push({type:"put",key:t.toString(),value:r})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:()=>this.db.batch(e)}}query(e){let r=!0;null!=e.keysOnly&&(r=!e.keysOnly);let i=h(this.db.db.iterator({keys:!0,values:r,keyAsBuffer:!0}));if(i=a(i,({key:e,value:i})=>{const s={key:new n(e,!1)};return r&&(s.value=t.from(i)),s}),null!=e.prefix&&(i=o(i,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(i=e.filters.reduce((e,t)=>o(e,t),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((e,t)=>u(e,t),i)),null!=e.offset){let t=0;i=o(i,()=>t++>=e.offset)}return null!=e.limit&&(i=c(i,e.limit)),i}}function h(e){return{next:()=>new Promise((t,r)=>{e.next((e,n,i)=>e?r(e):null==n?t({done:!0}):void t({done:!1,value:{key:n,value:i}}))}),return:()=>new Promise((t,r)=>{e.end(e=>{if(e)return r(e);t({done:!0})})}),[Symbol.asyncIterator](){return this}}}e.exports=l}).call(this,r("b639").Buffer)},"464c":function(e,t,r){var n=r("a47c");function i(e){return n(this,e).has(e)}e.exports=i},"467e":function(e,t,r){"use strict";const{createFromPrivKey:n}=r("b1aa"),i=r("fa4d"),s=r("7048"),o=r("4bc2"),a=o("ipfs:ipns");a.error=o("ipfs:ipns:error");const c=r("66f0"),u=r("ae21"),l=r("5d36"),h=r("f11e"),{normalizePath:f}=r("ad58"),d=r("3e21"),p=6e4;class y{constructor(e,t,r,n,i){this.publisher=new c(e,t),this.republisher=new u(this.publisher,t,r,n,i),this.resolver=new l(e),this.cache=new d(1e3),this.routing=e}async publish(e,t,r=c.defaultRecordLifetime){try{t=f(t);const s=await i(n)(e.bytes);await this.publisher.publishWithEOL(e,t,r),a(`IPNS value ${t} was published correctly`);const o=s.toB58String(),c=parseFloat(r),u=c1?L(e,t,r):B(e,t,r);case"function":return C(e,t,r);case"object":return N(e,t,r);case"string":{let n,i=!0;if(e.endsWith("?")&&(i=!1,e=e.slice(0,-1)),e.includes("|")){const i=e.split(/\s*\|\s*/g);n=M(i,t,r)}else if(e.includes("&")){const i=e.split(/\s*&\s*/g);n=U(i,t,r)}else n=D(e,t,r);return i||(n=O(n,void 0,r)),n}}throw new Error(`Invalid schema: ${e}`)}function E(e,t,r){if("array"!==s(e)||2!==e.length)throw new Error(`Invalid schema: ${e}`);const n=D("object",void 0,r),i=_(e[0],void 0,r),o=_(e[1],void 0,r),a="dict",c=`dict<${i.type},${o.type}>`,u=e=>{const r=b(t);e=r?v({},r,e):e;const[s]=n.validate(e);if(s)return s.type=c,[s];const a={},u=[];for(let t in e){const r=e[t],[n,s]=i.validate(t);if(n){const r=n.errors||[n];r.forEach(r=>{r.path=[t].concat(r.path),r.data=e,u.push(r)});continue}t=s;const[c,l]=o.validate(r);if(c){const r=c.errors||[c];r.forEach(r=>{r.path=[t].concat(r.path),r.data=e,u.push(r)})}else a[t]=l}return u.length?[v({},u[0],{errors:u})]:[void 0,a]};return new w(a,c,u)}function S(e,t,r){if("array"!==s(e))throw new Error(`Invalid schema: ${e}`);const n="enum",i=e.map(e=>{try{return JSON.stringify(e)}catch(t){return String(e)}}).join(" | "),o=(r=b(t))=>e.includes(r)?[void 0,r]:[{data:r,path:[],value:r,type:i}];return new w(n,i,o)}function k(e,t,r){const n=S(e,void 0,r),i=B([n],t,r);return i}function C(e,t,r){if("function"!==s(e))throw new Error(`Invalid schema: ${e}`);const n="function",i="",o=(r=b(t),n)=>{const o=e(r,n);let a,c={path:[],reason:null};switch(s(o)){case"boolean":a=o;break;case"string":a=!1,c.reason=o;break;case"object":a=!1,c=v({},c,o);break;default:throw new Error(`Invalid result: ${o}`)}return a?[void 0,r]:[v({type:i,value:r,data:r},c)]};return new w(n,i,o)}function A(e,t,r){const n="instance",i=`instance<${e.name}>`,s=(r=b(t))=>r instanceof e?[void 0,r]:[{data:r,path:[],value:r,type:i}];return new w(n,i,s)}function I(e,t,r){if("object"!==s(e))throw new Error(`Invalid schema: ${e}`);const n=D("object",void 0,r),i=[],o={};for(const s in e){i.push(s);const t=e[s],n=_(t,void 0,r);o[s]=n}const a="interface",c=`{${i.join()}}`,u=(e=b(t))=>{const[r]=n.validate(e);if(r)return r.type=c,[r];const i=[],s=e;for(const n in o){let r=e[n];const a=o[n];if(void 0===r){const i=t&&t[n];r=b(i,e)}const[c,u]=a.validate(r,e);if(c){const t=c.errors||[c];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,i.push(t)})}else(n in e||void 0!==u)&&(s[n]=u)}return i.length?[v({},i[0],{errors:i})]:[void 0,s]};return new w(a,c,u)}function T(e,t,r){if("function"!==s(e))throw new Error(`Invalid schema: ${e}`);let n,i;const o="lazy",a="lazy...",c=t=>(i=e(),n.name=i.kind,n.type=i.type,n.validate=i.validate,n.validate(t));return n=new w(o,a,c),n}function x(e,t,r){if("function"!==s(e))throw new Error(`Invalid schema: ${e}`);const n="dynamic",i="dynamic...",o=(r=b(t),n)=>{const i=e(r,n);if("function"!==s(i))throw new Error(`Invalid schema: ${i}`);const[o,a]=i.validate(r);return o?[o]:[void 0,a]};return new w(n,i,o)}function B(e,t,r){if("array"!==s(e)||1!==e.length)throw new Error(`Invalid schema: ${e}`);const n=D("array",void 0,r),i=_(e[0],void 0,r),o="list",a=`[${i.type}]`,c=(e=b(t))=>{const[r,s]=n.validate(e);if(r)return r.type=a,[r];e=s;const o=[],c=[];for(let t=0;t{r.path=[t].concat(r.path),r.data=e,o.push(r)})}else c[t]=s}return o.length?[v({},o[0],{errors:o})]:[void 0,c]};return new w(o,a,c)}function R(e,t,r){const n="literal",i=`literal: ${JSON.stringify(e)}`,s=(r=b(t))=>r===e?[void 0,r]:[{data:r,path:[],value:r,type:i}];return new w(n,i,s)}function N(e,t,r){if("object"!==s(e))throw new Error(`Invalid schema: ${e}`);const n=D("object",void 0,r),i=[],o={};for(const s in e){i.push(s);const t=e[s],n=_(t,void 0,r);o[s]=n}const a="object",c=`{${i.join()}}`,u=(e=b(t))=>{const[r]=n.validate(e);if(r)return r.type=c,[r];const i=[],s={},a=Object.keys(e),u=Object.keys(o),l=new Set(a.concat(u));return l.forEach(r=>{let n=e[r];const a=o[r];if(void 0===n){const i=t&&t[r];n=b(i,e)}if(!a){const t={data:e,path:[r],value:n};return void i.push(t)}const[c,u]=a.validate(n,e);if(c){const t=c.errors||[c];t.forEach(t=>{t.path=[r].concat(t.path),t.data=e,i.push(t)})}else(r in e||void 0!==u)&&(s[r]=u)}),i.length?[v({},i[0],{errors:i})]:[void 0,s]};return new w(a,c,u)}function O(e,t,r){return M([e,"undefined"],t,r)}function P(e,t,r){if("object"!==s(e))throw new Error(`Invalid schema: ${e}`);const n=D("object",void 0,r),i=[],o={};for(const s in e){i.push(s);const t=e[s],n=_(t,void 0,r);o[s]=n}const a="partial",c=`{${i.join()},...}`,u=(e=b(t))=>{const[r]=n.validate(e);if(r)return r.type=c,[r];const i=[],s={};for(const n in o){let r=e[n];const a=o[n];if(void 0===r){const i=t&&t[n];r=b(i,e)}const[c,u]=a.validate(r,e);if(c){const t=c.errors||[c];t.forEach(t=>{t.path=[n].concat(t.path),t.data=e,i.push(t)})}else(n in e||void 0!==u)&&(s[n]=u)}return i.length?[v({},i[0],{errors:i})]:[void 0,s]};return new w(a,c,u)}function D(e,t,r){if("string"!==s(e))throw new Error(`Invalid schema: ${e}`);const{types:n}=r,i=n[e];if("function"!==s(i))throw new Error(`Invalid type: ${e}`);const o=C(i,t,r),a="scalar",c=e,u=e=>{const[t,r]=o.validate(e);return t?(t.type=c,[t]):[void 0,r]};return new w(a,c,u)}function L(e,t,r){if("array"!==s(e))throw new Error(`Invalid schema: ${e}`);const n=e.map(e=>_(e,void 0,r)),i=D("array",void 0,r),o="tuple",a=`[${n.map(e=>e.type).join()}]`,c=(e=b(t))=>{const[r]=i.validate(e);if(r)return r.type=a,[r];const s=[],o=[],c=Math.max(e.length,n.length);for(let t=0;t{r.path=[t].concat(r.path),r.data=e,o.push(r)})}else s[t]=c}return o.length?[v({},o[0],{errors:o})]:[void 0,s]};return new w(o,a,c)}function M(e,t,r){if("array"!==s(e))throw new Error(`Invalid schema: ${e}`);const n=e.map(e=>_(e,void 0,r)),i="union",o=n.map(e=>e.type).join(" | "),a=(e=b(t))=>{const r=[];for(const t of n){const[n,i]=t.validate(e);if(!n)return[void 0,i];r.push(n)}return r[0].type=o,r};return new w(i,o,a)}function U(e,t,r){if("array"!==s(e))throw new Error(`Invalid schema: ${e}`);const n=e.map(e=>_(e,void 0,r)),i="intersection",o=n.map(e=>e.type).join(" & "),a=(e=b(t))=>{let r=e;for(const t of n){const[e,n]=t.validate(r);if(e)return e.type=o,[e];r=n}return[void 0,r]};return new w(i,o,a)}const j={any:_,dict:E,enum:S,enums:k,function:C,instance:A,interface:I,lazy:T,list:B,literal:R,object:N,optional:O,partial:P,scalar:D,tuple:L,union:M,intersection:U,dynamic:x},K=["arguments","array","boolean","buffer","error","float32array","float64array","function","generatorfunction","int16array","int32array","int8array","map","null","number","object","promise","regexp","set","string","symbol","uint16array","uint32array","uint8array","uint8clampedarray","undefined","weakmap","weakset"],F={any:e=>void 0!==e};function V(e={}){const t=v({},F,e.types||{});function r(e,r,i={}){m(e)&&(e=e.schema);const s=j.any(e,r,v({},i,{types:t}));function o(e){if(this instanceof o)throw new Error("Invalid `new` keyword!");return o.assert(e)}return Object.defineProperty(o,y,{value:!0}),Object.defineProperty(o,g,{value:s}),o.kind=s.name,o.type=s.type,o.schema=e,o.defaults=r,o.options=i,o.assert=e=>{const[t,r]=s.validate(e);if(t)throw new n(t);return r},o.test=e=>{const[t]=s.validate(e);return!t},o.validate=e=>{const[t,r]=s.validate(e);return t?[new n(t)]:[void 0,r]},o}return Object.keys(j).forEach(e=>{const n=j[e];r[e]=(e,i,s)=>{const o=n(e,i,v({},s,{types:t})),a=r(o,i,s);return a}}),r}K.forEach(e=>{F[e]=t=>s(t)===e}),F.date=e=>"date"===s(e)&&!isNaN(e);const q=V()},"46be":function(e,t,r){(function(t){function r(e){if("object"!==typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}r.prototype.next=function(e){var r=this;if("function"!==typeof e)throw new Error("next() requires a callback argument");return r._ended?(t.nextTick(e,new Error("cannot call next() after end()")),r):r._nexting?(t.nextTick(e,new Error("cannot call next() before previous next() has completed")),r):(r._nexting=!0,r._next((function(){r._nexting=!1,e.apply(null,arguments)})),r)},r.prototype._next=function(e){t.nextTick(e)},r.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},r.prototype._seek=function(e){},r.prototype.end=function(e){if("function"!==typeof e)throw new Error("end() requires a callback argument");if(this._ended)return t.nextTick(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},r.prototype._end=function(e){t.nextTick(e)},e.exports=r}).call(this,r("4362"))},"46fd":function(e,t,r){"use strict";var n=r("61a0").AbstractLevelDOWN,i=r("61a0").AbstractChainedBatch,s=r("61a0").AbstractIterator,o=r("3fb5"),a=r("66e8"),c=r("4392").EncodingError,u=["approximateSize","compactRange"];function l(e,t){if(!(this instanceof l))return new l(e,t);var r=e.supports||{},i=r.additionalMethods||{};n.call(this,r),this.supports.encodings=!0,this.supports.additionalMethods={},u.forEach((function(t){var r="function"===typeof e[t];(i[t]||r)&&(this.supports.additionalMethods[t]=!0,this[t]=function(e,r,n,i){return e=this.codec.encodeKey(e,n),r=this.codec.encodeKey(r,n),this.db[t](e,r,n,i)})}),this),t=t||{},"undefined"===typeof t.keyEncoding&&(t.keyEncoding="utf8"),"undefined"===typeof t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new a(t)}function h(e,t){s.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function f(e,t){i.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=l.default=l,o(l,n),l.prototype.type="encoding-down",l.prototype._serializeKey=l.prototype._serializeValue=function(e){return e},l.prototype._open=function(e,t){this.db.open(e,t)},l.prototype._close=function(e){this.db.close(e)},l.prototype._put=function(e,t,r,n){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,n)},l.prototype._get=function(e,t,r){var n=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,(function(e,i){if(e)return r(e);try{i=n.codec.decodeValue(i,t)}catch(e){return r(new c(e))}r(null,i)}))},l.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},l.prototype._chainedBatch=function(){return new f(this)},l.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},l.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new h(this,e)},l.prototype._clear=function(e,t){e=this.codec.encodeLtgt(e),this.db.clear(e,t)},o(h,s),h.prototype._next=function(e){var t=this;this.it.next((function(r,n,i){if(r)return e(r);try{n=t.keys&&"undefined"!==typeof n?t.codec.decodeKey(n,t.opts):void 0,i=t.values&&"undefined"!==typeof i?t.codec.decodeValue(i,t.opts):void 0}catch(r){return e(new c(r))}e(null,n,i)}))},h.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},h.prototype._end=function(e){this.it.end(e)},o(f,i),f.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},f.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},f.prototype._clear=function(){this.batch.clear()},f.prototype._write=function(e,t){this.batch.write(e,t)}},4706:function(e,t,r){"use strict";const n=r("23bc"),i=r("ef4d"),s=e=>{if(i.isDAGLink(e))return e;if(!("cid"in e||"hash"in e||"Hash"in e||"multihash"in e))throw new Error("Link must be a DAGLink or DAGLink-like. Convert the DAGNode into a DAGLink via `node.toDAGLink()`.");return new i(e.Name||e.name,e.Tsize||e.size,e.Hash||e.multihash||e.hash||e.cid)},o=(e,t)=>{const r=s(t);e._links.push(r),e._links=n(e._links)};e.exports=o},4720:function(e,t,r){(function(t){e.exports=s;var r="function"===typeof t&&"function"===typeof t.isBuffer,n="function"===typeof ArrayBuffer,i=function(e){return"function"===typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function s(e){return r&&t.isBuffer(e)||n&&(e instanceof ArrayBuffer||i(e))}}).call(this,r("b639").Buffer)},"473e":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"artist-page"},[n("ArtistTitle",{attrs:{"prizes-unlocked":e.prizesUnlocked}}),n("div",{attrs:{id:"primary"}},[n("div",{staticClass:"shrink-top"},[n("h3",{staticStyle:{"margin-left":"25px"}},[e._v("Ticket")]),n("div",{attrs:{id:"artist-card"}},[n("img",{attrs:{id:"artist-img",src:e.imageSrc}}),n("h2",[e._v(e._s(e.artistName)+" VIP Ticket")]),e._m(0)])]),n("div",{staticClass:"shrink-top"},[n("h3",{staticStyle:{"margin-left":"25px"}},[e._v("Price")]),n("div",{attrs:{id:"curve-card"}},[e._m(1),n("div",{attrs:{id:"trade-section"}},[n("h5",[e._v("current value")]),n("div",{attrs:{id:"price-and-token"}},[n("h1",[e._v("$"+e._s(e.tokenPriceUsd))]),n("img",{attrs:{id:"token-number",src:r("a740")}})]),n("div",{attrs:{id:"trade-buttons"}},[n("div",{staticClass:"btn",staticStyle:{"background-color":"#398557"},on:{click:function(t){e.buy=!0}}},[n("p",[e._v("Buy")])]),n("div",{staticClass:"btn sell-btn",staticStyle:{"background-color":"#da304c"},on:{click:function(t){e.sell=!0}}},[n("p",[e._v("Sell")])])])])])])]),n("Tests",{ref:"Tests",on:{receivedContractData:e.updateContract}}),n("Prizes",{attrs:{"prizes-unlocked":e.prizesUnlocked}}),n("Buy",{directives:[{name:"show",rawName:"v-show",value:e.buy,expression:"buy"}],staticClass:"modal",on:{close:function(t){e.buy=!1},confirmed:function(t){e.prizesUnlocked=!0}}}),n("Sell",{directives:[{name:"show",rawName:"v-show",value:e.sell,expression:"sell"}],staticClass:"modal",on:{close:function(t){e.sell=!1}}})],1)},i=[function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("ul",{attrs:{id:"offers"}},[r("li",[e._v(" Exclusive access to “BUBBA” behind-the-scenes videos and production tutorials ")]),r("li",[e._v("Receive early access to unrealeased music and videos")]),r("li",[e._v("A chance to win an 1 on 1 production session")]),r("li",[e._v("Two free VIP concert tickets for every year that you hold the token")]),r("li",[e._v("Submit a monthly question to Kaytranada.")])])},function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"graph-section"}},[n("img",{staticClass:"graph",attrs:{src:r("80c2")}})])}],s=(r("b0c0"),r("b680"),r("96cf"),r("1da1")),o=r("4360"),a=(r("4dec"),r("6314"),function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"modal-mask"},[r("div",{staticClass:"modal-wrapper"},[r("div",{staticClass:"modal-container"},[r("div",{staticClass:"modal-body"},[e._m(0),r("div",{attrs:{id:"right-column"}},[r("p",{staticStyle:{"font-weight":"700"}},[e._v(e._s(e.tokenPriceUsd))])])]),r("div",{staticClass:"btn",staticStyle:{"background-color":"#398557",width:"100%",margin:"0","margin-bottom":"10px"},on:{click:e.buyToken}},[r("p",[e._v("Buy for "+e._s(e.tokenPriceEth)+" ETH")])]),r("div",{staticClass:"btn btn-cancel",staticStyle:{"background-color":"transparent",width:"100%",margin:"0","margin-bottom":"20px"},attrs:{src:"../assets/CloseModal.svg"},on:{click:function(t){return e.$emit("close")}}},[r("p",{staticStyle:{color:"black"}},[e._v("Cancel")])])])])])}),c=[function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticStyle:{width:"50%",float:"left"},attrs:{id:"left-column"}},[r("p",{staticStyle:{"font-weight":"700"}},[e._v("Total price")])])}],u=(r("d3b7"),r("25f0"),r("9222")),l={name:"Buy",computed:{ethPriceUsd:function(){return this.$store.state.ethPrice},tokenPriceEth:function(){return this.$store.state.tokenPriceEth},tokenPriceUsd:function(){return(this.ethPriceUsd*this.tokenPriceEth).toFixed(2)||0}},data:function(){return{contractAddress:"0xDFA1dE81594DeC91c5a5765A0Cd27b8ECb79e5b9"}},methods:{getTransactionReceipt:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:r=null;case 1:if(null!==r){e.next=8;break}return e.next=4,this.getTransactionReceiptPromise(t);case 4:r=e.sent,setTimeout("",1e3),e.next=1;break;case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),getTransactionReceiptPromise:function(e){return new Promise((function(t,r){u["b"].eth.getTransactionReceipt(e,(function(e,n){null!==e?r(e):t(n)}))}))},buyToken:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:u["b"].eth.sendTransaction({from:"0x0000000000000000000000000000000000000000",to:this.contractAddress,value:u["b"].utils.toWei(this.tokenPriceEth.toString(),"ether")},function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(r,n){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:r||(console.log("Transaction Hash: "+n),t.$emit("confirmed"));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}},h=l,f=(r("3e48"),r("2877")),d=Object(f["a"])(h,a,c,!1,null,"6be94cbe",null),p=d.exports,y=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"modal-mask"},[r("div",{staticClass:"modal-wrapper"},[r("div",{staticClass:"modal-container"},[r("div",{staticClass:"modal-body"},[e._m(0),r("div",{attrs:{id:"right-column"}},[r("p",{},[e._v(e._s(e.tokenPriceUsd))]),r("p",{},[e._v(e._s(e.artistCutUsd))]),r("p",{staticStyle:{"font-weight":"700"}},[e._v(e._s((e.tokenPriceUsd-e.artistCutUsd).toFixed(2)))])])]),r("div",{staticClass:"btn",staticStyle:{"background-color":"#da304c",width:"100%",margin:"0","margin-bottom":"10px"},on:{click:e.sellToken}},[r("p",[e._v("Sell for "+e._s(e.tokenPriceEth-e.artistCutEth)+" ETH")])]),r("div",{staticClass:"btn btn-cancel",staticStyle:{"background-color":"transparent",width:"100%",margin:"0","margin-bottom":"20px"},attrs:{src:"../assets/CloseModal.svg"},on:{click:function(t){return e.$emit("close")}}},[r("p",{staticStyle:{color:"black"}},[e._v("Cancel")])])])])])},g=[function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticStyle:{width:"50%",float:"left"},attrs:{id:"left-column"}},[r("p",[e._v("Token value")]),r("p",[e._v("Artist allocation")]),r("p",{staticStyle:{"font-weight":"700"}},[e._v("You receive")])])}],m={name:"Sell",computed:{artistCutUsd:function(){return(this.artistCutEth*this.ethPriceUsd).toFixed(2)||0},artistCutEth:function(){return.2*this.tokenPriceEth},ethPriceUsd:function(){return this.$store.state.ethPrice},tokenPriceEth:function(){return this.$store.state.tokenPriceEth},tokenPriceUsd:function(){return(this.ethPriceUsd*this.tokenPriceEth).toFixed(2)||0}},methods:{sellToken:function(){web3.eth.sendTransaction({from:"0x0000000000000000000000000000000000000000",to:this.contractAddress,value:web3.utils.toWei(this.tokenPriceEth.toString(),"ether")})}}},b=m,v=(r("4069"),Object(f["a"])(b,y,g,!1,null,"231b042c",null)),w=v.exports,_=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{attrs:{id:"prizes"}},[r("h3",[e._v("Rewards")]),r("div",{directives:[{name:"show",rawName:"v-show",value:!e.prizesUnlocked,expression:"!prizesUnlocked"}],attrs:{id:"locked"}},[e._m(0)]),r("div",{directives:[{name:"show",rawName:"v-show",value:e.prizesUnlocked,expression:"prizesUnlocked"}],attrs:{id:"unlocked-grid"}},[r("div",{staticClass:"card",on:{click:function(t){e.redeemPrize=!0}}},[r("p",[e._v("Exclusive Song")])]),e._m(1),e._m(2),e._m(3),e._m(4),e._m(5)]),r("RedeemPrize",{directives:[{name:"show",rawName:"v-show",value:e.redeemPrize,expression:"redeemPrize"}],on:{close:function(t){e.redeemPrize=!1}}})],1)},E=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"locked-content"}},[n("img",{attrs:{id:"lockIcon",src:r("3c1a")}}),n("p",[e._v("Buy this artist's token to unlock their content")])])},function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"card"},[r("p",[e._v("2 Concert Tickets")])])},function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"card"},[r("p",[e._v("VIP")])])},function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"card"},[r("p",[e._v("1 on 1")])])},function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"card"},[r("p",[e._v("Song")])])},function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"card"},[r("p",[e._v("Concert")])])}],S=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"modal-mask"},[n("div",{staticClass:"modal-wrapper"},[n("div",{staticClass:"modal-container"},[n("div",{staticClass:"modal-body"}),n("div",{attrs:{id:"album-container"},on:{mouseover:function(t){e.hover=!0},mouseleave:function(t){e.hover=!1}}},[n("img",{attrs:{id:"albumArt",src:r("9a723")}}),n("img",{directives:[{name:"show",rawName:"v-show",value:!e.playing&&e.hover,expression:"!playing && hover"}],attrs:{id:"play",src:r("dbd8")},on:{click:e.play}}),n("img",{directives:[{name:"show",rawName:"v-show",value:e.playing&&e.hover,expression:"playing && hover"}],attrs:{id:"pause",src:r("ed6df")},on:{click:e.pause}})]),n("audio",{ref:"KaytraSong",attrs:{id:"song",src:r("2957")}}),e._m(0),n("div",{staticClass:"btn btn-cancel",staticStyle:{"background-color":"transparent",width:"100%",margin:"0","margin-bottom":"20px"},attrs:{src:"../assets/CloseModal.svg"},on:{click:function(t){return e.$emit("close")}}},[n("p",{staticStyle:{color:"black"}},[e._v("Close")])])])])])},k=[function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"btn",staticStyle:{"background-color":"#398557",width:"100%",margin:"0","margin-bottom":"10px","margin-top":"10px"}},[r("p",[e._v("Download Song")])])}],C={name:"RedeemPrize",data:function(){return{playing:!1,hover:!1}},methods:{play:function(){this.$refs.KaytraSong.play(),this.playing=!this.playing},pause:function(){this.$refs.KaytraSong.pause(),this.playing=!this.playing}}},A=C,I=(r("142d"),Object(f["a"])(A,S,k,!1,null,"0fc7ea69",null)),T=I.exports,x={name:"prizes",props:{prizesUnlocked:Boolean},components:{RedeemPrize:T},data:function(){return{redeemPrize:!1}}},B=x,R=(r("4e0a"),Object(f["a"])(B,_,E,!1,null,"662da522",null)),N=R.exports,O=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{attrs:{id:"artist-title"}},[r("p",{attrs:{id:"artist-name"}},[e._v("Kaytranada")]),e._m(0),r("div",{staticClass:"tokenOwnership",class:{own:e.prizesUnlocked,dontOwn:!e.prizesUnlocked}},[e._v(" "+e._s(e.ownershipText)+" ")])])},P=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"verified"}},[n("img",{attrs:{src:r("8536")}}),n("p",[e._v("Official artist page")])])}],D={name:"artistTitle",computed:{ownershipText:function(){return this.prizesUnlocked?"You own this token":"You do not own this token"}},props:{prizesUnlocked:Boolean},data:function(){return{ownership:!1}}},L=D,M=(r("0b79"),Object(f["a"])(L,O,P,!1,null,"2fa309b2",null)),U=M.exports,j=r("104a"),K=r("2edf"),F=new K,V=r("1d81"),q={name:"ArtistPage",components:{Buy:p,Sell:w,Prizes:N,ArtistTitle:U,Tests:j["a"]},computed:{ethPriceUsd:function(){return this.$store.state.ethPrice},tokenPriceEth:function(){return this.$store.state.tokenPriceEth},tokenPriceUsd:function(){return(this.ethPriceUsd*this.tokenPriceEth).toFixed(2)||0}},data:function(){return{artistAddress:null,artistName:null,boxAddress:"0x2ca6aFF1D484E86f24e0a9c9D879b116c3c904C5",buy:!1,sell:!1,imageSrc:"",rewards:[],prizesUnlocked:!1,totalTokenSupply:0}},methods:{getETHPrice:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,F.simple.price({ids:["ethereum"],vs_currencies:["usd"]});case 2:return t=e.sent,e.abrupt("return",t.data.ethereum.usd);case 4:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}(),updateContract:function(e){console.log(e),this.totalTokenSupply=e.artistTokenSupply}},mounted:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,V.getProfile(this.boxAddress);case 2:return t=e.sent,r=JSON.parse(t.artists1),this.artistName=r.name,this.artistAddress=r.artistAddress,this.imageSrc=r.imageSrc,this.rewards=r.rewards,e.next=10,this.getETHPrice();case 10:n=e.sent,o["a"].commit("setEthPrice",n),this.$refs.Tests.test(),o["a"].commit("setTokenPriceEth",.5883);case 14:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},z=q,H=(r("0f11"),Object(f["a"])(z,n,i,!1,null,null,null));t["default"]=H.exports},"475c":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("6874"),s=r("e782"),o=r("d19a");async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i("hash algorithm must be specified","ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(`multihash function '${e}' not yet supported`,"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},4768:function(e,t,r){"use strict";(function(e){const n=r("682d"),i=r("e31f"),s=r("8c79");function o(e){return Promise.all([i.subtle.exportKey("jwk",e.privateKey),i.subtle.exportKey("jwk",e.publicKey)])}function a(e){return i.subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}t.utils=r("2f79"),t.generateKey=function(e,t){n(i.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(o).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.unmarshalPrivateKey=function(e,t){const r=i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);n(Promise.all([r,a(e)]).then(e=>o({privateKey:e[0],publicKey:e[1]})).then(e=>({privateKey:e[0],publicKey:e[1]})),t)},t.getRandomValues=s,t.hashAndSign=function(t,r,s){n(i.subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]).then(e=>i.subtle.sign({name:"RSASSA-PKCS1-v1_5"},e,Uint8Array.from(r))).then(t=>e.from(t)),s)},t.hashAndVerify=function(e,t,r,s){n(i.subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]).then(e=>i.subtle.verify({name:"RSASSA-PKCS1-v1_5"},e,t,r)),s)};const{jwk2pub:c,jwk2priv:u}=r("3bd8");function l(t,r,n,i){const s=r?c(t):u(t),o=e.from(n).toString("binary"),a=i(o,s);return e.from(a,"binary")}t.encrypt=function(e,t){return l(e,!0,t,(e,t)=>t.encrypt(e))},t.decrypt=function(e,t){return l(e,!1,t,(e,t)=>t.decrypt(e))}}).call(this,r("b639").Buffer)},"476e":function(e,t,r){"use strict";const{TieredDatastore:n}=r("6e64"),i=r("9829"),s=r("6158"),o=r("20ba");e.exports=e=>{const t=[];let r;if(i(e._options,"EXPERIMENTAL.ipnsPubsub",!1)){const n=e.libp2p.pubsub,i=e._repo.datastore,o=e._peerInfo.id;r=new s(n,i,o),t.push(r)}if(i(e._options,"offline")||!i(e._options,"libp2p.config.dht.enabled",!1)){const r=new o(e._repo);t.push(r)}else t.push(e.libp2p.dht);return new n(t)}},"477b":function(e,t){function r(e){return"function"===typeof e}function n(e){return"object"===typeof e&&i(e.source)&&s(e.sink)}function i(e){return r(e)&&2===e.length}function s(e){return r(e)&&1===e.length}t.isDuplex=n,t.isSource=i,t.isSink=s},"477c":function(e,t,r){"use strict";const n=r("09a4"),i=r("6f12");e.exports=function(e){return n.variadic((async function(t,r){return i(e.refs._localAsyncIterator(t,r))}))}},4783:function(e,t,r){"use strict";t.names=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46e3:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},4784:function(e,t,r){"use strict";const n=r("218a");e.exports=function(e){return function(t,r){return n.source(e._lsAsyncIterator(t,r))}}},"479a":function(e,t,r){"use strict";t.names=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048}),t.codes=Object.freeze({0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46e3:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"}),t.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128})},"47ca":function(e,t,r){"use strict";const n=r("df7c"),i=r("3c43"),s=r("021d");t.filter=(e,t)=>async function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},4834:function(e,t,r){"use strict";e.exports=class{constructor(e,t){this.options=t||{},Object.assign(this,e)}}},4843:function(e,t,r){"use strict";(function(t){var n=r("ba68").Duplex,i=r("3022");function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)}))}else this.append(e);n.call(this)}i.inherits(s,n),s.prototype._offset=function(e){var t,r=0,n=0;if(0===e)return[0,0];for(;nthis.length||e<0)){var t=this._offset(e);return this._bufs[t[0]][t[1]]}},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,r,n,i){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof i||i>this.length)&&(i=this.length),n>=this.length)return e||t.alloc(0);if(i<=0)return e||t.alloc(0);var s,o,a=!!e,c=this._offset(n),u=i-n,l=u,h=a&&r||0,f=c[1];if(0===n&&i==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:t.concat(this._bufs,this.length);for(o=0;os)){this._bufs[o].copy(e,h,f,f+l);break}this._bufs[o].copy(e,h,f),h+=s,l-=s,f&&(f=0)}return e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!==typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return new s;var r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0==n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!=r[1]&&(i[0]=i[0].slice(r[1])),new s(i)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.prototype.consume=function(e){while(this._bufs.length){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;ethis.length?this.length:r;var i=this._offset(r),o=i[0],a=i[1];for(o;o=e.length){var l=c.indexOf(e,a);if(-1!==l)return this._reverseOffset([o,l]);a=c.length-e.length+1}else{var h=this._reverseOffset([o,a]);if(this._match(h,e))return h;a++}}a=0}return-1},s.prototype._match=function(e,t){if(this.length-e(new Date).getTime().toString(),m=e=>e.hash,b=(e,t)=>e.concat(t),v=e=>e.next,w=(e,t)=>Math.max(e,t.clock.time),_=(e,t)=>(e[t.hash]=t,e);class E extends i{constructor(e,t,{logId:r,access:n,entries:i,heads:s,clock:o,sortFn:u,concurrency:p}={}){if(!d(e))throw a.IPFSNotDefinedError();if(!d(t))throw new Error("Identity is required");if(d(n)||(n=new f),d(i)&&!Array.isArray(i))throw new Error("'entries' argument must be an array of Entry instances");if(d(s)&&!Array.isArray(s))throw new Error("'heads' argument must be an array");d(u)||(u=l),super(),this._sortFn=h(u),this._storage=e,this._id=r||g(),this._access=n,this._identity=t;const m=(i||[]).reduce(_,{});this._entryIndex=new y(m),i=Object.values(m)||[],s=s||E.findHeads(i),this._headsIndex=s.reduce(_,{}),this._nextsIndex={};const b=e=>e.next.forEach(t=>this._nextsIndex[t]=e.hash);i.forEach(b),this._length=i.length;const v=Math.max(o?o.time:0,this.heads.reduce(w,0));this._clock=new c(this._identity.publicKey,v),this.joinConcurrency=p||16}get id(){return this._id}get clock(){return this._clock}get length(){return this._length}get values(){return Object.values(this.traverse(this.heads)).reverse()}get heads(){return Object.values(this._headsIndex).sort(this._sortFn).reverse()}get tails(){return E.findTails(this.values)}get tailHashes(){return E.findTailHashes(this.values)}setIdentity(e){this._identity=e;const t=Math.max(this.clock.time,this.heads.reduce(w,0));this._clock=new c(this._identity.publicKey,t)}get(e){return this._entryIndex.get(e)}has(e){return void 0!==this._entryIndex.get(e.hash||e)}traverse(e,t=-1,r){let n=e.sort(this._sortFn).reverse(),i={},s={},o=0;const a=e=>this.get(e),c=e=>{e&&!i[e.hash]&&(n=[e,...n].sort(this._sortFn).reverse(),i[e.hash]=!0)},u=e=>{s[e.hash]=e,i[e.hash]=!0,o++};while(n.length>0&&(o{let t=new Set;for(let r=1;r<=e;r*=2){const e=Math.min(r-1,i.length-1);t.add(i[e])}return t},a=o(Math.min(t,i.length));i.length!u.includes(e),h=Array.from(a).map(m).filter(l),f=await s.create(this._storage,this._identity,this.id,e,u,this.clock,h,r),d=await this._access.canAppend(f,this._identity.provider);if(!d)throw new Error(`Could not append entry, key "${this._identity.id}" is not allowed to write to the log`);return this._entryIndex.set(f.hash,f),u.forEach(e=>this._nextsIndex[e]=f.hash),this._headsIndex={},this._headsIndex[f.hash]=f,this._length++,f}iterator({gt:e,gte:t,lt:r,lte:n,amount:i=-1}={}){if(0===i)return function*(){}();if("string"===typeof n&&(n=[this.get(n)]),"string"===typeof r&&(r=[this.get(this.get(r).next)]),n&&!Array.isArray(n))throw a.LtOrLteMustBeStringOrArray();if(r&&!Array.isArray(r))throw a.LtOrLteMustBeStringOrArray();let s=(n||r||this.heads).filter(d),o=t?this.get(t).hash:e?this.get(e).hash:null,c=o?-1:i||-1,u=this.traverse(s,c,o),l=Object.values(u);return e&&l.pop(),(e||t)&&i>-1&&(l=l.slice(l.length-i,l.length)),function*(){for(let e in l)yield l[e]}()}async join(e,t=-1){if(!d(e))throw a.LogNotDefinedError();if(!E.isLog(e))throw a.NotALogError();if(this.id!==e.id)return;const r=E.difference(e,this),i=this._identity.provider,o=async e=>{const t=await this._access.canAppend(e,i);if(!t)throw new Error(`Could not append entry, key "${e.identity.id}" is not allowed to write to the log`)},u=async e=>{const t=await s.verify(i,e),r=e.identity?e.identity.publicKey:e.key;if(!t)throw new Error(`Could not validate signature "${e.sig}" for entry "${e.hash}" and key "${r}"`)},l=Object.values(r);await n(l,async e=>{await o(e),await u(e)},{concurrency:this.joinConcurrency});const h=e=>{const t=this.get(e.hash);t||this._length++,e.next.forEach(t=>this._nextsIndex[t]=e.hash)};Object.values(r).forEach(h),this._entryIndex.add(r);const f=e=>!g.find(t=>t===e.hash),p=e=>!this._nextsIndex[e.hash],g=Object.values(r).map(v).reduce(b,[]),m=E.findHeads(Object.values(Object.assign({},this._headsIndex,e._headsIndex))).filter(f).filter(p).reduce(_,{});if(this._headsIndex=m,t>-1){let e=this.values;e=e.slice(-t),this._entryIndex=null,this._entryIndex=new y(e.reduce(_,{})),this._headsIndex=E.findHeads(e).reduce(_,{}),this._length=this._entryIndex.length}const S=Object.values(this._headsIndex).reduce(w,0);return this._clock=new c(this.clock.id,Math.max(this.clock.time,S)),this}toJSON(){return{id:this.id,heads:this.heads.sort(this._sortFn).reverse().map(m)}}toSnapshot(){return{id:this.id,heads:this.heads,values:this.values}}toBuffer(){return t.from(JSON.stringify(this.toJSON()))}toString(e){return this.values.slice().reverse().map((t,r)=>{const n=s.findChildren(t,this.values),i=n.length;let o=new Array(Math.max(i-1,0));return o=i>1?o.fill(" "):o,o=i>0?o.concat(["└─"]):o,o.join("")+(e?e(t.payload):t.payload)}).join("\n")}static isLog(e){return void 0!==e.id&&void 0!==e.heads&&void 0!==e._entryIndex}toMultihash({format:e}={}){return o.toMultihash(this._storage,this,{format:e})}static async fromMultihash(e,t,r,{access:n,length:i=-1,exclude:s=[],timeout:a,concurrency:c,sortFn:u,onProgressCallback:l}={}){const{logId:h,entries:f,heads:d}=await o.fromMultihash(e,r,{length:i,exclude:s,timeout:a,onProgressCallback:l,concurrency:c,sortFn:u});return new E(e,t,{logId:h,access:n,entries:f,heads:d,sortFn:u})}static async fromEntryHash(e,t,r,{logId:n,access:i,length:s=-1,exclude:a=[],timeout:c,concurrency:u,sortFn:l,onProgressCallback:h}={}){const{entries:f}=await o.fromEntryHash(e,r,{length:s,exclude:a,timeout:c,concurrency:u,onProgressCallback:h});return new E(e,t,{logId:n,access:i,entries:f,sortFn:l})}static async fromJSON(e,t,r,{access:n,length:i=-1,timeout:s,sortFn:a,onProgressCallback:c}={}){const{logId:u,entries:l}=await o.fromJSON(e,r,{length:i,timeout:s,onProgressCallback:c});return new E(e,t,{logId:u,access:n,entries:l,sortFn:a})}static async fromEntry(e,t,r,{access:n,length:i=-1,exclude:s=[],timeout:a,concurrency:c,sortFn:u,onProgressCallback:l}={}){const{logId:h,entries:f}=await o.fromEntry(e,r,{length:i,exclude:s,timeout:a,concurrency:c,onProgressCallback:l});return new E(e,t,{logId:h,access:n,entries:f,sortFn:u})}static findHeads(e){var t=(e,t,r,n)=>{var i=r=>e[r]=t.hash;return t.next.forEach(i),e},r=e.reduce(t,{}),n=e=>void 0===r[e.hash],i=(e,t)=>e.clock.id>t.clock.id;return e.filter(n).sort(i)}static findTails(e){var t={},r=[],n={},i=[],o=e=>{0===e.next.length&&r.push(e);var s=r=>{t[r]||(t[r]=[]),t[r].push(e)};e.next.forEach(s),i=i.concat(e.next),n[e.hash]=!0};e.forEach(o);var a=(e,t,r,n)=>e.concat(p(t,"hash")),c=e=>void 0===n[e],u=e=>t[e];const l=i.filter(c).map(u).reduce(a,[]).concat(r);return p(l,"hash").sort(s.compare)}static findTailHashes(e){var t={},r=e=>t[e.hash]=!0,n=(e,r,n,i)=>{var s=r=>{void 0===t[r]&&e.splice(0,0,r)};return r.next.reverse().forEach(s),e};return e.forEach(r),e.reduce(n,[])}static difference(e,t){let r=Object.keys(e._headsIndex),n={},i={};const s=e=>{n[e]||t.get(e)||(r.push(e),n[e]=!0)};while(r.length>0){const o=r.shift(),a=e.get(o);a&&!t.get(o)&&a.id===t.id&&(i[a.hash]=a,n[a.hash]=!0,a.next.forEach(s))}return i}}e.exports=E,e.exports.Sorting=u,e.exports.Entry=s,e.exports.AccessController=f}).call(this,r("b639").Buffer)},4864:function(e,t,r){"use strict";const n=r("c3bb"),i=r("b639").Buffer,s=r("0c77"),o=r("f1cb");function a(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){s.call(this,"der",e)}function u(e){return e<10?"0"+e:e}function l(e,t,r,n){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),o.tagByName.hasOwnProperty(e))i=o.tagByName[e];else{if("number"!==typeof e||(0|e)!==e)return n.error("Unknown tag: "+e);i=e}return i>=31?n.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=o.tagClassByName[r||"universal"]<<6,i)}e.exports=a,a.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},n(c,s),c.prototype._encodeComposite=function(e,t,r,n){const s=l(e,t,r,this.reporter);if(n.length<128){const e=new i(2);return e[0]=s,e[1]=n.length,this._createEncoderBuffer([e,n])}let o=1;for(let i=n.length;i>=256;i>>=8)o++;const a=new i(2+o);a[0]=s,a[1]=128|o;for(let i=1+o,c=n.length;c>0;i--,c>>=8)a[i]=255&c;return this._createEncoderBuffer([a,n])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=new i(2*e.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let n=0;for(let i=0;i=128;t>>=7)n++}const s=new i(n);let o=s.length-1;for(let i=e.length-1;i>=0;i--){let t=e[i];s[o--]=127&t;while((t>>=7)>0)s[o--]=128|127&t}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function(e,t){let r;const n=new Date(e);return"gentime"===t?r=[u(n.getUTCFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(n.getUTCFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"===typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!==typeof e&&!i.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=new i(t)}if(i.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=new i(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let i=e;i>=256;i>>=8)r++;const n=new Array(r);for(let i=n.length-1;i>=0;i--)n[i]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(new i(n))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"===typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,r){const n=this._baseState;let i;if(null===n["default"])return!1;const s=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n["default"],t,r).join()),s.length!==n.defaultBuffer.length)return!1;for(i=0;ithis.wm.wantlist.contains(e.cid)).map(e=>e.cid);this.wm.cancelWants(n),await Promise.all(r.map(async t=>{const r=n.includes(t.cid);await this._handleReceivedBlock(e,t,r)}))}async _handleReceivedBlock(e,t,r){this._log("received block");const n=await this.blockstore.has(t.cid);this._updateReceiveCounters(e.toB58String(),t,n),!n&&r&&await this.put(t)}_updateReceiveCounters(e,t,r){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",t.data.length),r&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",t.data.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}async get(e){for await(const t of this.getMany([e]))return t}async*getMany(e){let t=e.length;const r=[];let n=!1;const i=async e=>{r.push(e);const n=this.notifications.wantBlock(e);t||this.wm.wantBlocks(r);const i=await n;return this.wm.cancelWants([e]),i};for(const s of e){const o=await this.blockstore.has(s);t--,o?(t||this.wm.wantBlocks(r),yield this.blockstore.get(s)):(n||(n=!0,this.network.findAndConnect(e[0]).catch(e=>this._log.error(e))),yield i(s))}}unwant(e){Array.isArray(e)||(e=[e]),this.wm.unwantBlocks(e),e.forEach(e=>this.notifications.unwantBlock(e))}cancelWants(e){Array.isArray(e)||(e=[e]),this.wm.cancelWants(e)}async put(e){return this.putMany([e])}async putMany(e){const t=this;return this.blockstore.putMany(async function*(){for await(const r of e)await t.blockstore.has(r.cid)||(yield r,t.notifications.hasBlock(r),t.engine.receivedBlocks([r.cid]),t.network.provide(r.cid).catch(e=>{t._log.error("Failed to provide: %s",e.message)}))}())}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(){this.wm.start(),this.network.start(),this.engine.start()}stop(){this._stats.stop(),this.wm.stop(),this.network.stop(),this.engine.stop()}}e.exports=h},4896:function(e,t){e.exports=i;var r=128,n=127;function i(e,t){var s,o=0,a=(t=t||0,0),c=t,u=e.length;do{if(c>=u)throw i.bytes=0,new RangeError("Could not decode varint");s=e[c++],o+=a<28?(s&n)<=r);return i.bytes=c-t,o}},"48db":function(e,t,r){var n=r("918b");r("8c35"),r("5ee0");var i=e.exports=n.pss=n.pss||{};i.create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,s=r.digestLength,o=e.salt||null;if("string"===typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var u,l,h=c-1,f=Math.ceil(h/8),d=e.digest().getBytes();if(f>8*f-h&255;return w=String.fromCharCode(w.charCodeAt(0)&~_)+w.substr(1),w+y+String.fromCharCode(188)},verify:function(e,o,a){var c,u=a-1,l=Math.ceil(u/8);if(o=o.substr(-l),l>8*l-u&255;if(0!==(f.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(d,h),g="";for(c=0;c{if(e)return i(e);i(null,n.encode(s,t,r))})}e.exports=s,s.Buffer=t,s.multihash=n,s.digest=function(e,t,r,n){if("function"===typeof r&&(n=r,r=void 0),!n)throw new Error("Missing callback");let i,o=n;r&&(o=(e,t)=>{if(e)return n(e);n(null,t.slice(0,r))});try{i=s.createHash(t)}catch(a){return o(a)}i(e,o)},s.createHash=function(e){if(e=n.coerceCode(e),!s.functions[e])throw new Error("multihash function "+e+" not yet supported");return s.functions[e]},s.functions={17:i.sha1,18:i.sha2256,19:i.sha2512,20:i.sha3512,21:i.sha3384,22:i.sha3256,23:i.sha3224,24:i.shake128,25:i.shake256,26:i.keccak224,27:i.keccak256,28:i.keccak384,29:i.keccak512,34:i.murmur3128,35:i.murmur332,86:i.dblSha2256},i.addBlake(s.functions),s.validate=(e,r,i)=>{let o=n.decode(r).name;s(e,o,(e,n)=>{if(e)return i(e);i(e,0===t.compare(r,n))})}}).call(this,r("b639").Buffer)},"492d":function(e,t,r){"use strict";(function(e){const n=r("c449"),i=r("bda9");t.resolve=(e,t)=>{let r=i.deserialize(e);const s=t.split("/").filter(Boolean);while(s.length){const e=s.shift();if(void 0===r[e])throw new Error(`Object has no property '${e}'`);if(r=r[e],n.isCID(r))return{value:r,remainderPath:s.join("/")}}return{value:r,remainderPath:""}};const s=function*(t,r){if(!e.isBuffer(t)&&!n.isCID(t)&&"string"!==typeof t&&null!==t)for(const e of Object.keys(t)){const n=void 0===r?e:r+"/"+e;yield n,yield*s(t[e],n)}};t.tree=function*(e){const t=i.deserialize(e);yield*s(t)}}).call(this,r("b639").Buffer)},"493a":function(e,t,r){"use strict";const n=r("fa4d"),i=r("9646"),s=r("b1aa"),o=r("8911");e.exports=e=>n((t,r,n)=>{"function"!==typeof r||n||(n=r,r={}),"function"===typeof r&&"function"===typeof n&&(n=r,r={});const a=(e,t)=>{const r=e.map(e=>new o(s.createFromB58String(e.ID)));t(null,r)};e({path:"dht/query",args:t,qs:r},(e,t)=>{if(e)return n(e);i(t,a,n)})})},"49ba":function(e,t,r){"use strict";const n="undefined"!==typeof BigUint64Array,i=Symbol();function s(e,t,r){var n=e[r>>>2],i=r+4>>>1,s=n,o=[];const a=1024;while(s>a){let e=t[i+a-1],r=e>=55296&&e<56320?a-1:a,n=t.subarray(i,i+=r);o.push(String.fromCharCode.apply(String,n)),s-=r}return o.join("")+String.fromCharCode.apply(String,t.subarray(i,i+s))}function o(e){var t={};function r(e,t){if(!e)return"";var r=e.buffer;return s(new Uint32Array(r),new Uint16Array(r),t)}var n=e.env=e.env||{};return n.abort=n.abort||function(e,i,s,o){var a=t.memory||n.memory;throw Error("abort: "+r(a,e)+" at "+r(a,i)+":"+s+":"+o)},n.trace=n.trace||function(e,i){var s=t.memory||n.memory;console.log("trace: "+r(s,e)+(i?" ":"")+Array.prototype.slice.call(arguments,2,2+i).join(", "))},e.Math=e.Math||Math,e.Date=e.Date||Date,t}function a(e,t){var r,i,o,a,u,l,h,d,p,y,g,m=t.exports,b=m.memory,v=m["memory.allocate"],w=m["memory.fill"],_=m["memory.free"],E=m.table,S=m._setargc||function(){};function k(){r!==b.buffer&&(r=b.buffer,i=new Int8Array(r),o=new Uint8Array(r),a=new Int16Array(r),u=new Uint16Array(r),l=new Int32Array(r),h=new Uint32Array(r),n&&(y=new BigInt64Array(r),g=new BigUint64Array(r)),d=new Float32Array(r),p=new Float64Array(r))}function C(e){var t=e.length,r=v(4+(t<<1)),n=4+r>>>1;k(),h[r>>>2]=t;for(let i=0;i>>2]=c,h[a+4>>>2]=0,h[a+8>>>2]=o,h[c>>>2]=o,h[c+4>>>2]=0,e){if(new i(r,c+8,t).set(e),e.length>>2],s=h[t+4>>>2],o=h[t+8>>>2];return new e(r,i+8+s,(o-s)/n)}function B(e){k();var t=h[e>>>2];_(t),_(e)}function R(e){"function"===typeof e.original&&(e=e.original);var t=E.length;return E.grow(1),E.set(t,e),t}function N(e){return c(E.get(e),S)}return k(),e.newString=C,e.getString=A,e.newArray=T,e.getArray=x,e.freeArray=B,e.newFunction=R,e.getFunction=N,e.memory=e.memory||b,e.table=e.table||E,f(m,Object.defineProperties(e,{I8:{get:function(){return k(),i}},U8:{get:function(){return k(),o}},I16:{get:function(){return k(),a}},U16:{get:function(){return k(),u}},I32:{get:function(){return k(),l}},U32:{get:function(){return k(),h}},I64:{get:function(){return k(),y}},U64:{get:function(){return k(),g}},F32:{get:function(){return k(),d}},F64:{get:function(){return k(),p}}}))}function c(e,t){var r=(...r)=>(t(r.length),e(...r));return r.original=e,r}function u(e,t){return a(o(t||(t={})),new WebAssembly.Instance(e,t))}function l(e,t){return u(new WebAssembly.Module(e),t)}async function h(e,t){return a(o(t||(t={})),(await WebAssembly.instantiateStreaming(e,t)).instance)}function f(e,t){var r=t?Object.create(t):{},n=e._setargc||function(){};function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}for(let o in e){if(!s(e,o))continue;let t=e[o],a=o.split("."),u=r;while(a.length>1){let e=a.shift();s(u,e)||(u[e]={}),u=u[e]}let l=a[0],h=l.indexOf("#");if(h>=0){let r=l.substring(0,h),a=u[r];if("undefined"===typeof a||!a.prototype){let e=function(...t){return e.wrap(e.prototype.constructor(0,...t))};e.prototype={},e.wrap=function(t){return Object.create(e.prototype,{[i]:{value:t,writable:!1}})},a&&Object.getOwnPropertyNames(a).forEach(t=>Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))),u[r]=e}if(l=l.substring(h+1),u=u[r].prototype,/^(get|set):/.test(l)){if(!s(u,l=l.substring(4))){let t=e[o.replace("set:","get:")],r=e[o.replace("get:","set:")];Object.defineProperty(u,l,{get:function(){return t(this[i])},set:function(e){r(this[i],e)},enumerable:!0})}}else"constructor"===l?u[l]=c(t,n):Object.defineProperty(u,l,{value:function(...e){return n(e.length),t(this[i],...e)}})}else/^(get|set):/.test(l)?s(u,l=l.substring(4))||Object.defineProperty(u,l,{get:e[o.replace("set:","get:")],set:e[o.replace("get:","set:")],enumerable:!0}):u[l]="function"===typeof t?c(t,n):t}return r}t.instantiate=u,t.instantiateBuffer=l,t.instantiateStreaming=h,t.demangle=f},"49c5":function(e,t,r){"use strict";e.exports="\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n"},"4a0d":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var n=r("fdc4"),i=a(n),s=r("0395"),o=a(s);function a(e){return e&&e.__esModule?e:{default:e}}function c(e,t){(0,o.default)(i.default,e,t)}e.exports=t["default"]},"4a45":function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n="providers/5.0.0-beta.153"},"4a4b":function(e,t,r){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}r("131a"),e.exports=n},"4a8a":function(e,t,r){"use strict";const n=r("c3bb");function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function s(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function(e){return e instanceof s},i.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,r){const n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){const t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){let t;const r=this._reporterState,n=e instanceof s;if(t=n?e:new s(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return n||r.errors.push(t),t},i.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},n(s,Error),s.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,s),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},"4ac5":function(e,t,r){"use strict";var n;function i(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var s=r("c499").codes,o=s.ERR_MISSING_ARGS,a=s.ERR_STREAM_DESTROYED;function c(e){if(e)throw e}function u(e){return e.setHeader&&"function"===typeof e.abort}function l(e,t,s,o){o=i(o);var c=!1;e.on("close",(function(){c=!0})),void 0===n&&(n=r("b307")),n(e,{readable:t,writable:s},(function(e){if(e)return o(e);c=!0,o()}));var l=!1;return function(t){if(!c&&!l)return l=!0,u(e)?e.abort():"function"===typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}function h(e){e()}function f(e,t){return e.pipe(t)}function d(e){return e.length?"function"!==typeof e[e.length-1]?c:e.pop():c}function p(){for(var e=arguments.length,t=new Array(e),r=0;r0;return l(e,o,a,(function(e){n||(n=e),e&&s.forEach(h),o||(s.forEach(h),i(n))}))}));return t.reduce(f)}e.exports=p},"4b48":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=!1,i=r("7d0b"),s=r("9bda"),o=r("ffb2"),a=r("bc799");t.logger=new o.Logger(a.version);var c=function(){function e(r){var n=this.constructor;t.logger.checkAbstract(n,e),s.defineReadOnly(this,"locale",r)}return e.prototype.split=function(e){return e.toLowerCase().split(/ +/g)},e.prototype.join=function(e){return e.join(" ")},e.check=function(e){for(var t=[],r=0;r<2048;r++){var n=e.getWord(r);if(r!==e.getWordIndex(n))return"0x";t.push(n)}return i.id(t.join("\n")+"\n")},e.register=function(e,t){if(t||(t=e.locale),n)try{var r=window;r._ethers&&r._ethers.wordlists&&(r._ethers.wordlists[t]||s.defineReadOnly(r._ethers.wordlists,t,e))}catch(i){}},e}();t.Wordlist=c},"4b5a":function(e,t,r){"use strict";e.exports={keys:r("6225"),once:r("99d0"),values:r("e567"),count:r("7e7c"),infinite:r("00c9"),empty:r("2a68"),error:r("e61d")}},"4ba8":function(e,t,r){"use strict";e.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},"string"!==typeof e)throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!==typeof t)throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if("string"!==typeof r.indent)throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(0===t)return e;const n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}},"4bb2":function(e,t,r){"use strict";const n=r("3554"),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:s}=Object,o=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},u=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)s.call(e,n)&&t.push(n)}return t};function l(e){return Array.isArray(e)?h(e):n(e)?f(e):e}function h(e){const t=e.slice(0,0);return u(e).forEach(r=>{o(t,r,l(e[r]))}),t}function f(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach(r=>{o(t,r,l(e[r]))}),t}const d=(e,t,r,n)=>(r.forEach(r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,y(e[r],t[r],n)):o(e,r,l(t[r])))}),e),p=(e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach(t=>{const a=[];for(let r=0;r!a.includes(e)),r)}),n};function y(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?p(e,t,r):n(t)&&n(e)?d(e,t,u(t),r):l(t)}e.exports=function(...e){const t=y(l(c),this!==a&&this||{},c);let r={_:{}};for(const i of e)if(void 0!==i){if(!n(i))throw new TypeError("`"+i+"` is not an Option Object");r=y(r,{_:i},t)}return r._}},"4bbf":function(e,t){function r(){this.__data__=[],this.size=0}e.exports=r},"4bc2":function(e,t,r){(function(n){function i(){return!("undefined"===typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"===typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)}function o(...e){return"object"===typeof console&&console.log&&console.log(...e)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}}function c(){let e;try{e=t.storage.getItem("debug")}catch(r){}return!e&&"undefined"!==typeof n&&"env"in n&&(e=Object({NODE_ENV:"production",BASE_URL:"/"}).DEBUG),e}function u(){try{return localStorage}catch(e){}}t.log=o,t.formatArgs=s,t.save=a,t.load=c,t.useColors=i,t.storage=u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r("5b20")(t);const{formatters:l}=e.exports;l.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r("4362"))},"4bc9":function(e,t,r){"use strict";const n=r("4bc2")("ipfs:mfs:utils:update-tree"),i=r("8648"),s={shardSplitThreshold:1e3},o=async(e,t,r)=>{r=Object.assign({},s,r),n("Trail",t),t=t.slice().reverse();let o,a=0;for await(const n of e.ipld.getMany(t.map(e=>e.cid))){const s=t[a].cid,c=t[a].name;if(a++,!o){o={cid:s,name:c,size:n.size};continue}const u=await i(e,{parent:n,name:o.name,cid:o.cid,size:o.size,flush:r.flush,shardSplitThreshold:r.shardSplitThreshold,format:r.format,hashAlg:r.hashAlg,cidVersion:r.cidVersion});o={cid:u.cid,name:c,size:u.node.size}}return n(`Final CID ${o.cid}`),o.cid};e.exports=o},"4bef":function(e,t,r){var n;function i(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}function s(e){function r(){if(r.enabled){var e=r,i=+new Date,s=i-(n||i);e.diff=s,e.prev=n,e.curr=i,n=i;for(var o=new Array(arguments.length),a=0;aasync function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},"4c37":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r("b442b");class i{constructor(){Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]})}enqueue(e,t){t=Object.assign({priority:0},t);const r={priority:t.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(r);const i=n.default(this._queue,r,(e,t)=>t.priority-e.priority);this._queue.splice(i,0,r)}dequeue(){const e=this._queue.shift();return e&&e.run}get size(){return this._queue.length}}t.default=i},"4c6e":function(e,t,r){"use strict";(function(t){var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=r("4e5f"),o=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var r=e[f].read();null!==r&&(e[l]=null,e[o]=null,e[a]=null,t(d(r,!1)))}}function y(e){t.nextTick(p,e)}function g(e,t){return function(r,n){e.then((function(){t[u]?r(d(void 0,!0)):t[h](r,n)}),n)}}var m=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((n={get stream(){return this[f]},next:function(){var e=this,r=this[c];if(null!==r)return Promise.reject(r);if(this[u])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(r,n){t.nextTick((function(){e[c]?n(e[c]):r(d(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(g(i,this));else{var s=this[f].read();if(null!==s)return Promise.resolve(d(s,!1));n=new Promise(this[h])}return this[l]=n,n}},i(n,Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),m),v=function(e){var t,r=Object.create(b,(t={},i(t,f,{value:e,writable:!0}),i(t,o,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,c,{value:null,writable:!0}),i(t,u,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var n=r[f].read();n?(r[l]=null,r[o]=null,r[a]=null,e(d(n,!1))):(r[o]=e,r[a]=t)},writable:!0}),t));return r[l]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[l]=null,r[o]=null,r[a]=null,t(e)),void(r[c]=e)}var n=r[o];null!==n&&(r[l]=null,r[o]=null,r[a]=null,n(d(void 0,!0))),r[u]=!0})),e.on("readable",y.bind(null,r)),r};e.exports=v}).call(this,r("4362"))},"4c79":function(e,t,r){var n=r("ff48"),i=r("e0c5").Buffer,s=r("72e8");function o(e){var t=e._cipher.encryptBlockRaw(e._prev);return s(e._prev),t}var a=16;t.encrypt=function(e,t){var r=Math.ceil(t.length/a),s=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(r*a)]);for(var c=0;cn((t,r,n)=>{"function"!==typeof r||n||(n=r,r={}),"function"===typeof r&&"function"===typeof n&&(n=r,r={});const c=(e,t)=>{Array.isArray(e)||(e=[e]);let r=[];e.forEach(e=>{4===e.Type&&e.Responses.forEach(e=>{const t=new a(o.createFromB58String(e.ID));e.Addrs&&e.Addrs.forEach(e=>{const r=s(e);t.multiaddrs.add(r)}),r.push(t)})}),t(null,r)};e({path:"dht/findprovs",args:t.toString(),qs:r},(e,t)=>{if(e)return n(e);i(t,c,n)})})},"4c9f":function(e,t){e.exports=function(){if("undefined"===typeof window)return null;var e={RTCPeerConnection:window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.RTCSessionDescription||window.mozRTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.RTCIceCandidate||window.mozRTCIceCandidate||window.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}},"4d1c":function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r("4c33"),a=r("fb4dc"),c=r("8260");class u{constructor(){this.data={}}async open(){}async put(e,t){this.data[e.toString()]=t}async get(e){const t=await this.has(e);if(!t)throw c.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:async()=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[]}}}query(e){let t=Object.entries(this.data);if(t=o(t,e=>({key:new a(e[0]),value:e[1]})),null!=e.prefix&&(t=n(t,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(t=e.filters.reduce((e,t)=>n(e,t),t)),Array.isArray(e.orders)&&(t=e.orders.reduce((e,t)=>i(e,t),t)),null!=e.offset){let r=0;t=n(t,()=>r++>=e.offset)}return null!=e.limit&&(t=s(t,e.limit)),!0===e.keysOnly&&(t=o(t,e=>({key:e.key}))),t}async close(){}}e.exports=u},"4d23":function(e,t,r){var n=r("19d1").AbstractIterator,i=r("3fb5");function s(e,t){n.call(this,e),this._options=t,this._iterator=null,this._operations=[]}i(s,n),s.prototype.setDb=function(e){var t=this._iterator=e.iterator(this._options);this._operations.forEach((function(e){t[e.method].apply(t,e.args)}))},s.prototype._operation=function(e,t){if(this._iterator)return this._iterator[e].apply(this._iterator,t);this._operations.push({method:e,args:t})},"next end".split(" ").forEach((function(e){s.prototype["_"+e]=function(){this._operation(e,arguments)}})),s.prototype.seek=function(){this._operation("seek",arguments)},e.exports=s},"4d31":function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},"4d45":function(e,t,r){"use strict";const n=r("5800");class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const s=(e,t,r)=>new Promise((s,o)=>{if("number"!==typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout(()=>{if("function"===typeof r){try{s(r())}catch(c){o(c)}return}const n="string"===typeof r?r:`Promise timed out after ${t} milliseconds`,a=r instanceof Error?r:new i(n);"function"===typeof e.cancel&&e.cancel(),o(a)},t);n(e.then(s,o),()=>{clearTimeout(a)})});e.exports=s,e.exports.default=s,e.exports.TimeoutError=i},"4d46":function(e,t,r){"use strict";var n=r("3fb5"),i=r("5425").AbstractIterator,s=r("0b90"),o=r("c350"),a=r("8650"),c=function(){};function u(e,t,r){if(i.call(this,e),this._limit=r.limit,this._count=0,this._callback=null,this._cache=[],this._completed=!1,this._aborted=!1,this._error=null,this._transaction=null,this._keyAsBuffer=r.keyAsBuffer,this._valueAsBuffer=r.valueAsBuffer,0!==this._limit){try{var n=this.createKeyRange(r)}catch(s){return void(this._completed=!0)}this.createIterator(t,n,r.reverse)}else this._completed=!0}e.exports=u,n(u,i),u.prototype.createKeyRange=function(e){var t=s.lowerBound(e),r=s.upperBound(e),n=s.lowerBoundExclusive(e),i=s.upperBoundExclusive(e);return void 0!==t&&void 0!==r?IDBKeyRange.bound(t,r,n,i):void 0!==t?IDBKeyRange.lowerBound(t,n):void 0!==r?IDBKeyRange.upperBound(r,i):null},u.prototype.createIterator=function(e,t,r){var n=this,i=this.db.db.transaction([e],"readonly"),s=i.objectStore(e),o=s.openCursor(t,r?"prev":"next");o.onsuccess=function(e){var t=e.target.result;t&&n.onItem(t)},this._transaction=i,i.onabort=function(){n.onAbort(n._transaction.error||new Error("aborted by user"))},i.oncomplete=function(){n.onComplete()}},u.prototype.onItem=function(e){this._cache.push(e.key,e.value),(this._limit<=0||++this._count0){var r=this._cache.shift(),n=this._cache.shift();this._keyAsBuffer&&(r=o(r)),this._valueAsBuffer&&(n=o(n)),a((function(){e(null,r,n)}))}else this._completed?a(e):this._callback=e},u.prototype._end=function(e){if(this._aborted||this._completed){var t=this._error;a((function(){e(t)}))}else this.onItem=c,this.onAbort=e,this.onComplete=e}},"4d51":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=self.crypto||self.msCrypto;e.exports=e=>{if("undefined"===typeof self||!self.crypto&&!self.msCrypto)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return async t=>{switch(e){case"sha1":return n.from(await i.subtle.digest({name:"SHA-1"},t));case"sha2-256":return n.from(await i.subtle.digest({name:"SHA-256"},t));case"sha2-512":return n.from(await i.subtle.digest({name:"SHA-512"},t));case"dbl-sha2-256":{const e=await i.subtle.digest({name:"SHA-256"},t);return n.from(await i.subtle.digest({name:"SHA-256"},e))}default:throw new Error(`${e} is not a supported algorithm`)}}}},"4d58":function(e,t,r){"use strict";const n=r("b624"),i=r("f2f6");class s extends n{constructor(e,t,r,n){let s=Object.assign({},{Index:i});Object.assign(s,n),super(e,t,r,s),this._type="keyvalue"}get all(){return this._index._index}get(e){return this._index.get(e)}set(e,t,r={}){return this.put(e,t,r)}put(e,t,r={}){return this._addOperation({op:"PUT",key:e,value:t},r)}del(e,t={}){return this._addOperation({op:"DEL",key:e,value:null},t)}}e.exports=s},"4d84":function(e,t,r){var n=r("f0a0");n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function s(e,t){i[e]=t,i[t]=e}function o(e,t){i[e]=t}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.5","serialName"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},"4d9e":function(e,t,r){"use strict";const n=r("fd9e");async function i(e,t){Array.isArray(t[0])&&(t=t[0]);const r=t.filter(e=>"string"===typeof e).map(e=>e.trim());return{sources:await n(e,r)}}e.exports=i},"4dd4":function(e,t,r){"use strict";(function(t){const n=r("b62c"),i=r("1f47").encode,s=r("22ac"),o=r("c14df"),a=r("d58b"),c=r("c59f"),{getRequest:u}=r("ff6b"),l=r("81f3"),h=r("e3ea"),f=r("4bc2")("ipfs-http-client:request");function d(e){return e.headers["content-type"]&&0===e.headers["content-type"].indexOf("application/json")}function p(e,t){const r=new Error(`Server responded with ${e.statusCode}`);if(r.statusCode=e.statusCode,!d(e))return l(e,(e,n)=>{n&&n.length&&(r.message=n.toString()),t(r)});h(e,(e,n)=>{if(e)return t(e);n&&(r.code=n.Code,r.message=n.Message||n.toString(),r.type=n.Type),t(r)})}function y(e,t){return r=>{const n=Boolean(r.headers["x-stream-output"]),i=Boolean(r.headers["x-chunked-output"]),s=d(r);if(r.req?f(r.req.method,`${r.req.getHeaders().host}${r.req.path}`,r.statusCode,r.statusMessage):f(r.url,r.statusCode,r.statusMessage),r.statusCode>=400||!r.statusCode)return p(r,t);if(n&&!e)return t(null,r);if(i&&s){const e=o.parse();return a(r,e),r.on("end",()=>{let t=r.trailers["x-stream-error"];if(t){try{t=JSON.parse(t)}catch(n){t={Message:t}}e.emit("error",new Error(t.Message))}}),t(null,e)}return s?h(r,t):l(r,t)}}function g(e,r,o){o=c(o),r.qs=r.qs||{},Array.isArray(r.path)&&(r.path=r.path.join("/")),r.args&&!Array.isArray(r.args)&&(r.args=[r.args]),r.args&&(r.qs.arg=r.args),r.progress&&(r.qs.progress=!0),r.qs.r&&(r.qs.recursive=r.qs.r,delete r.qs.r),r.qs["stream-channels"]=!0,r.stream&&(r.buffer=!1),delete r.qs.followSymlinks;const a="POST",l=Object.assign({},e.headers);if(s&&(l["User-Agent"]=e["user-agent"]),r.multipart){if(!r.multipartBoundary)return o(new Error("No multipartBoundary"));l["Content-Type"]=`multipart/form-data; boundary=${r.multipartBoundary}`}const h=n.stringify(r.qs,{arrayFormat:"repeat",encoder:e=>{if(t.isBuffer(e)){let t="";for(const r of e)if(r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||45===r||46===r||95===r||126===r)t+=String.fromCharCode(r);else{const e=r.toString(16),n=1===e.length?`0${e}`:e;t+=`%${n}`}return t}return i(e)}}),f={hostname:e.host,path:`${e["api-path"]}${r.path}?${h}`,port:e.port,method:a,headers:l,protocol:`${e.protocol}:`},d=u(f,y(r.buffer,o));return d.on("error",e=>{o(e)}),r.stream||d.end(),d}e.exports=e=>{const t=(t,r)=>"object"!==typeof t?r(new Error("no options were passed")):g(e,t,r);return t.andTransform=(e,r,n)=>t(e,(e,t)=>{if(e)return n(e);r(t,n)}),t}}).call(this,r("b639").Buffer)},"4de4":function(e,t,r){"use strict";var n=r("23e7"),i=r("b727").filter,s=r("1dde"),o=r("ae40"),a=s("filter"),c=o("filter");n({target:"Array",proto:!0,forced:!a||!c},{filter:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},"4dec2":function(e,t,r){"use strict";const n=r("09a4"),i=r("ad58").OFFLINE_ERROR,s=r("7048");e.exports=function(e){function t(){if(!e.isOnline())throw s(new Error(i),"ERR_OFFLINE");if(!e.libp2p.pubsub)throw s(new Error("pubsub is not enabled"),"ERR_PUBSUB_DISABLED")}return{subscribe:(r,n,i,s)=>{if("function"===typeof i&&(s=i,i={}),"function"!==typeof s){try{t()}catch(o){return Promise.reject(o)}return e.libp2p.pubsub.subscribe(r,n,i)}try{t()}catch(o){return s(o)}e.libp2p.pubsub.subscribe(r,n,i,s)},unsubscribe:(r,n,i)=>{if("function"!==typeof i){try{t()}catch(s){return Promise.reject(s)}return e.libp2p.pubsub.unsubscribe(r,n)}try{t()}catch(s){return i(s)}e.libp2p.pubsub.unsubscribe(r,n,i)},publish:n(async(r,n)=>{t(),await e.libp2p.pubsub.publish(r,n)}),ls:n(async()=>(t(),e.libp2p.pubsub.ls())),peers:n(async r=>(t(),e.libp2p.pubsub.peers(r))),setMaxListeners(r){t(),e.libp2p.pubsub.setMaxListeners(r)}}}},"4df4":function(e,t,r){"use strict";var n=r("0366"),i=r("7b0b"),s=r("9bdd"),o=r("e95a"),a=r("50c4"),c=r("8418"),u=r("35a1");e.exports=function(e){var t,r,l,h,f,d,p=i(e),y="function"==typeof this?this:Array,g=arguments.length,m=g>1?arguments[1]:void 0,b=void 0!==m,v=u(p),w=0;if(b&&(m=n(m,g>2?arguments[2]:void 0,2)),void 0==v||y==Array&&o(v))for(t=a(p.length),r=new y(t);t>w;w++)d=b?m(p[w],w):p[w],c(r,w,d);else for(h=v.call(p),f=h.next,r=new y;!(l=f.call(h)).done;w++)d=b?s(h,m,[l.value,w],!0):l.value,c(r,w,d);return r.length=w,r}},"4e0a":function(e,t,r){"use strict";var n=r("d75d"),i=r.n(n);i.a},"4e5f":function(e,t,r){"use strict";var n=r("93bc").codes.ERR_STREAM_PREMATURE_CLOSE;function i(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0||s>0){var l=new i;l.update(u),l.update(e),t&&l.update(t),u=l.digest();var h=0;if(o>0){var f=a.length-o;h=Math.min(o,u.length),u.copy(a,f,0,h),o-=h}if(h0){var d=c.length-s,p=Math.min(s,u.length-h);u.copy(c,d,h,h+p),s-=p}}return u.fill(0),{key:a,iv:c}}e.exports=s},"4f37":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("b13c"),s=r("76a7"),o=r("cc1f"),{fromNumberTo32BitBuf:a}=r("8f91"),c=e=>async t=>{switch(e){case"sha3-224":return n.from(i.sha3_224.arrayBuffer(t));case"sha3-256":return n.from(i.sha3_256.arrayBuffer(t));case"sha3-384":return n.from(i.sha3_384.arrayBuffer(t));case"sha3-512":return n.from(i.sha3_512.arrayBuffer(t));case"shake-128":return n.from(i.shake128.create(128).update(t).arrayBuffer());case"shake-256":return n.from(i.shake256.create(256).update(t).arrayBuffer());case"keccak-224":return n.from(i.keccak224.arrayBuffer(t));case"keccak-256":return n.from(i.keccak256.arrayBuffer(t));case"keccak-384":return n.from(i.keccak384.arrayBuffer(t));case"keccak-512":return n.from(i.keccak512.arrayBuffer(t));case"murmur3-128":return n.from(s.x64.hash128(t),"hex");case"murmur3-32":return a(s.x86.hash32(t));default:throw new TypeError(`${e} is not a supported algorithm`)}};e.exports={sha1:o("sha1"),sha2256:o("sha2-256"),sha2512:o("sha2-512"),dblSha2256:o("dbl-sha2-256"),sha3224:c("sha3-224"),sha3256:c("sha3-256"),sha3384:c("sha3-384"),sha3512:c("sha3-512"),shake128:c("shake-128"),shake256:c("shake-256"),keccak224:c("keccak-224"),keccak256:c("keccak-256"),keccak384:c("keccak-384"),keccak512:c("keccak-512"),murmur3128:c("murmur3-128"),murmur332:c("murmur3-32"),addBlake:r("7440")}},"4f57":function(e,t,r){(function(n){function i(){return!("undefined"===typeof window||!window.process||"renderer"!==window.process.type)||("undefined"===typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),r){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(s=i))})),e.splice(s,0,n)}}function o(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(r){}}function c(){var e;try{e=t.storage.debug}catch(r){}return!e&&"undefined"!==typeof n&&"env"in n&&(e=Object({NODE_ENV:"production",BASE_URL:"/"}).DEBUG),e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=r("b335"),t.log=o,t.formatArgs=s,t.save=a,t.load=c,t.useColors=i,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(c())}).call(this,r("4362"))},"4f94":function(e,t){function r(e,t){this.value=e,this.next=t}e.exports=r,r.prototype.contains=function(e){var t=this;while(t){if(t.value===e)return!0;t=t.next}return!1}},"4fa4":function(e,t,r){"use strict";const n=r("33fc"),i=r("e24c").Connection,s=r("f654"),o=r("8911"),a=r("4bc2"),c=r("c59f"),u=a("libp2p:secio");u.error=a("libp2p:secio:error");const l=r("b6ec"),h=r("bd4e");e.exports={tag:"/secio/1.0.0",encrypt(e,t,r,a){s(e,"no local private key provided"),s(t,"no connection for the handshake provided"),"function"===typeof r&&(a=r,r=void 0),a=c(a||function(e){e&&u.error(e)});const f=3e5,d=new h(e,r,f,a);function p(e){if(e)return a(e);t.getPeerInfo((e,r)=>{y.setInnerConn(new i(d.secure,t)),e&&y.setPeerInfo(new o(d.id.remote)),a()})}const y=new i(void 0,t);return n(t,l(d,p),t),y}}},"4fa7":function(e,t,r){"use strict";const n=r("566a"),i=r("a85d"),s=r("20df"),o=r("d79f"),a=r("989c"),c=[["base1","1","","1"],["base2","0",i,"01"],["base8","7",i,"01234567"],["base10","9",i,"0123456789"],["base16","f",s,"0123456789abcdef"],["base32","b",o,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",o,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",o,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",o,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",o,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",i,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",i,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",a,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce((e,t)=>(e[t[0]]=new n(t[0],t[1],t[2],t[3]),e),{}),l=c.reduce((e,t)=>(e[t[1]]=u[t[0]],e),{});e.exports={names:u,codes:l}},"4fcf":function(e,t,r){var n=r("222c");function i(e,t,r){t&&"string"!=typeof t&&(t=t.message||t.name),n(this,{type:e,name:e,cause:"string"!=typeof t?t:r,message:t},"ewr")}function s(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),i.call(this,"CustomError",e,t)}function o(e,t,r){var n=function(r,s){i.call(this,t,r,s),"FilesystemError"==t&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,n)};return n.prototype=r?new r:new s,n}s.prototype=new Error,e.exports=function(e){var t=function(t,r){return o(e,t,r)};return{CustomError:s,FilesystemError:t("FilesystemError"),createError:t}}},"4fd9":function(e,t,r){"use strict";(function(t){const n=r("bb5f"),i=s();function s(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function o(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(r,s)=>{const o=i.digest({name:e},r);if("function"!==typeof o.then)return o.onerror=()=>{s(new Error(`hashing data using ${e}`))},void(o.oncomplete=e=>{s(null,e.target.result)});n(o.then(e=>t.from(new Uint8Array(e))),s)}}function a(e,t){o("SHA-1")(e,t)}function c(e,t){o("SHA-256")(e,t)}function u(e,t){o("SHA-512")(e,t)}e.exports={sha1:a,sha2256:c,sha2512:u}}).call(this,r("b639").Buffer)},5:function(e,t){},5036:function(e,t,r){"use strict";const n=r("218a");e.exports=function(e){return function(t,r){return n.source(e._catAsyncIterator(t,r))}}},5051:function(e,t,r){"use strict";const n=r("7048"),i=r("2091e"),s=r("9c10"),o=(e,t)=>{const r=e.Links.find(e=>e.Name===t);return r&&r.Hash},a={raw:r("ca31"),file:r("ca31"),directory:r("9d33"),"hamt-sharded-directory":r("f37a"),metadata:(e,t,r,n,i,s,o)=>{},symlink:(e,t,r,n,i,s,o)=>{}},c=async(e,t,r,c,u,l,h)=>{const f=await h.get(e);let d,p;t||(t=e.toBaseEncodedString());try{d=i.unmarshal(f.Data)}catch(y){throw n(y,"ERR_NOT_UNIXFS")}if(r||(r=t),c.length){let e;if(e=d&&"hamt-sharded-directory"===d.type?await s(f,c[0],h):o(f,c[0]),!e)throw n(new Error("file does not exist"),"ERR_NOT_FOUND");const t=c.shift(),i=`${r}/${t}`;p={cid:e,toResolve:c,name:t,path:i}}return{entry:{name:t,path:r,cid:e,node:f,content:a[d.type](e,f,d,r,u,l,h),unixfs:d,depth:l},next:p}};e.exports=c},"505b":function(e,t,r){"use strict";e.exports={lock:"memory",storageBackends:{root:r("5eec"),blocks:r("5eec"),keys:r("5eec"),datastore:r("5eec")},storageBackendOptions:{root:{extension:"",prefix:"",version:2},blocks:{sharding:!1,prefix:"",version:2},keys:{sharding:!1,prefix:"",version:2},datastore:{sharding:!1,prefix:"",version:2}}}},"508d":function(e,t,r){var n=r("f0a0");r("5959"),r("8d3f");var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||l(),"undefined"===typeof e&&(e="SHA-512"),!(e in u))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=u[e],r=null,i=n.util.createBuffer(),s=new Array(80),c=0;c<80;++c)s[c]=new Array(2);var f=64;switch(e){case"SHA-384":f=48;break;case"SHA-512/256":f=32;break;case"SHA-512/224":f=28;break}var d={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:f,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var e=d.messageLengthSize/4,s=0;s>>0,o>>>0];for(var a=d.fullMessageLength.length-1;a>=0;--a)d.fullMessageLength[a]+=o[1],o[1]=o[0]+(d.fullMessageLength[a]/4294967296>>>0),d.fullMessageLength[a]=d.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(e),h(r,s,i),(i.read>2048||0===i.length())&&i.compact(),d},d.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c,u=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize,l=u&d.blockLength-1;t.putBytes(o.substr(0,d.blockLength-l));for(var f=8*d.fullMessageLength[0],p=0;p>>0,f+=c,t.putInt32(f>>>0),f=a>>>0;t.putInt32(f);var y=new Array(r.length);for(p=0;p=128){for(N=0;N<16;++N)t[N][0]=r.getInt32()>>>0,t[N][1]=r.getInt32()>>>0;for(;N<80;++N)D=t[N-2],O=D[0],P=D[1],n=((O>>>19|P<<13)^(P>>>29|O<<3)^O>>>6)>>>0,i=((O<<13|P>>>19)^(P<<3|O>>>29)^(O<<26|P>>>6))>>>0,M=t[N-15],O=M[0],P=M[1],s=((O>>>1|P<<31)^(O>>>8|P<<24)^O>>>7)>>>0,o=((O<<31|P>>>1)^(O<<24|P>>>8)^(O<<25|P>>>7))>>>0,L=t[N-7],U=t[N-16],P=i+L[1]+o+U[1],t[N][0]=n+L[0]+s+U[0]+(P/4294967296>>>0)>>>0,t[N][1]=P>>>0;for(g=e[0][0],m=e[0][1],b=e[1][0],v=e[1][1],w=e[2][0],_=e[2][1],E=e[3][0],S=e[3][1],k=e[4][0],C=e[4][1],A=e[5][0],I=e[5][1],T=e[6][0],x=e[6][1],B=e[7][0],R=e[7][1],N=0;N<80;++N)l=((k>>>14|C<<18)^(k>>>18|C<<14)^(C>>>9|k<<23))>>>0,h=((k<<18|C>>>14)^(k<<14|C>>>18)^(C<<23|k>>>9))>>>0,f=(T^k&(A^T))>>>0,d=(x^C&(I^x))>>>0,a=((g>>>28|m<<4)^(m>>>2|g<<30)^(m>>>7|g<<25))>>>0,u=((g<<4|m>>>28)^(m<<30|g>>>2)^(m<<25|g>>>7))>>>0,p=(g&b|w&(g^b))>>>0,y=(m&v|_&(m^v))>>>0,P=R+h+d+c[N][1]+t[N][1],n=B+l+f+c[N][0]+t[N][0]+(P/4294967296>>>0)>>>0,i=P>>>0,P=u+y,s=a+p+(P/4294967296>>>0)>>>0,o=P>>>0,B=T,R=x,T=A,x=I,A=k,I=C,P=S+i,k=E+n+(P/4294967296>>>0)>>>0,C=P>>>0,E=w,S=_,w=b,_=v,b=g,v=m,P=i+o,g=n+s+(P/4294967296>>>0)>>>0,m=P>>>0;P=e[0][1]+m,e[0][0]=e[0][0]+g+(P/4294967296>>>0)>>>0,e[0][1]=P>>>0,P=e[1][1]+v,e[1][0]=e[1][0]+b+(P/4294967296>>>0)>>>0,e[1][1]=P>>>0,P=e[2][1]+_,e[2][0]=e[2][0]+w+(P/4294967296>>>0)>>>0,e[2][1]=P>>>0,P=e[3][1]+S,e[3][0]=e[3][0]+E+(P/4294967296>>>0)>>>0,e[3][1]=P>>>0,P=e[4][1]+C,e[4][0]=e[4][0]+k+(P/4294967296>>>0)>>>0,e[4][1]=P>>>0,P=e[5][1]+I,e[5][0]=e[5][0]+A+(P/4294967296>>>0)>>>0,e[5][1]=P>>>0,P=e[6][1]+x,e[6][0]=e[6][0]+T+(P/4294967296>>>0)>>>0,e[6][1]=P>>>0,P=e[7][1]+R,e[7][0]=e[7][0]+B+(P/4294967296>>>0)>>>0,e[7][1]=P>>>0,j-=128}}},"50b0":function(e,t,r){"use strict";const n=r("faa1").EventEmitter,i=r("e24c").Connection,s=r("9f2e"),o=r("4bc2"),a=r("0b0f"),c=o("libp2p-mplex:muxer");function u(){}c.err=o("libp2p-mplex:muxer:error");class l extends n{constructor(e,t){super(),this.conn=e,this.multiplex=t,this.multicodec=a,t.on("close",()=>this.emit("close")),t.on("error",e=>this.emit("error",e)),t.on("stream",e=>{e.on("error",e=>{c.err("receiver stream errored",e)}),this.emit("stream",new i(e,this.conn))})}newStream(e){e=e||u;let t=this.multiplex.createStream();t.on("error",e=>{c.err("initiator stream errored",e)});const r=new i(t,this.conn);return s(e,null,r),r}end(e){if(e=e||u,this.multiplex.destroyed)return s(e);this.multiplex.once("close",e),this.multiplex.close()}}e.exports=l},"50f6":function(e,t,r){"use strict";var n=r("00d8"),i=r("da3e");function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s{const t=e._modules.contentRouting||[];return e._dht&&t.unshift(e._dht),{findProviders:o((e,r,i)=>{if("function"===typeof r?(i=r,r={}):"number"===typeof r&&(r={maxTimeout:r}),!t.length)return i(s(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE"));const o=t.map(t=>n=>t.findProviders(e,r,(e,t)=>e?n(e):t&&0!==Object.keys(t).length?void n(null,t):n(s(new Error("not found"),"NOT_FOUND"),null)));n(o,(e,t)=>{if(e&&"NOT_FOUND"!==e.code)return i(e);t=t||[],i(null,t)})}),provide:o((e,r)=>{if(!t.length)return r(s(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE"));i(t.map(t=>r=>t.provide(e,r)),r)})}}},5118:function(e,t,r){(function(e){var n="undefined"!==typeof e&&e||"undefined"!==typeof self&&self||window,i=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new s(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r("6017"),t.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r("c8ba"))},"512f":function(e,t,r){var n=r("f0a0");r("8d3f"),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){e&&this._input.putBuffer(e);while(!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},"515c":function(e,t){(function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n>2],s+=e[(3&n[r])<<4|n[r+1]>>4],s+=e[(15&n[r+1])<<2|n[r+2]>>6],s+=e[63&n[r+2]];return i%3===2?s=s.substring(0,s.length-1)+"=":i%3===1&&(s=s.substring(0,s.length-2)+"=="),s},t.decode=function(e){var t,n,i,s,o,a=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var l=new ArrayBuffer(a),h=new Uint8Array(l);for(t=0;t>4,h[u++]=(15&i)<<4|s>>2,h[u++]=(3&s)<<6|63&o;return l}})()},"516b":function(e,t,r){"use strict";var n=r("a3b8");e.exports=function(e,t){return function(r,i){if(r)return n(i,r,t);if(null!=e){var s=e;e=null,i(null,s)}else i(!0)}}},"516c":function(e,t,r){"use strict";const n=r("80f8");e.exports=function(e){return function(t,r){return n.readable(e._refsAsyncIterator(t,r),{objectMode:!0})}}},5190:function(e,t,r){var n=r("e0c5").Buffer,i=r("d485").Transform,s=r("7d72").StringDecoder,o=r("c3bb");function a(e){i.call(this),this.hashMode="string"===typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}o(a,i),a.prototype.update=function(e,t,r){"string"===typeof e&&(e=n.from(e,t));var i=this._update(e);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(i){n=i}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new s(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},e.exports=a},"51a5":function(e,t,r){"use strict";const{DAGNode:n,DAGLink:i}=r("c75d"),s=r("e3d5"),o=r("4bc2")("ipfs:mfs:core:utils:remove-link"),a=r("2091e"),{generatePath:c,updateHamtDirectory:u}=r("f6e4"),l=r("7048"),h=r("0c9a"),f=r("e782"),d=async(e,t)=>{if(!t.parentCid&&!t.parent)throw l(new Error("No parent node or CID passed to removeLink"),"EINVALIDPARENT");if(t.parentCid&&!s.isCID(t.parentCid))throw l(new Error("Invalid CID passed to removeLink"),"EINVALIDPARENTCID");if(t.parent||(o(`Loading parent node ${t.parentCid}`),t.parent=await e.ipld.get(t.parentCid)),!t.name)throw l(new Error("No child name passed to removeLink"),"EINVALIDCHILDNAME");const r=a.unmarshal(t.parent.Data);return"hamt-sharded-directory"===r.type?(o(`Removing ${t.name} from sharded directory`),y(e,t)):(o(`Removing link ${t.name} regular directory`),p(e,t))},p=async(e,t)=>{const r=h[t.format.toUpperCase().replace(/-/g,"_")],n=f.names[t.hashAlg];t.parent.rmLink(t.name);const i=await e.ipld.put(t.parent,r,{cidVersion:t.cidVersion,hashAlg:n});return o(`Updated regular directory ${i}`),{node:t.parent,cid:i}},y=async(e,t)=>{const{rootBucket:r,path:n}=await c(e,t.name,t.parent);await r.del(t.name);const{node:i}=await g(e,n,{name:t.name,cid:t.cid,size:t.size,hashAlg:t.hashAlg,format:t.format,cidVersion:t.cidVersion,flush:t.flush},t);return u(e,i.Links,r,t)},g=async(e,t,r,i)=>{const{bucket:s,prefix:a,node:c}=t.pop(),h=c.Links.find(e=>e.Name.substring(0,2)===a);if(!h)throw l(new Error(`No link found with prefix ${a} for file ${r.name}`),"ERR_NOT_FOUND");if(h.Name===`${a}${r.name}`)return o(`Removing existing link ${h.Name}`),c.rmLink(h.Name),await s.del(r.name),u(e,c.Links,s,i);o(`Descending into sub-shard ${h.Name} for ${a}${r.name}`);const f=await g(e,t,r,i);let d=a;1===f.node.Links.length&&(o(`Removing subshard for ${a}`),f.cid=f.node.Links[0].Hash,f.node=f.node.Links[0],d=`${a}${f.node.Name.substring(2)}`),o(`Updating shard ${a} with name ${d}`);const p=n.isDAGNode(f.node)?f.node.size:f.node.Tsize;return m(e,s,c,a,d,p,f.cid,i)},m=(e,t,r,n,s,o,a,c)=>(r.rmLink(n),r.addLink(new i(s,o,a)),u(e,r.Links,t,c));e.exports=d},"51de":function(e,t,r){"use strict";var n=r("69b6");function i(e){return Number.isFinite(e)}function s(e){return"function"===typeof e}function o(e,t){return t?function(r,n){var i=setTimeout((function(){e(new Error("pull-reader: read exceeded timeout"),n)}),t);e(r,(function(e,t){clearTimeout(i),n(e,t)}))}:e}e.exports=function(e){var t,r,a,c,u,l=[],h=!1,f=n();function d(){while(l.length)if(null==l[0].length&&f.has(1))l.shift().cb(null,f.get());else if(f.has(l[0].length)){var e=l.shift();e.cb(null,f.get(e.length))}else if(1==a&&l[0].length&&f.length(t=t||{},n.call({concatArrays:!0},{blockService:e,formats:[i,s,o]},t))},"521b":function(e,t,r){"use strict";const n=r("e3d5"),i=r("7048"),s=async(e,t,r,s,o,a,c)=>{const u=await c.get(e);let l=u,h=r;while(s.length){const o=s[0];if(!(o in l))throw i(new Error(`No property named ${o} found in cbor node ${e.toBaseEncodedString()}`),"ERR_NO_PROP");if(s.shift(),h=`${h}/${o}`,n.isCID(l[o]))return{entry:{name:t,path:r,cid:e,node:u,depth:a},next:{cid:l[o],name:o,path:h,toResolve:s}};l=l[o]}return{entry:{name:t,path:r,cid:e,node:u,depth:a}}};e.exports=s},5252:function(e,t,r){"use strict";e.exports='// can\'t use, because protocol-buffers doesn\'t support imports\n// so we have to duplicate for now :(\n// import "record.proto";\n\nmessage Record {\n // adjusted for javascript\n optional bytes key = 1;\n optional bytes value = 2;\n optional bytes author = 3;\n optional bytes signature = 4;\n optional string timeReceived = 5;\n}\n\nmessage Message {\n enum MessageType {\n PUT_VALUE = 0;\n GET_VALUE = 1;\n ADD_PROVIDER = 2;\n GET_PROVIDERS = 3;\n FIND_NODE = 4;\n PING = 5;\n }\n\n enum ConnectionType {\n // sender does not have a connection to peer, and no extra information (default)\n NOT_CONNECTED = 0;\n\n // sender has a live connection to peer\n CONNECTED = 1;\n\n // sender recently connected to peer\n CAN_CONNECT = 2;\n\n // sender recently tried to connect to peer repeatedly but failed to connect\n // ("try" here is loose, but this should signal "made strong effort, failed")\n CANNOT_CONNECT = 3;\n }\n\n message Peer {\n // ID of a given peer.\n optional bytes id = 1;\n\n // multiaddrs for a given peer\n repeated bytes addrs = 2;\n\n // used to signal the sender\'s connection capabilities to the peer\n optional ConnectionType connection = 3;\n }\n\n // defines what type of message it is.\n optional MessageType type = 1;\n\n // defines what coral cluster level this query/response belongs to.\n // in case we want to implement coral\'s cluster rings in the future.\n optional int32 clusterLevelRaw = 10;\n\n // Used to specify the key associated with this message.\n // PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS\n // adjusted for javascript\n optional bytes key = 2;\n\n // Used to return a value\n // PUT_VALUE, GET_VALUE\n // adjusted Record to bytes for js\n optional bytes record = 3;\n\n // Used to return peers closer to a key in a query\n // GET_VALUE, GET_PROVIDERS, FIND_NODE\n repeated Peer closerPeers = 8;\n\n // Used to return Providers\n // GET_VALUE, ADD_PROVIDER, GET_PROVIDERS\n repeated Peer providerPeers = 9;\n}'},"52b2":function(e,t,r){"use strict";(function(t){const n=r("3e1e"),i=r("faa1"),s=new i;function o(e,r){r.getPeerInfo((e,i)=>{if(e)return void console.log(e);const o=i.id.toB58String();n(r,n.map(r=>{let n;try{n=JSON.parse(r.toString())}catch(e){return void s.emit("warning",e.message)}if(o!==n.from)return void s.emit("warning","no peerid match "+n.from);const i=n.topicIDs;if(Array.isArray(i))return n.data=t.from(n.data,"hex"),n.seqno=t.from(n.seqno,"hex"),i.forEach(e=>{s.emit(e,n)}),n;s.emit("warning","no topic IDs")}),n.onEnd(()=>{}))})}e.exports={handler:o,emitter:s}}).call(this,r("b639").Buffer)},"52ec":function(e,t,r){"use strict";function n(e){return e}var i=r("64f1");e.exports=function(e){if(!e)return n;e=i(e);var t,r,s=!1;return function(n){return function i(o,a){if(r)return a(r);o?(r=o,n(o,s?function(e){s?t=a:a(o)}:function(e){a(o)})):n(null,(function(n,o){n?a(n):r?a(r):(s=!0,e(o,(function(e,n){s=!1,r?(a(r),t&&t(r)):e?i(e,a):a(null,n)})))}))}}}},5303:function(e,t,r){var n=r("6b4f"),i=r("9868"),s=r("cdca"),o=r("9144"),a=1/0,c=n?n.prototype:void 0,u=c?c.toString:void 0;function l(e){if("string"==typeof e)return e;if(s(e))return i(e,l)+"";if(o(e))return u?u.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}e.exports=l},5329:function(e,t,r){e.exports=r("faa1").EventEmitter},"532e":function(e,t,r){var n=r("0b22"),i=r("0c7b");function s(e){return null!=e&&i(e.length)&&!n(e)}e.exports=s},5345:function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},5353:function(e,t,r){(function(t){var n=r("faa1").EventEmitter,i=r("3022").inherits,s=r("53a8"),o=r("54af"),a=r("7a3d"),c=r("edbd"),u=r("4392"),l=r("f654"),h=r("5438"),f=r("0bd9").getCallback,d=r("0bd9").getOptions,p=u.WriteError,y=u.ReadError,g=u.NotFoundError,m=u.OpenError,b=u.InitializationError;function v(e,r,i){if(!(this instanceof v))return new v(e,r,i);var s;if(n.call(this),this.setMaxListeners(1/0),"function"===typeof r&&(i=r,r={}),r=r||{},!e||"object"!==typeof e){if(s=new b("First argument must be an abstract-leveldown compliant store"),"function"===typeof i)return t.nextTick(i,s);throw s}l.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=d(r),this._db=e,this.db=new o(e),this.open(i)}function w(e,r){if(!e._isOpening()&&!e.isOpen())return t.nextTick(r,new y("Database is not open")),!0}v.prototype.emit=n.prototype.emit,v.prototype.once=n.prototype.once,i(v,n),v.prototype.open=function(e,r){var n,i=this;return"function"===typeof e&&(r=e,e=null),r||(r=h(),n=r.promise),e||(e=this.options),this.isOpen()?(t.nextTick(r,null,i),n):this._isOpening()?(this.once("open",(function(){r(null,i)})),n):(this.emit("opening"),this.db.open(e,(function(e){if(e)return r(new m(e));i.db=i._db,r(null,i),i.emit("open"),i.emit("ready")})),n)},v.prototype.close=function(e){var r,n=this;return e||(e=h(),r=e.promise),this.isOpen()?(this.db.close((function(){n.emit("closed"),e.apply(null,arguments)})),this.emit("closing"),this.db=new o(this._db)):this.isClosed()?t.nextTick(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",(function(){n.close(e)})),r},v.prototype.isOpen=function(){return"open"===this.db.status},v.prototype._isOpening=function(){return"opening"===this.db.status},v.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},v.prototype.get=function(e,t,r){if(null===e||void 0===e)throw new y("get() requires a key argument");var n;return r=f(t,r),r||(r=h(),n=r.promise),w(this,r)?n:(t=d(t),this.db.get(e,t,(function(t,n){if(t)return t=/notfound/i.test(t)||t.notFound?new g("Key not found in database ["+e+"]",t):new y(t),r(t);r(null,n)})),n)},v.prototype.put=function(e,t,r,n){if(null===e||void 0===e)throw new p("put() requires a key argument");var i,s=this;return n=f(r,n),n||(n=h(),i=n.promise),w(this,n)?i:(r=d(r),this.db.put(e,t,r,(function(r){if(r)return n(new p(r));s.emit("put",e,t),n()})),i)},v.prototype.del=function(e,t,r){if(null===e||void 0===e)throw new p("del() requires a key argument");var n,i=this;return r=f(t,r),r||(r=h(),n=r.promise),w(this,r)?n:(t=d(t),this.db.del(e,t,(function(t){if(t)return r(new p(t));i.emit("del",e),r()})),n)},v.prototype.batch=function(e,t,r){if(!arguments.length)return new c(this);if(!Array.isArray(e))throw new p("batch() requires an array argument");var n,i=this;return r=f(t,r),r||(r=h(),n=r.promise),w(this,r)?n:(t=d(t),this.db.batch(e,t,(function(t){if(t)return r(new p(t));i.emit("batch",e),r()})),n)},v.prototype.iterator=function(e){return this.db.iterator(e)},v.prototype.readStream=v.prototype.createReadStream=function(e){return e=s({keys:!0,values:!0},e),"number"!==typeof e.limit&&(e.limit=-1),new a(this.db.iterator(e),e)},v.prototype.keyStream=v.prototype.createKeyStream=function(e){return this.createReadStream(s(e,{keys:!0,values:!1}))},v.prototype.valueStream=v.prototype.createValueStream=function(e){return this.createReadStream(s(e,{keys:!1,values:!0}))},v.prototype.toString=function(){return"LevelUP"},v.errors=u,e.exports=v.default=v}).call(this,r("4362"))},5380:function(e){e.exports=JSON.parse('{"COMPRESSED_TYPE_INVALID":"compressed should be a boolean","EC_PRIVATE_KEY_TYPE_INVALID":"private key should be a Buffer","EC_PRIVATE_KEY_LENGTH_INVALID":"private key length is invalid","EC_PRIVATE_KEY_RANGE_INVALID":"private key range is invalid","EC_PRIVATE_KEY_TWEAK_ADD_FAIL":"tweak out of range or resulting private key is invalid","EC_PRIVATE_KEY_TWEAK_MUL_FAIL":"tweak out of range","EC_PRIVATE_KEY_EXPORT_DER_FAIL":"couldn\'t export to DER format","EC_PRIVATE_KEY_IMPORT_DER_FAIL":"couldn\'t import from DER format","EC_PUBLIC_KEYS_TYPE_INVALID":"public keys should be an Array","EC_PUBLIC_KEYS_LENGTH_INVALID":"public keys Array should have at least 1 element","EC_PUBLIC_KEY_TYPE_INVALID":"public key should be a Buffer","EC_PUBLIC_KEY_LENGTH_INVALID":"public key length is invalid","EC_PUBLIC_KEY_PARSE_FAIL":"the public key could not be parsed or is invalid","EC_PUBLIC_KEY_CREATE_FAIL":"private was invalid, try again","EC_PUBLIC_KEY_TWEAK_ADD_FAIL":"tweak out of range or resulting public key is invalid","EC_PUBLIC_KEY_TWEAK_MUL_FAIL":"tweak out of range","EC_PUBLIC_KEY_COMBINE_FAIL":"the sum of the public keys is not valid","ECDH_FAIL":"scalar was invalid (zero or overflow)","ECDSA_SIGNATURE_TYPE_INVALID":"signature should be a Buffer","ECDSA_SIGNATURE_LENGTH_INVALID":"signature length is invalid","ECDSA_SIGNATURE_PARSE_FAIL":"couldn\'t parse signature","ECDSA_SIGNATURE_PARSE_DER_FAIL":"couldn\'t parse DER signature","ECDSA_SIGNATURE_SERIALIZE_DER_FAIL":"couldn\'t serialize signature to DER format","ECDSA_SIGN_FAIL":"nonce generation function failed or private key is invalid","ECDSA_RECOVER_FAIL":"couldn\'t recover public key from signature","MSG32_TYPE_INVALID":"message should be a Buffer","MSG32_LENGTH_INVALID":"message length is invalid","OPTIONS_TYPE_INVALID":"options should be an Object","OPTIONS_DATA_TYPE_INVALID":"options.data should be a Buffer","OPTIONS_DATA_LENGTH_INVALID":"options.data length is invalid","OPTIONS_NONCEFN_TYPE_INVALID":"options.noncefn should be a Function","RECOVERY_ID_TYPE_INVALID":"recovery should be a Number","RECOVERY_ID_VALUE_INVALID":"recovery should have value between -1 and 4","TWEAK_TYPE_INVALID":"tweak should be a Buffer","TWEAK_LENGTH_INVALID":"tweak length is invalid"}')},"53a4":function(e,t,r){"use strict";const n=r("4a0d"),i=r("c59f"),s=r("4bc2"),o=s("libp2p:switch:transport"),a=r("8b4d"),{DIAL_TIMEOUT:c}=r("0d8d"),{uniqueBy:u}=r("82a9"),l=8;class h{constructor(e){this.switch=e,this.dialer=new a(l,this.switch._options.dialTimeout||c)}add(e,t){if(o("adding %s",e),this.switch.transports[e])throw new Error("There is already a transport with this key");this.switch.transports[e]=t,this.switch.transports[e].listeners||(this.switch.transports[e].listeners=[])}remove(e,t){if(t=t||function(){},!this.switch.transports[e])return t();this.close(e,r=>{delete this.switch.transports[e],t(r)})}removeAll(e){const t=Object.keys(this.switch.transports).map(e=>t=>{this.remove(e,t)});n(t,e)}dial(e,t,r){const n=this.switch.transports[e];let i=t.multiaddrs.toArray();Array.isArray(i)||(i=[i]),i=h.dialables(n,i,this.switch._peerInfo),o("dialing %s",e,i.map(e=>e.toString())),this.dialer.dialMany(t.id,n,i,(e,n)=>{if(e)return r(e);t.connect(n.multiaddr),r(null,n.conn)})}listen(e,t,r,s){r=this.switch._connectionHandler(e,r);const o=this.switch.transports[e];let a=this.switch._peerInfo.multiaddrs.toArray();a=u(a,e=>{const t=Number(e.toOptions().port);return isNaN(t)||0===t?e.toString():t});const c=h.dialables(o,a);o.listeners||(o.listeners=[]);let l=[];const f=c.map(e=>t=>{const n=i(t),s=o.createListener(r);s.once("error",n),s.listen(e,e=>{if(e)return n(e);s.removeListener("error",n),s.getAddrs((e,t)=>{if(e)return n(e);l=l.concat(t),o.listeners.push(s),n()})})});n(f,e=>{if(e)return s(e);this.switch._peerInfo.multiaddrs.replace(c,l),s()})}close(e,t){const r=this.switch.transports[e];if(!r)return t(new Error(`Trying to close non existing transport: ${e}`));n(r.listeners.map(e=>t=>{e.close(t)}),t)}static dialables(e,t,r){if(!e||!e.filter)return[];const n=e.filter(t);if(!r||!n.length)return n;const i=f(r),s=n.filter(e=>!i.some(t=>p(e).startsWith(t)));return s}}function f(e){const t=e.id.toB58String();return e.multiaddrs.toArray().reduce((e,r)=>{const n=r.getPeerId();r=r.toString();const i=n?r.slice(0,r.lastIndexOf(`/ipfs/${n}`)):`${r}/ipfs/${t}`;return e.concat([r,i])},[]).filter(e=>Boolean(e)).concat(`/ipfs/${t}`)}const d=["p2p-circuit","p2p-websocket-star","p2p-webrtc-star","p2p-stardust"];function p(e){const t=e.protoNames().reverse(),r=t.find(e=>d.includes(e));return e=e.toString(),r?e.slice(e.lastIndexOf(r)+r.length):e}e.exports=h},"53b2":function(e,t,r){"use strict";(function(t){var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=u;var i=r("2bff"),s=r("b7eb");r("c3bb")(u,i);for(var o=n(s.prototype),a=0;a4||!a||"sha1"===a))return"string"!==typeof a&&(a="sha1"),e=t.from(e,"binary"),r=t.from(r,"binary"),c?4===i.pbkdf2Sync.length?i.pbkdf2(e,r,s,o,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):i.pbkdf2(e,r,s,o,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,r,s,o).toString("binary"):i.pbkdf2Sync(e,r,s,o,a).toString("binary");if("undefined"!==typeof a&&null!==a||(a="sha1"),"string"===typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var u=a.digestLength;if(o>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var h=Math.ceil(o/u),f=o-(h-1)*u,d=n.hmac.create();d.start(a,e);var p,y,g,m="";if(!c){for(var b=1;b<=h;++b){d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),p=g=d.digest().getBytes();for(var v=2;v<=s;++v)d.start(null,null),d.update(g),y=d.digest().getBytes(),p=n.util.xorBytes(p,y,u),g=y;m+=bh)return c(null,m);d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),p=g=d.digest().getBytes(),v=2,_()}function _(){if(v<=s)return d.start(null,null),d.update(g),y=d.digest().getBytes(),p=n.util.xorBytes(p,y,u),g=y,++v,n.util.setImmediate(_);m+=b2&&void 0!==arguments[2]?arguments[2]:{};return(0,a["default"])(this,t),n=(0,u["default"])(this,(0,l["default"])(t).call(this)),n._name=e,n._spaceName=e.split(".")[2],n._room=y(i,e),n._ipfs=i,n._peerId=i._peerInfo.id.toB58String(),n._members={},n._backlog=new Set,n._backlogLimit=c.ghostBacklogLimit||g,n._filters=c.ghostFilters||[],n._room.on("message",function(){var e=(0,o["default"])(s["default"].mark((function e(t){var r,i,o,a,c,u;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r=t.from,i=t.data,!i.toString().startsWith("{")){e.next=7;break}if(o=JSON.parse(i),"request_backlog"===o.type||"backlog_response"===o.type){e.next=5;break}return e.abrupt("return");case 5:e.next=12;break;case 7:return e.next=9,n._verifyData(i);case 9:c=e.sent,o=c.payload,a=c.issuer;case 12:if(u=n._filters.reduce((function(e,t){return e&&t(o,a,r)}),!0),!o||!u){e.next=25;break}e.t0=o.type,e.next="join"===e.t0?17:"request_backlog"===e.t0?19:"backlog_response"===e.t0?21:24;break;case 17:return n._userJoined(a,r),e.abrupt("break",25);case 19:return n.getPosts(n._backlogLimit).then((function(e){return n._sendDirect({type:"backlog_response",message:e},r,!0)})),e.abrupt("break",25);case 21:return o.message.map((function(e){n._backlog.add(JSON.stringify(e))})),n.emit("backlog-received",{type:"backlog",author:a,message:o.message,timestamp:o.iat}),e.abrupt("break",25);case 24:n._messageReceived(o);case 25:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n._room.on("peer joined",(function(e){n._announce(e),n._requestBacklog(e)})),n._room.on("peer left",(function(e){return n._userLeft(e)})),n}return(0,h["default"])(t,e),(0,c["default"])(t,[{key:"_set3id",value:function(e){var t=this;this._3id=e,this.listMembers().then((function(e){t._room.getPeers().map((function(e){t._announce(e)}))}))}},{key:"listMembers",value:function(){var e=(0,o["default"])(s["default"].mark((function e(){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",Object.keys(this._members).filter((function(e){return!e.startsWith("Qm")})));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_threeIdToPeerId",value:function(e){return this._members[e]}},{key:"getPosts",value:function(){var e=(0,o["default"])(s["default"].mark((function e(){var t,r,n=arguments;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:0,r=(0,i["default"])(this._backlog).map((function(e){return JSON.parse(e)})).sort((function(e,t){return e.timestamp-t.timestamp})).slice(-t),e.abrupt("return",r);case 3:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_announce",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!this._3id){e.next=8;break}if(t){e.next=6;break}return e.next=4,this._broadcast({type:"join"});case 4:e.next=8;break;case 6:return e.next=8,this._sendDirect({type:"join"},t);case 8:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"post",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t,r){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r){e.next=5;break}return e.next=3,this._broadcast({type:"chat",message:t});case 3:e.next=7;break;case 5:return e.next=7,this._sendDirect({type:"chat",message:t},r);case 7:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"deletePost",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:throw new Error("Not possible to delete post in Ghost Thread");case 1:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"addModerator",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:throw new Error("Not possible to add moderator in Ghost Thread");case 1:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"listModerators",value:function(){var e=(0,o["default"])(s["default"].mark((function e(){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:throw new Error("Not possible to list moderators in Ghost Thread");case 1:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}()},{key:"addMember",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:throw new Error("Not possible to add member in Ghost Thread");case 1:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_requestBacklog",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t){e.next=5;break}return e.next=3,this._broadcast({type:"request_backlog"});case 3:e.next=7;break;case 5:return e.next=7,this._sendDirect({type:"request_backlog"},t,!0);case 7:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"close",value:function(){var e=(0,o["default"])(s["default"].mark((function e(){return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._room.leave();case 2:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_broadcast",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t,r){var n;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._3id||r){e.next=2;break}throw new Error("Can not send message if not authenticated");case 2:if(!r){e.next=6;break}e.t0=JSON.stringify(t),e.next=9;break;case 6:return e.next=8,this._3id.signJWT(t);case 8:e.t0=e.sent;case 9:n=e.t0,this._room.broadcast(n);case 11:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"_sendDirect",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t,r,n){var i;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._3id||n){e.next=2;break}throw new Error("Can not send message if not authenticated");case 2:if(!n){e.next=6;break}e.t0=JSON.stringify(t),e.next=9;break;case 6:return e.next=8,this._3id.signJWT(t);case 8:e.t0=e.sent;case 9:i=e.t0,r.startsWith("Qm")?this._room.sendTo(r,i):this._room.sendTo(this._threeIdToPeerId(r),i);case 11:case"end":return e.stop()}}),e,this)})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"onUpdate",value:function(e){this.removeAllListeners("message"),this.removeAllListeners("backlog-received"),this.on("message",e),this.on("backlog-received",e)}},{key:"onNewCapabilities",value:function(e){this.removeAllListeners("user-joined"),this.removeAllListeners("user-left"),this.on("user-joined",e),this.on("user-left",e)}},{key:"_userJoined",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t,r){var n;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.listMembers();case 2:n=e.sent,n.includes(t)||this._3id&&this._3id.DID===t||(this._members[t]=r,this._members[r]=t,this.emit("user-joined","joined",t,r));case 4:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"_userLeft",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){var r;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:r=this._members[t],delete this._members[r],delete this._members[t],this.emit("user-left","left",r,t);case 4:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_messageReceived",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){var r,n,i,o,a;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:r=t.type,n=t.message,i=t.iss,o=t.iat,a=t.postId,this._backlog.add(JSON.stringify({type:r,author:i,message:n,timestamp:o,postId:a})),this.emit("message",{type:r,author:i,message:n,timestamp:o,postId:a});case 3:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_verifyData",value:function(){var e=(0,o["default"])(s["default"].mark((function e(t){var r,n,i;return s["default"].wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r=t.toString(),n=this._ipfs.dag.put(r),e.prev=2,e.next=5,p(r);case 5:return i=e.sent,e.next=8,n;case 8:return i.payload.postId=e.sent.toString(),e.abrupt("return",i);case 12:e.prev=12,e.t0=e["catch"](2),console.log(e.t0);case 15:case"end":return e.stop()}}),e,this,[[2,12]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"isGhost",get:function(){return!0}}]),t}(f);e.exports=m},"53d3":function(e,t,r){"use strict";(function(t){"undefined"!==typeof self?e.exports=self:"undefined"!==typeof window?e.exports=window:e.exports="undefined"!==typeof t?t:Function("return this")()}).call(this,r("c8ba"))},"53e9":function(e,t,r){t.AbstractLevelDOWN=r("2776"),t.AbstractIterator=r("f7ae"),t.AbstractChainedBatch=r("d7a8")},"540c":function(e,t,r){"use strict";const n=r("1421");function i(e){return n.isMultiaddr(e)?e:n(e)}e.exports={ensureMultiaddr:i}},5425:function(e,t,r){t.AbstractLevelDOWN=r("7ca2"),t.AbstractIterator=r("7e11"),t.AbstractChainedBatch=r("e7aa")},5438:function(e,t){function r(){var e,t=new Promise((function(t,r){e=function(e,n){e?r(e):t(n)}}));return e.promise=t,e}e.exports=r},"545b":function(e,t,r){"use strict";const n=r("df7c"),i=r("3c43"),s=r("021d");t.filter=(e,t)=>async function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},"549e":function(e,t,r){"use strict";r.r(t);var n=r("ffb2");const i="bytes/5.0.0-beta.136";r.d(t,"isBytesLike",(function(){return c})),r.d(t,"isBytes",(function(){return u})),r.d(t,"arrayify",(function(){return l})),r.d(t,"concat",(function(){return h})),r.d(t,"stripZeros",(function(){return f})),r.d(t,"zeroPad",(function(){return d})),r.d(t,"isHexString",(function(){return p})),r.d(t,"hexlify",(function(){return g})),r.d(t,"hexDataLength",(function(){return m})),r.d(t,"hexDataSlice",(function(){return b})),r.d(t,"hexConcat",(function(){return v})),r.d(t,"hexValue",(function(){return w})),r.d(t,"hexStripZeros",(function(){return _})),r.d(t,"hexZeroPad",(function(){return E})),r.d(t,"splitSignature",(function(){return S})),r.d(t,"joinSignature",(function(){return k}));const s=new n["Logger"](i);function o(e){return!!e.toHexString}function a(e){return e.slice?e:(e.slice=function(){const t=Array.prototype.slice.call(arguments);return a(new Uint8Array(Array.prototype.slice.apply(e,t)))},e)}function c(e){return p(e)&&!(e.length%2)||u(e)}function u(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(null==e.length)return!1;for(let t=0;t=256||r%1)return!1}return!0}function l(e,t){if(t||(t={}),"number"===typeof e){s.checkSafeUint53(e,"invalid arrayify value");const t=[];while(e)t.unshift(255&e),e/=256;return 0===t.length&&t.push(0),a(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),o(e)&&(e=e.toHexString()),p(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0x0"+r.substring(2):"right"===t.hexPad?r+="0":s.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;el(e)),r=t.reduce((e,t)=>e+t.length,0),n=new Uint8Array(r);return t.reduce((e,t)=>(n.set(t,e),e+t.length),0),a(n)}function f(e){let t=l(e);if(0===t.length)return t;let r=0;while(rt&&s.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),a(r)}function p(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const y="0123456789abcdef";function g(e,t){if(t||(t={}),"number"===typeof e){s.checkSafeUint53(e,"invalid hexlify value");let t="";while(e)t=y[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),o(e))return e.toHexString();if(p(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":s.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(u(e)){let t="0x";for(let r=0;r>4]+y[15&n]}return t}return s.throwArgumentError("invalid hexlify value","value",e)}function m(e){if("string"!==typeof e)e=g(e);else if(!p(e)||e.length%2)return null;return(e.length-2)/2}function b(e,t,r){return"string"!==typeof e?e=g(e):(!p(e)||e.length%2)&&s.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function v(e){let t="0x";return e.forEach(e=>{t+=g(e).substring(2)}),t}function w(e){const t=_(g(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function _(e){"string"!==typeof e&&(e=g(e)),p(e)||s.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;while(t2*t+2&&s.throwArgumentError("value out of range","value",arguments[1]);while(e.length<2*t+2)e="0x0"+e.substring(2);return e}function S(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(c(e)){const r=l(e);65!==r.length&&s.throwArgumentError("invalid signature string; must be 65 bytes","signature",e),t.r=g(r.slice(0,32)),t.s=g(r.slice(32,64)),t.v=r[64],t.recoveryParam=1-t.v%2,t.v<27&&(0===t.v||1===t.v?t.v+=27:s.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam&&(r[32]|=128),t._vs=g(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=d(l(t._vs),32);t._vs=g(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&s.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=g(r);null==t.s?t.s=i:t.s!==i&&s.throwArgumentError("signature v mismatch _vs","signature",e)}null==t.recoveryParam?null==t.v?s.throwArgumentError("signature missing v and recoveryParam","signature",e):t.recoveryParam=1-t.v%2:null==t.v?t.v=27+t.recoveryParam:t.recoveryParam!==1-t.v%2&&s.throwArgumentError("signature recoveryParam mismatch v","signature",e),null!=t.r&&p(t.r)?t.r=E(t.r,32):s.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&p(t.s)?t.s=E(t.s,32):s.throwArgumentError("signature missing or invalid s","signature",e);const r=l(t.s);r[0]>=128&&s.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=g(r);t._vs&&(p(t._vs)||s.throwArgumentError("signature invalid _vs","signature",e),t._vs=E(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&s.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t}function k(e){return e=S(e),g(h([e.r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},"54af":function(e,t,r){var n=r("5425").AbstractLevelDOWN,i=r("3fb5"),s=r("f0a01"),o="put get del batch".split(" ");function a(e){n.call(this,""),this._db=e,this._operations=[],this._iterators=[],u(this)}function c(e){o.concat("iterator").forEach((function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}})),e._db.approximateSize&&(e.approximateSize=function(){return this._db.approximateSize.apply(this._db,arguments)})}function u(e){o.forEach((function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}})),"function"===typeof e._db.approximateSize&&(e.approximateSize=function(){this._operations.push({method:"approximateSize",args:arguments})}),e._iterator=function(e){var t=new s(e);return this._iterators.push(t),t}}i(a,n),a.prototype._open=function(e,t){var r=this;this._db.open(e,(function(e){if(e)return t(e);r._operations.forEach((function(e){r._db[e.method].apply(r._db,e.args)})),r._operations=[],r._iterators.forEach((function(e){e.setDb(r._db)})),r._iterators=[],c(r),t()}))},a.prototype._close=function(e){var t=this;this._db.close((function(r){if(r)return e(r);u(t),e()}))},a.prototype._serializeKey=function(e){return e},a.prototype._serializeValue=function(e){return e},e.exports=a,e.exports.DeferredIterator=s},"54bc":function(e,t,r){var n=r("8284"),i=Array.prototype,s=i.splice;function o(e){var t=this.__data__,r=n(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():s.call(t,r,1),--this.size,!0}e.exports=o},"54fb":function(e,t,r){var n=r("0cb2"),i=536870911,s=["int32","int64","uint32","uint64","sint32","sint64","bool","fixed64","sfixed64","double","fixed32","sfixed32","float"],o=function(e){var t={};while(e.length)switch(e[0]){case"[":case",":e.shift();var r=e.shift();if("("===r&&(r=e.shift(),e.shift()),"="!==e[0])throw new Error("Unexpected token in field options: "+e[0]);if(e.shift(),"]"===e[0])throw new Error("Unexpected ] in field option");t[r]=e.shift();break;case"]":return e.shift(),t;default:throw new Error("Unexpected token in field options: "+e[0])}throw new Error("No closing tag for field options")},a=function(e){var t={name:null,type:null,tag:-1,map:null,oneof:null,required:!1,repeated:!1,options:{}};while(e.length)switch(e[0]){case"=":e.shift(),t.tag=Number(e.shift());break;case"map":if(t.type="map",t.map={from:null,to:null},e.shift(),"<"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.from=e.shift(),","!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.to=e.shift(),">"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var r=e.shift();t.required="required"===r,t.repeated="repeated"===r,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=o(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},c=function(e){var t={enums:[],messages:[],fields:[],extends:[],extensions:null};while(e.length)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(y(e));break;case"message":t.messages.push(h(e));break;case"extensions":t.extensions=l(e);break;case"oneof":e.shift();var r=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);e.shift();while("}"!==e[0]){e.unshift("optional");var n=a(e);n.oneof=r,t.fields.push(n)}e.shift();break;case"extend":t.extends.push(u(e));break;case";":e.shift();break;case"reserved":case"option":e.shift();while(";"!==e[0])e.shift();break;default:e.unshift("optional"),t.fields.push(a(e))}return t},u=function(e){var t={name:e[1],message:h(e)};return t},l=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var r=e.shift();if("max"===r&&(r=i),r=Number(r),isNaN(r))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:r}},h=function(e){e.shift();var t=1,r=[],n={name:e.shift(),enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);e.shift();while(e.length){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),r=c(r),n.enums=r.enums,n.messages=r.messages,n.fields=r.fields,n.extends=r.extends,n.extensions=r.extensions,n;r.push(e.shift())}if(t)throw new Error("No closing tag for message")},f=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},d=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var r={value:null,options:{}};return r.value=Number(e.shift()),"["===e[0]&&(r.options=o(e)),e.shift(),{name:t,val:r}},y=function(e){e.shift();var t={},r={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);e.shift();while(e.length){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),r;if("option"!==e[0]){var n=p(e);r.values[n.name]=n.val}else t=g(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=function(e){var t=null,r=null,n=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};while(e.length){if(";"===e[0])return e.shift(),{name:t,value:r};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(r=n(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(r))throw new Error("Unexpected value for option optimize_for: "+r);"{"===r&&(r=m(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},m=function(e){var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},r={};while(e.length){if("}"===e[0])return e.shift(),r;var n="("===e[0];n&&e.shift();var i=e.shift();if(n){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var s=null;switch(e[0]){case":":if(void 0!==r[i])throw new Error("Duplicate option map key "+i);e.shift(),s=t(e.shift()),"{"===s&&(s=m(e)),r[i]=s,";"===e[0]&&e.shift();break;case"{":if(e.shift(),s=m(e),void 0===r[i]&&(r[i]=[]),!Array.isArray(r[i]))throw new Error("Duplicate option map key "+i);r[i].push(s);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},b=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},v=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);e.shift();while(e.length){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var r=g(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value;break;case"rpc":t.methods.push(w(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},w=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);e.shift();while(e.length){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var r=g(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value}throw new Error("No closing tag for rpc")},_=function(e){for(var t=n(e.toString()),r=0;rt.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)}))}))})),o.messages.forEach((function(e){e.fields.forEach((function(t){var r,n,i,a;function c(e){return e.name===t.type}function u(e){return e.name===i}if(t.options&&"true"===t.options.packed&&-1===s.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some(c))return}else{if(r=t.type.split("."),r.length>2)throw new Error("what is this?");if(n=r[0],i=r[1],o.messages.some((function(e){if(e.name===n)return a=e,e})),a&&a.enums&&a.enums.some(u))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}}))})),o};e.exports=_},"554d":function(e,t,r){var n=r("8707").Buffer;e.exports=function(e){for(var t={},r=e.length,i=e.charAt(0),s=0;s0)n.push(a%r),a=a/r|0}for(var c="",u=0;0===t[u]&&u=0;--l)c+=e[n[l]];return c}function c(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return n.allocUnsafe(0);for(var s=[0],o=0;o>=8;while(u>0)s.push(255&u),u>>=8}for(var l=0;e[l]===i&&l_(e,d,y,p),A=e=>E(e,d,y,p);e.exports={multihash:g,multiaddr:v,peerMultiaddr:w,cid:b,base32cid:e=>"base32"===m(e)&&b(e),ipfsSubdomain:C,ipnsSubdomain:A,subdomain:e=>C(e)||A(e),subdomainPattern:d,ipfsUrl:e=>_(e,u),ipnsUrl:e=>E(e,u),url:e=>_(e,u)||E(e,u),urlPattern:u,ipfsPath:e=>_(e,l),ipnsPath:e=>E(e,l),path:e=>_(e,l)||E(e,l),pathPattern:l,urlOrPath:e=>_(e,u)||E(e,u)||_(e,l)||E(e,l),cidPath:e=>S(e)&&!b(e)&&_(`/ipfs/${e}`,l)}}).call(this,r("b639").Buffer)},"55cd":function(e,t,r){"use strict";const n=t;n.bignum=r("6e62"),n.define=r("fc4a").define,n.base=r("67e0"),n.constants=r("4223"),n.decoders=r("b43d"),n.encoders=r("19c5")},"55e1":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var n=r("96f6"),i=u(n),s=r("e4f6"),o=u(s),a=r("76bf"),c=u(a);function u(e){return e&&e.__esModule?e:{default:e}}function l(e,t,r,n){(0,i.default)(t)(e,(0,o.default)((0,c.default)(r)),n)}e.exports=t["default"]},5609:function(e,t,r){var n=r("5995");r("c882"),r("80f7"),r("84f3"),r("b3d5"),r("c81d"),r("ce05"),r("71c7"),r("b05d"),r("88cb"),r("31a0");var i=n.asn1,s=e.exports=n.pki=n.pki||{},o=s.oids,a={};a["CN"]=o["commonName"],a["commonName"]="CN",a["C"]=o["countryName"],a["countryName"]="C",a["L"]=o["localityName"],a["localityName"]="L",a["ST"]=o["stateOrProvinceName"],a["stateOrProvinceName"]="ST",a["O"]=o["organizationName"],a["organizationName"]="O",a["OU"]=o["organizationalUnitName"],a["organizationalUnitName"]="OU",a["E"]=o["emailAddress"],a["emailAddress"]="E";var c=n.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},h={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function d(e,t){"string"===typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var p=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);h=e.value.value;if(e.keyIdentifier){var g=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;h.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,g))}if(e.authorityCertIssuer){var m=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];h.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var b=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);h.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);h=e.value.value;var v,w=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),_=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(y.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(h.validity.notBefore=y[0],h.validity.notAfter=y[1],h.tbsCertificate=r.tbsCertificate,t){if(h.md=null,h.signatureOid in o){l=o[h.signatureOid];switch(l){case"sha1WithRSAEncryption":h.md=n.md.sha1.create();break;case"md5WithRSAEncryption":h.md=n.md.md5.create();break;case"sha256WithRSAEncryption":h.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":h.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":h.md=n.md.sha512.create();break;case"RSASSA-PSS":h.md=n.md.sha256.create();break}}if(null===h.md){c=new Error("Could not compute certificate digest. Unknown signature OID.");throw c.signatureOid=h.signatureOid,c}var m=i.toDer(h.tbsCertificate);h.md.update(m.getBytes())}var b=n.md.sha1.create();h.issuer.getField=function(e){return d(h.issuer,e)},h.issuer.addField=function(e){g([e]),h.issuer.attributes.push(e)},h.issuer.attributes=s.RDNAttributesAsArray(r.certIssuer,b),r.certIssuerUniqueId&&(h.issuer.uniqueId=r.certIssuerUniqueId),h.issuer.hash=b.digest().toHex();var v=n.md.sha1.create();return h.subject.getField=function(e){return d(h.subject,e)},h.subject.addField=function(e){g([e]),h.subject.attributes.push(e)},h.subject.attributes=s.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(h.subject.uniqueId=r.certSubjectUniqueId),h.subject.hash=v.digest().toHex(),r.certExtensions?h.extensions=s.certificateExtensionsFromAsn1(r.certExtensions):h.extensions=[],h.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),h},s.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(s=r.value.charCodeAt(1),a=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128===(128&s),t.nonRepudiation=64===(64&s),t.keyEncipherment=32===(32&s),t.dataEncipherment=16===(16&s),t.keyAgreement=8===(8&s),t.keyCertSign=4===(4&s),t.cRLSign=2===(2&s),t.encipherOnly=1===(1&s),t.decipherOnly=128===(128&a)}else if("basicConstraints"===t.name){r=i.fromDer(t.value);r.value.length>0&&r.value[0].type===i.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var c=null;r.value.length>0&&r.value[0].type===i.Type.INTEGER?c=r.value[0].value:r.value.length>1&&(c=r.value[1].value),null!==c&&(t.pathLenConstraint=i.derToInteger(c))}else if("extKeyUsage"===t.name){r=i.fromDer(t.value);for(var u=0;u1&&(s=r.value.charCodeAt(1)),t.client=128===(128&s),t.server=64===(64&s),t.email=32===(32&s),t.objsign=16===(16&s),t.reserved=8===(8&s),t.sslCA=4===(4&s),t.emailCA=2===(2&s),t.objCA=1===(1&s)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];r=i.fromDer(t.value);for(var f=0;f=w&&e<_?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}s.getTBSCertificate=function(e){var t=E(e.validity.notBefore),r=E(e.validity.notAfter),o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),b(e.siginfo.algorithmOid,e.siginfo.parameters)]),y(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),y(e.subject),s.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(s.certificateExtensionsToAsn1(e.extensions)),o},s.getCertificationRequestInfo=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),y(e.subject),s.publicKeyToAsn1(e.publicKey),v(e)]);return t},s.distinguishedNameToAsn1=function(e){return y(e)},s.certificateToAsn1=function(e){var t=e.tbsCertificate||s.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),b(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;nl.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:s.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:o}),null===c){if(h=t[0]||e.getIssuer(l),null===h&&l.isIssuer(l)&&(f=!0,h=l),h){var d=h;n.util.isArray(d)||(d=[d]);var p=!1;while(!p&&d.length>0){h=d.shift();try{p=h.verify(l)}catch(S){}}p||(c={message:"Certificate signature is invalid.",error:s.certificateError.bad_certificate})}null!==c||h&&!f||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:s.certificateError.unknown_ca})}if(null===c&&h&&!l.isIssuer(h)&&(c={message:"Certificate issuer is invalid.",error:s.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&gb.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:s.certificateError.bad_certificate})}}var _=null===c||c.error,E=r.verify?r.verify(_,u,i):_;if(!0!==E)throw!0===_&&(c={message:"The application rejected the certificate.",error:s.certificateError.bad_certificate}),(E||0===E)&&("object"!==typeof E||n.util.isArray(E)?"string"===typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,a=!1,++u}while(t.length>0);return!0}},5624:function(e,t){function r(e,t,r){var n=e.length;if(!n)return r(t);function i(){--n||r(t)}e.forEach((function(e){e?e(t,i):i()})),n||i()}e.exports=function(e){return function(t,n){(function i(){t?r(e,t,n):e.length?e[0]?e[0](null,(function(t,s){t?(e.shift(),!0===t?i():r(e,t,n)):n(null,s)})):(e.shift(),i()):n(!0)})()}}},"566a":function(e,t,r){"use strict";class n{constructor(e,t,r,n){this.name=e,this.code=t,this.alphabet=n,r&&n&&(this.engine=r(n))}encode(e){return this.engine.encode(e)}decode(e){return this.engine.decode(e)}isImplemented(){return this.engine}}e.exports=n},"567e":function(e,t,r){"use strict";const n=r("9941"),i=r("faa1").EventEmitter,s=r("e24c").Connection,o=r("bcc7"),a=r("8911"),c=r("6c8b").CircuitRelay,u=r("0512"),l=r("4bc2"),h=l("libp2p:circuit:stop");h.err=l("libp2p:circuit:error:stop");class f extends i{constructor(e){super(),this.swarm=e,this.utils=o(e)}handle(e,t,r){r=r||(()=>{}),u([r=>this.utils.validateAddrs(e,t,c.Type.STOP,r),e=>this.utils.writeResponse(t,c.Status.Success,e)],i=>{if(i)return r(),h(i);const o=new a(this.utils.peerIdFromId(e.srcPeer.id));e.srcPeer.addrs.forEach(e=>o.multiaddrs.add(e));const c=new s(t.rest());c.setPeerInfo(o),n(()=>this.emit("connection",c)),r(c)})}}e.exports=f},5681:function(e,t,r){"use strict";var n=r("309b").defined,i=r("9efb");function s(e,t,r){for(var s=Object.keys(r),o=t.length,a=new Array(o),c=0;c0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.shuffled=n},"56ad":function(e,t,r){"use strict";const n=r("d4c4"),i=r("4bc2")("ipfs:mfs:utils:to-trail"),s=async(e,t)=>{i(`Creating trail for path ${t}`);const r=[];for await(const i of n.path(t,e.ipld))r.push({name:i.name,cid:i.cid,size:i.node.size,type:i.unixfs?i.unixfs.type:void 0});return r};e.exports=s},5705:function(e,t,r){"use strict";(function(n){Object.defineProperty(t,"__esModule",{value:!0});const i=r("3022"),s=Object.prototype.toString,o=e=>t=>typeof t===e,a=e=>{const t=s.call(e).slice(8,-1);return t||null},c=e=>t=>a(t)===e;function u(e){if(null===e)return"null";if(!0===e||!1===e)return"boolean";const t=typeof e;if("undefined"===t)return"undefined";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if(u.function_(e))return"Function";if(Array.isArray(e))return"Array";if(n.isBuffer(e))return"Buffer";const r=a(e);if(r)return r;if(e instanceof String||e instanceof Boolean||e instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}(function(e){const t=e=>"object"===typeof e;e.undefined=o("undefined"),e.string=o("string"),e.number=o("number"),e.function_=o("function"),e.null_=e=>null===e,e.class_=t=>e.function_(t)&&t.toString().startsWith("class "),e.boolean=e=>!0===e||!1===e,e.symbol=o("symbol"),e.array=Array.isArray,e.buffer=n.isBuffer,e.nullOrUndefined=t=>e.null_(t)||e.undefined(t),e.object=r=>!e.nullOrUndefined(r)&&(e.function_(r)||t(r)),e.iterable=t=>!e.nullOrUndefined(t)&&e.function_(t[Symbol.iterator]),e.generator=t=>e.iterable(t)&&e.function_(t.next)&&e.function_(t.throw),e.nativePromise=c("Promise");const r=r=>!e.null_(r)&&t(r)&&e.function_(r.then)&&e.function_(r.catch);e.promise=t=>e.nativePromise(t)||r(t);const s=t=>r=>e.function_(r)&&e.function_(r.constructor)&&r.constructor.name===t;e.generatorFunction=s("GeneratorFunction"),e.asyncFunction=s("AsyncFunction"),e.boundFunction=t=>e.function_(t)&&!t.hasOwnProperty("prototype"),e.regExp=c("RegExp"),e.date=c("Date"),e.error=c("Error"),e.map=c("Map"),e.set=c("Set"),e.weakMap=c("WeakMap"),e.weakSet=c("WeakSet"),e.int8Array=c("Int8Array"),e.uint8Array=c("Uint8Array"),e.uint8ClampedArray=c("Uint8ClampedArray"),e.int16Array=c("Int16Array"),e.uint16Array=c("Uint16Array"),e.int32Array=c("Int32Array"),e.uint32Array=c("Uint32Array"),e.float32Array=c("Float32Array"),e.float64Array=c("Float64Array"),e.arrayBuffer=c("ArrayBuffer"),e.sharedArrayBuffer=c("SharedArrayBuffer"),e.dataView=c("DataView"),e.directInstanceOf=(t,r)=>e.object(t)&&e.object(r)&&Object.getPrototypeOf(t)===r.prototype,e.truthy=e=>Boolean(e),e.falsy=e=>!e,e.nan=e=>Number.isNaN(e);const u=new Set(["undefined","string","number","boolean","symbol"]);e.primitive=t=>e.null_(t)||u.has(typeof t),e.integer=e=>Number.isInteger(e),e.safeInteger=e=>Number.isSafeInteger(e),e.plainObject=e=>{let t;return"Object"===a(e)&&(t=Object.getPrototypeOf(e),null===t||t===Object.getPrototypeOf({}))};const l=new Set(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"]);e.typedArray=e=>{const t=a(e);return null!==t&&l.has(t)};const h=t=>e.safeInteger(t)&&t>-1;e.arrayLike=t=>!e.nullOrUndefined(t)&&!e.function_(t)&&h(t.length),e.inRange=(t,r)=>{if(e.number(r))return t>=Math.min(0,r)&&t<=Math.max(r,0);if(e.array(r)&&2===r.length)return t>=Math.min.apply(null,r)&&t<=Math.max.apply(null,r);throw new TypeError(`Invalid range: ${i.inspect(r)}`)};const f=1,d=["innerHTML","ownerDocument","style","attributes","nodeValue"];e.domElement=t=>e.object(t)&&t.nodeType===f&&e.string(t.nodeName)&&!e.plainObject(t)&&d.every(e=>e in t),e.nodeStream=r=>!e.nullOrUndefined(r)&&t(r)&&e.function_(r.pipe),e.infinite=e=>e===1/0||e===-1/0;const p=t=>r=>e.integer(r)&&Math.abs(r%2)===t;e.even=p(0),e.odd=p(1);const y=t=>e.string(t)&&!1===/\S/.test(t),g=t=>(e.string(t)||e.array(t))&&0===t.length,m=t=>!e.map(t)&&!e.set(t)&&e.object(t)&&0===Object.keys(t).length,b=t=>(e.map(t)||e.set(t))&&0===t.size;e.empty=t=>e.falsy(t)||g(t)||m(t)||b(t),e.emptyOrWhitespace=t=>e.empty(t)||y(t);const v=(t,r,n)=>{const s=Array.prototype.slice.call(n,1);if(!1===e.function_(r))throw new TypeError(`Invalid predicate: ${i.inspect(r)}`);if(0===s.length)throw new TypeError("Invalid number of values");return t.call(s,r)};function w(e){return v(Array.prototype.some,e,arguments)}function _(e){return v(Array.prototype.every,e,arguments)}e.any=w,e.all=_})(u||(u={})),Object.defineProperties(u,{class:{value:u.class_},function:{value:u.function_},null:{value:u.null_}}),t.default=u,e.exports=u,e.exports.default=u}).call(this,r("b639").Buffer)},5721:function(e,t,r){"use strict";const n=r("8945");e.exports=e=>{const t=n.logger(e.peerInfo.id,"rpc:ping");return function(e,r,n){t("from %s",e.id.toB58String()),n(null,r)}}},5754:function(e,t,r){"use strict";(function(t){const n=r("ec4e"),i=r("91f6").toCallback,s=45569,o=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},c={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},u=(e,r)=>i(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}}).call(this,r("b639").Buffer)},"576d":function(e,t,r){"use strict";const n=async e=>{for await(const t of e)return t};e.exports=n},5790:function(e,t,r){"use strict";(function(t){const n=r("021d"),i=r("87dd"),s="/",o=t.from(s),a=o[0];class c{constructor(e,r){if("string"===typeof e?this._buf=t.from(e):t.isBuffer(e)&&(this._buf=e),null==r&&(r=!0),r&&this.clean(),0===this._buf.length||this._buf[0]!==a)throw new Error(`Invalid key: ${this.toString()}`)}toString(e){return this._buf.toString(e||"utf8")}toBuffer(){return this._buf}get[Symbol.toStringTag](){return`[Key ${this.toString()}]`}static withNamespaces(e){return new h(e.join(s))}static random(){return new h(n().replace(/-/g,""))}clean(){this._buf&&0!==this._buf.length||(this._buf=t.from(s)),this._buf[0]!==a&&(this._buf=t.concat([o,this._buf]));while(this._buf.length>1&&this._buf[this._buf.length-1]===a)this._buf=this._buf.slice(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;ni)return!1}return t.length-1&&(m=m.split(",")),b.indexOf("[]=")>-1&&(m=s(m)?[m]:m),i.call(l,g)?l[g]=n.combine(l[g],m):l[g]=m}return l},h=function(e,t,r){for(var n=t,i=e.length-1;i>=0;--i){var s,o=e[i];if("[]"===o&&r.parseArrays)s=[].concat(n);else{s=r.plainObjects?Object.create(null):{};var a="["===o.charAt(0)&&"]"===o.charAt(o.length-1)?o.slice(1,-1):o,c=parseInt(a,10);r.parseArrays||""!==a?!isNaN(c)&&o!==a&&String(c)===a&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(s=[],s[c]=n):s[a]=n:s={0:n}}n=s}return n},f=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,a=r.depth>0&&s.exec(n),c=a?n.slice(0,a.index):n,u=[];if(c){if(!r.plainObjects&&i.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}var l=0;while(r.depth>0&&null!==(a=o.exec(n))&&l{const n=new URL(r.url).search.slice(1),i=await r.json();o.set(n,i,a)}]}}),l=e=>{if(e.Path)return e.Path;throw new Error(e.Message)};e.exports=async(e,t)=>{const r=async(e,t)=>{t=t||{};const r=new URLSearchParams(t);r.set("arg",e);const n=r.toString();if(!t.nocache&&o.has(n)){const e=o.get(n);return l(e)}const i=await c.add(()=>u.get("dns",{searchParams:r}).json());return l(i)};return r(e,t)}},5800:function(e,t,r){"use strict";e.exports=(e,t)=>(t=t||(()=>{}),e.then(e=>new Promise(e=>{e(t())}).then(()=>e),e=>new Promise(e=>{e(t())}).then(()=>{throw e})))},"583a":function(e,t,r){var n=r("f0a0");r("8d3f"),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(e,t){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{this._j0=[0,0,0,0];while(r.length()>0)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];while(t.length()>0)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=e[n]>>>4*(7-r%8)&15,s=this._m[r][i];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,s=new Array(i),o=0;o>>1,i=new Array(r);i[n]=e.slice(0);var s=n>>>1;while(s>0)this.pow(i[2*s],i[s]=[]),s>>=1;s=2;while(s4||!a||"sha1"===a))return"string"!==typeof a&&(a="sha1"),e=t.from(e,"binary"),r=t.from(r,"binary"),c?4===i.pbkdf2Sync.length?i.pbkdf2(e,r,s,o,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):i.pbkdf2(e,r,s,o,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,r,s,o).toString("binary"):i.pbkdf2Sync(e,r,s,o,a).toString("binary");if("undefined"!==typeof a&&null!==a||(a="sha1"),"string"===typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var u=a.digestLength;if(o>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var h=Math.ceil(o/u),f=o-(h-1)*u,d=n.hmac.create();d.start(a,e);var p,y,g,m="";if(!c){for(var b=1;b<=h;++b){d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),p=g=d.digest().getBytes();for(var v=2;v<=s;++v)d.start(null,null),d.update(g),y=d.digest().getBytes(),p=n.util.xorBytes(p,y,u),g=y;m+=bh)return c(null,m);d.start(null,null),d.update(r),d.update(n.util.int32ToBytes(b)),p=g=d.digest().getBytes(),v=2,_()}function _(){if(v<=s)return d.start(null,null),d.update(g),y=d.digest().getBytes(),p=n.util.xorBytes(p,y,u),g=y,++v,n.util.setImmediate(_);m+=b=0;c--)x>>=8,x+=C.at(c)+T.at(c),T.setAt(c,255&x);I.putBuffer(T)}w=I,h.putBuffer(S)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids["pkcs5PBES2"]:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},o.pbe.getCipherForPBES2=function(e,t,r){var i={},a=[];if(!s.validate(t,u,i,a)){var c=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=a,c}if(e=s.derToOid(i.kdfOid),e!==o.oids["pkcs5PBKDF2"]){c=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw c.oid=e,c.supportedOids=["pkcs5PBKDF2"],c}if(e=s.derToOid(i.encOid),e!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.oids["desCBC"]){c=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw c.oid=e,c.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],c}var l,h,d=i.kdfSalt,p=n.util.createBuffer(i.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":l=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,h=n.des.createDecryptionCipher;break;case"desCBC":l=8,h=n.des.createDecryptionCipher;break}var y=f(i.prfOid),g=n.pkcs5.pbkdf2(r,d,p,l,y),m=i.encIv,b=h(g);return b.start(m),b},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!s.validate(t,l,i,a)){var c=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=a,c}var u,h,d,p=n.util.createBuffer(i.salt),y=n.util.createBuffer(i.iterations);switch(y=y.getInt(y.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,h=8,d=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,h=8,d=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:c=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw c.oid=e,c}var g=f(i.prfOid),m=o.pbe.generatePkcs12Key(r,p,1,y,u,g);g.start();var b=o.pbe.generatePkcs12Key(r,p,2,y,h,g);return d(m,b)},o.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;o>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"===typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&u]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,u,l,h=!1,f=null,d=null,p=null,y=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(i=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=o(e[u],s[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(i=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],s[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var n=f.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var i=0;i=8)g([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var n=8===f.length()?8:8-f.length();f.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===f.length(),t))if(e)t=e(8,d,!r);else{var i=d.length(),s=d.at(i-1);s>i?t=!1:d.truncate(s)}return t}},m};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},5959:function(e,t,r){var n=r("f0a0");e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},5968:function(e,t,r){"use strict";class n{constructor(e){}append(e){}merge(e){}get(e){}has(e){}get values(){}get length(){}}e.exports=n},5995:function(e,t){e.exports={options:{usePureJavaScript:!1}}},59957:function(e,t){var r=Function.prototype,n=r.toString;function i(e){if(null!=e){try{return n.call(e)}catch(t){}try{return e+""}catch(t){}}return""}e.exports=i},"59c5":function(e,t,r){"use strict";const n=r("df7c"),i=r("3c43"),s=r("c64e");t.filter=(e,t)=>async function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},"59eb":function(e,t,r){"use strict";class n{constructor(){this.queries=new Set,this.running=!1}queryStarted(e){this.queries.add(e)}queryCompleted(e){this.queries.delete(e)}start(){this.running=!0}stop(){this.running=!1;for(const e of this.queries)e.stop();this.queries.clear()}}e.exports=n},"5a38":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("c8f6"),s=45569,o=45633,a={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},c={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},u=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}},"5ab1":function(e,t,r){"use strict";const n=r("cfab"),i=new Map;for(const s in n){const e=n[s];i.set(e,s)}e.exports=Object.freeze(i)},"5ac3":function(e,t,r){"use strict";var n=r("3b1c"),i=r("3a17"),s=r("549e"),o=r("b46b"),a=r("6f5a"),c=r("9bda"),u=r("e165"),l=r("ae1c"),h=r("ffb2");const f="transactions/5.0.0-beta.134";r.d(t,"a",(function(){return b})),r.d(t,"c",(function(){return v})),r.d(t,"d",(function(){return w})),r.d(t,"b",(function(){return _}));const d=new h["Logger"](f);function p(e){return"0x"===e?null:Object(n["a"])(e)}function y(e){return"0x"===e?o["f"]:i["a"].from(e)}const g=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],m={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};function b(e){const t=Object(l["b"])(e);return Object(n["a"])(Object(s["hexDataSlice"])(Object(a["a"])(Object(s["hexDataSlice"])(t,1)),12))}function v(e,t){return b(Object(l["c"])(Object(s["arrayify"])(e),t))}function w(e,t){Object(c["checkProperties"])(e,m);const r=[];g.forEach((function(t){let n=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),n=Object(s["arrayify"])(Object(s["hexlify"])(n,i)),t.length&&n.length!==t.length&&n.length>0&&d.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=Object(s["stripZeros"])(n),n.length>t.maxLength&&d.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n)),r.push(Object(s["hexlify"])(n))}));let n=0;if(null!=e.chainId?(n=e.chainId,"number"!==typeof n&&d.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!Object(s["isBytesLike"])(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push(Object(s["hexlify"])(n)),r.push("0x"),r.push("0x")),!t)return u["b"](r);const i=Object(s["splitSignature"])(t);let o=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),o+=2*n+8,i.v>28&&i.v!==o&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==o&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push(Object(s["hexlify"])(o)),r.push(Object(s["stripZeros"])(Object(s["arrayify"])(i.r))),r.push(Object(s["stripZeros"])(Object(s["arrayify"])(i.s))),u["b"](r)}function _(e){const t=u["a"](e);9!==t.length&&6!==t.length&&d.throwArgumentError("invalid raw transaction","rawTransactin",e);const r={nonce:y(t[0]).toNumber(),gasPrice:y(t[1]),gasLimit:y(t[2]),to:p(t[3]),value:y(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=i["a"].from(t[6]).toNumber()}catch(n){return console.log(n),r}if(r.r=Object(s["hexZeroPad"])(t[7],32),r.s=Object(s["hexZeroPad"])(t[8],32),i["a"].from(r.r).isZero()&&i["a"].from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let i=r.v-27;const o=t.slice(0,6);0!==r.chainId&&(o.push(Object(s["hexlify"])(r.chainId)),o.push("0x"),o.push("0x"),i-=2*r.chainId+8);const c=Object(a["a"])(u["b"](o));try{r.from=v(c,{r:Object(s["hexlify"])(r.r),s:Object(s["hexlify"])(r.s),recoveryParam:i})}catch(n){console.log(n)}r.hash=Object(a["a"])(e)}return r}},"5ae5":function(e,t,r){"use strict";(function(t){const n=r("6586"),i=s();function s(){return self.crypto?self.crypto.subtle||self.crypto.webkitSubtle:self.msCrypto?self.msCrypto.subtle:void 0}function o(e){if(!i)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");return(r,s)=>{const o=i.digest({name:e},r);if("function"!==typeof o.then)return o.onerror=()=>{s(new Error(`hashing data using ${e}`))},void(o.oncomplete=e=>{s(null,e.target.result)});n(o.then(e=>t.from(new Uint8Array(e))),s)}}function a(e,t){o("SHA-1")(e,t)}function c(e,t){o("SHA-256")(e,t)}function u(e,t){o("SHA-512")(e,t)}e.exports={sha1:a,sha2256:c,sha2512:u}}).call(this,r("b639").Buffer)},"5b20":function(e,t,r){function n(e){function t(e){let t=0;for(let r=0;r{if("%%"===r)return r;a++;const s=n.formatters[i];if("function"===typeof s){const n=e[a];r=s.call(t,n),e.splice(a,1),a--}return r}),n.formatArgs.call(t,e);const c=t.log||n.log;c.apply(t,e)}return o.namespace=e,o.enabled=n.enabled(e),o.useColors=n.useColors(),o.color=t(e),o.destroy=i,o.extend=s,"function"===typeof n.init&&n.init(o),n.instances.push(o),o}function i(){const e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function s(e,t){const r=n(this.namespace+("undefined"===typeof t?":":t)+e);return r.log=this.log,r}function o(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"===typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t"-"+e)].join(",");return n.enable(""),e}function c(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t{n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=t,n.enable(n.load()),n}e.exports=n},"5b29":function(e,t,r){"use strict";const n=async(e,t)=>{const r=await e();if(t(r))return n(e,t)};e.exports=n,e.exports.default=n},"5b39":function(e,t,r){var n=r("51de"),i=r("76d6"),s=r("5624"),o=r("40df");function a(e){var t=0;return function(r,n,i){t++||e(r,n,i)}}function c(e){return"function"===typeof e}e.exports=function(e,t){c(e)&&(t=e,e={}),t=a(t||function(){});var r=n(e&&e.timeout||5e3),u=i((function(e){e&&t(e)})),l=o();return{handshake:{read:r.read,abort:function(e){u.end(e),r.abort(e,(function(e){})),t(e)},write:u.push,rest:function(){return u.end(),{source:r.read(),sink:l.sink}}},sink:r,source:s([u,l.source])}}},"5b398":function(e,t,r){"use strict";function n(e,t,r){var n,i=e instanceof Error?e:new Error(e);if("object"===typeof t?r=t:null!=t&&(i.code=t),r)for(n in r)i[n]=r[n];return i}e.exports=n},"5b4a":function(e,t,r){"use strict";var n=r("ef02");e.exports=function(e){return n((function(e,t){return e+t}),"",e)}},"5b50":function(e,t,r){"use strict";const n=r("f281");e.exports=(e,t={})=>{if(!n(e))throw new TypeError("Expected a plain object");const{deep:r}=t,i=[],s=[],o=e=>{const a=i.indexOf(e);if(-1!==a)return s[a];const c={},u=Object.keys(e).sort(t.compare);i.push(e),s.push(c);for(const t of u){const i=e[t];r&&Array.isArray(i)?c[t]=i.map(e=>n(e)?o(e):e):c[t]=r&&n(i)?o(i):i}return c};return o(e)}},"5bc3":function(e,t){function r(e,t){for(var r=0;r1)throw new Error("value should be a number between 0 and 1");e.toB58String&&(e=e.toB58String()),this._peerValues.set(e,t)}_onceStarted(){this._peerId=this._libp2p.peerInfo.id.toB58String()}_onStatsUpdate(){const e=this._stats.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkLimit("maxReceivedData",t);const r=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkLimit("maxSentData",r);const n=t+r;this._checkLimit("maxData",n),s("stats update",n)}_onPeerConnect(e){const t=e.id.toB58String();s("%s: connected to %s",this._peerId,t),this._peerValues.set(t,this._options.defaultPeerValue),this._peers.set(t,e),this.emit("connected",t),this._checkLimit("maxPeers",this._peers.size),l(e).forEach(e=>{const r=this._peerCountPerProtocol[e];r||(this._peerCountPerProtocol[e]=0),this._peerCountPerProtocol[e]++;let n=this._peerProtocols[t];n||(n=this._peerProtocols[t]=new Set),n.add(e),this._checkProtocolMaxPeersLimit(e,this._peerCountPerProtocol[e])})}_onPeerDisconnect(e){const t=e.id.toB58String();s("%s: disconnected from %s",this._peerId,t),this._peerValues.delete(t),this._peers.delete(t);const r=this._peerProtocols[t];r&&Array.from(r).forEach(e=>{const t=this._peerCountPerProtocol[e];t&&this._peerCountPerProtocol[e]--}),this.emit("disconnected",t)}_onLatencyMeasure(e){this._checkLimit("maxEventLoopDelay",e.avgMs)}_checkLimit(e,t){const r=this._options[e];s("checking limit of %s. current value: %d of %d",e,t,r),t>r&&(s("%s: limit exceeded: %s, %d",this._peerId,e,t),this.emit("limit:exceeded",e,t),this._maybeDisconnectOne())}_checkProtocolMaxPeersLimit(e,t){s("checking protocol limit. current value of %s is %d",e,t);const r=this._options.maxPeersPerProtocol[e];t>r&&(s("%s: protocol max peers limit exceeded: %s, %d",this._peerId,e,t),this.emit("limit:exceeded",e,t),this._maybeDisconnectOne())}_maybeDisconnectOne(){if(this._options.minPeers{e&&this.emit("error",e)})}}function c(e,t){return e[1]-t[1]}function u(e){return e||(e={}),Object.keys(e).forEach(t=>{const r=e[t];delete e[t],e[t.toLowerCase()]=r}),e}function l(e){const t=new Set;return e.multiaddrs.forEach(e=>{e.protos().map(h).forEach(e=>{t.add(e)})}),Array.from(t)}function h(e){return e.name.toLowerCase()}e.exports=a},"5c41":function(e,t,r){"use strict";const n=r("f2a6"),i=r("b103"),s=r("b02d"),{LastWriteWins:o,NoZeroes:a}=s,c=r("ce32"),{isDefined:u,findUniques:l,difference:h,io:f}=r("79ca"),d=["heads"],p=(e,t)=>e.slice(e.length-Math.min(e.length,t),e.length);class y{static async toMultihash(e,t,{format:r}={}){if(!u(e))throw c.IPFSNotDefinedError();if(!u(t))throw c.LogNotDefinedError();if(u(r)||(r="dag-cbor"),t.values.length<1)throw new Error("Can't serialize an empty log");return f.write(e,r,t.toJSON(),{links:d})}static async fromMultihash(e,t,{length:r=-1,exclude:n=[],timeout:s,concurrency:l,sortFn:h,onProgressCallback:y}){if(!u(e))throw c.IPFSNotDefinedError();if(!u(t))throw new Error(`Invalid hash: ${t}`);const g=await f.read(e,t,{links:d});if(!g.heads||!g.id)throw c.NotALogError();h=h||a(o);const m=e=>g.heads.includes(e.hash),b=await i.fetchAll(e,g.heads,{length:r,exclude:n,timeout:s,concurrency:l,onProgressCallback:y}),v=g.id,w=r>-1?p(b.sort(h),r):b,_=w.filter(m);return{logId:v,entries:w,heads:_}}static async fromEntryHash(e,t,{length:r=-1,exclude:n=[],timeout:s,concurrency:l,sortFn:h,onProgressCallback:f}){if(!u(e))throw c.IpfsNotDefinedError();if(!u(t))throw new Error("'hash' must be defined");const d=Array.isArray(t)?t:[t];r=r>-1?Math.max(r,1):r;const y=await i.fetchParallel(e,d,{length:r,exclude:n,timeout:s,concurrency:l,onProgressCallback:f});h=h||a(o);const g=r>-1?p(y.sort(h),r):y;return{entries:g}}static async fromJSON(e,t,{length:r=-1,timeout:s,concurrency:o,onProgressCallback:a}){if(!u(e))throw c.IPFSNotDefinedError();const{id:l,heads:h}=t,f=h.map(e=>e.hash),d=await i.fetchParallel(e,f,{length:r,timeout:s,concurrency:o,onProgressCallback:a}),p=d.sort(n.compare);return{logId:l,entries:p,heads:h}}static async fromEntry(e,t,{length:r=-1,exclude:s=[],timeout:o,concurrency:a,onProgressCallback:f}){if(!u(e))throw c.IPFSNotDefinedError();if(!u(t))throw new Error("'sourceEntries' must be defined");if(!Array.isArray(t)&&!n.isEntry(t))throw new Error("'sourceEntries' argument must be an array of Entry instances or a single Entry");Array.isArray(t)||(t=[t]),r=r>-1?Math.max(r,t.length):r;const d=t.map(e=>e.hash),p=await i.fetchParallel(e,d,{length:r,exclude:s,timeout:o,concurrency:a,onProgressCallback:f}),y=t.concat(p).concat(s),g=l(y,"hash").sort(n.compare),m=g.slice(r>-1?-r:-g.length),b=h(m,t,"hash"),v=(e,t)=>{var r=e.slice(t.length,e.length);return t.concat(r)},w=v(m,b),_=w[w.length-1].id;return{logId:_,entries:w}}}e.exports=y},"5c43":function(e,t){const r="GENESIS";class n{constructor(e,t){this._ipfs=e,this._content={id:`did:${t}:${r}`}}get DID(){if(this._content.id.includes(r))throw new Error("DID is not available before commit");return this._content.id}static async load(e,t){const r=new n(e);return r._content=await n.cidToDocument(e,t),r._content.previousDocument={"/":t.toString()},r}addPublicKey(e,t,r,n,i){this._content.publicKey||(this._content.publicKey=[]);let s={id:`${this._content.id}#${e}`,type:t};s[r]=n,i&&(s.owner=i),this._content.publicKey.push(s)}removePublicKey(e){const t=this._content.publicKey.findIndex(t=>t.id.endsWith(e));this._content.publicKey.splice(t,1),this._content.publicKey.length||delete this._content.publicKey}addAuthentication(e,t){this._content.authentication||(this._content.authentication=[]),this._content.authentication.push({type:e,publicKey:`${this._content.id}#${t}`})}removeAuthentication(e){const t=this._content.authentication.findIndex(t=>t.publicKey.endsWith(e));this._content.authentication.splice(t,1),this._content.authentication.length||delete this._content.authentication}addService(e,t,r,n){this._content.service||(this._content.service=[]),this._content.service.push(Object.assign({id:`${this._content.id};${e}`,type:t,serviceEndpoint:r},n))}removeService(e){const t=this._content.service.findIndex(t=>t.id.endsWith(e));this._content.service.splice(t,1),this._content.service.length||delete this._content.service}setRevocationMethod(e){this._content.revocationMethod=e}addCustomProperty(e,t){this._content[e]=t}removeCustomProperty(e){delete this._content[e]}async commit(e={}){this._content.created?e.noTimestamp||(this._content.updated=new Date(Date.now()).toISOString()):(this._content["@context"]="https://w3id.org/did/v1",e.noTimestamp||(this._content.created=new Date(Date.now()).toISOString()));const t=await this._ipfs.dag.put(this._content,{format:"dag-cbor",hashAlg:"sha2-256"});return this._content=await n.cidToDocument(this._ipfs,t),this._content.previousDocument={"/":t.toString()},t}static async cidToDocument(e,t){let n=(await e.dag.get(t)).value;if(n.id.includes(r)){const e=new RegExp(r,"gi");n.id=n.id.replace(e,t),n.publicKey&&(n.publicKey=JSON.parse(JSON.stringify(n.publicKey).replace(e,t))),n.authentication&&(n.authentication=JSON.parse(JSON.stringify(n.authentication).replace(e,t))),n.service&&(n.service=JSON.parse(JSON.stringify(n.service).replace(e,t)))}return n.previousDocument&&(n.previousDocument={"/":n.previousDocument.toString()}),n}}e.exports=n},"5c4e":function(e,t,r){"use strict";const n=r("fb71");e.exports=e=>{const t=e.repo||"ipfs";return new n(t,{autoMigrate:e.repoAutoMigrate})}},"5c71":function(e,t,r){"use strict";const n=r("b74a"),i=r("3f64"),s=r("f65f").logger;e.exports=class{constructor(e,t,r){this.peerId=t,this.network=r,this.refcnt=1,this._entries=[],this._log=s(e,"msgqueue",t.toB58String().slice(0,8)),this.sendEntries=n(this._sendEntries.bind(this),200)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;const e=new i(!1);this._entries.forEach(t=>{t.cancel?e.cancel(t.cid):e.addEntry(t.cid,t.priority)}),this._entries=[],this.addMessage(e)}async send(e){try{await this.network.connectTo(this.peerId)}catch(t){return void this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),t.message)}this._log("sending message to peer %s",this.peerId.toB58String()),this.network.sendMessage(this.peerId,e).catch(e=>{this._log.error("send error: %s",e.message)})}}},"5c9e":function(e,t,r){"use strict";const n=r("df7c"),i=r("3c43"),s=r("021d");t.filter=(e,t)=>async function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},"5c9e5":function(e,t){function r(e,t){return null==e?void 0:e[t]}e.exports=r},"5c9eb":function(e,t,r){"use strict";var n=r("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.toSignatureObject=l,t.verifyES256K=h,t.verifyRecoverableES256K=f,t.verifyEd25519=d;var i=r("3337"),s=r("b0e4"),o=n(r("fb4d")),a=n(r("dfb7")),c=n(r("427a")),u=new i.ec("secp256k1");function l(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=o.default.toBuffer(e);if(r.length!==(t?65:64))throw new Error("wrong signature length");var n=r.slice(0,32).toString("hex"),i=r.slice(32,64).toString("hex"),s={r:n,s:i};return t&&(s.recoveryParam=r[64]),s}function h(e,t,r){var n=(0,s.sha256)(e),i=l(t),o=r.find((function(e){var t=e.publicKeyHex;return u.keyFromPublic(t,"hex").verify(n,i)}));if(!o)throw new Error("Signature invalid for JWT");return o}function f(e,t,r){var n=l(t,!0),i=(0,s.sha256)(e),o=u.recoverPubKey(i,n,n.recoveryParam),a=o.encode("hex"),c=o.encode("hex",!0),h=(0,s.toEthereumAddress)(a),f=r.find((function(e){var t=e.publicKeyHex,r=e.ethereumAddress;return t===a||t===c||r===h}));if(!f)throw new Error("Signature invalid for JWT");return f}function d(e,t,r){var n=c.default.decodeUTF8(e),i=c.default.decodeBase64(o.default.toBase64(t)),s=r.find((function(e){var t=e.publicKeyBase64;return a.default.sign.detached.verify(n,i,c.default.decodeBase64(t))}));if(!s)throw new Error("Signature invalid for JWT");return s}var p={ES256K:h,"ES256K-R":f,Ed25519:d};function y(e){var t=p[e];if(!t)throw new Error("Unsupported algorithm ".concat(e));return t}y.toSignatureObject=l,e.exports=y},"5cb7":function(e,t,r){var n,i,s;(function(){var r,o,a,c,u,l,h,f,d,p,y,g,m,b,v;a=Math.floor,p=Math.min,o=function(e,t){return et?1:0},d=function(e,t,r,n,i){var s;if(null==r&&(r=0),null==i&&(i=o),r<0)throw new Error("lo must be non-negative");null==n&&(n=e.length);while(rr;0<=r?t++:t--)u.push(t);return u}.apply(this).reverse(),c=[],n=0,i=s.length;ny;0<=y?++l:--l)g.push(u(e,r));return g},b=function(e,t,r,n){var i,s,a;null==n&&(n=o),i=e[r];while(r>t){if(a=r-1>>1,s=e[a],!(n(i,s)<0))break;e[r]=s,r=a}return e[r]=i},v=function(e,t,r){var n,i,s,a,c;null==r&&(r=o),i=e.length,c=t,s=e[t],n=2*t+1;while(n0&&void 0!==arguments[0]?arguments[0]:{},n=t.latencyCheckIntervalMs,i=t.dataEmitIntervalMs,s=t.asyncTestFn,o=t.latencyRandomPercentage;d(this,r);var c=p(this,(r.__proto__||Object.getPrototypeOf(r)).call(this)),u=c;return u.latencyCheckIntervalMs=n||500,u.latencyRandomPercentage=o||10,u._latecyCheckMultiply=u.latencyRandomPercentage/100*2*u.latencyCheckIntervalMs,u._latecyCheckSubtract=u._latecyCheckMultiply/2,u.dataEmitIntervalMs=null===i||0===i?void 0:i||5e3,g("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",u.latencyCheckIntervalMs,u.dataEmitIntervalMs),u.dataEmitIntervalMs?g("Expecting ~%s events per summary",u.latencyCheckIntervalMs/u.dataEmitIntervalMs):g("Not emitting summaries"),u.asyncTestFn=s,e&&e.hrtime?(g("Using process.hrtime for timing"),u.now=e.hrtime,u.getDeltaMS=function(e){var t=u.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!==typeof window&&(0,a.default)(window,"performance.now")?(g("Using performance.now for timing"),u.now=window.performance.now.bind(window.performance),u.getDeltaMS=function(e){return Math.round(u.now()-e)}):(g("Using Date.now for timing"),u.now=Date.now,u.getDeltaMS=function(e){return u.now()-e}),u._latencyData=u._initLatencyData(),b()&&(u._visibilityChangeEmitter=new h.default,u._visibilityChangeEmitter.on("visibilityChange",(function(e){e?u._startTimers():(u._emitSummary(),u._stopTimers())}))),u._visibilityChangeEmitter&&!u._visibilityChangeEmitter.isVisible()||u._startTimers(),c}return y(r,t),n(r,[{key:"_startTimers",value:function(){var e=this;this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval((function(){return e._emitSummary()}),this.dataEmitIntervalMs),(0,u.default)(this._emitIntervalID.unref)&&this._emitIntervalID.unref()))}},{key:"_stopTimers",value:function(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}},{key:"_emitSummary",value:function(){var e=this.getSummary();e.events>0&&this.emit("data",e)}},{key:"getSummary",value:function(){var e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),g("Summary: %O",e),e}},{key:"_checkLatency",value:function(){var e=this,t=this,r=Math.random()*t._latecyCheckMultiply-t._latecyCheckSubtract,n={deltaOffset:Math.ceil(t.latencyCheckIntervalMs+r),startTime:t.now()},i=function(){if(e._checkLatencyID){var r=t.getDeltaMS(n.startTime)-n.deltaOffset;t._checkLatency(),t._latencyData.events++,t._latencyData.minMs=Math.min(t._latencyData.minMs,r),t._latencyData.maxMs=Math.max(t._latencyData.maxMs,r),t._latencyData.totalMs+=r,g("MS: %s Data: %O",r,t._latencyData)}};g("localData: %O",n),this._checkLatencyID=setTimeout((function(){t.asyncTestFn?(n.deltaOffset=0,n.startTime=t.now(),t.asyncTestFn(i)):(n.deltaOffset-=1,i())}),n.deltaOffset),(0,u.default)(this._checkLatencyID.unref)&&this._checkLatencyID.unref()}},{key:"_initLatencyData",value:function(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}]),r}(s.default);function b(){return"undefined"!==typeof window}t.default=m}).call(this,r("4362"))},"5cdc":function(e,t,r){"use strict";(function(e){const n=r("a0e5").bignum;t.toBase64=function(t,r){const n=t.toArrayLike(e,"be",r).toString("base64");return n.replace(/(=*)$/,"").replace(/\+/g,"-").replace(/\//g,"_")},t.toBn=function(t){return new n(e.from(t,"base64"))}}).call(this,r("b639").Buffer)},"5d02":function(e){e.exports=JSON.parse('{"_args":[["ipfs-http-client@33.1.1","/Users/feewet/dev/ethdenver/bound/frontend"]],"_from":"ipfs-http-client@33.1.1","_id":"ipfs-http-client@33.1.1","_inBundle":false,"_integrity":"sha512-iwtLL3lOIzxXJFwLnOEtFUv1cYTuWJ0NauD7rpMEd/y4C7z6fuN6TSF4h547lxMh7sJWv+6Z0PmOA5N8FzUHJw==","_location":"/ipfs/libp2p-delegated-content-routing/ipfs-http-client","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"ipfs-http-client@33.1.1","name":"ipfs-http-client","escapedName":"ipfs-http-client","rawSpec":"33.1.1","saveSpec":null,"fetchSpec":"33.1.1"},"_requiredBy":["/ipfs/libp2p-delegated-content-routing"],"_resolved":"https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-33.1.1.tgz","_spec":"33.1.1","_where":"/Users/feewet/dev/ethdenver/bound/frontend","browser":{"glob":false,"fs":false,"stream":"readable-stream"},"bugs":{"url":"https://github.com/ipfs/js-ipfs-http-client/issues"},"contributors":[{"name":"Alan Shaw","email":"alan.shaw@protocol.ai"},{"name":"Alan Shaw","email":"alan@tableflip.io"},{"name":"Alex Mingoia","email":"talk@alexmingoia.com"},{"name":"Alex Potsides","email":"alex@achingbrain.net"},{"name":"Antonio Tenorio-Fornés","email":"antoniotenorio@ucm.es"},{"name":"Bruno Barbieri","email":"bbarbieri@delivery.com"},{"name":"Clemo","email":"flipflopsimsommer@users.noreply.github.com"},{"name":"Connor Keenan","email":"ckeenan89@gmail.com"},{"name":"Danny","email":"dannyid@protonmail.com"},{"name":"David Braun","email":"David.Braun@Toptal.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Dietrich Ayala","email":"autonome@gmail.com"},{"name":"Diogo Silva","email":"fsdiogo@gmail.com"},{"name":"Dmitriy Ryajov","email":"dryajov@gmail.com"},{"name":"Dmitry Nikulin","email":"dmitr-nikulin@mail.ru"},{"name":"Donatas Stundys","email":"donatas.stundys@necolt.com"},{"name":"Fil","email":"fil@rezo.net"},{"name":"Filip Š","email":"filip.stamcar@hotmail.com"},{"name":"Francisco Baio Dias","email":"xicombd@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Gar","email":"gar+gh@danger.computer"},{"name":"Gavin McDermott","email":"gavinmcdermott@gmail.com"},{"name":"Gopalakrishna Palem","email":"KrishnaPG@users.noreply.github.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Haad","email":"haadcode@users.noreply.github.com"},{"name":"Harlan T Wood","email":"harlantwood@users.noreply.github.com"},{"name":"Harlan T Wood","email":"code@harlantwood.net"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Holodisc","email":"holodiscent@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Hugo Dias","email":"mail@hugodias.me"},{"name":"JGAntunes","email":"j.goncalo.antunes@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"James Halliday","email":"substack@gmail.com"},{"name":"Jason Carver","email":"jacarver@linkedin.com"},{"name":"Jason Papakostas","email":"vith@users.noreply.github.com"},{"name":"Jeff Downie","email":"JeffDownie@users.noreply.github.com"},{"name":"Jeromy","email":"why@ipfs.io"},{"name":"Jeromy","email":"jeromyj@gmail.com"},{"name":"Joe Turgeon","email":"arithmetric@gmail.com"},{"name":"Jonathan","email":"jkrone@vt.edu"},{"name":"Juan Batiz-Benet","email":"juan@benet.ai"},{"name":"Kevin Wang","email":"kevin@fossa.io"},{"name":"Kristoffer Ström","email":"kristoffer@rymdkoloni.se"},{"name":"Marcin Rataj","email":"lidel@lidel.org"},{"name":"Matt Bell","email":"mappum@gmail.com"},{"name":"Matt Ober","email":"matt.ober3@gmail.com"},{"name":"Maxime Lathuilière","email":"k@maxlath.eu"},{"name":"Michael Bradley","email":"michaelsbradleyjr@gmail.com"},{"name":"Michael Muré","email":"michael.mure@consensys.net"},{"name":"Michael Muré","email":"batolettre@gmail.com"},{"name":"Mikeal Rogers","email":"mikeal.rogers@gmail.com"},{"name":"Mitar","email":"mitar.git@tnode.com"},{"name":"Mithgol","email":"getgit@mithgol.ru"},{"name":"Mohamed Abdulaziz","email":"mohamed@mohamedabdulaziz.com"},{"name":"Nitin Patel","email":"31539366+niinpatel@users.noreply.github.com"},{"name":"Nuno Nogueira","email":"nunofmn@gmail.com"},{"name":"Níckolas Goline","email":"nickolas.goline@gmail.com"},{"name":"Oli Evans","email":"oli@tableflip.io"},{"name":"Orie Steele","email":"orie@ohs.io"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Pete Thomas","email":"pete@xminusone.net"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Richard Schneider","email":"makaretu@gmail.com"},{"name":"Roman Khafizianov","email":"requilence@gmail.com"},{"name":"SeungWon","email":"ksw3894@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Tara Vancil","email":"tbvanc@gmail.com"},{"name":"Teri Chadbourne","email":"terichadbourne@users.noreply.github.com"},{"name":"Travis Person","email":"travis@protocol.ai"},{"name":"Travis Person","email":"travis.person@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Victor Bjelkholm","email":"victor@typeform.com"},{"name":"Volker Mische","email":"volker.mische@gmail.com"},{"name":"Zhiyuan Lin","email":"edsgerlin@gmail.com"},{"name":"dirkmc","email":"dirkmdev@gmail.com"},{"name":"dmitriy ryajov","email":"dryajov@dmitriys-MacBook-Pro.local"},{"name":"elsehow","email":"yes@cosmopol.is"},{"name":"ethers","email":"ethereum@outlook.com"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"haad","email":"haad@headbanggames.com"},{"name":"kumavis","email":"kumavis@users.noreply.github.com"},{"name":"leekt216","email":"leekt216@gmail.com"},{"name":"nginnever","email":"ginneversource@gmail.com"},{"name":"noah the goodra","email":"peterpan0413@live.com"},{"name":"priecint","email":"tp-dev@seznam.cz"},{"name":"samuli","email":"samuli@nugg.ad"},{"name":"shunkin","email":"hiyoko.san.ipod@gmail.com"},{"name":"victorbjelkholm","email":"victorbjelkholm@gmail.com"},{"name":"Łukasz Magiera","email":"magik6k@users.noreply.github.com"},{"name":"Łukasz Magiera","email":"magik6k@gmail.com"}],"dependencies":{"async":"^2.6.1","bignumber.js":"^9.0.0","bl":"^3.0.0","bs58":"^4.0.1","buffer":"^5.2.1","cids":"~0.7.1","concat-stream":"github:hugomrdias/concat-stream#feat/smaller","debug":"^4.1.0","detect-node":"^2.0.4","end-of-stream":"^1.4.1","err-code":"^1.1.2","flatmap":"0.0.3","glob":"^7.1.3","ipfs-block":"~0.8.1","ipfs-utils":"~0.0.3","ipld-dag-cbor":"~0.15.0","ipld-dag-pb":"~0.17.3","ipld-raw":"^4.0.0","is-ipfs":"~0.6.1","is-pull-stream":"0.0.0","is-stream":"^2.0.0","iso-stream-http":"~0.1.2","iso-url":"~0.4.6","just-kebab-case":"^1.1.0","just-map-keys":"^1.1.0","kind-of":"^6.0.2","lru-cache":"^5.1.1","multiaddr":"^6.0.6","multibase":"~0.6.0","multicodec":"~0.5.1","multihashes":"~0.4.14","ndjson":"github:hugomrdias/ndjson#feat/readable-stream3","once":"^1.4.0","peer-id":"~0.12.2","peer-info":"~0.15.1","promisify-es6":"^1.0.3","pull-defer":"~0.2.3","pull-stream":"^3.6.9","pull-to-stream":"~0.1.1","pump":"^3.0.0","qs":"^6.5.2","readable-stream":"^3.1.1","stream-to-pull-stream":"^1.7.2","tar-stream":"^2.0.1","through2":"^3.0.1"},"description":"A client library for the IPFS HTTP API","devDependencies":{"aegir":"^19.0.3","browser-process-platform":"~0.1.1","chai":"^4.2.0","cross-env":"^5.2.0","dirty-chai":"^2.0.1","go-ipfs-dep":"~0.4.21","interface-ipfs-core":"^0.109.0","ipfsd-ctl":"~0.43.0","nock":"^10.0.2","stream-equal":"^1.1.1"},"engines":{"node":">=8.3.0","npm":">=3.0.0"},"files":["src","dist"],"homepage":"https://github.com/ipfs/js-ipfs-http-client","keywords":["ipfs"],"leadMaintainer":"Alan Shaw ","license":"MIT","main":"src/index.js","name":"ipfs-http-client","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-http-client.git"},"scripts":{"build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","lint":"aegir lint","release":"aegir release ","release-major":"aegir release --type major ","release-minor":"aegir release --type minor ","test":"aegir test","test:browser":"aegir test -t browser","test:node":"aegir test -t node","test:webworker":"aegir test -t webworker"},"version":"33.1.1"}')},"5d14":function(e,t,r){"use strict";(function(t){const n=r("1304").Key,i=new n("api");e.exports=e=>({async get(){const t=await e.get(i);return t&&t.toString()},async set(r){return e.put(i,t.from(r.toString()))},async delete(){return e.delete(i)}})}).call(this,r("b639").Buffer)},"5d36":function(e,t,r){"use strict";const n=r("2e53"),i=r("f929"),s=r("b1aa"),o=r("7048"),a=r("e3d5"),c=r("4bc2"),u=c("ipfs:ipns:resolver");u.error=c("ipfs:ipns:resolver:error");const{Errors:l}=r("7b6d"),h=l.notFoundError().code,f=32;class d{constructor(e){this._routing=e}async resolve(e,t){if(t=t||{},"string"!==typeof e)throw o(new Error("invalid name"),"ERR_INVALID_NAME");t=t||{};const r=t.recursive&&"true"===t.recursive.toString(),n=e.split("/");if(3!==n.length||""!==n[0])throw o(new Error("invalid name"),"ERR_INVALID_NAME");const i=n[2];let s;r&&(s=f);const a=await this.resolver(i,s);return u(`${e} was locally resolved correctly`),a}async resolver(e,t){if(0===t){const e=`could not resolve name (recursion limit of ${f} exceeded)`;throw u.error(e),o(new Error(e),"ERR_RESOLVE_RECURSION_LIMIT")}const r=await this._resolveName(e),n=r.split("/");return"ipfs"!==n[1]&&t?this.resolver(n[2],t-1):r}async _resolveName(e){const t=s.createFromBytes(new a(e).multihash),{routingKey:r}=n.getIdKeys(t.toBytes());let c,l,f;try{c=await this._routing.get(r.toBuffer())}catch(d){if(u.error(d),d.code===h)throw o(new Error(`record requested for ${e} was not found in the network`),"ERR_NO_RECORD_FOUND");throw o(new Error(`unexpected error getting the ipns record ${t.id}`),"ERR_UNEXPECTED_ERROR_GETTING_RECORD")}try{l=n.unmarshal(c)}catch(d){throw u.error(d),o(new Error("found ipns record that we couldn't convert to a value"),"ERR_INVALID_RECORD_RECEIVED")}if(l.pubKey)return this._validateRecord(t,l);try{f=await this._routing.get(r.toBuffer())}catch(d){if(u.error(d),d.code===h)throw o(new Error(`public key requested for ${e} was not found in the network`),"ERR_NO_RECORD_FOUND");throw o(new Error(`unexpected error getting the public key for the ipns record ${t.id}`),"ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY")}try{t.pubKey=i.keys.unmarshalPublicKey(f)}catch(d){throw u.error(d),o(new Error("found public key record that we couldn't convert to a value"),"ERR_INVALID_PUB_KEY_RECEIVED")}return this._validateRecord(t,l)}async _validateRecord(e,t){const r=await n.extractPublicKey(e,t);return await n.validate(r,t),t.value.toString()}}e.exports=d},"5d41":function(e,t,r){var n=r("23e7"),i=r("861d"),s=r("825a"),o=r("5135"),a=r("06cf"),c=r("e163");function u(e,t){var r,n,l=arguments.length<3?e:arguments[2];return s(e)===l?e[t]:(r=a.f(e,t))?o(r,"value")?r.value:void 0===r.get?void 0:r.get.call(l):i(n=c(e))?u(n,t,l):void 0}n({target:"Reflect",stat:!0},{get:u})},"5d5f":function(e,t,r){var n=r("5995");r("b3d5"),r("31a0");var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||c();var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s>>0,a>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=a[1],a[1]=a[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),u(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,c,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,h=l&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-h));for(var f=8*i.fullMessageLength[0],d=0;d>>0,f+=c,o.putInt32(f>>>0),f=a>>>0;o.putInt32(f);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};u(p,r,o);var y=n.util.createBuffer();return y.putInt32(p.h0),y.putInt32(p.h1),y.putInt32(p.h2),y.putInt32(p.h3),y.putInt32(p.h4),y.putInt32(p.h5),y.putInt32(p.h6),y.putInt32(p.h7),y},i};var s=null,o=!1,a=null;function c(){s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),a=[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],o=!0}function u(e,t,r){var n,i,s,o,c,u,l,h,f,d,p,y,g,m,b,v=r.length();while(v>=64){for(l=0;l<16;++l)t[l]=r.getInt32();for(;l<64;++l)n=t[l-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[l-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[l]=n+t[l-7]+i+t[l-16]|0;for(h=e.h0,f=e.h1,d=e.h2,p=e.h3,y=e.h4,g=e.h5,m=e.h6,b=e.h7,l=0;l<64;++l)o=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),c=m^y&(g^m),s=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),u=h&f|d&(h^f),n=b+o+c+a[l]+t[l],i=s+u,b=m,m=g,g=y,y=p+n>>>0,p=d,d=f,f=h,h=n+i>>>0;e.h0=e.h0+h|0,e.h1=e.h1+f|0,e.h2=e.h2+d|0,e.h3=e.h3+p|0,e.h4=e.h4+y|0,e.h5=e.h5+g|0,e.h6=e.h6+m|0,e.h7=e.h7+b|0,v-=64}}},"5d61":function(e,t){var r=function(e){function t(){this.fetch=!1,this.DOMException=e.DOMException}return t.prototype=e,new t}("undefined"!==typeof self?self:this);(function(e){(function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};function n(e){return e&&DataView.prototype.isPrototypeOf(e)}if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!==typeof e&&(e=String(e)),e}function c(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function l(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function f(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function d(e){var t=new FileReader,r=h(t);return t.readAsText(e),r}function p(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?t:e}function v(e,t){t=t||{};var r=t.body;if(e instanceof v){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new u(t.headers)),this.method=b(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function _(e){var t=new u,r=e.replace(/\r?\n[\t ]+/g," ");return r.split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t}function E(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];E.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(C){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function k(e,n){return new Promise((function(i,s){var o=new v(e,n);if(o.signal&&o.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:_(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;i(new E(t,e))},a.onerror=function(){s(new TypeError("Network request failed"))},a.ontimeout=function(){s(new TypeError("Network request failed"))},a.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&r.blob&&(a.responseType="blob"),o.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof o._bodyInit?null:o._bodyInit)}))}k.polyfill=!0,e.fetch||(e.fetch=k,e.Headers=u,e.Request=v,e.Response=E),t.Headers=u,t.Request=v,t.Response=E,t.fetch=k})({})})(r),delete r.fetch.polyfill,t=r.fetch,t.default=r.fetch,t.fetch=r.fetch,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,e.exports=t},"5d98":function(e,t,r){"use strict";(function(n){const i=r("2612"),s=r("5ab1"),o=r("cc3c"),a=r("1c13");t=e.exports,t.addPrefix=(e,t)=>{let r;if(n.isBuffer(e))r=a.varintBufferEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");r=o[e]}return n.concat([r,t])},t.rmPrefix=e=>(i.decode(e),e.slice(i.decode.bytes)),t.getCodec=e=>{const t=i.decode(e),r=s.get(t);if(void 0===r)throw new Error(`Code ${t} not found`);return r},t.getName=e=>s.get(e),t.getNumber=e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return a.varintBufferDecode(t)[0]},t.getCode=e=>i.decode(e),t.getCodeVarint=e=>{const t=o[e];if(void 0===t)throw new Error("Codec `"+e+"` not found");return t},t.getVarint=e=>i.encode(e);const c=r("81116");Object.assign(t,c),t.print=r("17b2")}).call(this,r("b639").Buffer)},"5dd0":function(e,t,r){"use strict";(function(t){const n=r("7048");async function*i(e){for await(const r of e){if(void 0===r.length)throw n(new Error("Content was invalid"),"ERR_INVALID_CONTENT");"string"===typeof r||r instanceof String?yield t.from(r,"utf8"):Array.isArray(r)?yield t.from(r):yield r}}e.exports=i}).call(this,r("b639").Buffer)},"5e0f":function(e,t,r){"use strict";(function(t,n){function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){H(t,e)}}var s;e.exports=T,T.WritableState=I;var o={deprecate:r("b7d1")},a=r("22a8"),c=r("b639").Buffer,u=t.Uint8Array||function(){};function l(e){return c.from(e)}function h(e){return c.isBuffer(e)||e instanceof u}var f,d=r("28d3"),p=r("ac2a"),y=p.getHighWaterMark,g=r("c499").codes,m=g.ERR_INVALID_ARG_TYPE,b=g.ERR_METHOD_NOT_IMPLEMENTED,v=g.ERR_MULTIPLE_CALLBACK,w=g.ERR_STREAM_CANNOT_PIPE,_=g.ERR_STREAM_DESTROYED,E=g.ERR_STREAM_NULL_VALUES,S=g.ERR_STREAM_WRITE_AFTER_END,k=g.ERR_UNKNOWN_ENCODING,C=d.errorOrDestroy;function A(){}function I(e,t,n){s=s||r("a390"),e=e||{},"boolean"!==typeof n&&(n=t instanceof s),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=y(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){L(t,e)},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 T(e){s=s||r("a390");var t=this instanceof s;if(!t&&!f.call(T,this))return new T(e);this._writableState=new I(e,this,t),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)),a.call(this)}function x(e,t){var r=new S;C(e,r),n.nextTick(t,r)}function B(e,t,r,i){var s;return null===r?s=new E:"string"===typeof r||t.objectMode||(s=new m("chunk",["string","Buffer"],r)),!s||(C(e,s),n.nextTick(i,s),!1)}function R(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!==typeof t||(t=c.from(t,r)),t}function N(e,t,r,n,i,s){if(!r){var o=R(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length-1))throw new k(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new b("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,t,r){var n=this._writableState;return"function"===typeof e?(r=e,e=null,t=null):"function"===typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||z(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=d.destroy,T.prototype._undestroy=d.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this,r("c8ba"),r("4362"))},"5e27":function(e,t,r){"use strict";const n=r("df7c"),i=r("3c43"),s=r("021d");t.filter=(e,t)=>async function*(){for await(const r of e){const e=await t(r);e&&(yield r)}}(),t.sortAll=(e,t)=>async function*(){let r=[];for await(const t of e)r.push(t);r=await t(r);for(const e of r)yield e}(),t.take=(e,t)=>async function*(){if(t<=0)return;let r=0;for await(const n of e)if(yield n,r++,r>=t)return}(),t.map=(e,t)=>async function*(){for await(const r of e)yield t(r)}(),t.replaceStartWith=function(e,t){const r=new RegExp("^"+t);return e.replace(r,"")},t.tmpdir=()=>n.join(i.tmpdir(),s())},"5e38":function(e,t,r){"use strict";function n(e,t,r){var n;if(!(e instanceof Error))throw new TypeError("Please pass an Error to err-code");if("object"===typeof t?r=t:null!=t&&(e.code=t),r)for(n in r)e[n]=r[n];return e}e.exports=n},"5e45":function(e,t,r){var n=r("c3bb"),i=r("ba68").Readable,s=r("0bac");function o(e,t){if(!(this instanceof o))return new o(e,t);t=t||{},i.call(this,s(t,{objectMode:!0})),this._iterator=e,this._options=t,this.on("end",this.destroy.bind(this,null,null))}e.exports=o,n(o,i),o.prototype._read=function(){var e=this,t=this._options;this.destroyed||this._iterator.next((function(r,n,i){if(!e.destroyed)return r?e.destroy(r):void(void 0===n&&void 0===i?e.push(null):!1!==t.keys&&!1===t.values?e.push(n):!1===t.keys&&!1!==t.values?e.push(i):e.push({key:n,value:i}))}))},o.prototype._destroy=function(e,t){this._iterator.end((function(r){t(e||r)}))}},"5e55":function(e,t,r){"use strict";var n=r("a3b8");e.exports=function(e,t){if(!e)return function(e,r){return e?n(r,e,t):r(!0)};Array.isArray(e)||(e=Object.keys(e).map((function(t){return e[t]})));var r=0;return function(i,s){if(i)return n(s,i,t);r>=e.length?s(!0):s(null,e[r++])}}},"5e57":function(e,t,r){"use strict";(function(e){const n=r("9aa3"),i=r("9f2e");t.publicKeyLength=n.sign.publicKeyLength,t.privateKeyLength=n.sign.secretKeyLength,t.generateKey=function(e){i(()=>{let t;try{t=n.sign.keyPair()}catch(r){return e(r)}e(null,t)})},t.generateKeyFromSeed=function(e,t){i(()=>{let r;try{r=n.sign.keyPair.fromSeed(e)}catch(i){return t(i)}t(null,r)})},t.hashAndSign=function(t,r,s){i(()=>{s(null,e.from(n.sign.detached(r,t)))})},t.hashAndVerify=function(e,t,r,s){i(()=>{let i;try{i=n.sign.detached.verify(r,t,e)}catch(o){return s(o)}s(null,i)})}}).call(this,r("b639").Buffer)},"5eae":function(e,t,r){"use strict";const n=r("bbaf6"),i=r("de4f").isFunction,s=r("de4f").isBoolean,o=r("de4f").isObject,a=r("de4f").isArray,c=r("de4f").isRegex,u=r("de4f").assign,l=r("de4f").keys;function h(e){return null===e||void 0===e?e:c(e)?e.toString():e.toJSON?e.toJSON():e}function f(e,t){t=t||u({},n),i(t)&&(t={compare:t});const r=t.space||n.space,c=s(t.cycles)?t.cycles:n.cycles,f=t.replacer||n.replacer,d=t.stringify||n.stringify,p=t.compare&&function(e){return function(t){return function(r,n){const i={key:r,value:t[r]},s={key:n,value:t[n]};return e(i,s)}}}(t.compare);c||d(e);const y=[];return function e(t,n,i,s){const u=r?"\n"+new Array(s+1).join(r):"",g=r?": ":":";if(i=h(i),i=f.call(t,n,i),void 0!==i){if(!o(i)||null===i)return d(i);if(a(i)){const t=[];for(let n=0;n15?(i=Date.now(),c(e)):(r.push(e),1===r.length&&o.setAttribute("a",s=!s))}}a.nextTick=a.setImmediate})(),a.isNodejs="undefined"!==typeof t&&t.versions&&t.versions.node,a.globalScope=function(){return a.isNodejs?n:"undefined"===typeof self?window:self}(),a.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},a.isArrayBufferView=function(e){return e&&a.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},a.ByteBuffer=u,a.ByteStringBuffer=u;var l=4096;function h(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=a.isArrayBuffer(e),n=a.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}a.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>l&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},a.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);var r=this.data;while(t>0)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},a.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},a.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(a.encodeUtf8(e))},a.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},a.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},a.ByteStringBuffer.prototype.putInt=function(e,t){c(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},a.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},a.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},a.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},a.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var e=a.createBuffer(this.data);return e.read=this.read,e},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},a.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},a.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},a.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},a.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},a.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(e,t){c(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},a.DataBuffer.prototype.putSignedInt=function(e,t){return c(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},a.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},a.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},a.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0)1&t&&(r+=e),t>>>=1,t>0&&(e+=e);return r},a.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s,n},a.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(e,t){var r,n,i,s="",o="",a=0;while(a>2),s+=f.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=f.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":f.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s,o},a.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");var t,r,n,i,s="",o=0;while(o>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},a.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},a.decodeUtf8=function(e){return decodeURIComponent(escape(e))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},a.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},a.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,s=0;s>2),s+=f.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=f.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":f.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s,o},a.binary.base64.decode=function(e,t,r){var n,i,s,o,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;var c=0,u=r;while(c>4,64!==s&&(a[u++]=(15&i)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},a.binary.base58.encode=function(e,t){return a.binary.baseN.encode(e,p,t)},a.binary.base58.decode=function(e,t){return a.binary.baseN.decode(e,p,t)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(e,t,r){e=a.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var i=r,s=0;s0?(i=r[n].substring(0,o),s=r[n].substring(o+1)):(i=r[n],s=null),i in t||(t[i]=[]),i in Object.prototype||null===s||t[i].push(unescape(s))}return t};return"undefined"===typeof e?(null===E&&(E="undefined"!==typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=E):t=r(e),t},a.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");i.length>0&&""===i[0]&&i.shift();var s=""===r?{}:a.getQueryVariables(r);return{pathString:t,queryString:r,path:i,query:s}},a.makeRequest=function(e){var t=a.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return"undefined"===typeof e?t.path:t.path[e]},getQuery:function(e,r){var n;return"undefined"===typeof e?n=t.query:(n=t.query[e],n&&"undefined"!==typeof r&&(n=n[r])),n},getQueryLast:function(e,t){var n,i=r.getQuery(e);return n=i?i[i.length-1]:t,n}};return r},a.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},a.setPath=function(e,t,r){if("object"===typeof e&&null!==e){var n=0,i=t.length;while(n0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},a.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+a:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-u).toFixed(s).slice(2):"")},a.formatSize=function(e){return e=e>=1073741824?a.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?a.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?a.formatNumber(e/1024,0)+" KiB":a.formatNumber(e,0)+" bytes",e},a.bytesFromIP=function(e){return-1!==e.indexOf(".")?a.bytesFromIPv4(e):-1!==e.indexOf(":")?a.bytesFromIPv6(e):null},a.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=a.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},a.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in a&&!e.update)return t(null,a.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,t(null,a.cores);if("undefined"===typeof Worker)return a.cores=1,t(null,a.cores);if("undefined"===typeof Blob)return a.cores=2,t(null,a.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;while(Date.now()a.st&&i.sti.st&&a.st{e.push({type:"put",key:t.toString(),value:r})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:()=>this.db.batch(e)}}query(e){let r=!0;null!=e.keysOnly&&(r=!e.keysOnly);const i={keys:!0,values:r,keyAsBuffer:!0};if(null!=e.prefix){const t=e.prefix.toString();i.gte=t,i.lt=t+"ÿ"}let s=h(this.db.iterator(i));if(s=a(s,({key:e,value:i})=>{const s={key:new n(e,!1)};return r&&(s.value=t.from(i)),s}),Array.isArray(e.filters)&&(s=e.filters.reduce((e,t)=>o(e,t),s)),Array.isArray(e.orders)&&(s=e.orders.reduce((e,t)=>u(e,t),s)),null!=e.offset){let t=0;s=o(s,()=>t++>=e.offset)}return null!=e.limit&&(s=c(s,e.limit)),s}}function h(e){return{next:()=>new Promise((t,r)=>{e.next((n,i,s)=>n?r(n):null==i?e.end(e=>{if(e)return r(e);t({done:!0})}):void t({done:!1,value:{key:i,value:s}}))}),return:()=>new Promise((t,r)=>{e.end(e=>{if(e)return r(e);t({done:!0})})}),[Symbol.asyncIterator](){return this}}}e.exports=l}).call(this,r("b639").Buffer)},"5f0c":function(e,t,r){"use strict";const n=r("7048"),i={fixed:r("99e7"),rabin:r("7494")};e.exports=(e,t,r)=>{const s=i[e];if(!s)throw n(new Error(`Unknkown chunker named ${e}`),"ERR_UNKNOWN_CHUNKER");return s(t,r)}},"5f0e":function(e,t,r){"use strict";const n=r("e43a"),{EventEmitter:i}=r("faa1");function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0,n=e.length;rt.vectorClock?e:t}static distance(e,t){let r=0,n=0;const i=Math.min(e.length,t.length),s=Math.max(e.length,t.length);for(;n=0?(this._update(r,n,e),this):r.contacts.length0&&r.length[this.distance(t.id,e),t]).sort((e,t)=>e[0]-t[0]).slice(0,t).map(e=>e[1])}count(){let e=0;for(const t=[this.root];t.length>0;){const r=t.pop();null===r.contacts?t.push(r.right,r.left):e+=r.contacts.length}return e}_determineNode(e,t,r){const n=r>>3,i=r%8;if(t.length<=n&&0!==i)return e.left;const s=t[n];return s&1<<7-i?e.right:e.left}get(e){a("id",e);let t=0,r=this.root;while(null===r.contacts)r=this._determineNode(r,e,t++);const n=this._indexOf(r,e);return n>=0?r.contacts[n]:null}_indexOf(e,t){for(let r=0;r=0){const e=r.contacts.splice(n,1)[0];this.emit("removed",e)}return this}_split(e,t){e.left=o(),e.right=o();for(const i of e.contacts)this._determineNode(e,i.id,t).contacts.push(i);e.contacts=null;const r=this._determineNode(e,this.localNodeId,t),n=e.left===r?e.right:e.left;n.dontSplit=!0}toArray(){let e=[];for(const t=[this.root];t.length>0;){const r=t.pop();null===r.contacts?t.push(r.right,r.left):e=e.concat(r.contacts)}return e}_update(e,t,r){if(!s(e.contacts[t].id,r.id))throw new Error("wrong index for _update");const n=e.contacts[t],i=this.arbiter(n,r);i===n&&n!==r||(e.contacts.splice(t,1),e.contacts.push(i),this.emit("updated",n,i))}}e.exports=c},"5f14":function(e,t,r){(function(t){var n=r("4bc2")("simple-peer"),i=r("4c9f"),s=r("e43a"),o=r("ba68"),a=r("6a91"),c=65536,u=5e3,l=5e3;function h(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function f(e,t){var r=new Error(e);return r.code=t,r}function d(e){console.warn(e)}class p extends o.Duplex{constructor(e){if(e=Object.assign({allowHalfOpen:!1},e),super(e),this._id=s(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||p.channelConfig,this.config=Object.assign({},p.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||u,this.destroyed=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"===typeof e.wrtc?e.wrtc:i(),!this._wrtc)throw"undefined"===typeof window?f("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT"):f("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!this.initiator,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._firstStable=!0,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(t){return void a(()=>this.destroy(f(t,"ERR_PC_CONSTRUCTOR")))}this._isReactNativeWebrtc="number"===typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},this.initiator?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach(e=>{this.addStream(e)}),this._pc.ontrack=e=>{this._onTrack(e)},this.initiator&&this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(this.destroyed)throw f("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"===typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(e=>{this._addIceCandidate(e)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(e=>{this.destroy(f(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(f("signal() called with invalid signal data","ERR_SIGNALING"))}_addIceCandidate(e){var t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch(e=>{!t.address||t.address.endsWith(".local")?d("Ignoring unsupported ICE candidate."):this.destroy(f(e,"ERR_ADD_ICE_CANDIDATE"))})}send(e){this._channel.send(e)}addTransceiver(e,t){if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(r){this.destroy(f(r,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})}addStream(e){this._debug("addStream()"),e.getTracks().forEach(t=>{this.addTrack(t,e)})}addTrack(e,t){this._debug("addTrack()");var r=this._senderMap.get(e)||new Map,n=r.get(t);if(n)throw n.removed?f("Track has been removed. You should enable/disable tracks that you want to re-add.","ERR_SENDER_REMOVED"):f("Track has already been added to that stream.","ERR_SENDER_ALREADY_ADDED");n=this._pc.addTrack(e,t),r.set(t,n),this._senderMap.set(e,r),this._needsNegotiation()}replaceTrack(e,t,r){this._debug("replaceTrack()");var n=this._senderMap.get(e),i=n?n.get(r):null;if(!i)throw f("Cannot replace track that was never added.","ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,n),null!=i.replaceTrack?i.replaceTrack(t):this.destroy(f("replaceTrack is not supported in this browser","ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){this._debug("removeSender()");var r=this._senderMap.get(e),n=r?r.get(t):null;if(!n)throw f("Cannot remove track that was never added.","ERR_TRACK_NOT_ADDED");try{n.removed=!0,this._pc.removeTrack(n)}catch(i){"NS_ERROR_UNEXPECTED"===i.name?this._sendersAwaitingStable.push(n):this.destroy(f(i,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){this._debug("removeSenders()"),e.getTracks().forEach(t=>{this.removeTrack(t,e)})}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,a(()=>{this._batchedNegotiation=!1,this._debug("starting batched negotiation"),this.negotiate()}))}negotiate(){this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating||(this._debug("requesting negotiation from initiator"),this.emit("signal",{renegotiate:!0})),this._isNegotiating=!0}destroy(e){this._destroy(e,()=>{})}_destroy(e,t){if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.destroyed=!0,this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close"),t()}}_setupData(e){if(!e.channel)return this.destroy(f("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"===typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=c),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{this.destroy(f(e,"ERR_DATA_CHANNEL"))};var t=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1},l)}_read(){}_write(e,t,r){if(this.destroyed)return r(f("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(n){return this.destroy(f(n,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>c?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=r):r(null)}else this._debug("write before connect"),this._chunk=e,this._cb=r}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?e():this.once("connect",e)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=h(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})}},r=()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))},n=e=>{this.destroy(f(e,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(r).catch(n)}).catch(e=>{this.destroy(f(e,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=h(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()}},r=()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))},n=e=>{this.destroy(f(e,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(r).catch(n)}).catch(e=>{this.destroy(f(e,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(f("Connection failed.","ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(!this.destroyed){var e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(f("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(f("Ice connection closed.","ERR_ICE_CONNECTION_CLOSED"))}}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(t=>{Object.assign(e,t)}),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(r=>{var n=[];r.forEach(e=>{n.push(t(e))}),e(null,n)},t=>e(t)):this._pc.getStats.length>0?this._pc.getStats(r=>{if(!this.destroyed){var n=[];r.result().forEach(e=>{var r={};e.names().forEach(t=>{r[t]=e.stat(t)}),r.id=e.id,r.type=e.type,r.timestamp=e.timestamp,n.push(t(r))}),e(null,n)}},t=>e(t)):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const e=()=>{this.destroyed||this.getStats((t,r)=>{if(this.destroyed)return;t&&(r=[]);var n={},i={},s={},o=!1;r.forEach(e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(n[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(i[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(s[e.id]=e)});const a=e=>{o=!0;var t=i[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"===typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");var r=n[e.remoteCandidateId];r&&(r.ip||r.address)?(this.remoteAddress=r.ip||r.address,this.remotePort=Number(r.port)):r&&r.ipAddress?(this.remoteAddress=r.ipAddress,this.remotePort=Number(r.portNumber)):"string"===typeof e.googRemoteAddress&&(r=e.googRemoteAddress.split(":"),this.remoteAddress=r[0],this.remotePort=Number(r[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(r.forEach(e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(s[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)}),o||Object.keys(s).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(f(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');var c=this._cb;this._cb=null,c(null)}"number"!==typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(e,100)})};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>c||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"!==this._pc.signalingState||this._firstStable||(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation&&(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()),this._debug("negotiate"),this.emit("negotiate")),this._firstStable=!1,this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=t.from(r)),this.push(r)}}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach(t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some(e=>e.id===t.id)||(this._remoteStreams.push(t),a(()=>{this.emit("stream",t)}))})}_debug(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],n.apply(null,e)}}p.WEBRTC_SUPPORT=!!i(),p.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}],sdpSemantics:"unified-plan"},p.channelConfig={},e.exports=p}).call(this,r("b639").Buffer)},"5f75":function(e,t,r){"use strict";var n=r("4ea4"),i=n(r("a34a")),s=n(r("c973")),o=n(r("f1e8")),a=n(r("427a"));function c(e){return a.default.encodeBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function u(e){var t=a.default.decodeBase64(e);return(function(){var e=(0,s.default)(i.default.mark((function e(r){return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",c(o.default.sign.detached(a.default.decodeUTF8(r),t)));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())}e.exports=u},"5f7e":function(e,t,r){"use strict";const n=r("0503"),i=r("fd9e"),s=r("d4c4"),o=r("4bc2")("ipfs:mfs:stat"),a=r("7048"),c={withLocal:!1};e.exports=e=>async function(t,r){r=n(r,c),o(`Fetching stats for ${t}`);const{type:l,cid:h,mfsPath:f}=await i(e,t),d="ipfs"===l&&h?h:f;let p;try{p=await s(d,e.ipld)}catch(y){if("ERR_NOT_FOUND"===y.code)throw a(new Error(`${t} does not exist`),"ERR_NOT_FOUND");throw y}if(!u[p.cid.codec])throw new Error(`Cannot stat codec ${p.cid.codec}`);return u[p.cid.codec](p,r)};const u={raw:e=>({cid:e.cid,size:e.node.length,cumulativeSize:e.node.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1}),"dag-pb":e=>{let t=e.node.Links.length,r=e.node.size,n=e.node.size,i=null;return e.unixfs&&(r=e.unixfs.fileSize(),i=e.unixfs.type,i.includes("directory")&&(r=0,n=e.node.size),"file"===i&&(t=e.unixfs.blockSizes.length)),{cid:e.cid,size:r,cumulativeSize:n,blocks:t,type:i,local:void 0,sizeLocal:void 0,withLocality:!1}},"dag-cbor":e=>({cid:e.cid,local:void 0,sizeLocal:void 0,withLocality:!1})}},"5f7f":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("ec4e"),s=45569,o=45633,a={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},c={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},u=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}},"5fb1":function(e,t,r){"use strict";(function(n){const i=r("f106"),s=i(r("437b"));r("91bb"),r("8942"),r("5904");const o=r("918b");t=e.exports;const a={rsa:r("793e"),ed25519:r("173c"),secp256k1:r("b694")(s,r("8c79"))};function c(e){const t=a[e.toLowerCase()];return void 0!==t}t.supportedKeys=a,t.keysPBM=s,t.keyStretcher=r("d05d"),t.generateEphemeralKeyPair=r("edb7"),t.generateKeyPair=(e,t,r)=>{const n=a[e.toLowerCase()];if(!n)return r(new Error("invalid or unsupported key type"));n.generateKeyPair(t,r)},t.generateKeyPairFromSeed=(e,t,r,n)=>{const i=a[e.toLowerCase()];return i?"ed25519"!==e.toLowerCase()?n(new Error("Seed key derivation is unimplemented for RSA or secp256k1")):void i.generateKeyPairFromSeed(t,r,n):n(new Error("invalid or unsupported key type"))},t.unmarshalPublicKey=e=>{const t=s.PublicKey.decode(e),r=t.Data;switch(t.Type){case s.KeyType.RSA:return a.rsa.unmarshalRsaPublicKey(r);case s.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PublicKey(r);case s.KeyType.Secp256k1:if(a.secp256k1)return a.secp256k1.unmarshalSecp256k1PublicKey(r);throw new Error("secp256k1 support requires libp2p-crypto-secp256k1 package");default:throw new Error("invalid or unsupported key type")}},t.marshalPublicKey=(e,t)=>{if(t=(t||"rsa").toLowerCase(),!c(t))throw new Error("invalid or unsupported key type");return e.bytes},t.unmarshalPrivateKey=(e,t)=>{let r;try{r=s.PrivateKey.decode(e)}catch(i){return t(i)}const n=r.Data;switch(r.Type){case s.KeyType.RSA:return a.rsa.unmarshalRsaPrivateKey(n,t);case s.KeyType.Ed25519:return a.ed25519.unmarshalEd25519PrivateKey(n,t);case s.KeyType.Secp256k1:return a.secp256k1?a.secp256k1.unmarshalSecp256k1PrivateKey(n,t):t(new Error("secp256k1 support requires libp2p-crypto-secp256k1 package"));default:t(new Error("invalid or unsupported key type"))}},t.marshalPrivateKey=(e,t)=>{if(t=(t||"rsa").toLowerCase(),!c(t))throw new Error("invalid or unsupported key type");return e.bytes},t.import=(e,t,r)=>{try{const i=o.pki.decryptRsaPrivateKey(e,t);if(null===i)throw new Error("Cannot read the key, most likely the password is wrong or not a RSA key");let s=o.asn1.toDer(o.pki.privateKeyToAsn1(i));return s=n.from(s.getBytes(),"binary"),a.rsa.unmarshalRsaPrivateKey(s,r)}catch(i){r(i)}}}).call(this,r("b639").Buffer)},"5fbf":function(e,t,r){"use strict";var n,i,s=r("e6e9"),o=(r("8638"),1567752802062),a=7;function c(e){var t="",r=Math.floor(.001*(Date.now()-o));return r===i?n++:(n=0,i=r),t+=s(a),t+=s(e),n>0&&(t+=s(n)),t+=s(r),t}e.exports=c},"5fc2":function(e,t,r){(function(t){var n=r("ba68").Transform,i=r("3022").inherits;function s(e){n.call(this,e),this._destroyed=!1}function o(e,t,r){r(null,e)}function a(e){return function(t,r,n){return"function"==typeof t&&(n=r,r=t,t={}),"function"!=typeof r&&(r=o),"function"!=typeof n&&(n=null),e(t,r,n)}}i(s,n),s.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var r=this;t.nextTick((function(){e&&r.emit("error",e),r.emit("close")}))}},e.exports=a((function(e,t,r){var n=new s(e);return n._transform=t,r&&(n._flush=r),n})),e.exports.ctor=a((function(e,t,r){function n(t){if(!(this instanceof n))return new n(t);this.options=Object.assign({},e,t),s.call(this,this.options)}return i(n,s),n.prototype._transform=t,r&&(n.prototype._flush=r),n})),e.exports.obj=a((function(e,t,r){var n=new s(Object.assign({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n}))}).call(this,r("4362"))},"5ffd":function(e,t,r){"use strict";const n=r("7048"),i=(e,t,r)=>{if(t||(t=0),t<0)throw n(new Error("Offset must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(t>e)throw n(new Error("Offset must be less than the file size"),"ERR_INVALID_PARAMS");if(r||0===r||(r=e-t),r<0)throw n(new Error("Length must be greater than or equal to 0"),"ERR_INVALID_PARAMS");return t+r>e&&(r=e-t),{offset:t,length:r}};e.exports=i},6:function(e,t){},6017:function(e,t,r){(function(e,t){(function(e,r){"use strict";if(!e.setImmediate){var n,i=1,s={},o=!1,a=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"==={}.toString.call(e.process)?d():p()?y():e.MessageChannel?g():a&&"onreadystatechange"in a.createElement("script")?m():b(),c.setImmediate=u,c.clearImmediate=l}function u(e){"function"!==typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r{if(!e)throw new Error("No signature given");if(!t)throw new Error("Given publicKey was undefined");if(!r)throw new Error("Given input data was undefined");let n=!1;const s=i.keyPair({pub:t,pubEnc:"hex"});try{n=i.verify(r,e,s)}catch(o){}return Promise.resolve(n)}}},"609c":function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r("59c5"),a=r("8724"),c=r("e730");class u{constructor(){this.data={}}async open(){}async put(e,t){this.data[e.toString()]=t}async get(e){const t=await this.has(e);if(!t)throw c.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:async()=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[]}}}query(e){let t=Object.entries(this.data);if(t=o(t,e=>({key:new a(e[0]),value:e[1]})),null!=e.prefix&&(t=n(t,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(t=e.filters.reduce((e,t)=>n(e,t),t)),Array.isArray(e.orders)&&(t=e.orders.reduce((e,t)=>i(e,t),t)),null!=e.offset){let r=0;t=n(t,()=>r++>=e.offset)}return null!=e.limit&&(t=s(t,e.limit)),!0===e.keysOnly&&(t=o(t,e=>({key:e.key}))),t}async close(){}}e.exports=u},"60b3":function(e,t,r){"use strict";const n=r("faa1"),i=r("04dcb"),s=r("8b24"),o={computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50},a=["dataReceived","dataSent"],c={in:"dataReceived",out:"dataSent"};e.exports=(e,t)=>{const r=Object.assign({},o,t),u=new i(a,r),l=Object.assign(new n,{start:g,stop:m,global:u,peers:()=>Array.from(f.keys()),forPeer:e=>f.get(e)||h.get(e),transports:()=>Array.from(d.keys()),forTransport:e=>d.get(e),protocols:()=>Array.from(p.keys()),forProtocol:e=>p.get(e)});u.on("update",b);const h=s(r.maxOldPeersRetention),f=new Map,d=new Map,p=new Map;return e.on("peer:closed",e=>{const t=f.get(e);t&&(t.removeListener("update",b),t.stop(),f.delete(e),h.set(e,t))}),l;function y(e,t,n,s,o){const l=c[s];if(t){u.push(l,o);let t=f.get(e);t||(t=h.get(e),t?h.delete(e):t=new i(a,r),t.on("update",b),t.start(),f.set(e,t)),t.push(l,o)}if(t){let e=d.get(t);e||(e=new i(a,r),e.on("update",b),d.set(t,e)),e.push(l,o)}if(n){let e=p.get(n);e||(e=new i(a,r),e.on("update",b),p.set(n,e)),e.push(l,o)}}function g(){e.on("message",y),u.start();for(const e of f.values())e.start();for(const e of d.values())e.start()}function m(){e.removeListener("message",y),u.stop();for(const e of f.values())e.stop();for(const e of d.values())e.stop()}function b(){l.emit("update")}}},6121:function(e,t,r){"use strict";var n=r("e0c5").Buffer;function i(e){if(e.length>=255)throw new TypeError("Alphabet too long");var t=new Uint8Array(256);t.fill(255);for(var r=0;r>>0,h=new Uint8Array(l);while(s!==c){for(var f=t[s],d=0,p=l-1;(0!==f||d>>0,h[p]=f%o>>>0,f=f/o>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,s++}var y=l-i;while(y!==l&&0===h[y])y++;for(var g=a.repeat(r);y>>0,l=new Uint8Array(u);while(e[r]){var h=t[e.charCodeAt(r)];if(255===h)return;for(var f=0,d=u-1;(0!==h||f>>0,l[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");s=f,r++}if(" "!==e[r]){var p=u-s;while(p!==u&&0===l[p])p++;var y=n.allocUnsafe(i+(u-p));y.fill(0,0,i);var g=i;while(p!==u)y[g++]=l[p++];return y}}}function f(e){var t=h(e);if(t)return t;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:h,decode:f}}e.exports=i},"614f":function(e,t,r){"use strict";t.umulTo10x10=function(e,t,r){var n,i,s,o=e.words,a=t.words,c=r.words,u=0,l=0|o[0],h=8191&l,f=l>>>13,d=0|o[1],p=8191&d,y=d>>>13,g=0|o[2],m=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],S=8191&E,k=E>>>13,C=0|o[5],A=8191&C,I=C>>>13,T=0|o[6],x=8191&T,B=T>>>13,R=0|o[7],N=8191&R,O=R>>>13,P=0|o[8],D=8191&P,L=P>>>13,M=0|o[9],U=8191&M,j=M>>>13,K=0|a[0],F=8191&K,V=K>>>13,q=0|a[1],z=8191&q,H=q>>>13,G=0|a[2],$=8191&G,W=G>>>13,Y=0|a[3],Q=8191&Y,J=Y>>>13,X=0|a[4],Z=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],he=8191&le,fe=le>>>13,de=0|a[9],pe=8191&de,ye=de>>>13;r.length=19,n=Math.imul(h,F),i=Math.imul(h,V),i+=Math.imul(f,F),s=Math.imul(f,V);var ge=u+n+((8191&i)<<13);u=s+(i>>>13)+(ge>>>26),ge&=67108863,n=Math.imul(p,F),i=Math.imul(p,V),i+=Math.imul(y,F),s=Math.imul(y,V),n+=Math.imul(h,z),i+=Math.imul(h,H),i+=Math.imul(f,z),s+=Math.imul(f,H);var me=u+n+((8191&i)<<13);u=s+(i>>>13)+(me>>>26),me&=67108863,n=Math.imul(m,F),i=Math.imul(m,V),i+=Math.imul(b,F),s=Math.imul(b,V),n+=Math.imul(p,z),i+=Math.imul(p,H),i+=Math.imul(y,z),s+=Math.imul(y,H),n+=Math.imul(h,$),i+=Math.imul(h,W),i+=Math.imul(f,$),s+=Math.imul(f,W);var be=u+n+((8191&i)<<13);u=s+(i>>>13)+(be>>>26),be&=67108863,n=Math.imul(w,F),i=Math.imul(w,V),i+=Math.imul(_,F),s=Math.imul(_,V),n+=Math.imul(m,z),i+=Math.imul(m,H),i+=Math.imul(b,z),s+=Math.imul(b,H),n+=Math.imul(p,$),i+=Math.imul(p,W),i+=Math.imul(y,$),s+=Math.imul(y,W),n+=Math.imul(h,Q),i+=Math.imul(h,J),i+=Math.imul(f,Q),s+=Math.imul(f,J);var ve=u+n+((8191&i)<<13);u=s+(i>>>13)+(ve>>>26),ve&=67108863,n=Math.imul(S,F),i=Math.imul(S,V),i+=Math.imul(k,F),s=Math.imul(k,V),n+=Math.imul(w,z),i+=Math.imul(w,H),i+=Math.imul(_,z),s+=Math.imul(_,H),n+=Math.imul(m,$),i+=Math.imul(m,W),i+=Math.imul(b,$),s+=Math.imul(b,W),n+=Math.imul(p,Q),i+=Math.imul(p,J),i+=Math.imul(y,Q),s+=Math.imul(y,J),n+=Math.imul(h,Z),i+=Math.imul(h,ee),i+=Math.imul(f,Z),s+=Math.imul(f,ee);var we=u+n+((8191&i)<<13);u=s+(i>>>13)+(we>>>26),we&=67108863,n=Math.imul(A,F),i=Math.imul(A,V),i+=Math.imul(I,F),s=Math.imul(I,V),n+=Math.imul(S,z),i+=Math.imul(S,H),i+=Math.imul(k,z),s+=Math.imul(k,H),n+=Math.imul(w,$),i+=Math.imul(w,W),i+=Math.imul(_,$),s+=Math.imul(_,W),n+=Math.imul(m,Q),i+=Math.imul(m,J),i+=Math.imul(b,Q),s+=Math.imul(b,J),n+=Math.imul(p,Z),i+=Math.imul(p,ee),i+=Math.imul(y,Z),s+=Math.imul(y,ee),n+=Math.imul(h,re),i+=Math.imul(h,ne),i+=Math.imul(f,re),s+=Math.imul(f,ne);var _e=u+n+((8191&i)<<13);u=s+(i>>>13)+(_e>>>26),_e&=67108863,n=Math.imul(x,F),i=Math.imul(x,V),i+=Math.imul(B,F),s=Math.imul(B,V),n+=Math.imul(A,z),i+=Math.imul(A,H),i+=Math.imul(I,z),s+=Math.imul(I,H),n+=Math.imul(S,$),i+=Math.imul(S,W),i+=Math.imul(k,$),s+=Math.imul(k,W),n+=Math.imul(w,Q),i+=Math.imul(w,J),i+=Math.imul(_,Q),s+=Math.imul(_,J),n+=Math.imul(m,Z),i+=Math.imul(m,ee),i+=Math.imul(b,Z),s+=Math.imul(b,ee),n+=Math.imul(p,re),i+=Math.imul(p,ne),i+=Math.imul(y,re),s+=Math.imul(y,ne),n+=Math.imul(h,se),i+=Math.imul(h,oe),i+=Math.imul(f,se),s+=Math.imul(f,oe);var Ee=u+n+((8191&i)<<13);u=s+(i>>>13)+(Ee>>>26),Ee&=67108863,n=Math.imul(N,F),i=Math.imul(N,V),i+=Math.imul(O,F),s=Math.imul(O,V),n+=Math.imul(x,z),i+=Math.imul(x,H),i+=Math.imul(B,z),s+=Math.imul(B,H),n+=Math.imul(A,$),i+=Math.imul(A,W),i+=Math.imul(I,$),s+=Math.imul(I,W),n+=Math.imul(S,Q),i+=Math.imul(S,J),i+=Math.imul(k,Q),s+=Math.imul(k,J),n+=Math.imul(w,Z),i+=Math.imul(w,ee),i+=Math.imul(_,Z),s+=Math.imul(_,ee),n+=Math.imul(m,re),i+=Math.imul(m,ne),i+=Math.imul(b,re),s+=Math.imul(b,ne),n+=Math.imul(p,se),i+=Math.imul(p,oe),i+=Math.imul(y,se),s+=Math.imul(y,oe),n+=Math.imul(h,ce),i+=Math.imul(h,ue),i+=Math.imul(f,ce),s+=Math.imul(f,ue);var Se=u+n+((8191&i)<<13);u=s+(i>>>13)+(Se>>>26),Se&=67108863,n=Math.imul(D,F),i=Math.imul(D,V),i+=Math.imul(L,F),s=Math.imul(L,V),n+=Math.imul(N,z),i+=Math.imul(N,H),i+=Math.imul(O,z),s+=Math.imul(O,H),n+=Math.imul(x,$),i+=Math.imul(x,W),i+=Math.imul(B,$),s+=Math.imul(B,W),n+=Math.imul(A,Q),i+=Math.imul(A,J),i+=Math.imul(I,Q),s+=Math.imul(I,J),n+=Math.imul(S,Z),i+=Math.imul(S,ee),i+=Math.imul(k,Z),s+=Math.imul(k,ee),n+=Math.imul(w,re),i+=Math.imul(w,ne),i+=Math.imul(_,re),s+=Math.imul(_,ne),n+=Math.imul(m,se),i+=Math.imul(m,oe),i+=Math.imul(b,se),s+=Math.imul(b,oe),n+=Math.imul(p,ce),i+=Math.imul(p,ue),i+=Math.imul(y,ce),s+=Math.imul(y,ue),n+=Math.imul(h,he),i+=Math.imul(h,fe),i+=Math.imul(f,he),s+=Math.imul(f,fe);var ke=u+n+((8191&i)<<13);u=s+(i>>>13)+(ke>>>26),ke&=67108863,n=Math.imul(U,F),i=Math.imul(U,V),i+=Math.imul(j,F),s=Math.imul(j,V),n+=Math.imul(D,z),i+=Math.imul(D,H),i+=Math.imul(L,z),s+=Math.imul(L,H),n+=Math.imul(N,$),i+=Math.imul(N,W),i+=Math.imul(O,$),s+=Math.imul(O,W),n+=Math.imul(x,Q),i+=Math.imul(x,J),i+=Math.imul(B,Q),s+=Math.imul(B,J),n+=Math.imul(A,Z),i+=Math.imul(A,ee),i+=Math.imul(I,Z),s+=Math.imul(I,ee),n+=Math.imul(S,re),i+=Math.imul(S,ne),i+=Math.imul(k,re),s+=Math.imul(k,ne),n+=Math.imul(w,se),i+=Math.imul(w,oe),i+=Math.imul(_,se),s+=Math.imul(_,oe),n+=Math.imul(m,ce),i+=Math.imul(m,ue),i+=Math.imul(b,ce),s+=Math.imul(b,ue),n+=Math.imul(p,he),i+=Math.imul(p,fe),i+=Math.imul(y,he),s+=Math.imul(y,fe),n+=Math.imul(h,pe),i+=Math.imul(h,ye),i+=Math.imul(f,pe),s+=Math.imul(f,ye);var Ce=u+n+((8191&i)<<13);u=s+(i>>>13)+(Ce>>>26),Ce&=67108863,n=Math.imul(U,z),i=Math.imul(U,H),i+=Math.imul(j,z),s=Math.imul(j,H),n+=Math.imul(D,$),i+=Math.imul(D,W),i+=Math.imul(L,$),s+=Math.imul(L,W),n+=Math.imul(N,Q),i+=Math.imul(N,J),i+=Math.imul(O,Q),s+=Math.imul(O,J),n+=Math.imul(x,Z),i+=Math.imul(x,ee),i+=Math.imul(B,Z),s+=Math.imul(B,ee),n+=Math.imul(A,re),i+=Math.imul(A,ne),i+=Math.imul(I,re),s+=Math.imul(I,ne),n+=Math.imul(S,se),i+=Math.imul(S,oe),i+=Math.imul(k,se),s+=Math.imul(k,oe),n+=Math.imul(w,ce),i+=Math.imul(w,ue),i+=Math.imul(_,ce),s+=Math.imul(_,ue),n+=Math.imul(m,he),i+=Math.imul(m,fe),i+=Math.imul(b,he),s+=Math.imul(b,fe),n+=Math.imul(p,pe),i+=Math.imul(p,ye),i+=Math.imul(y,pe),s+=Math.imul(y,ye);var Ae=u+n+((8191&i)<<13);u=s+(i>>>13)+(Ae>>>26),Ae&=67108863,n=Math.imul(U,$),i=Math.imul(U,W),i+=Math.imul(j,$),s=Math.imul(j,W),n+=Math.imul(D,Q),i+=Math.imul(D,J),i+=Math.imul(L,Q),s+=Math.imul(L,J),n+=Math.imul(N,Z),i+=Math.imul(N,ee),i+=Math.imul(O,Z),s+=Math.imul(O,ee),n+=Math.imul(x,re),i+=Math.imul(x,ne),i+=Math.imul(B,re),s+=Math.imul(B,ne),n+=Math.imul(A,se),i+=Math.imul(A,oe),i+=Math.imul(I,se),s+=Math.imul(I,oe),n+=Math.imul(S,ce),i+=Math.imul(S,ue),i+=Math.imul(k,ce),s+=Math.imul(k,ue),n+=Math.imul(w,he),i+=Math.imul(w,fe),i+=Math.imul(_,he),s+=Math.imul(_,fe),n+=Math.imul(m,pe),i+=Math.imul(m,ye),i+=Math.imul(b,pe),s+=Math.imul(b,ye);var Ie=u+n+((8191&i)<<13);u=s+(i>>>13)+(Ie>>>26),Ie&=67108863,n=Math.imul(U,Q),i=Math.imul(U,J),i+=Math.imul(j,Q),s=Math.imul(j,J),n+=Math.imul(D,Z),i+=Math.imul(D,ee),i+=Math.imul(L,Z),s+=Math.imul(L,ee),n+=Math.imul(N,re),i+=Math.imul(N,ne),i+=Math.imul(O,re),s+=Math.imul(O,ne),n+=Math.imul(x,se),i+=Math.imul(x,oe),i+=Math.imul(B,se),s+=Math.imul(B,oe),n+=Math.imul(A,ce),i+=Math.imul(A,ue),i+=Math.imul(I,ce),s+=Math.imul(I,ue),n+=Math.imul(S,he),i+=Math.imul(S,fe),i+=Math.imul(k,he),s+=Math.imul(k,fe),n+=Math.imul(w,pe),i+=Math.imul(w,ye),i+=Math.imul(_,pe),s+=Math.imul(_,ye);var Te=u+n+((8191&i)<<13);u=s+(i>>>13)+(Te>>>26),Te&=67108863,n=Math.imul(U,Z),i=Math.imul(U,ee),i+=Math.imul(j,Z),s=Math.imul(j,ee),n+=Math.imul(D,re),i+=Math.imul(D,ne),i+=Math.imul(L,re),s+=Math.imul(L,ne),n+=Math.imul(N,se),i+=Math.imul(N,oe),i+=Math.imul(O,se),s+=Math.imul(O,oe),n+=Math.imul(x,ce),i+=Math.imul(x,ue),i+=Math.imul(B,ce),s+=Math.imul(B,ue),n+=Math.imul(A,he),i+=Math.imul(A,fe),i+=Math.imul(I,he),s+=Math.imul(I,fe),n+=Math.imul(S,pe),i+=Math.imul(S,ye),i+=Math.imul(k,pe),s+=Math.imul(k,ye);var xe=u+n+((8191&i)<<13);u=s+(i>>>13)+(xe>>>26),xe&=67108863,n=Math.imul(U,re),i=Math.imul(U,ne),i+=Math.imul(j,re),s=Math.imul(j,ne),n+=Math.imul(D,se),i+=Math.imul(D,oe),i+=Math.imul(L,se),s+=Math.imul(L,oe),n+=Math.imul(N,ce),i+=Math.imul(N,ue),i+=Math.imul(O,ce),s+=Math.imul(O,ue),n+=Math.imul(x,he),i+=Math.imul(x,fe),i+=Math.imul(B,he),s+=Math.imul(B,fe),n+=Math.imul(A,pe),i+=Math.imul(A,ye),i+=Math.imul(I,pe),s+=Math.imul(I,ye);var Be=u+n+((8191&i)<<13);u=s+(i>>>13)+(Be>>>26),Be&=67108863,n=Math.imul(U,se),i=Math.imul(U,oe),i+=Math.imul(j,se),s=Math.imul(j,oe),n+=Math.imul(D,ce),i+=Math.imul(D,ue),i+=Math.imul(L,ce),s+=Math.imul(L,ue),n+=Math.imul(N,he),i+=Math.imul(N,fe),i+=Math.imul(O,he),s+=Math.imul(O,fe),n+=Math.imul(x,pe),i+=Math.imul(x,ye),i+=Math.imul(B,pe),s+=Math.imul(B,ye);var Re=u+n+((8191&i)<<13);u=s+(i>>>13)+(Re>>>26),Re&=67108863,n=Math.imul(U,ce),i=Math.imul(U,ue),i+=Math.imul(j,ce),s=Math.imul(j,ue),n+=Math.imul(D,he),i+=Math.imul(D,fe),i+=Math.imul(L,he),s+=Math.imul(L,fe),n+=Math.imul(N,pe),i+=Math.imul(N,ye),i+=Math.imul(O,pe),s+=Math.imul(O,ye);var Ne=u+n+((8191&i)<<13);u=s+(i>>>13)+(Ne>>>26),Ne&=67108863,n=Math.imul(U,he),i=Math.imul(U,fe),i+=Math.imul(j,he),s=Math.imul(j,fe),n+=Math.imul(D,pe),i+=Math.imul(D,ye),i+=Math.imul(L,pe),s+=Math.imul(L,ye);var Oe=u+n+((8191&i)<<13);u=s+(i>>>13)+(Oe>>>26),Oe&=67108863,n=Math.imul(U,pe),i=Math.imul(U,ye),i+=Math.imul(j,pe),s=Math.imul(j,ye);var Pe=u+n+((8191&i)<<13);return u=s+(i>>>13)+(Pe>>>26),Pe&=67108863,c[0]=ge,c[1]=me,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ee,c[7]=Se,c[8]=ke,c[9]=Ce,c[10]=Ae,c[11]=Ie,c[12]=Te,c[13]=xe,c[14]=Be,c[15]=Re,c[16]=Ne,c[17]=Oe,c[18]=Pe,0!==u&&(c[19]=u,r.length++),r}},6158:function(e,t,r){"use strict";(function(t){const n=r("2e53"),{fromB58String:i,toB58String:s}=r("e782"),o=r("8eda"),a=r("87dd"),c=r("7048"),u=r("4bc2"),l=u("ipfs:ipns:pubsub");l.error=u("ipfs:ipns:pubsub:error");class h{constructor(e,t,r){this._pubsub=e,this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new o(e,t,r,n.validator,this._handleSubscriptionKey)}async put(e,t){return this._pubsubDs.put(e,t)}async get(e){let t,r;try{t=await this._pubsubDs.get(e)}catch(o){r=o}const i=e.slice(0,n.namespaceLength);if(i.toString()===n.namespace){const t=s(e),r=s(e.slice(n.namespaceLength));this._subscriptions[t]=r,l(`subscribed to pubsub topic ${t}, id ${r}`)}if(r)throw r;return t}_handleSubscriptionKey(e){t.isBuffer(e)&&(e=s(e));const r=this._subscriptions[e];if(!r)throw c(new Error(`key ${e} does not correspond to a subscription`),"ERR_INVALID_KEY");let o;try{o=n.getIdKeys(i(r))}catch(a){throw l.error(a),a}return o.routingKey.toBuffer()}getSubscriptions(){const e=Object.values(this._subscriptions).filter(Boolean);return e.map(e=>`${n.namespace}${e}`)}async cancel(e){if("string"!==typeof e)throw c(new Error("invalid subscription name"),"ERR_INVALID_SUBSCRIPTION_NAME");e.startsWith(n.namespace)&&(e=e.substring(n.namespaceLength));const r=Object.keys(this._subscriptions).find(t=>this._subscriptions[t]===e);if(!r)return{canceled:!1};const i=t.from(r);return this._pubsubDs.unsubscribe(i),this._subscriptions[r]=void 0,l(`unsubscribed pubsub ${r}: ${e}`),{canceled:!0}}}e.exports=a(h,{className:"IpnsPubsubDatastore",symbolName:"@js-ipfs/ipns/IpnsPubsubDatastore"})}).call(this,r("b639").Buffer)},6166:function(e,t,r){"use strict";const n=r("c59f"),i=r("b1aa"),s=r("20b8"),o=r("9941"),a=r("1421"),c=r("e24c").Connection,u=r("bcc7"),l=r("f8c9"),h=r("4bc2"),f=h("libp2p:circuit:dialer");f.err=h("libp2p:circuit:error:dialer");const d=r("8ffa"),p=r("6c8b");class y{constructor(e,t){this.swarm=e,this.relayPeers=new Map,this.relayConns=new Map,this.options=t,this.utils=u(e)}_dialRelayHelper(e,t){return this.relayConns.has(e.id.toB58String())?t(null,this.relayConns.get(e.id.toB58String())):this._dialRelay(e,t)}dial(e,t){t=t||(()=>{});const r=e.toString();if(!r.includes("/p2p-circuit"))return f.err("invalid circuit address"),t(new Error("invalid circuit address"));const n=r.split("p2p-circuit"),i="/"===n[0]?null:a(n[0]),s=a(n[1]||n[0]),u=new c;return o(this._dialPeer.bind(this),s,i,(e,r)=>{if(e)return f.err(e),t(e);u.setInnerConn(r),t(null,u)}),u}canHop(e,t){t=n(t||(()=>{})),this._dialRelayHelper(e,(r,n)=>{if(r)return t(r);const i=new l(n);s([e=>i.write(p.CircuitRelay.encode({type:p.CircuitRelay.Type.CAN_HOP}),e),e=>i.read(e)],(r,n)=>{if(r)return t(r);const s=p.CircuitRelay.decode(n);if(s.code!==p.CircuitRelay.Status.SUCCESS){const r=new Error(`HOP not supported, skipping - ${this.utils.getB58String(e)}`);return f(r),t(r)}f("HOP supported adding as relay - %s",this.utils.getB58String(e)),this.relayPeers.set(this.utils.getB58String(e),e),i.close(),t()})})}_dialPeer(e,t,r){if("function"===typeof t&&(r=t,t=null),r||(r=()=>{}),e=a(e),t)return this._negotiateRelay(t,e,(e,t)=>e?(f.err("An error has occurred negotiating the relay connection",e),r(e)):r(null,t));{const t=Array.from(this.relayPeers.values()),n=i=>{if(!i){const e="no relay peers were found or all relays failed to dial";return f.err(e),r(e)}return this._negotiateRelay(i,e,(e,i)=>{if(e)return f.err(e),n(t.shift());r(null,i)})};n(t.shift())}}_negotiateRelay(e,t,r){t=a(t),e=this.utils.peerInfoFromMa(e);const n=this.swarm._peerInfo.multiaddrs.toArray();this._dialRelayHelper(e,(e,o)=>{if(e)return f.err(e),r(e);const a=new l(o);s([r=>{let s;f("negotiating relay for peer %s",t.getPeerId());try{s=i.createFromB58String(t.getPeerId()).id}catch(e){return r(e)}a.write(p.CircuitRelay.encode({type:p.CircuitRelay.Type.HOP,srcPeer:{id:this.swarm._peerInfo.id.id,addrs:n.map(e=>e.buffer)},dstPeer:{id:s,addrs:[t.buffer]}}),r)},e=>a.read(e)],(e,t)=>{if(e)return r(e);const n=p.CircuitRelay.decode(t);return n.type!==p.CircuitRelay.Type.STATUS?r(new Error("Got invalid message type - "+`expected ${p.CircuitRelay.Type.STATUS} got ${n.type}`)):n.code!==p.CircuitRelay.Status.SUCCESS?r(new Error(`Got ${n.code} error code trying to dial over relay`)):void r(null,new c(a.rest()))})})}_dialRelay(e,t){t=n(t||(()=>{})),this.swarm.dial(e,d.relay,n((e,r)=>{if(e)return f.err(e),t(e);t(null,r)}))}}e.exports=y},"61a0":function(e,t,r){t.AbstractLevelDOWN=r("13b0"),t.AbstractIterator=r("46be"),t.AbstractChainedBatch=r("7804")},"61d3":function(e,t,r){"use strict";var n=r("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.toSignatureObject=l,t.verifyES256K=h,t.verifyRecoverableES256K=f,t.verifyEd25519=d;var i=r("3337"),s=r("d0cf"),o=n(r("fb4d")),a=n(r("f1e8")),c=n(r("427a")),u=new i.ec("secp256k1");function l(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=o.default.toBuffer(e);if(r.length!==(t?65:64))throw new Error("wrong signature length");var n=r.slice(0,32).toString("hex"),i=r.slice(32,64).toString("hex"),s={r:n,s:i};return t&&(s.recoveryParam=r[64]),s}function h(e,t,r){var n=(0,s.sha256)(e),i=l(t),o=r.find((function(e){var t=e.publicKeyHex;return u.keyFromPublic(t,"hex").verify(n,i)}));if(!o)throw new Error("Signature invalid for JWT");return o}function f(e,t,r){var n=l(t,!0),i=(0,s.sha256)(e),o=u.recoverPubKey(i,n,n.recoveryParam),a=o.encode("hex"),c=o.encode("hex",!0),h=(0,s.toEthereumAddress)(a),f=r.find((function(e){var t=e.publicKeyHex,r=e.ethereumAddress;return t===a||t===c||r===h}));if(!f)throw new Error("Signature invalid for JWT");return f}function d(e,t,r){var n=c.default.decodeUTF8(e),i=c.default.decodeBase64(o.default.toBase64(t)),s=r.find((function(e){var t=e.publicKeyBase64;return a.default.sign.detached.verify(n,i,c.default.decodeBase64(t))}));if(!s)throw new Error("Signature invalid for JWT");return s}var p={ES256K:h,"ES256K-R":f,Ed25519:d};function y(e){var t=p[e];if(!t)throw new Error("Unsupported algorithm ".concat(e));return t}y.toSignatureObject=l,e.exports=y},"61f1":function(e,t){var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),s=Math.pow(2,28),o=Math.pow(2,35),a=Math.pow(2,42),c=Math.pow(2,49),u=Math.pow(2,56),l=Math.pow(2,63);e.exports=function(e){return e{n(i.subtle.sign({name:"HMAC"},t,r).then(t=>e.from(t)),s)};t.create=function(e,t,r){const c=o[e];n(i.subtle.importKey("raw",t,{name:"HMAC",hash:{name:c}},!1,["sign"]).then(t=>({digest(e,r){a(t,e,r)},length:s[e]})),r)}}).call(this,r("b639").Buffer)},6223:function(e,t,r){var n=r("64f1");function i(e){return e}e.exports=function(e){return"object"===typeof e&&"function"===typeof e.test?function(t){return e.test(t)}:n(e)||i}},6225:function(e,t,r){"use strict";var n=r("e567");e.exports=function(e){return n(Object.keys(e))}},6266:function(e,t,r){var n=r("918b");r("dbd5"),r("5ee0");var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||c();var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s>>0,a>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=a[1],a[1]=a[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),u(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,c,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,h=l&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-h));for(var f=8*i.fullMessageLength[0],d=0;d>>0,f+=c,o.putInt32(f>>>0),f=a>>>0;o.putInt32(f);var p={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};u(p,r,o);var y=n.util.createBuffer();return y.putInt32(p.h0),y.putInt32(p.h1),y.putInt32(p.h2),y.putInt32(p.h3),y.putInt32(p.h4),y.putInt32(p.h5),y.putInt32(p.h6),y.putInt32(p.h7),y},i};var s=null,o=!1,a=null;function c(){s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),a=[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],o=!0}function u(e,t,r){var n,i,s,o,c,u,l,h,f,d,p,y,g,m,b,v=r.length();while(v>=64){for(l=0;l<16;++l)t[l]=r.getInt32();for(;l<64;++l)n=t[l-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[l-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[l]=n+t[l-7]+i+t[l-16]|0;for(h=e.h0,f=e.h1,d=e.h2,p=e.h3,y=e.h4,g=e.h5,m=e.h6,b=e.h7,l=0;l<64;++l)o=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),c=m^y&(g^m),s=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),u=h&f|d&(h^f),n=b+o+c+a[l]+t[l],i=s+u,b=m,m=g,g=y,y=p+n>>>0,p=d,d=f,f=h,h=n+i>>>0;e.h0=e.h0+h|0,e.h1=e.h1+f|0,e.h2=e.h2+d|0,e.h3=e.h3+p|0,e.h4=e.h4+y|0,e.h5=e.h5+g|0,e.h6=e.h6+m|0,e.h7=e.h7+b|0,v-=64}}},"627f":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("c8f6"),s=45569,o=45633,a={init:i.blake2bInit,update:i.blake2bUpdate,digest:i.blake2bFinal},c={init:i.blake2sInit,update:i.blake2sUpdate,digest:i.blake2sFinal},u=(e,t)=>async r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}},"62a7":function(e,t,r){"use strict";const n=r("4bc2"),i=n("libp2p:floodsub");i.err=n("libp2p:floodsub:error"),e.exports={log:i,multicodec:"/floodsub/1.0.0"}},"62fc":function(e,t,r){"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},6307:function(e,t,r){"use strict";function n(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i{this.switch.emit("peer-mux-established",e.theirPeerInfo),this.switch.dialer.clearDenylist(e.theirPeerInfo)}))}get(e){if(!this.connections[e.theirB58Id])return null;for(let t=0;t{const s=e.listener(r);return s.on("stream",this.switch.protocolMuxer(null)),this.switch.identify&&r.getPeerInfo((e,t)=>{!e&&t||o("crypto peerInfo wasnt found"),r.getPeerInfo=async r=>{const o=s.newStream(),c=new i.Dialer;let f;r=a(r);try{await u(c,o);const e=await l(c,n.multicodec);f=await h(e,t)}catch(e){return s.end(()=>{r(e,null)})}const{peerInfo:d}=f;d&&o.setPeerInfo(d),r(null,d)},r.getPeerInfo((e,t)=>{if(e)return o("identify not successful");const n=t.id.toB58String();t=this.switch._peerBook.put(t);const i=new c({_switch:this.switch,peerInfo:t,muxer:s,conn:r,type:"inc"});this.switch.connection.add(i),t.isConnected()||(t.multiaddrs.size>0?t.connect(t.multiaddrs.toArray()[0]):t.connect(`/ipfs/${n}`)),s.once("close",()=>{i.close()})})}),r})}crypto(e,t){e||t||(e=d.tag,t=d.encrypt),this.switch.crypto={tag:e,encrypt:t}}enableCircuitRelay(e){e=e||{},e.enabled&&(e.hop||Object.assign(e,{hop:{enabled:!1,active:!1}}),this.switch.transport.add(f.tag,new f(this.switch,e)))}reuse(){this.switch.identify=!0,this.switch.handle(n.multicodec,(e,t)=>{n.listener(t,this.switch._peerInfo)})}}e.exports=p},6338:function(e,t,r){"use strict";var n=r("5e55");e.exports=function(e){return n(Object.keys(e))}},6341:function(e,t,r){(function(t){var r="Expected a function",n="__lodash_hash_undefined__",i=1/0,s=9007199254740991,o="[object Arguments]",a="[object Function]",c="[object GeneratorFunction]",u="[object Symbol]",l=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/,f=/^\./,d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p=/[\\^$.*+?()[\]{}|]/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,m=/^(?:0|[1-9]\d*)$/,b="object"==typeof t&&t&&t.Object===Object&&t,v="object"==typeof self&&self&&self.Object===Object&&self,w=b||v||Function("return this")();function _(e,t){return null==e?void 0:e[t]}function E(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}var S=Array.prototype,k=Function.prototype,C=Object.prototype,A=w["__core-js_shared__"],I=function(){var e=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),T=k.toString,x=C.hasOwnProperty,B=C.toString,R=RegExp("^"+T.call(x).replace(p,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=w.Symbol,O=C.propertyIsEnumerable,P=S.splice,D=ue(w,"Map"),L=ue(Object,"create"),M=N?N.prototype:void 0,U=M?M.toString:void 0;function j(e){var t=-1,r=e?e.length:0;this.clear();while(++t-1}function Q(e,t){var r=this.__data__,n=ne(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function J(e){var t=-1,r=e?e.length:0;this.clear();while(++t-1&&e%1==0&&e-1&&e%1==0&&e<=s}function Ae(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ie(e){return!!e&&"object"==typeof e}function Te(e){return"symbol"==typeof e||Ie(e)&&B.call(e)==u}function xe(e){return null==e?"":oe(e)}function Be(e,t){return null!=e&&le(e,t,ie)}e.exports=Be}).call(this,r("c8ba"))},"63a5":function(e,t,r){"use strict";const n=r("c4bf"),i=r("df87"),s=r("4bc2"),o=s("libp2p:switch:protocol-muxer");o.error=s("libp2p:switch:protocol-muxer:error"),e.exports=function(e,t){return r=>(s,a)=>{const c=a||new n.Listener;let u;u=r&&!a?i(r,null,s,t):s,Object.keys(e).forEach(r=>{if(!r)return;const n=(r,n)=>{o("registering handler with protocol %s",r);const s=e[r];if(s){const e=s&&s.handlerFunc;if(e){const o=i(null,r,n,t);e(s,o)}}};c.addHandler(r,n,e[r].matchFunc)}),c.handle(u,e=>{e&&o.error("multistream handshake failed",e)})}}},"63a7":function(e,t,r){(function(e){var n=r("f64a"),i=t&&!t.nodeType&&t,s=i&&"object"==typeof e&&e&&!e.nodeType&&e,o=s&&s.exports===i,a=o&&n.process,c=function(){try{var e=s&&s.require&&s.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(t){}}();e.exports=c}).call(this,r("62e4")(e))},"63e1":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("7048"),s=r("e782"),o=r("d8cf");async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(new Error(`multihash function '${e}' not yet supported`),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={0:o.identity,17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},"640a":function(e,t,r){(function(e){var n=r("0937"),i=r("c4ae"),s=t&&!t.nodeType&&t,o=s&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===s,c=a?n.Buffer:void 0,u=c?c.isBuffer:void 0,l=u||i;e.exports=l}).call(this,r("62e4")(e))},6415:function(e,t,r){(function(t){const n=r("c449"),i=r("e03c"),s="base58btc",o=e=>e?Array.isArray(e)?e.map(o):new n(e):e,a=(e,t)=>{if(!e)return e;if(Array.isArray(e))return e.map(a);if(e["/"])return e["/"];const r=t.base||s;return e.toBaseEncodedString(r)},c=async(e,r)=>{const n=t.from(JSON.stringify(r)),s=i.DAGNode.create(n),o=await e.dag.put(s,{format:"dag-pb",hashAlg:"sha2-256"});return o.toV0().toBaseEncodedString()},u=async(e,t)=>{const r=await e.dag.get(t),n=r.value;return JSON.parse(n.toJSON().data)},l=async(e,t,r)=>{const n=Object.assign({},t),i=r.links||[];i.forEach(e=>{n[e]=o(n[e])});const a=r.base||s,c=r.onlyHash||!1,u=await e.dag.put(n,{onlyHash:c});return u.toBaseEncodedString(a)},h=async(e,t,r)=>{const n=await e.dag.get(t),i=n.value,s=r.links||[];return s.forEach(e=>{i[e]=a(i[e],r)}),i},f=async(e,t,r)=>{const n=r.onlyHash||!1,o=r.base||s,a=Object.assign({},{onlyHash:n},r.format?{format:r.format,hashAlg:"sha2-256"}:{});"dag-pb"===a.format&&(t=i.DAGNode.create(t));const c=await e.dag.put(t,a);return c.toBaseEncodedString(o)},d={"dag-pb":{read:u,write:c},"dag-cbor":{write:l,read:h},raw:{write:f}},p=(e,t,r,n={})=>{const i=d[t];if(!i)throw new Error("Unsupported codec");return i.write(e,r,n)},y=(e,t,r={})=>{t=new n(t);const i=d[t.codec];if(!i)throw new Error("Unsupported codec");return i.read(e,t,r)};e.exports={read:y,write:p}}).call(this,r("b639").Buffer)},"641e":function(e,t){function r(e,t,r,i){return JSON.stringify(e,n(t,i),r)}function n(e,t){var r=[],n=[];return null==t&&(t=function(e,t){return r[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(t)).join(".")+"]"}),function(i,s){if(r.length>0){var o=r.indexOf(this);~o?r.splice(o+1):r.push(this),~o?n.splice(o,1/0,i):n.push(i),~r.indexOf(s)&&(s=t.call(this,i,s))}else r.push(s);return null==e?s:e.call(this,i,s)}}t=e.exports=r,t.getSerialize=n},6429:function(e,t,r){"use strict";const n=r("fb92").utils,i=n.map;class s{constructor(e,t){this.child=e,this.transform=t}open(){return this.child.open()}put(e,t){return this.child.put(this.transform.convert(e),t)}get(e){return this.child.get(this.transform.convert(e))}has(e){return this.child.has(this.transform.convert(e))}delete(e){return this.child.delete(this.transform.convert(e))}batch(){const e=this.child.batch();return{put:(t,r)=>{e.put(this.transform.convert(t),r)},delete:t=>{e.delete(this.transform.convert(t))},commit:()=>e.commit()}}query(e){return i(this.child.query(e),e=>(e.key=this.transform.invert(e.key),e))}close(){return this.child.close()}}e.exports=s},"647f":function(e,t,r){"use strict";const n=r("d9ea"),i=r("000a"),s=r("fa4d");e.exports=e=>{const t=e._modules.peerRouting||[];return e._dht&&t.unshift(e._dht),{findPeer:s((e,r,s)=>{"function"===typeof r&&(s=r,r={}),t.length||s(i(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE"));const o=t.map(t=>n=>t.findPeer(e,r,(e,t)=>e?n(e):t&&0!==Object.keys(t).length?void n(null,t):n(i(new Error("not found"),"NOT_FOUND"),null)));n(o,(e,t)=>{if(e)return s(e);t=t||[],s(null,t)})})}}},"649d":function(e,t,r){"use strict";const n=r("b2f0").TYPES;e.exports=e=>{const t={[n.GET_VALUE]:r("649dc")(e),[n.PUT_VALUE]:r("eac8")(e),[n.FIND_NODE]:r("a5f0")(e),[n.ADD_PROVIDER]:r("9394")(e),[n.GET_PROVIDERS]:r("2d4b")(e),[n.PING]:r("5721")(e)};return function(e){return t[e]}}},"649dc":function(e,t,r){"use strict";const n=r("4a0d"),i=r("b4a2").Record,s=r("4514"),o=r("b2f0"),a=r("8945");e.exports=e=>{const t=a.logger(e.peerInfo.id,"rpc:get-value");return function(r,c,u){const l=c.key;if(t("key: %b",l),!l||0===l.length)return u(s(new Error("Invalid key"),"ERR_INVALID_KEY"));const h=new o(o.TYPES.GET_VALUE,l,c.clusterLevel);if(a.isPublicKeyKey(l)){t("is public key");const r=a.fromPublicKeyKey(l);let n;if(e._isSelf(r)?n=e.peerInfo:e.peerBook.has(r)&&(n=e.peerBook.get(r)),n&&n.id.pubKey)return t("returning found public key"),h.record=new i(l,n.id.pubKey.bytes),u(null,h)}n([t=>e._checkLocalDatastore(l,t),t=>e._betterPeersToQuery(c,r,t)],(e,r)=>{if(e)return u(e);const n=r[0],i=r[1];n&&(t("got record"),h.record=n),i.length>0&&(t("got closer %s",i.length),h.closerPeers=i),u(null,h)})}}},"64b8":function(e,t,r){"use strict";(function(e){t.test=function(){return"document"in e&&"onreadystatechange"in e.document.createElement("script")},t.install=function(t){return function(){var r=e.document.createElement("script");return r.onreadystatechange=function(){t(),r.onreadystatechange=null,r.parentNode.removeChild(r),r=null},e.document.documentElement.appendChild(r),t}}}).call(this,r("c8ba"))},"64d4":function(e,t,r){"use strict";const n=r("1c7ef"),i=n.cloneLinks,s=n.cloneData,o=r("70cf");function a(e){const t=s(e),r=i(e);return o(t,r)}e.exports=a},"64f1":function(e,t){e.exports=function(e){return e&&("string"==typeof e?function(t){return t[e]}:"object"===typeof e&&"function"===typeof e.exec?function(t){var r=e.exec(t);return r&&r[0]}:e)}},"64f9":function(e,t){function r(e,t,r){"string"==typeof t&&(t=t.split(".")),"symbol"==typeof t&&(t=[t]);var n,i=t.pop();if(!i)return!1;while(n=t.shift())if("undefined"==typeof e[n]&&(e[n]={}),e=e[n],!e||"object"!=typeof e)return!1;return e[i]=r,!0}e.exports=r},6547:function(e,t,r){var n=r("a691"),i=r("1d80"),s=function(e){return function(t,r){var s,o,a=String(i(t)),c=n(r),u=a.length;return c<0||c>=u?e?"":void 0:(s=a.charCodeAt(c),s<55296||s>56319||c+1===u||(o=a.charCodeAt(c+1))<56320||o>57343?e?a.charAt(c):s:e?a.slice(c,c+2):o-56320+(s-55296<<10)+65536)}};e.exports={codeAt:s(!1),charAt:s(!0)}},6586:function(e,t,r){(function(t){var n,i=r("11ce"),s=r("2655");function o(e,t){return"function"!==typeof t?e:e.then((function(e){n((function(){t(null,e)}))}),(function(e){n((function(){t(e)}))}))}function a(e){return o(this,e)}function c(e){if(e&&s(e)){e.nodeify=a;var t=e.then;return e.then=function(){return c(t.apply(this,arguments))},e}"function"===typeof e?e.prototype.nodeify=a:i.prototype.nodeify=a}function u(e){if(!(this instanceof u))return new u(e);i.call(this,e),c(this)}n="function"===typeof setImmediate?setImmediate:"object"===typeof t&&t&&t.nextTick?t.nextTick:function(e){setTimeout(e,0)},e.exports=o,o.extend=c,o.Promise=u,u.prototype=Object.create(i.prototype),u.prototype.constructor=u}).call(this,r("4362"))},"65b6":function(e,t,r){"use strict";var n=r("1e35");function i(e,t,r){var i=this;function s(){i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._timer=setTimeout(s,i._scheduled),i._rescheduled=0):e.apply(null,i._args)}this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._timer=setTimeout(s,t)}function s(){if("function"!==typeof arguments[0])throw new Error("callback needed");if("number"!==typeof arguments[1])throw new Error("timeout needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t{const o=e=>n(()=>s(e));if(!t.isBuffer(e))return o(new Error('"key" must be a Buffer'));if(e.length<3)return o(new Error("invalid public key record"));const a=e.slice(0,4).toString();if("/pk/"!==a)return o(new Error("key was not prefixed with /pk/"));const c=e.slice(4);i(r,"sha2-256",(e,t)=>e?o(e):c.equals(t)?void o():o(new Error("public key does not match passed in key")))};e.exports={func:s,sign:!1}}).call(this,r("b639").Buffer)},"666d":function(e,t){var r=[].indexOf;e.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n{if(e)throw e;this.kb=new n({localNodeId:r,numberOfNodesPerKBucket:t,numberOfNodesToPing:1}),this.kb.on("ping",this._onPing)})}_onPing(e,t){const r=e[0];this.kb.remove(r.id),this.kb.add(t)}get size(){return this.kb.count()}find(e,t){i.convertPeerId(e,(r,n)=>{if(r)return t(r);const i=this.closestPeer(n);if(i&&i.isEqual(e))return t(null,i);t()})}closestPeer(e,t){const r=this.closestPeers(e,1);if(r.length>0)return r[0]}closestPeers(e,t){return this.kb.closest(e,t).map(e=>e.peer)}add(e,t){i.convertPeerId(e,(r,n)=>{if(r)return t(r);this.kb.add({id:n,peer:e}),t()})}remove(e,t){i.convertPeerId(e,(e,r)=>{if(e)return t(e);this.kb.remove(r),t()})}}e.exports=s},"66e8":function(e,t,r){var n=r("010f");function i(e){if(!(this instanceof i))return new i(e);this.opts=e||{},this.encodings=n}e.exports=i,i.prototype._encoding=function(e){return"string"===typeof e&&(e=n[e]),e||(e=n.id),e},i.prototype._keyEncoding=function(e,t){return this._encoding(t&&t.keyEncoding||e&&e.keyEncoding||this.opts.keyEncoding)},i.prototype._valueEncoding=function(e,t){return this._encoding(t&&(t.valueEncoding||t.encoding)||e&&(e.valueEncoding||e.encoding)||this.opts.valueEncoding||this.opts.encoding)},i.prototype.encodeKey=function(e,t,r){return this._keyEncoding(t,r).encode(e)},i.prototype.encodeValue=function(e,t,r){return this._valueEncoding(t,r).encode(e)},i.prototype.decodeKey=function(e,t){return this._keyEncoding(t).decode(e)},i.prototype.decodeValue=function(e,t){return this._valueEncoding(t).decode(e)},i.prototype.encodeBatch=function(e,t){var r=this;return e.map((function(e){var n={type:e.type,key:r.encodeKey(e.key,t,e)};return r.keyAsBuffer(t,e)&&(n.keyEncoding="binary"),e.prefix&&(n.prefix=e.prefix),"value"in e&&(n.value=r.encodeValue(e.value,t,e),r.valueAsBuffer(t,e)&&(n.valueEncoding="binary")),n}))};var s=["lt","gt","lte","gte","start","end"];i.prototype.encodeLtgt=function(e){var t=this,r={};return Object.keys(e).forEach((function(n){r[n]=s.indexOf(n)>-1?t.encodeKey(e[n],e):e[n]})),r},i.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(r,n){return{key:t.decodeKey(r,e),value:t.decodeValue(n,e)}}:e.keys?function(r){return t.decodeKey(r,e)}:e.values?function(r,n){return t.decodeValue(n,e)}:function(){}},i.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer},i.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}},"66f0":function(e,t,r){"use strict";const n=r("b1aa"),{Key:i,Errors:s}=r("7b6d"),o=r("7048"),a=r("fa4d"),c=r("4bc2"),u=c("ipfs:ipns:publisher");u.error=c("ipfs:ipns:publisher:error");const l=r("2e53"),h=s.notFoundError().code,f=36e5;class d{constructor(e,t){this._routing=e,this._datastore=t}async publishWithEOL(e,t,r){if(!e||!e.bytes)throw o(new Error("invalid private key"),"ERR_INVALID_PRIVATE_KEY");const i=await a(n.createFromPrivKey)(e.bytes),s=await this._updateOrCreateRecord(e,t,r,i);return this._putRecordToRouting(s,i)}async publish(e,t){return this.publishWithEOL(e,t,f)}async _putRecordToRouting(e,t){if(!n.isPeerId(t)){const e="peerId received is not valid";throw u.error(e),o(new Error(e),"ERR_INVALID_PEER_ID")}const r=t._pubKey,i=await l.embedPublicKey(r,e),s=l.getIdKeys(t.toBytes());return await this._publishEntry(s.routingKey,i||e,t),await this._publishPublicKey(s.routingPubKey,r),i||e}async _publishEntry(e,t){if(!i.isKey(e)){const e="datastore key does not have a valid format";throw u.error(e),o(new Error(e),"ERR_INVALID_DATASTORE_KEY")}let r;try{r=l.marshal(t)}catch(n){throw u.error(n),n}try{const t=await this._routing.put(e.toBuffer(),r);return u(`ipns record for ${e.toString("base64")} was stored in the routing`),t}catch(n){const t=`ipns record for ${e.toString("base64")} could not be stored in the routing`;throw u.error(t),u.error(n),o(new Error(t),"ERR_PUTTING_TO_ROUTING")}}async _publishPublicKey(e,t){if(!i.isKey(e)){const e="datastore key does not have a valid format";throw u.error(e),o(new Error(e),"ERR_INVALID_DATASTORE_KEY")}if(!t||!t.bytes){const e="one or more of the provided parameters are not defined";throw u.error(e),o(new Error(e),"ERR_UNDEFINED_PARAMETER")}try{const r=await this._routing.put(e.toBuffer(),t.bytes);return u(`public key for ${e.toString("base64")} was stored in the routing`),r}catch(r){const t=`public key for ${e.toString("base64")} could not be stored in the routing`;throw u.error(t),u.error(r),o(new Error(t),"ERR_PUTTING_TO_ROUTING")}}async _getPublished(e,t){if(!n.isPeerId(e)){const e="peerId received is not valid";throw u.error(e),o(new Error(e),"ERR_INVALID_PEER_ID")}t=t||{};const r=!1!==t.checkRouting;try{const t=await this._datastore.get(l.getLocalKey(e.id));return this._unmarshalData(t)}catch(i){if(i.code!==h){const t=`unexpected error getting the ipns record ${e.id} from datastore`;throw u.error(t),o(new Error(t),"ERR_UNEXPECTED_DATASTORE_RESPONSE")}if(!r)throw o(i);try{const t=l.getIdKeys(e.toBytes()),r=await this._routing.get(t.routingKey.toBuffer());return this._unmarshalData(r)}catch(i){throw u.error(i),i}}}_unmarshalData(e){try{return l.unmarshal(e)}catch(t){throw o(t,"ERR_INVALID_RECORD_DATA")}}async _updateOrCreateRecord(e,t,r,i){if(!n.isPeerId(i)){const e="peerId received is not valid";throw u.error(e),o(new Error(e),"ERR_INVALID_PEER_ID")}const s={checkRouting:!0};let a;try{a=await this._getPublished(i,s)}catch(d){if(d.code!==h){const e=`unexpected error when determining the last published IPNS record for ${i.id}`;throw u.error(e),o(new Error(e),"ERR_DETERMINING_PUBLISHED_RECORD")}}let c,f=0;a&&void 0!==a.sequence&&(f=a.value.toString()!==t?a.sequence+1:a.sequence);try{c=await l.create(e,t,f,r)}catch(d){const e=`ipns record for ${t} could not be created`;throw u.error(d),o(new Error(e),"ERR_CREATING_IPNS_RECORD")}try{const e=l.marshal(c);return await this._datastore.put(l.getLocalKey(i.id),e),u(`ipns record for ${t} was stored in the datastore`),c}catch(d){const e=`ipns record for ${t} could not be stored in the datastore`;throw u.error(e),o(new Error(e),"ERR_STORING_IN_DATASTORE")}}}d.defaultRecordLifetime=f,e.exports=d},"670b":function(e,t,r){"use strict";(function(t,n){const i=r("cf7a"),s=r("26a6").BigNumber,o=r("1c1d"),a=r("c14d"),c=r("d3e5"),u=r("99a6"),l=r("a041"),{URL:h}=r("e2a8");class f{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=a.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=t.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>a.arrayBufferToBignumber(e),3:e=>c.NEG_ONE.minus(a.arrayBufferToBignumber(e)),4:e=>c.TEN.pow(e[0]).times(e[1]),5:e=>c.TWO.pow(e[0]).times(e[1]),32:e=>new h(e),35:e=>new RegExp(e)},e.tags),this.parser=o(n,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case c.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case c.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case c.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case c.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case c.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case c.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length));break;default:break}this._currentParent&&this._currentParent.type===c.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const r=this._currentParent;switch(r.values++,r.type){case c.PARENT.ARRAY:case c.PARENT.BYTE_STRING:case c.PARENT.UTF8_STRING:r.length>-1?this._ref[this._ref.length-r.length]=e:this._ref.push(e),this._dec();break;case c.PARENT.OBJECT:null!=r.tmpKey?(this._ref[r.tmpKey]=e,r.tmpKey=null,this._dec()):(r.tmpKey=e,"string"!==typeof r.tmpKey&&(r.type=c.PARENT.MAP,r.ref=a.buildMap(r.ref)));break;case c.PARENT.MAP:null!=r.tmpKey?(this._ref.set(r.tmpKey,e),r.tmpKey=null,this._dec()):r.tmpKey=e;break;case c.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,r){this._parents[this._depth]={type:t,length:r,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:c.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const r=this._knownTags[e];return r?r(t):new l(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,r){return t.concat(e)}createByteStringFromHeap(e,r){return e===r?t.alloc(0):t.from(this._heap.slice(e,r))}createInt(e){return e}createInt32(e,t){return a.buildInt32(e,t)}createInt64(e,t,r,n){return a.buildInt64(e,t,r,n)}createFloat(e){return e}createFloatSingle(e,t,r,n){return i.read([e,t,r,n],0,!1,23,4)}createFloatDouble(e,t,r,n,s,o,a,c){return i.read([e,t,r,n,s,o,a,c],0,!1,52,8)}createInt32Neg(e,t){return-1-a.buildInt32(e,t)}createInt64Neg(e,t,r,n){const i=a.buildInt32(e,t),o=a.buildInt32(r,n);return i>c.MAX_SAFE_HIGH?c.NEG_ONE.minus(new s(i).times(c.SHIFT32).plus(o)):-1-(i*c.SHIFT32+o)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new u(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,r,n){this._push(this.createInt64(e,t,r,n))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,r,n){this._push(this.createFloatSingle(e,t,r,n))}pushFloatDouble(e,t,r,n,i,s,o,a){this._push(this.createFloatDouble(e,t,r,n,i,s,o,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,r,n){this._push(this.createInt64Neg(e,t,r,n))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],c.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const r=a.buildInt32(e,t);this._createArrayStartFixed(r)}pushArrayStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const r=a.buildInt32(e,t);this._createObjectStartFixed(r)}pushObjectStartFixed64(e,t,r,n){const i=a.buildInt64(e,t,r,n);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:c.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:c.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:c.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(a.buildInt32(e,t))}pushTagStart8(e,t,r,n){this.pushTagStart(a.buildInt64(e,t,r,n))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},c.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),c.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){while(0===this._currentParent.length)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,r){"string"===typeof e&&(e=t.from(e,r||"hex"));const n=new f({size:e.length});return n.decodeFirst(e)}static decodeAll(e,r){"string"===typeof e&&(e=t.from(e,r||"hex"));const n=new f({size:e.length});return n.decodeAll(e)}}f.decodeFirst=f.decode,e.exports=f}).call(this,r("b639").Buffer,r("c8ba"))},"670f":function(e,t,r){"use strict";function n(e,t,r){var n;if(!(e instanceof Error))throw new TypeError("Please pass an Error to err-code");if("object"===typeof t?r=t:null!=t&&(e.code=t),r)for(n in r)e[n]=r[n];return e}e.exports=n},6719:function(e,t,r){(function(t){var r={};e.exports=r;var n={};function i(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r0)s.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[s[r]];return c}r.encode=function(e,t,r){if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!==typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var s=0,o=t.length,a=t.charAt(0),c=[0];for(s=0;s0)c.push(l%o),l=l/o|0}for(s=0;0===e[s]&&s=0;--s)n+=t[c[s]]}else n=i(e,t);if(r){var h=new RegExp(".{1,"+r+"}","g");n=n.match(h).join("\r\n")}return n},r.decode=function(e,r){if("string"!==typeof e)throw new TypeError('"input" must be a string.');if("string"!==typeof r)throw new TypeError('"alphabet" must be a string.');var i=n[r];if(!i){i=n[r]=[];for(var s=0;s>=8;while(h>0)c.push(255&h),h>>=8}for(var f=0;e[f]===a&&fi(null,e),i)}}},"67e0":function(e,t,r){"use strict";const n=t;n.Reporter=r("4a8a").Reporter,n.DecoderBuffer=r("999a").DecoderBuffer,n.EncoderBuffer=r("999a").EncoderBuffer,n.Node=r("0c77")},"680e":function(e,t,r){"use strict";(function(t){const{URL:n}=r("e2a8"),i=r("cb90"),{default:s}=r("2424");e.exports=e=>{const r=async(r,i)=>{i=i||{};const o=await s.get(r),a=decodeURIComponent(new n(o.url).pathname.split("/").pop()),c=t.from(await o.arrayBuffer());return e.add({content:c,path:a},i)};return(e,t,n)=>("function"===typeof t&&(n=t,t={}),i(r(e,t),n))}}).call(this,r("b639").Buffer)},"682d":function(e,t,r){"use strict";e.exports=function(e,t){return e.then(e=>{t(null,e)},e=>{t(e)})}},"686e":function(e,t,r){"use strict";const n=r("c3bb"),i=r("b639").Buffer,s=r("9e80");function o(e){s.call(this,e),this.enc="pem"}n(o,s),e.exports=o,o.prototype.decode=function(e,t){const r=e.toString().split(/[\r\n]+/g),n=t.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/;let a=-1,c=-1;for(let i=0;ithis.addPeerToQuery(e))),await this.run.workerQueue(this)}async addPeerToQuery(e){this.run.query.dht._isSelf(e)||this.run.peersSeen.has(e)||await this.peersToQuery.enqueue(e)}}e.exports=o},"68f6":function(e,t,r){"use strict";var n=r("e0c5").Buffer,i=r("bce7"),s=r("1972"),o=r("c627");function a(){this.x=i.fromBuffer(n.from("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex")),this.y=i.fromBuffer(n.from("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex")),this.inf=!1,this._precompute()}a.prototype._precompute=function(){for(var e=new s(this.x,this.y),t=4,r=new Array(1+Math.ceil(257/t)),n=r[0]=e,i=1;i=u;h--)l=(l<<1)+i[h];c.push(l)}for(var f=new o(null,null,null),d=new o(null,null,null),p=a;p>0;p--){for(var y=0;y=0;l--){for(var h=0;l>=0;++h,--l)if(u[0]=0|a[0][l],u[1]=0|a[1][l],0!==u[0]||0!==u[1])break;if(l>=0&&(h+=1),c=c.dblp(h),l<0)break;for(var f=0;f<2;f++){var d,p=u[f];0!==p&&(p>0?d=s[f][p>>1]:p<0&&(d=s[f][-p>>1].neg()),c=void 0===d.z?c.mixedAdd(d):c.add(d))}}return c},e.exports=new a},"691e":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var n=r("e7ab"),i=s(n);function s(e){return e&&e.__esModule?e:{default:e}}var o="function"===typeof Symbol;function a(e){return o&&"AsyncFunction"===e[Symbol.toStringTag]}function c(e){return a(e)?(0,i.default)(e):e}t.default=c,t.isAsync=a},"694c":function(e,t,r){"use strict";const n=r("e0c5").Buffer;e.exports=s;const i=10240;function s(e){e=Object.assign({fixed:!1},e||{});const t=r("9efb");let i=e.fixed?null:o(),s=0,a=!1;return r=>(c,u)=>{if(c&&(a=c),a)return u(a);r(null,(r,c)=>{if(r&&(a=r),a)return u(a);if(!a&&!n.isBuffer(c))return a=new Error("data must be a buffer"),u(a);const l=a?0:c.length;let h;if(e.fixed?(h=n.alloc(4),h.writeInt32BE(l,0)):(t.encode(l,i,s),s+=t.encode.bytes,h=i.slice(s-t.encode.bytes,s),i.length-s<100&&(i=o(),s=0)),a)return u(null,h);u(null,n.concat([h,c],(e.fixed?4:t.encode.bytes)+l))})}}function o(){return n.alloc(i)}},"694d":function(e,t,r){"use strict";var n=r("0a86");e.exports=function(e){return n(e,!0)}},6966:function(e,t,r){"use strict";(function(t){var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=r("b307"),o=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),f=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var r=e[f].read();null!==r&&(e[l]=null,e[o]=null,e[a]=null,t(d(r,!1)))}}function y(e){t.nextTick(p,e)}function g(e,t){return function(r,n){e.then((function(){t[u]?r(d(void 0,!0)):t[h](r,n)}),n)}}var m=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((n={get stream(){return this[f]},next:function(){var e=this,r=this[c];if(null!==r)return Promise.reject(r);if(this[u])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise((function(r,n){t.nextTick((function(){e[c]?n(e[c]):r(d(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(g(i,this));else{var s=this[f].read();if(null!==s)return Promise.resolve(d(s,!1));n=new Promise(this[h])}return this[l]=n,n}},i(n,Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(d(void 0,!0))}))}))})),n),m),v=function(e){var t,r=Object.create(b,(t={},i(t,f,{value:e,writable:!0}),i(t,o,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,c,{value:null,writable:!0}),i(t,u,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var n=r[f].read();n?(r[l]=null,r[o]=null,r[a]=null,e(d(n,!1))):(r[o]=e,r[a]=t)},writable:!0}),t));return r[l]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[l]=null,r[o]=null,r[a]=null,t(e)),void(r[c]=e)}var n=r[o];null!==n&&(r[l]=null,r[o]=null,r[a]=null,n(d(void 0,!0))),r[u]=!0})),e.on("readable",y.bind(null,r)),r};e.exports=v}).call(this,r("4362"))},"69b6":function(e,t,r){(function(t){e.exports=function(){var e=[],r=0;return{length:r,data:this,add:function(n){if(!t.isBuffer(n))throw new Error("data must be a buffer, was: "+JSON.stringify(n));return this.length=r+=n.length,e.push(n),this},has:function(e){return null==e?r>0:r>=e},get:function(n){var i;if(null==n||n===r){r=0;var s=e;return e=[],1==s.length?s[0]:t.concat(s)}if(e.length>1&&n<=(i=e[0].length)){var o=e[0].slice(0,n);return n===i?e.shift():e[0]=e[0].slice(n,i),r-=n,o}if(n(r=r||{},e._keychain.createKey(t,r.type,r.size))),info:n(async t=>e._keychain.findKeyByName(t)),list:n(async()=>e._keychain.listKeys()),rm:n(async t=>e._keychain.removeKey(t)),rename:n(async(t,r)=>{const n=await e._keychain.renameKey(t,r);return{was:t,now:n.name,id:n.id,overwrite:!1}}),import:n(async(t,r,n)=>e._keychain.importKey(t,r,n)),export:n(async(t,r)=>e._keychain.exportKey(t,r))}}},"69d0":function(e,t){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);e.exports=function(){return r(n),n}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},"69e7":function(e,t,r){"use strict";(function(t){const n=r("1c7ef"),i=n.cloneLinks,s=n.cloneData,o=r("70cf"),a=r("c449"),c=(e,r)=>{const n=s(e);let c=i(e);if("string"===typeof r)c=c.filter(e=>e.Name!==r);else{if(!t.isBuffer(r)&&!a.isCID(r))throw new Error("second arg needs to be a name or CID");c=c.filter(e=>!e.Hash.equals(r))}return o(n,c)};e.exports=c}).call(this,r("b639").Buffer)},"6a27":function(e,t,r){var n=r("6b4e");e.exports=function(e){return(new n).update(e).digest()}},"6a63":function(e,t,r){function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i(r||(r=Promise.resolve())).then(e).catch(e=>setTimeout(()=>{throw e},0))},"6ad2":function(e,t,r){"use strict";(function(n){function i(e){return i="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(){return!("undefined"===typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"===typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)}}function a(){var e;return"object"===("undefined"===typeof console?"undefined":i(console))&&console.log&&(e=console).log.apply(e,arguments)}function c(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}}function u(){var e;try{e=t.storage.getItem("debug")}catch(r){}return!e&&"undefined"!==typeof n&&"env"in n&&(e=Object({NODE_ENV:"production",BASE_URL:"/"}).DEBUG),e}function l(){try{return localStorage}catch(e){}}t.log=a,t.formatArgs=o,t.save=c,t.load=u,t.useColors=s,t.storage=l(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=r("8922")(t);var h=e.exports.formatters;h.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r("4362"))},"6b25":function(e,t,r){"use strict";const n=r("247b");e.exports=(e,t)=>{n.generateEphmeralKeyPair(e,t)}},"6b4e":function(e,t,r){"use strict";var n=r("c3bb"),i=r("a254"),s=r("e0c5").Buffer,o=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function c(e,t){return e<>>32-t}function u(e,t,r,n,i,s,o){return c(e+(t&r|~t&n)+i+s|0,o)+t|0}function l(e,t,r,n,i,s,o){return c(e+(t&n|r&~n)+i+s|0,o)+t|0}function h(e,t,r,n,i,s,o){return c(e+(t^r^n)+i+s|0,o)+t|0}function f(e,t,r,n,i,s,o){return c(e+(r^(t|~n))+i+s|0,o)+t|0}n(a,i),a.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,s=this._d;r=u(r,n,i,s,e[0],3614090360,7),s=u(s,r,n,i,e[1],3905402710,12),i=u(i,s,r,n,e[2],606105819,17),n=u(n,i,s,r,e[3],3250441966,22),r=u(r,n,i,s,e[4],4118548399,7),s=u(s,r,n,i,e[5],1200080426,12),i=u(i,s,r,n,e[6],2821735955,17),n=u(n,i,s,r,e[7],4249261313,22),r=u(r,n,i,s,e[8],1770035416,7),s=u(s,r,n,i,e[9],2336552879,12),i=u(i,s,r,n,e[10],4294925233,17),n=u(n,i,s,r,e[11],2304563134,22),r=u(r,n,i,s,e[12],1804603682,7),s=u(s,r,n,i,e[13],4254626195,12),i=u(i,s,r,n,e[14],2792965006,17),n=u(n,i,s,r,e[15],1236535329,22),r=l(r,n,i,s,e[1],4129170786,5),s=l(s,r,n,i,e[6],3225465664,9),i=l(i,s,r,n,e[11],643717713,14),n=l(n,i,s,r,e[0],3921069994,20),r=l(r,n,i,s,e[5],3593408605,5),s=l(s,r,n,i,e[10],38016083,9),i=l(i,s,r,n,e[15],3634488961,14),n=l(n,i,s,r,e[4],3889429448,20),r=l(r,n,i,s,e[9],568446438,5),s=l(s,r,n,i,e[14],3275163606,9),i=l(i,s,r,n,e[3],4107603335,14),n=l(n,i,s,r,e[8],1163531501,20),r=l(r,n,i,s,e[13],2850285829,5),s=l(s,r,n,i,e[2],4243563512,9),i=l(i,s,r,n,e[7],1735328473,14),n=l(n,i,s,r,e[12],2368359562,20),r=h(r,n,i,s,e[5],4294588738,4),s=h(s,r,n,i,e[8],2272392833,11),i=h(i,s,r,n,e[11],1839030562,16),n=h(n,i,s,r,e[14],4259657740,23),r=h(r,n,i,s,e[1],2763975236,4),s=h(s,r,n,i,e[4],1272893353,11),i=h(i,s,r,n,e[7],4139469664,16),n=h(n,i,s,r,e[10],3200236656,23),r=h(r,n,i,s,e[13],681279174,4),s=h(s,r,n,i,e[0],3936430074,11),i=h(i,s,r,n,e[3],3572445317,16),n=h(n,i,s,r,e[6],76029189,23),r=h(r,n,i,s,e[9],3654602809,4),s=h(s,r,n,i,e[12],3873151461,11),i=h(i,s,r,n,e[15],530742520,16),n=h(n,i,s,r,e[2],3299628645,23),r=f(r,n,i,s,e[0],4096336452,6),s=f(s,r,n,i,e[7],1126891415,10),i=f(i,s,r,n,e[14],2878612391,15),n=f(n,i,s,r,e[5],4237533241,21),r=f(r,n,i,s,e[12],1700485571,6),s=f(s,r,n,i,e[3],2399980690,10),i=f(i,s,r,n,e[10],4293915773,15),n=f(n,i,s,r,e[1],2240044497,21),r=f(r,n,i,s,e[8],1873313359,6),s=f(s,r,n,i,e[15],4264355552,10),i=f(i,s,r,n,e[6],2734768916,15),n=f(n,i,s,r,e[13],1309151649,21),r=f(r,n,i,s,e[4],4149444226,6),s=f(s,r,n,i,e[11],3174756917,10),i=f(i,s,r,n,e[2],718787259,15),n=f(n,i,s,r,e[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+s|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=s.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a},"6b4f":function(e,t,r){var n=r("0937"),i=n.Symbol;e.exports=i},"6b58":function(e,t,r){var n=r("7037"),i=r("3c96");function s(e,t){return!t||"object"!==n(t)&&"function"!==typeof t?i(e):t}e.exports=s},"6b6e":function(e,t,r){"use strict";e.exports=e=>{const t={add:r("67ce")(e),addFromFs:r("3bf8")(e),addFromStream:r("a47a")(e),addFromURL:r("680e")(e),addPullStream:r("b6713")(e),addReadableStream:r("84b3")(e),_addAsyncIterator:r("cb3e")(e),cat:r("2632")(e),catPullStream:r("5036")(e),catReadableStream:r("74c8")(e),_catAsyncIterator:r("cf23")(e),get:r("eb0c")(e),getPullStream:r("005a")(e),getReadableStream:r("363c")(e),_getAsyncIterator:r("d8a0")(e),ls:r("a808")(e),lsPullStream:r("4784")(e),lsReadableStream:r("5571")(e),_lsAsyncIterator:r("f99c")(e),refs:r("12dd")(e),refsReadableStream:r("516c")(e),refsPullStream:r("a02c")(e),_refsAsyncIterator:r("3902")(e)};return t.refs.local=r("477c")(e),t.refs.localReadableStream=r("2f57")(e),t.refs.localPullStream=r("a62b")(e),t.refs._localAsyncIterator=r("e115")(e),t}},"6bf2":function(e,t,r){"use strict";(function(n){const i=r("d733"),s=r("0c9a"),o=r("efc9"),a=r("e3d5"),c=r("17e5"),u=42;function l(e){return"string"===typeof e?e=new a(e).buffer:a.isCID(e)&&(e=e.buffer),new i.Tagged(u,n.concat([n.from("00","hex"),e]))}function h(e){let t;try{t=c(e)}catch(i){t=!1}if(t)throw new Error("The object passed has circular references");function r(e){if(!e||n.isBuffer(e)||"string"===typeof e)return e;if(Array.isArray(e))return e.map(r);if(a.isCID(e))return l(e);const t=Object.keys(e);if(t.length>0){const n={};return t.forEach(t=>{"object"===typeof e[t]?n[t]=r(e[t]):n[t]=e[t]}),n}return e}return r(e)}t=e.exports,t.codec=s.DAG_CBOR,t.defaultHashAlg=s.SHA2_256;const f={[u]:e=>(e=e.slice(1),new a(e))},d=65536;let p=d;const y=67108864;let g=y,m=null;t.configureDecoder=e=>{let t=f;e?("number"===typeof e.size&&(p=e.size),"number"===typeof e.maxSize&&(g=e.maxSize),e.tags&&(t=Object.assign({},f,e&&e.tags))):(p=d,g=y);let r={tags:t,size:p};m=new i.Decoder(r),p=r.size},t.configureDecoder(),t.serialize=e=>{const t=h(e),r=i.encode(t);return r},t.deserialize=e=>{if(e.length>p&&e.length<=g&&t.configureDecoder({size:e.length}),e.length>p)throw new Error("Data is too large to deserialize with current decoder");const r=m.decodeFirst(e);return r},t.cid=async(e,r)=>{const n={cidVersion:1,hashAlg:t.defaultHashAlg},i=Object.assign(n,r),c=await o(e,i.hashAlg),u=s.print[t.codec],l=new a(i.cidVersion,u,c);return l}}).call(this,r("b639").Buffer)},"6bf6":function(e,t,r){"use strict";e.exports={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}}},"6c0a":function(e,t,r){var n=r("e0c5").Buffer;function i(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var r=e[5+t];return 0!==r&&(6+t+r===e.length&&(!(128&e[4])&&(!(t>1&&0===e[4]&&!(128&e[5]))&&(!(128&e[t+6])&&!(r>1&&0===e[t+6]&&!(128&e[t+7]))))))}function s(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var r=e[5+t];if(0===r)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(r>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}function o(e,t){var r=e.length,i=t.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>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&t[0])throw new Error("S value is negative");if(r>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var s=n.allocUnsafe(6+r+i);return s[0]=48,s[1]=s.length-2,s[2]=2,s[3]=e.length,e.copy(s,4),s[4+r]=2,s[5+r]=t.length,t.copy(s,6+r),s}e.exports={check:i,decode:s,encode:o}},"6c12":function(e,t,r){"use strict";e.exports=function(e,t){t=t||{};var r=t.last||!1,n=!1;if("number"===typeof e){r=!0;var i=e;e=function(){return--i}}return function(t){function i(e){t(!0,(function(t){r=!1,e(t||!0)}))}return function(s,o){n&&!s?r?i(o):o(n):(n=s)?t(n,o):t(null,(function(t,s){(n=n||t)?o(n):e(s)?o(null,s):(n=!0,r?o(null,s):i(o))}))}}}},"6c27":function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__; +/** + * [js-sha256]{@link https://github.com/emn178/js-sha256} + * + * @version 0.9.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2017 + * @license MIT + */(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"===typeof window,root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"===typeof self,NODE_JS=!root.JS_SHA256_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&"object"===typeof module&&module.exports,AMD=__webpack_require__("3c35"),ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];!root.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e,t){return function(r){return new Sha256(t,!0).update(r)[e]()}},createMethod=function(e){var t=createOutputMethod("hex",e);NODE_JS&&(t=nodeWrap(t,e)),t.create=function(){return new Sha256(e)},t.update=function(e){return t.create().update(e)};for(var r=0;r>6,o[c++]=128|63&s):s<55296||s>=57344?(o[c++]=224|s>>12,o[c++]=128|s>>6&63,o[c++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++n)),o[c++]=240|s>>18,o[c++]=128|s>>12&63,o[c++]=128|s>>6&63,o[c++]=128|63&s);e=o}else{if("object"!==i)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw new Error(ERROR)}e.length>64&&(e=new Sha256(t,!0).update(e).array());var u=[],l=[];for(n=0;n<64;++n){var h=e[n]||0;u[n]=92^h,l[n]=54^h}Sha256.call(this,t,r),this.update(l),this.oKeyPad=u,this.inner=!0,this.sharedMemory=r}Sha256.prototype.update=function(e){if(!this.finalized){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw new Error(ERROR);t=!0}var n,i,s=0,o=e.length,a=this.blocks;while(s>2]|=e[s]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(a[i>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<=64?(this.block=a[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=EXTRA[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var e,t,r,n,i,s,o,a,c,u,l,h=this.h0,f=this.h1,d=this.h2,p=this.h3,y=this.h4,g=this.h5,m=this.h6,b=this.h7,v=this.blocks;for(e=16;e<64;++e)i=v[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=v[e-2],r=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,v[e]=v[e-16]+t+v[e-7]+r<<0;for(l=f&d,e=0;e<64;e+=4)this.first?(this.is224?(a=300032,i=v[0]-1413257819,b=i-150054599<<0,p=i+24177077<<0):(a=704751109,i=v[0]-210244248,b=i-1521486534<<0,p=i+143694565<<0),this.first=!1):(t=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),r=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),a=h&f,n=a^h&d^l,o=y&g^~y&m,i=b+r+o+K[e]+v[e],s=t+n,b=p+i<<0,p=i+s<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),r=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),c=p&h,n=c^p&f^a,o=b&y^~b&g,i=m+r+o+K[e+1]+v[e+1],s=t+n,m=d+i<<0,d=i+s<<0,t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),u=d&p,n=u^d&h^c,o=m&b^~m&y,i=g+r+o+K[e+2]+v[e+2],s=t+n,g=f+i<<0,f=i+s<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),r=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=f&d,n=l^f&p^u,o=g&m^~g&b,i=y+r+o+K[e+3]+v[e+3],s=t+n,y=h+i<<0,h=i+s<<0;this.h0=this.h0+h<<0,this.h1=this.h1+f<<0,this.h2=this.h2+d<<0,this.h3=this.h3+p<<0,this.h4=this.h4+y<<0,this.h5=this.h5+g<<0,this.h6=this.h6+m<<0,this.h7=this.h7+b<<0},Sha256.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o];return this.is224||(c+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a]),c},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,s>>24&255,s>>16&255,s>>8&255,255&s,o>>24&255,o>>16&255,o>>8&255,255&o];return this.is224||c.push(a>>24&255,a>>16&255,a>>8&255,255&a),c},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__("4362"),__webpack_require__("c8ba"))},"6c29":function(e,t,r){"use strict";function n(e,t,r){let n=0,i=e.length;while(i>0){const s=i/2|0;let o=n+s;r(e[o],t)<=0?(n=++o,i-=s+1):i=s}return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},"6c8b":function(e,t,r){"use strict";const n=r("f106");e.exports=n("\nmessage CircuitRelay {\n\n enum Status {\n SUCCESS = 100;\n HOP_SRC_ADDR_TOO_LONG = 220;\n HOP_DST_ADDR_TOO_LONG = 221;\n HOP_SRC_MULTIADDR_INVALID = 250;\n HOP_DST_MULTIADDR_INVALID = 251;\n HOP_NO_CONN_TO_DST = 260;\n HOP_CANT_DIAL_DST = 261;\n HOP_CANT_OPEN_DST_STREAM = 262;\n HOP_CANT_SPEAK_RELAY = 270;\n HOP_CANT_RELAY_TO_SELF = 280;\n STOP_SRC_ADDR_TOO_LONG = 320;\n STOP_DST_ADDR_TOO_LONG = 321;\n STOP_SRC_MULTIADDR_INVALID = 350;\n STOP_DST_MULTIADDR_INVALID = 351;\n STOP_RELAY_REFUSED = 390;\n MALFORMED_MESSAGE = 400;\n }\n\n enum Type { // RPC identifier, either HOP, STOP or STATUS\n HOP = 1;\n STOP = 2;\n STATUS = 3;\n CAN_HOP = 4;\n }\n\n message Peer {\n required bytes id = 1; // peer id\n repeated bytes addrs = 2; // peer's known addresses\n }\n\n optional Type type = 1; // Type of the message\n\n optional Peer srcPeer = 2; // srcPeer and dstPeer are used when Type is HOP or STATUS\n optional Peer dstPeer = 3;\n\n optional Status code = 4; // Status code, used when Type is STATUS\n}\n")},"6cf0":function(e,t){function r(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=r,r.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-r:e+r}return 0|Math.min(e,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(e){this.ms=e},r.prototype.setMax=function(e){this.max=e},r.prototype.setJitter=function(e){this.jitter=e}},"6d36":function(e,t,r){"use strict";const n=r("4bc2"),i=r("727b"),s=r("df87");function o(e){const t=n("libp2p:switch:listener");return function(r,n){return function(o){t("received incoming connection for transport %s",r),o.getPeerInfo((a,c)=>{const u=r?s(r,null,o,e.observer):o,l=new i({connection:u,_switch:e,transportKey:r,peerInfo:c});l.once("error",e=>t(e)),l.once("private",e=>{if(n)return n(e);l.encrypt()}),l.once("encrypted",()=>l.upgrade()),l.protect()})}}}e.exports=o},"6d3e":function(e,t,r){"use strict";const n=r("ddda");class i{constructor(e,t,r,i,s,o){if(!n(e))throw new Error("Identity id is required");if(!n(t))throw new Error("Invalid public key");if(!n(r))throw new Error("Signature of the id (idSignature) is required");if(!n(i))throw new Error("Signature of (publicKey + idSignature) is required");if(!n(s))throw new Error("Identity type is required");if(!n(o))throw new Error("Identity provider is required");this._id=e,this._publicKey=t,this._signatures=Object.assign({},{id:r},{publicKey:i}),this._type=s,this._provider=o}get id(){return this._id}get publicKey(){return this._publicKey}get signatures(){return this._signatures}get type(){return this._type}get provider(){return this._provider}toJSON(){return{id:this.id,publicKey:this.publicKey,signatures:this.signatures,type:this.type}}static isIdentity(e){return void 0!==e.id&&void 0!==e.publicKey&&void 0!==e.signatures&&void 0!==e.signatures.id&&void 0!==e.signatures.publicKey&&void 0!==e.type}static toJSON(e){return{id:e.id,publicKey:e.publicKey,signatures:e.signatures,type:e.type}}}e.exports=i},"6d68":function(e,t,r){var n=r("2007"),i="Expected a function";function s(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(i);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(s.Cache||n),r}s.Cache=n,e.exports=s},"6d6a":function(e,t,r){"use strict";e.exports=e=>(e.id&&"function"===typeof e.id.toB58String&&(e=e.id),e.toB58String())},"6da9":function(e,t,r){"use strict";const n=r("c9b5"),i=r("5f7e"),s=r("4bc2")("ipfs:mfs:cp"),o=r("7048"),a=r("4bc9"),c=r("13d9"),u=r("8648"),l=r("0503"),h=r("fd9e"),f=r("cef2"),d=r("56ad"),p={parents:!1,flush:!0,format:"dag-pb",hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3};e.exports=e=>async function(...t){const r=l(t,p);let{sources:a,destination:c}=await f(e,t);if(!a.length)throw o(new Error("Please supply at least one source"),"ERR_INVALID_PARAMS");if(!c)throw o(new Error("Please supply a destination"),"ERR_INVALID_PARAMS");r.parents=r.p||r.parents;const u=a.find(e=>!e.exists);if(u)throw o(new Error(`${u.path} does not exist`),"ERR_INVALID_PARAMS");const b=y(c);if(c.exists){if(s("Destination exists"),1===a.length&&!b)throw o(new Error("directory already has entry by that name"),"ERR_ALREADY_EXISTS")}else if(s("Destination does not exist"),a.length>1){if(!r.parents)throw o(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await n(e)(c.path,r),c=await h(e,c.path)}else if(c.parts.length>1){const t=`/${c.parts.slice(0,-1).join("/")}`;try{await i(e)(t,r)}catch(_){if("ERR_NOT_FOUND"!==_.code)throw _;if(!r.parents)throw o(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await n(e)(t,r),c=await h(e,c.path)}}const v=y(c)?c.mfsPath:c.mfsDirectory,w=await d(e,v,r);if(1===a.length){const t=a.pop(),n=b?t.name:c.name;return s(`Only one source, copying to destination ${b?"directory":"file"} ${n}`),g(e,t,n,w,r)}return s("Multiple sources, wrapping in a directory"),m(e,a,c,w,r)};const y=e=>e.unixfs&&e.unixfs.type&&e.unixfs.type.includes("directory"),g=async(e,t,r,n,i)=>{let s=n.pop();s=await b(e,t,r,s,i),n.push(s);const o=await a(e,n,i);await c(e,o)},m=async(e,t,r,n,i)=>{for(let o=0;o{const s=await e.repo.blocks.get(t.cid),{node:o,cid:a}=await u(e,{parentCid:n.cid,size:s.data.length,cid:t.cid,name:r,format:i.format,hashAlg:i.hashAlg,cidVersion:i.cidVersion});return n.node=o,n.cid=a,n.size=o.size,n}},"6daa":function(e,t,r){"use strict";const n=r("7048"),{Buffer:i}=r("b639"),s=r("c2b1"),{isSource:o}=r("477b"),a=r("6757"),{Readable:c}=r("d485"),u=r("ba68");function l(e){const t={path:e.path||""};return e.content?t.content=h(e.content):e.path||(t.content=h(e)),t}function h(e){if(p(e)||"string"===typeof e)return async function*(){yield d(e)}();if(y(e))return b(e);if(f(e)&&(e=m(e)),e[Symbol.iterator])return async function*(){const t=e[Symbol.iterator](),r=t.next();if(r.done)return t;if(Number.isInteger(r.value))yield d(Array.from(function*(){yield r.value,yield*t}()));else{if(!p(r.value))throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield d(r.value);for(const e of t)yield d(e)}}();if(e[Symbol.asyncIterator])return async function*(){for await(const t of e)yield d(t)}();if(o(e))return s(e);throw n(new Error(`Unexpected input: ${e}`,"ERR_UNEXPECTED_INPUT"))}function f(e){return!e[Symbol.iterator]&&!e[Symbol.asyncIterator]&&Boolean(e.readable)}function d(e){return p(e)?e:i.from(e)}function p(e){return i.isBuffer(e)||ArrayBuffer.isView(e)||e instanceof ArrayBuffer}function y(e){return"undefined"!==typeof a.Blob&&e instanceof a.Blob}function g(e){return"object"===typeof e&&(e.path||e.content)}function m(e){return e[Symbol.asyncIterator]||e[Symbol.iterator]?e:(e[Symbol.asyncIterator]=c.prototype[Symbol.asyncIterator]||u.prototype[Symbol.asyncIterator],e)}function b(e){return"function"===typeof e.stream?v(e):w(e)}async function*v(e){const t=e.stream().getReader();while(1){const e=await t.read();if(e.done)return;yield e.value}}async function*w(e,t){t=t||{};const r=new a.FileReader,n=t.chunkSize||1048576;let s=t.offset||0;const o=()=>new Promise((t,i)=>{r.onloadend=e=>{const r=e.target.result;t(0===r.byteLength?null:r)},r.onerror=i;const o=s+n,a=e.slice(s,o);r.readAsArrayBuffer(a),s=o});while(1){const e=await o();if(null==e)return;yield i.from(e)}}e.exports=function(e){if(null===e||void 0===e)throw n(new Error(`Unexpected input: ${e}`,"ERR_UNEXPECTED_INPUT"));if("string"===typeof e||e instanceof String)return async function*(){yield l(e)}();if(p(e)||y(e))return async function*(){yield l(e)}();if(f(e)&&(e=m(e)),e[Symbol.iterator])return async function*(){const t=e[Symbol.iterator](),r=t.next();if(r.done)return t;if(Number.isInteger(r.value)||p(r.value))yield l(function*(){yield r.value,yield*t}());else{if(!g(r.value)&&!y(r.value)&&"string"!==typeof r.value)throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield l(r.value);for(const e of t)yield l(e)}}();if(e[Symbol.asyncIterator])return async function*(){const t=e[Symbol.asyncIterator](),r=await t.next();if(r.done)return t;if(p(r.value))yield l(async function*(){yield r.value,yield*t}());else{if(!g(r.value)&&!y(r.value)&&"string"!==typeof r.value)throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield l(r.value);for await(const e of t)yield l(e)}}();if(g(e))return async function*(){yield l(e)}();if(o(e))return async function*(){const t=s(e)[Symbol.asyncIterator](),r=await t.next();if(r.done)return t;if(p(r.value))yield l(async function*(){yield r.value,yield*t}());else{if(!g(r.value)&&!y(r.value)&&"string"!==typeof r.value)throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT");yield l(r.value);for await(const e of t)yield l(e)}}();throw n(new Error("Unexpected input: "+typeof e),"ERR_UNEXPECTED_INPUT")}},"6dd4":function(e,t,r){"use strict";(function(t){const n=r("e3d5"),i=r("f654"),s=r("87dd");class o{constructor(e,t,r){i(r,"A link requires a cid to point to"),this._name=e||"",this._nameBuf=null,this._size=t,this._cid=new n(r)}toString(){return`DAGLink <${this._cid.toBaseEncodedString()} - name: "${this.Name}", size: ${this.Tsize}>`}toJSON(){return this._json||(this._json=Object.freeze({name:this.Name,size:this.Tsize,cid:this.Hash.toBaseEncodedString()})),Object.assign({},this._json)}get Name(){return this._name}get nameAsBuffer(){return null!==this._nameBuf?this._nameBuf:(this._nameBuf=t.from(this._name),this._nameBuf)}set Name(e){throw new Error("Can't set property: 'name' is immutable")}get Tsize(){return this._size}set Tsize(e){throw new Error("Can't set property: 'size' is immutable")}get Hash(){return this._cid}set Hash(e){throw new Error("Can't set property: 'cid' is immutable")}}e.exports=s(o,{className:"DAGLink",symbolName:"@ipld/js-ipld-dag-pb/daglink"})}).call(this,r("b639").Buffer)},"6e30":function(e,t,r){"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},"6e62":function(e,t,r){(function(e){(function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"===typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{o=r(8).Buffer}catch(A){}function a(e,t,r){for(var n=0,i=Math.min(e.length,r),s=t;s=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function c(e,t,r,n){for(var i=0,s=Math.min(e.length,r),o=t;o=49?a-49+10:a>=17?a-17+10:a}return i}s.isBN=function(e){return e instanceof s||null!==e&&"object"===typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"===typeof e)return this._initNumber(e,t,r);if("object"===typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var i=0;"-"===e[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(n("number"===typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[s]|=o<>>26-a&67108863,a+=24,a>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i>>26-a&67108863,a+=24,a>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=a(e,r,r+6),this.words[n]|=i<>>26-s&4194303,s+=24,s>=26&&(s-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<>>26-s&4194303),this.strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,u=0,l=r;l1&&0===this.words[this.length-1])this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],s=0|t.words[0],o=i*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,h=67108863&c,f=Math.min(u,t.length-1),d=Math.max(0,u-e.length+1);d<=f;d++){var p=u-d|0;i=0|e.words[p],s=0|t.words[d],o=i*s+h,l+=o/67108864|0,h=67108863&o}r.words[u]=0|h,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}s.prototype.toString=function(e,t){var r;if(e=e||10,t=0|t||1,16===e||"hex"===e){r="";for(var i=0,s=0,o=0;o>>24-i&16777215,r=0!==s||o!==this.length-1?u[6-c.length]+c+r:c+r,i+=2,i>=26&&(i-=26,o--)}0!==s&&(r=s.toString(16)+r);while(r.length%t!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=l[e],d=h[e];r="";var p=this.clone();p.negative=0;while(!p.isZero()){var y=p.modn(d).toString(e);p=p.idivn(d),r=p.isZero()?y+r:u[f-y.length]+y+r}this.isZero()&&(r="0"+r);while(r.length%t!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(e,t){return n("undefined"!==typeof o),this.toArrayLike(o,e,t)},s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0"),this.strip();var o,a,c="le"===t,u=new e(s),l=this.clone();if(c){for(a=0;!l.isZero();a++)o=l.andln(255),l.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0===(8191&t)&&(r+=13,t>>>=13),0===(127&t)&&(r+=7,t>>>=7),0===(15&t)&&(r+=4,t>>>=4),0===(3&t)&&(r+=2,t>>>=2),0===(1&t)&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){n("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){n("number"===typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;se.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var s=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==s&&o>26,this.words[o]=67108863&t;if(0===s&&o>>13,d=0|o[1],p=8191&d,y=d>>>13,g=0|o[2],m=8191&g,b=g>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],S=8191&E,k=E>>>13,C=0|o[5],A=8191&C,I=C>>>13,T=0|o[6],x=8191&T,B=T>>>13,R=0|o[7],N=8191&R,O=R>>>13,P=0|o[8],D=8191&P,L=P>>>13,M=0|o[9],U=8191&M,j=M>>>13,K=0|a[0],F=8191&K,V=K>>>13,q=0|a[1],z=8191&q,H=q>>>13,G=0|a[2],$=8191&G,W=G>>>13,Y=0|a[3],Q=8191&Y,J=Y>>>13,X=0|a[4],Z=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],he=8191&le,fe=le>>>13,de=0|a[9],pe=8191&de,ye=de>>>13;r.negative=e.negative^t.negative,r.length=19,n=Math.imul(h,F),i=Math.imul(h,V),i=i+Math.imul(f,F)|0,s=Math.imul(f,V);var ge=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,F),i=Math.imul(p,V),i=i+Math.imul(y,F)|0,s=Math.imul(y,V),n=n+Math.imul(h,z)|0,i=i+Math.imul(h,H)|0,i=i+Math.imul(f,z)|0,s=s+Math.imul(f,H)|0;var me=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,F),i=Math.imul(m,V),i=i+Math.imul(b,F)|0,s=Math.imul(b,V),n=n+Math.imul(p,z)|0,i=i+Math.imul(p,H)|0,i=i+Math.imul(y,z)|0,s=s+Math.imul(y,H)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,W)|0,i=i+Math.imul(f,$)|0,s=s+Math.imul(f,W)|0;var be=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,F),i=Math.imul(w,V),i=i+Math.imul(_,F)|0,s=Math.imul(_,V),n=n+Math.imul(m,z)|0,i=i+Math.imul(m,H)|0,i=i+Math.imul(b,z)|0,s=s+Math.imul(b,H)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,W)|0,i=i+Math.imul(y,$)|0,s=s+Math.imul(y,W)|0,n=n+Math.imul(h,Q)|0,i=i+Math.imul(h,J)|0,i=i+Math.imul(f,Q)|0,s=s+Math.imul(f,J)|0;var ve=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(S,F),i=Math.imul(S,V),i=i+Math.imul(k,F)|0,s=Math.imul(k,V),n=n+Math.imul(w,z)|0,i=i+Math.imul(w,H)|0,i=i+Math.imul(_,z)|0,s=s+Math.imul(_,H)|0,n=n+Math.imul(m,$)|0,i=i+Math.imul(m,W)|0,i=i+Math.imul(b,$)|0,s=s+Math.imul(b,W)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,J)|0,i=i+Math.imul(y,Q)|0,s=s+Math.imul(y,J)|0,n=n+Math.imul(h,Z)|0,i=i+Math.imul(h,ee)|0,i=i+Math.imul(f,Z)|0,s=s+Math.imul(f,ee)|0;var we=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(A,F),i=Math.imul(A,V),i=i+Math.imul(I,F)|0,s=Math.imul(I,V),n=n+Math.imul(S,z)|0,i=i+Math.imul(S,H)|0,i=i+Math.imul(k,z)|0,s=s+Math.imul(k,H)|0,n=n+Math.imul(w,$)|0,i=i+Math.imul(w,W)|0,i=i+Math.imul(_,$)|0,s=s+Math.imul(_,W)|0,n=n+Math.imul(m,Q)|0,i=i+Math.imul(m,J)|0,i=i+Math.imul(b,Q)|0,s=s+Math.imul(b,J)|0,n=n+Math.imul(p,Z)|0,i=i+Math.imul(p,ee)|0,i=i+Math.imul(y,Z)|0,s=s+Math.imul(y,ee)|0,n=n+Math.imul(h,re)|0,i=i+Math.imul(h,ne)|0,i=i+Math.imul(f,re)|0,s=s+Math.imul(f,ne)|0;var _e=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(x,F),i=Math.imul(x,V),i=i+Math.imul(B,F)|0,s=Math.imul(B,V),n=n+Math.imul(A,z)|0,i=i+Math.imul(A,H)|0,i=i+Math.imul(I,z)|0,s=s+Math.imul(I,H)|0,n=n+Math.imul(S,$)|0,i=i+Math.imul(S,W)|0,i=i+Math.imul(k,$)|0,s=s+Math.imul(k,W)|0,n=n+Math.imul(w,Q)|0,i=i+Math.imul(w,J)|0,i=i+Math.imul(_,Q)|0,s=s+Math.imul(_,J)|0,n=n+Math.imul(m,Z)|0,i=i+Math.imul(m,ee)|0,i=i+Math.imul(b,Z)|0,s=s+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=i+Math.imul(p,ne)|0,i=i+Math.imul(y,re)|0,s=s+Math.imul(y,ne)|0,n=n+Math.imul(h,se)|0,i=i+Math.imul(h,oe)|0,i=i+Math.imul(f,se)|0,s=s+Math.imul(f,oe)|0;var Ee=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(N,F),i=Math.imul(N,V),i=i+Math.imul(O,F)|0,s=Math.imul(O,V),n=n+Math.imul(x,z)|0,i=i+Math.imul(x,H)|0,i=i+Math.imul(B,z)|0,s=s+Math.imul(B,H)|0,n=n+Math.imul(A,$)|0,i=i+Math.imul(A,W)|0,i=i+Math.imul(I,$)|0,s=s+Math.imul(I,W)|0,n=n+Math.imul(S,Q)|0,i=i+Math.imul(S,J)|0,i=i+Math.imul(k,Q)|0,s=s+Math.imul(k,J)|0,n=n+Math.imul(w,Z)|0,i=i+Math.imul(w,ee)|0,i=i+Math.imul(_,Z)|0,s=s+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=i+Math.imul(m,ne)|0,i=i+Math.imul(b,re)|0,s=s+Math.imul(b,ne)|0,n=n+Math.imul(p,se)|0,i=i+Math.imul(p,oe)|0,i=i+Math.imul(y,se)|0,s=s+Math.imul(y,oe)|0,n=n+Math.imul(h,ce)|0,i=i+Math.imul(h,ue)|0,i=i+Math.imul(f,ce)|0,s=s+Math.imul(f,ue)|0;var Se=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(D,F),i=Math.imul(D,V),i=i+Math.imul(L,F)|0,s=Math.imul(L,V),n=n+Math.imul(N,z)|0,i=i+Math.imul(N,H)|0,i=i+Math.imul(O,z)|0,s=s+Math.imul(O,H)|0,n=n+Math.imul(x,$)|0,i=i+Math.imul(x,W)|0,i=i+Math.imul(B,$)|0,s=s+Math.imul(B,W)|0,n=n+Math.imul(A,Q)|0,i=i+Math.imul(A,J)|0,i=i+Math.imul(I,Q)|0,s=s+Math.imul(I,J)|0,n=n+Math.imul(S,Z)|0,i=i+Math.imul(S,ee)|0,i=i+Math.imul(k,Z)|0,s=s+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,i=i+Math.imul(w,ne)|0,i=i+Math.imul(_,re)|0,s=s+Math.imul(_,ne)|0,n=n+Math.imul(m,se)|0,i=i+Math.imul(m,oe)|0,i=i+Math.imul(b,se)|0,s=s+Math.imul(b,oe)|0,n=n+Math.imul(p,ce)|0,i=i+Math.imul(p,ue)|0,i=i+Math.imul(y,ce)|0,s=s+Math.imul(y,ue)|0,n=n+Math.imul(h,he)|0,i=i+Math.imul(h,fe)|0,i=i+Math.imul(f,he)|0,s=s+Math.imul(f,fe)|0;var ke=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,F),i=Math.imul(U,V),i=i+Math.imul(j,F)|0,s=Math.imul(j,V),n=n+Math.imul(D,z)|0,i=i+Math.imul(D,H)|0,i=i+Math.imul(L,z)|0,s=s+Math.imul(L,H)|0,n=n+Math.imul(N,$)|0,i=i+Math.imul(N,W)|0,i=i+Math.imul(O,$)|0,s=s+Math.imul(O,W)|0,n=n+Math.imul(x,Q)|0,i=i+Math.imul(x,J)|0,i=i+Math.imul(B,Q)|0,s=s+Math.imul(B,J)|0,n=n+Math.imul(A,Z)|0,i=i+Math.imul(A,ee)|0,i=i+Math.imul(I,Z)|0,s=s+Math.imul(I,ee)|0,n=n+Math.imul(S,re)|0,i=i+Math.imul(S,ne)|0,i=i+Math.imul(k,re)|0,s=s+Math.imul(k,ne)|0,n=n+Math.imul(w,se)|0,i=i+Math.imul(w,oe)|0,i=i+Math.imul(_,se)|0,s=s+Math.imul(_,oe)|0,n=n+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0,i=i+Math.imul(b,ce)|0,s=s+Math.imul(b,ue)|0,n=n+Math.imul(p,he)|0,i=i+Math.imul(p,fe)|0,i=i+Math.imul(y,he)|0,s=s+Math.imul(y,fe)|0,n=n+Math.imul(h,pe)|0,i=i+Math.imul(h,ye)|0,i=i+Math.imul(f,pe)|0,s=s+Math.imul(f,ye)|0;var Ce=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,z),i=Math.imul(U,H),i=i+Math.imul(j,z)|0,s=Math.imul(j,H),n=n+Math.imul(D,$)|0,i=i+Math.imul(D,W)|0,i=i+Math.imul(L,$)|0,s=s+Math.imul(L,W)|0,n=n+Math.imul(N,Q)|0,i=i+Math.imul(N,J)|0,i=i+Math.imul(O,Q)|0,s=s+Math.imul(O,J)|0,n=n+Math.imul(x,Z)|0,i=i+Math.imul(x,ee)|0,i=i+Math.imul(B,Z)|0,s=s+Math.imul(B,ee)|0,n=n+Math.imul(A,re)|0,i=i+Math.imul(A,ne)|0,i=i+Math.imul(I,re)|0,s=s+Math.imul(I,ne)|0,n=n+Math.imul(S,se)|0,i=i+Math.imul(S,oe)|0,i=i+Math.imul(k,se)|0,s=s+Math.imul(k,oe)|0,n=n+Math.imul(w,ce)|0,i=i+Math.imul(w,ue)|0,i=i+Math.imul(_,ce)|0,s=s+Math.imul(_,ue)|0,n=n+Math.imul(m,he)|0,i=i+Math.imul(m,fe)|0,i=i+Math.imul(b,he)|0,s=s+Math.imul(b,fe)|0,n=n+Math.imul(p,pe)|0,i=i+Math.imul(p,ye)|0,i=i+Math.imul(y,pe)|0,s=s+Math.imul(y,ye)|0;var Ae=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,$),i=Math.imul(U,W),i=i+Math.imul(j,$)|0,s=Math.imul(j,W),n=n+Math.imul(D,Q)|0,i=i+Math.imul(D,J)|0,i=i+Math.imul(L,Q)|0,s=s+Math.imul(L,J)|0,n=n+Math.imul(N,Z)|0,i=i+Math.imul(N,ee)|0,i=i+Math.imul(O,Z)|0,s=s+Math.imul(O,ee)|0,n=n+Math.imul(x,re)|0,i=i+Math.imul(x,ne)|0,i=i+Math.imul(B,re)|0,s=s+Math.imul(B,ne)|0,n=n+Math.imul(A,se)|0,i=i+Math.imul(A,oe)|0,i=i+Math.imul(I,se)|0,s=s+Math.imul(I,oe)|0,n=n+Math.imul(S,ce)|0,i=i+Math.imul(S,ue)|0,i=i+Math.imul(k,ce)|0,s=s+Math.imul(k,ue)|0,n=n+Math.imul(w,he)|0,i=i+Math.imul(w,fe)|0,i=i+Math.imul(_,he)|0,s=s+Math.imul(_,fe)|0,n=n+Math.imul(m,pe)|0,i=i+Math.imul(m,ye)|0,i=i+Math.imul(b,pe)|0,s=s+Math.imul(b,ye)|0;var Ie=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Q),i=Math.imul(U,J),i=i+Math.imul(j,Q)|0,s=Math.imul(j,J),n=n+Math.imul(D,Z)|0,i=i+Math.imul(D,ee)|0,i=i+Math.imul(L,Z)|0,s=s+Math.imul(L,ee)|0,n=n+Math.imul(N,re)|0,i=i+Math.imul(N,ne)|0,i=i+Math.imul(O,re)|0,s=s+Math.imul(O,ne)|0,n=n+Math.imul(x,se)|0,i=i+Math.imul(x,oe)|0,i=i+Math.imul(B,se)|0,s=s+Math.imul(B,oe)|0,n=n+Math.imul(A,ce)|0,i=i+Math.imul(A,ue)|0,i=i+Math.imul(I,ce)|0,s=s+Math.imul(I,ue)|0,n=n+Math.imul(S,he)|0,i=i+Math.imul(S,fe)|0,i=i+Math.imul(k,he)|0,s=s+Math.imul(k,fe)|0,n=n+Math.imul(w,pe)|0,i=i+Math.imul(w,ye)|0,i=i+Math.imul(_,pe)|0,s=s+Math.imul(_,ye)|0;var Te=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,Z),i=Math.imul(U,ee),i=i+Math.imul(j,Z)|0,s=Math.imul(j,ee),n=n+Math.imul(D,re)|0,i=i+Math.imul(D,ne)|0,i=i+Math.imul(L,re)|0,s=s+Math.imul(L,ne)|0,n=n+Math.imul(N,se)|0,i=i+Math.imul(N,oe)|0,i=i+Math.imul(O,se)|0,s=s+Math.imul(O,oe)|0,n=n+Math.imul(x,ce)|0,i=i+Math.imul(x,ue)|0,i=i+Math.imul(B,ce)|0,s=s+Math.imul(B,ue)|0,n=n+Math.imul(A,he)|0,i=i+Math.imul(A,fe)|0,i=i+Math.imul(I,he)|0,s=s+Math.imul(I,fe)|0,n=n+Math.imul(S,pe)|0,i=i+Math.imul(S,ye)|0,i=i+Math.imul(k,pe)|0,s=s+Math.imul(k,ye)|0;var xe=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,re),i=Math.imul(U,ne),i=i+Math.imul(j,re)|0,s=Math.imul(j,ne),n=n+Math.imul(D,se)|0,i=i+Math.imul(D,oe)|0,i=i+Math.imul(L,se)|0,s=s+Math.imul(L,oe)|0,n=n+Math.imul(N,ce)|0,i=i+Math.imul(N,ue)|0,i=i+Math.imul(O,ce)|0,s=s+Math.imul(O,ue)|0,n=n+Math.imul(x,he)|0,i=i+Math.imul(x,fe)|0,i=i+Math.imul(B,he)|0,s=s+Math.imul(B,fe)|0,n=n+Math.imul(A,pe)|0,i=i+Math.imul(A,ye)|0,i=i+Math.imul(I,pe)|0,s=s+Math.imul(I,ye)|0;var Be=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,se),i=Math.imul(U,oe),i=i+Math.imul(j,se)|0,s=Math.imul(j,oe),n=n+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,i=i+Math.imul(L,ce)|0,s=s+Math.imul(L,ue)|0,n=n+Math.imul(N,he)|0,i=i+Math.imul(N,fe)|0,i=i+Math.imul(O,he)|0,s=s+Math.imul(O,fe)|0,n=n+Math.imul(x,pe)|0,i=i+Math.imul(x,ye)|0,i=i+Math.imul(B,pe)|0,s=s+Math.imul(B,ye)|0;var Re=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,ce),i=Math.imul(U,ue),i=i+Math.imul(j,ce)|0,s=Math.imul(j,ue),n=n+Math.imul(D,he)|0,i=i+Math.imul(D,fe)|0,i=i+Math.imul(L,he)|0,s=s+Math.imul(L,fe)|0,n=n+Math.imul(N,pe)|0,i=i+Math.imul(N,ye)|0,i=i+Math.imul(O,pe)|0,s=s+Math.imul(O,ye)|0;var Ne=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(U,he),i=Math.imul(U,fe),i=i+Math.imul(j,he)|0,s=Math.imul(j,fe),n=n+Math.imul(D,pe)|0,i=i+Math.imul(D,ye)|0,i=i+Math.imul(L,pe)|0,s=s+Math.imul(L,ye)|0;var Oe=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,pe),i=Math.imul(U,ye),i=i+Math.imul(j,pe)|0,s=Math.imul(j,ye);var Pe=(u+n|0)+((8191&i)<<13)|0;return u=(s+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,c[0]=ge,c[1]=me,c[2]=be,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Ee,c[7]=Se,c[8]=ke,c[9]=Ce,c[10]=Ae,c[11]=Ie,c[12]=Te,c[13]=xe,c[14]=Be,c[15]=Re,c[16]=Ne,c[17]=Oe,c[18]=Pe,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s>>26)|0,i+=o>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r.strip()}function g(e,t,r){var n=new m;return n.mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=d),s.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):n<63?d(this,e,t):n<1024?y(this,e,t):g(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o>=26,t+=i/67108864|0,t+=s>>>26,this.words[r]=67108863&s}return 0!==t&&(this.words[r]=t,this.length++),this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=f(e);if(0===t.length)return new s(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==l||u>=i);u--){var h=0|this.words[u];this.words[u]=l<<26-s|h>>>s,l=h&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){n("number"===typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(n("number"===typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+r]=67108863&s}for(;i>26,this.words[i+r]=67108863&s;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(e,t){var r=this.length-e.length,n=this.clone(),i=e,o=0|i.words[i.length-1],a=this._countBits(o);r=26-a,0!==r&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var c,u=n.length-i.length;if("mod"!==t){c=new s(null),c.length=u+1,c.words=new Array(c.length);for(var l=0;l=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);d=Math.min(d/o|0,67108863),n._ishlnsubmul(i,d,f);while(0!==n.negative)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);c&&(c.words[f]=d)}return c&&c.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:c||null,mod:n}},s.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},s.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();var i=new s(1),o=new s(0),a=new s(0),c=new s(1),u=0;while(t.isEven()&&r.isEven())t.iushrn(1),r.iushrn(1),++u;var l=r.clone(),h=t.clone();while(!t.isZero()){for(var f=0,d=1;0===(t.words[0]&d)&&f<26;++f,d<<=1);if(f>0){t.iushrn(f);while(f-- >0)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(h)),i.iushrn(1),o.iushrn(1)}for(var p=0,y=1;0===(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0){r.iushrn(p);while(p-- >0)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(h)),a.iushrn(1),c.iushrn(1)}t.cmp(r)>=0?(t.isub(r),i.isub(a),o.isub(c)):(r.isub(t),a.isub(i),c.isub(o))}return{a:a,b:c,gcd:r.iushln(u)}},s.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();var i,o=new s(1),a=new s(0),c=r.clone();while(t.cmpn(1)>0&&r.cmpn(1)>0){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0){t.iushrn(u);while(u-- >0)o.isOdd()&&o.iadd(c),o.iushrn(1)}for(var h=0,f=1;0===(r.words[0]&f)&&h<26;++h,f<<=1);if(h>0){r.iushrn(h);while(h-- >0)a.isOdd()&&a.iadd(c),a.iushrn(1)}t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return i=0===t.cmpn(1)?o:a,i.cmpn(0)<0&&i.iadd(e),i},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);do{while(t.isEven())t.iushrn(1);while(r.isEven())r.iushrn(1);var i=t.cmp(r);if(i<0){var s=t;t=r,r=s}else if(0===i||0===r.cmpn(1))break;t.isub(r)}while(1);return r.iushln(n)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return 0===(1&this.words[0])},s.prototype.isOdd=function(){return 1===(1&this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){n("number"===typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new k(e)},s.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"===typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),t=r.bitLength()}while(t>this.n);var n=t0?r.isub(this.p):r.strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},i(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,s=o}s>>>=22,e.words[i-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return b[e]=t,t},k.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2===1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}var i=this.m.subn(1),o=0;while(!i.isZero()&&0===i.andln(1))o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();l=new s(2*l*l).toRed(this);while(0!==this.pow(l,u).cmp(c))l.redIAdd(c);var h=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=o;while(0!==d.cmp(a)){for(var y=d,g=0;0!==y.cmp(a);g++)y=y.redSqr();n(g=0;i--){for(var l=t.words[i],h=u-1;h>=0;h--){var f=l>>h&1;o!==n[0]&&(o=this.sqr(o)),0!==f||0!==a?(a<<=1,a|=f,c++,(c===r||0===i&&0===h)&&(o=this.mul(o,n[a]),c=0,a=0)):c=0}u=26}return o},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new C(e)},i(C,k),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},C.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})(e,this)}).call(this,r("62e4")(e))},"6e64":function(e,t,r){"use strict";const n=r("6429"),i=r("3e4c"),s=r("3580"),o=r("086c"),a=r("c2c9"),c=r("7178");t.KeytransformDatastore=n,t.ShardingDatastore=i,t.MountDatastore=s,t.TieredDatastore=o,t.NamespaceDatastore=a,t.shard=c},"6e6a":function(e,t,r){"use strict";const{filter:n,sortAll:i,take:s,map:o}=r("545b"),a=r("42b7"),c=r("fed0");class u{constructor(){this.data={}}async open(){}async put(e,t){this.data[e.toString()]=t}async get(e){const t=await this.has(e);if(!t)throw c.notFoundError();return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}batch(){let e=[],t=[];return{put(t,r){e.push([t,r])},delete(e){t.push(e)},commit:async()=>{e.forEach(e=>{this.data[e[0].toString()]=e[1]}),e=[],t.forEach(e=>{delete this.data[e.toString()]}),t=[]}}}query(e){let t=Object.entries(this.data);if(t=o(t,e=>({key:new a(e[0]),value:e[1]})),null!=e.prefix&&(t=n(t,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(t=e.filters.reduce((e,t)=>n(e,t),t)),Array.isArray(e.orders)&&(t=e.orders.reduce((e,t)=>i(e,t),t)),null!=e.offset){let r=0;t=n(t,()=>r++>=e.offset)}return null!=e.limit&&(t=s(t,e.limit)),!0===e.keysOnly&&(t=o(t,e=>({key:e.key}))),t}async close(){}}e.exports=u},"6ecd":function(e,t,r){const n=r("d177"),i=r("8707").Buffer,s=r("9440").default,o="legacy-ipfs-3box",a=async e=>{const t=await s(e);return t.publicKey.find(e=>{const r=e.id.split("#");return r[0]===t.id&&("subSigningKey"===r[1]||"signingKey"===r[1])}).publicKeyHex};class c{constructor(e,t){this._ipfs=e,this._write=Array.from(t.write||[])}static get type(){return o}get write(){return this._write}async canAppend(e,t){const r=0===e.v?e.key:await a(e.identity.id);return!(!this.write.includes(r)&&!this.write.includes("*"))&&(0===e.v||await t.verifyIdentity(e.identity))}async load(e){0===e.indexOf("/ipfs")&&(e=e.split("/")[2]);try{const t=await n.read(this._ipfs,e);this._write=t.write}catch(t){console.log("LegacyIPFS3BoxAccessController.load ERROR:",t)}}async save(e){let t;const r={admin:[],write:this.write,read:[]};try{t=await n.write(this._ipfs,"raw",i.from(JSON.stringify(r,null,2)),{format:"dag-pb"})}catch(s){console.log("LegacyIPFS3BoxAccessController.save ERROR:",s)}return{address:t,skipManifest:!0}}static async create(e,t={}){return t={...t,write:t.write||[e.identity.publicKey]},new c(e._ipfs,t)}}e.exports=c},"6f12":function(e,t,r){"use strict";const n=async e=>{const t=[];for await(const r of e)t.push(r);return t};e.exports=n},"6f2b":function(e,t,r){"use strict";const n=r("83fd").utils,i=n.map;class s{constructor(e,t){this.child=e,this.transform=t}open(){return this.child.open()}put(e,t){return this.child.put(this.transform.convert(e),t)}get(e){return this.child.get(this.transform.convert(e))}has(e){return this.child.has(this.transform.convert(e))}delete(e){return this.child.delete(this.transform.convert(e))}batch(){const e=this.child.batch();return{put:(t,r)=>{e.put(this.transform.convert(t),r)},delete:t=>{e.delete(this.transform.convert(t))},commit:()=>e.commit()}}query(e){return i(this.child.query(e),e=>(e.key=this.transform.invert(e.key),e))}close(){return this.child.close()}}e.exports=s},"6f32":function(e,t,r){"use strict";const n=r("4ed1"),i=r("5b398");class s{constructor(e){this.gossipsub=e}start(e){if(this._heartbeatTimer){const t="Heartbeat timer is already running";return this.gossipsub.log(t),e(i(new Error(t),"ERR_HEARTBEAT_ALREADY_RUNNING"))}const t={_onCancel:null,_timeoutId:null,runPeriodically:(e,r)=>{t._timeoutId=setInterval(e,r)},cancel:e=>{clearTimeout(t._timeoutId),e()}},r=this._heartbeat.bind(this);setTimeout(()=>{r(),t.runPeriodically(r,n.GossipSubHeartbeatInterval)},n.GossipSubHeartbeatInitialDelay),this._heartbeatTimer=t,e()}stop(e){if(!this._heartbeatTimer){const t="Heartbeat timer is not running";return this.gossipsub.log(t),e(i(new Error(t),"ERR_HEARTBEAT_NO_RUNNING"))}this._heartbeatTimer.cancel(()=>{this._heartbeatTimer=null,e()})}_heartbeat(){this.gossipsub._flush();const e=new Map,t=new Map;this.gossipsub.mesh.forEach((r,i)=>{if(r.size{if(r.has(t))return;this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",t.info.id.toB58String(),i),r.add(t);const n=e.get(t);n?n.push(i):e.set(t,[i])})}if(r.size>n.GossipSubDhi){const e=r.size-n.GossipSubD;let s=Array.from(r);s=this.gossipsub._shufflePeers(s),s=s.slice(0,e),s.forEach(e=>{this.gossipsub.log("HEARTBEAT: Remove mesh link to %s in %s",e.info.id.toB58String(),i),r.delete(e);const n=t.get(e);n?n.push(i):t.set(e,[i])})}this.gossipsub._emitGossip(i,r)});const r=this.gossipsub._now();this.gossipsub.lastpub.forEach((e,t)=>{e+n.GossipSubFanoutTTL{if(e.forEach(t=>{this.gossipsub.topics.has(t)&&e.delete(t)}),e.size{e.has(t)&&e.add(t)})}this.gossipsub._emitGossip(t,e)}),this.gossipsub._sendGraftPrune(e,t),this.gossipsub.messageCache.shift(),this.gossipsub.emit("gossipsub:heartbeat")}}e.exports=s},"6f55":function(e,t){function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=r},"6f5a":function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r("bbf9"),i=r.n(n),s=r("549e");function o(e){return"0x"+i.a.keccak_256(Object(s["arrayify"])(e))}},"6f71":function(e,t,r){"use strict";const n=r("c368"),i=r("2e81"),s=r("5e27"),o=r("4547");t.Key=n,t.MemoryDatastore=i,t.utils=s,t.Errors=o},"6f76":function(e,t,r){"use strict";(function(t){ +/*! + * @description Recursive object extending + * @author Viacheslav Lotsmanov + * @license MIT + * + * The MIT License (MIT) + * + * Copyright (c) 2013-2018 Viacheslav Lotsmanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +function r(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function n(e){if(e instanceof t){var r=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(r),r}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function i(e){var t=[];return e.forEach((function(e,s){"object"===typeof e&&null!==e?Array.isArray(e)?t[s]=i(e):r(e)?t[s]=n(e):t[s]=o({},e):t[s]=e})),t}function s(e,t){return"__proto__"===t?void 0:e[t]}var o=e.exports=function(){if(arguments.length<1||"object"!==typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e,t,a=arguments[0],c=Array.prototype.slice.call(arguments,1);return c.forEach((function(c){"object"!==typeof c||null===c||Array.isArray(c)||Object.keys(c).forEach((function(u){return t=s(a,u),e=s(c,u),e===a?void 0:"object"!==typeof e||null===e?void(a[u]=e):Array.isArray(e)?void(a[u]=i(e)):r(e)?void(a[u]=n(e)):"object"!==typeof t||null===t||Array.isArray(t)?void(a[u]=o({},e)):void(a[u]=o(t,e))}))})),a}}).call(this,r("b639").Buffer)},"6fee":function(e,t,r){"use strict";function n(e,t){return function(r,n,i){return e(r,t,n,i)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t["default"]},7:function(e,t){},7028:function(e){e.exports=JSON.parse('{"identity":0,"ip4":4,"tcp":6,"sha1":17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"dccp":33,"murmur3-128":34,"murmur3-32":35,"ip6":41,"ip6zone":42,"path":47,"multicodec":48,"multihash":49,"multiaddr":50,"multibase":51,"dns":53,"dns4":54,"dns6":55,"dnsaddr":56,"protobuf":80,"cbor":81,"raw":85,"dbl-sha2-256":86,"rlp":96,"bencode":99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,"sctp":132,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,"md4":212,"md5":213,"bmt":214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,"zeronet":230,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,"udp":273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,"udt":301,"utp":302,"unix":400,"p2p":421,"ipfs":421,"https":443,"onion":444,"onion3":445,"garlic64":446,"garlic32":447,"tls":448,"quic":460,"ws":477,"wss":478,"p2p-websocket-star":479,"http":480,"json":512,"messagepack":513,"x11":4352,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46000,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332}')},7037:function(e,t,r){function n(t){return"function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}r("a4d3"),r("e01a"),r("d28b"),r("e260"),r("d3b7"),r("3ca3"),r("ddb0"),e.exports=n},7048:function(e,t,r){"use strict";function n(e,t,r){var n;if(!(e instanceof Error))throw new TypeError("Please pass an Error to err-code");if("object"===typeof t?r=t:null!=t&&(e.code=t),r)for(n in r)e[n]=r[n];return e}e.exports=n},7066:function(e,t,r){e.exports=r("708a")},"708a":function(e,t,r){"use strict";(function(t){const n=r("e0b9"),i=r("cc26"),s=r("aea9"),o=s.create("pubsub",{color:s.Colors.Yellow});s.setLogLevel("ERROR");const a=256;let c=0;class u{constructor(e,t){this._ipfs=e,this._id=t,this._subscriptions={},null===this._ipfs.pubsub&&o.error("The provided version of ipfs doesn't have pubsub support. Messages will not be exchanged."),this._handleMessage=this._handleMessage.bind(this),this._ipfs.setMaxListeners&&this._ipfs.setMaxListeners(a)}async subscribe(e,t,r){if(!this._subscriptions[e]&&this._ipfs.pubsub){await this._ipfs.pubsub.subscribe(e,this._handleMessage);const n=new i(this._ipfs.pubsub,e);n.on("join",t=>{o.debug(`Peer joined ${e}:`),o.debug(t),this._subscriptions[e]?r(e,t):(o.warn("Peer joined a room we don't have a subscription for"),o.warn(e,t))}),n.on("leave",t=>o.debug(`Peer ${t} left ${e}`)),n.on("error",e=>o.error(e)),this._subscriptions[e]={topicMonitor:n,onMessage:t,onNewPeer:r},c++,o.debug("Topics open:",c)}}async unsubscribe(e){this._subscriptions[e]&&(await this._ipfs.pubsub.unsubscribe(e,this._handleMessage),this._subscriptions[e].topicMonitor.stop(),delete this._subscriptions[e],o.debug(`Unsubscribed from '${e}'`),c--,o.debug("Topics open:",c))}publish(e,r){this._subscriptions[e]&&this._ipfs.pubsub&&this._ipfs.pubsub.publish(e,t.from(JSON.stringify(r)))}async disconnect(){const e=Object.keys(this._subscriptions);await n(e.map(e=>this.unsubscribe.bind(this,e))),this._subscriptions={}}async _handleMessage(e){if(e.from===this._id)return;let t,r,n;try{n=e.topicIDs[0],t=JSON.parse(e.data),r=this._subscriptions[n]}catch(i){o.error(i),o.error("Couldn't parse pubsub message:",e)}r&&r.onMessage&&t&&await r.onMessage(n,t,e.from)}}e.exports=u}).call(this,r("b639").Buffer)},"708c":function(e,t,r){"use strict";e.exports=()=>({Addresses:{Swarm:[],API:"",Gateway:"",Delegates:[]},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"],Pubsub:{Enabled:!0},Swarm:{ConnMgr:{LowWater:200,HighWater:500}}})},"70c8":function(e,t,r){var n=r("918b");r("5ee0"),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(e,t){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{this._j0=[0,0,0,0];while(r.length()>0)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];while(t.length()>0)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=e[n]>>>4*(7-r%8)&15,s=this._m[r][i];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,s=new Array(i),o=0;o>>1,i=new Array(r);i[n]=e.slice(0);var s=n>>>1;while(s>0)this.pow(i[2*s],i[s]=[]),s>>=1;s=2;while(s{if("string"===typeof e&&(e=t.from(e)),!t.isBuffer(e))throw new Error("Passed 'data' is not a buffer or a string!");r=r.map(e=>c.isDAGLink(e)?e:c.util.createDagLinkFromB58EncodedHash(e)),r=n(r,o);const s=i({Data:e,Links:r});return new a(e,r,s.length)};e.exports=u}).call(this,r("b639").Buffer)},"70cf2":function(e,t,r){"use strict";const n=r("220c"),i=r("1652"),s=r("8281"),o=r("e5c1");t.Key=n,t.MemoryDatastore=i,t.utils=s,t.Errors=o},"70e3":function(e,t,r){var n=r("2f07"),i=r("eb12"),s=r("ed4b");function o(){return Object.keys(s)}t.createCipher=t.Cipher=n.createCipher,t.createCipheriv=t.Cipheriv=n.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=o},"70f8":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)};e.exports={fromNumberTo32BitBuf:i}},7107:function(e,t,r){"use strict";const n=r("1a18"),i=r("63e1"),s=r("e3d5"),o=r("09a4"),a=r("7048"),c=r("6f12"),{PinTypes:u}=r("22df");function l(e){if(s.isCID(e))return e;try{return new s(e)}catch(t){throw a(t,"ERR_INVALID_CID")}}e.exports=function(e){async function*t(t,r){r=r||{},Array.isArray(t)||(t=[t]);const n=await e._gcLock.writeLock();try{for(let n of t){n=l(n);const t={hash:n.toString()};try{const t=await e.pin.pinManager.isPinnedWithType(n,u.all);if(t.pinned){if(s.isCID(t.reason))throw a(new Error(`pinned via ${t.reason}`));throw a(new Error(`pinned: ${t.reason}`))}const r=await e._blockService._repo.blocks.has(n);if(!r)throw a(new Error("block not found"),"ERR_BLOCK_NOT_FOUND");await e._blockService.delete(n)}catch(i){r.force||(t.error=`cannot remove ${n}: ${i.message}`)}r.quiet||(yield t)}}finally{n()}}return{get:o.variadic(async(t,r)=>(r=r||{},t=l(t),!1!==r.preload&&e._preload(t),e._blockService.get(t))),put:o.variadic(async(t,r)=>{if(r=r||{},Array.isArray(t))throw new Error("Array is not supported");if(!n.isBlock(t))if(r.cid&&s.isCID(r.cid))t=new n(t,r.cid);else{const e=r.mhtype||"sha2-256",o=r.format||"dag-pb";let a;a=null==r.version?"sha2-256"===e&&"dag-pb"===o?0:1:r.version;const c=await i(t,e),u=new s(a,o,c);t=new n(t,u)}const o=await e._gcLock.readLock();try{return await e._blockService.put(t),!1!==r.preload&&e._preload(t.cid),t}finally{o()}}),rm:o.variadic(async(e,r)=>c(t(e,r))),_rmAsyncIterator:t,stat:o.variadic(async(t,r)=>{r=r||{},t=l(t),!1!==r.preload&&e._preload(t);const n=await e._blockService.get(t);return{key:t.toString(),size:n.data.length}})}}},7139:function(e,t,r){"use strict";const n=r("cd3f"),i=r("4f57")("hyperdiff"),s=r("a3b4"),o=e=>-1!==e;function a(){return{common:[],removed:[]}}function c(e,t,r){return r.every(r=>t[r]===e[r])}function u(e,t){return e.indexOf(t)}function l(e,t,r){return e.findIndex((function(e){return c(e,t,r)}))}function h(e,t){return{first:e,second:n(t)}}function f(e,t){return t?l:u}function d(e,t,r){const n=r?[].concat(r):[],{first:c,second:u}=h(e,t),l=f(n,r);i("preconditions first=%j second=%j findIndex=%s",c,u,l.name);const d=c.reduce((function(e,t,r){const a=l(u,t,n),c=o(a)?"common":"removed";return e[c].push(t),s(u,a),i("index=%s value=%s collection=%s",r,t,c),e}),a());return d.added=u,i("added=%j removed=%j common%j",d.added,d.removed,d.common),d}e.exports=d},"714a":function(e,t,r){"use strict";var n,i,s,o=[r("bba3"),r("06a1"),r("cd55"),r("856c"),r("e2a9")],a=-1,c=[],u=!1;function l(){n&&i&&(n=!1,i.length?c=i.concat(c):a=-1,c.length&&h())}function h(){if(!n){u=!1,n=!0;var e=c.length,t=setTimeout(l);while(e){i=c,c=[];while(i&&++a1)for(var r=1;r{const r=new n(e).child(new n(o)),i="function"===typeof t.getRaw?t.getRaw.bind(t):t.get.bind(t),s=await i(r);return h((s||"").toString().trim())},t.readme=i,t.parseShardFun=h,t.Prefix=c,t.Suffix=u,t.NextToLast=l},"71ad":function(e,t){function r(e,t){"function"===typeof e&&(t=e,e=!1);var r,n,i,s=[];function o(e,t){e&&(r=e,n&&l(r)),n=t,u()}function a(e){i=i||e||!0,u()}function c(e){i||(n?l(r,e):s.push(e))}return e?{push:c,end:a,source:o,buffer:s}:(o.push=c,o.end=a,o.buffer=s,o);function u(){n&&(r?l(r):!s.length&&i?l(i):s.length&&l(null,s.shift()))}function l(e,r){var i=n;if(e&&t){var s=t;t=null,s(!0===e?null:e)}n=null,i(e,r)}}e.exports=r},"71c7":function(e,t,r){var n=r("5995");r("31a0");var i=e.exports=n.pem=n.pem||{};function s(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(o=i);return t}function o(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},i+=s(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},i+=s(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=s(r)),e.headers)for(var o=0;on[e]}},"720b":function(e,t,r){"use strict";const n=r("faa1").EventEmitter;class i extends n{static async create(e,t){}static get type(){throw new Error("'static get type ()' needs to be defined in the inheriting class")}get type(){return this.constructor.type}get address(){}async canAppend(e,t){}async grant(e,t){return!1}async revoke(e,t){return!1}async load(e){}async save(){}async close(){}}e.exports=i},"722f":function(e,t,r){"use strict";e.exports=r("f12b")},7247:function(e,t,r){"use strict";(function(t){function r(e){return parseInt(e)===e}function n(e){if(!r(e.length))return!1;for(var t=0;t255)return!1;return!0}function i(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function s(e){return new Uint8Array(e)}function o(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var a=function(){function e(e){var t=[],r=0;e=encodeURI(e);while(r191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}return{toBytes:e,fromBytes:t}}(),c=function(){function e(e){for(var t=[],r=0;r>4]+t[15&i])}return r.join("")}return{toBytes:e,fromBytes:r}}(),u={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],h=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],f=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],d=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],y=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],m=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],b=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],v=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],E=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],S=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],k=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function C(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];var o,a=0,c=i;while(c>16&255]<<24^h[o>>8&255]<<16^h[255&o]<<8^h[o>>24&255]^l[a]<<24,a+=1,8!=i)for(t=1;t>8&255]<<8^h[o>>16&255]<<16^h[o>>24&255]<<24;for(t=i/2+1;t>2,d=c%4,this._Ke[f][d]=s[t],this._Kd[e-f][d]=s[t++],c++}for(var f=1;f>24&255]^E[o>>16&255]^S[o>>8&255]^k[255&o]},A.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=C(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o>24&255]^p[n[(i+1)%4]>>16&255]^y[n[(i+2)%4]>>8&255]^g[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var a,c=s(16);for(i=0;i<4;i++)a=this._Ke[t][i],c[4*i]=255&(h[n[i]>>24&255]^a>>24),c[4*i+1]=255&(h[n[(i+1)%4]>>16&255]^a>>16),c[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^a>>8),c[4*i+3]=255&(h[255&n[(i+3)%4]]^a);return c},A.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=C(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o>24&255]^b[n[(i+3)%4]>>16&255]^v[n[(i+2)%4]>>8&255]^w[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var a,c=s(16);for(i=0;i<4;i++)a=this._Kd[t][i],c[4*i]=255&(f[n[i]>>24&255]^a>>24),c[4*i+1]=255&(f[n[(i+3)%4]>>16&255]^a>>16),c[4*i+2]=255&(f[n[(i+2)%4]>>8&255]^a>>8),c[4*i+3]=255&(f[255&n[(i+1)%4]]^a);return c};var I=function(e){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new A(e)};I.prototype.encrypt=function(e){if(e=i(e),e.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=s(e.length),r=s(16),n=0;n=0;--t)this._counter[t]=e%256,e>>=8},R.prototype.setBytes=function(e){if(e=i(e,!0),16!=e.length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},R.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var N=function(e,t){if(!(this instanceof N))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof R||(t=new R(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new A(e)};function O(e){e=i(e,!0);var t=16-e.length%16,r=s(e.length+t);o(e,r);for(var n=e.length;n16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n0===e.length?"ERROR_EMPTY":(e.forEach(e=>{if(!e.dial)return"ERR_NOT_A_TRANSPORT"}),!0),protector:e=>!!e.protect||"ERR_NOT_A_PROTECTOR"}}),l=u({connEncryption:o(a([u("object|function")])),connProtector:u("undefined|protector"),contentRouting:o(a(["object"])),dht:o(u("null|function|object")),pubsub:o(u("null|function|object")),peerDiscovery:o(a([u("object|function")])),peerRouting:o(a(["object"])),streamMuxer:o(a([u("object|function")])),transport:"transport"}),h=u({peerDiscovery:"object?",relay:"object?",dht:"object?",pubsub:"object?"}),f=u({switch:"object?",connectionManager:"object?",datastore:"object?",peerInfo:"object",peerBook:"object?",modules:l,config:h});e.exports.validate=e=>{e=n(c,e);const[t,r]=f.validate(e);if(t)throw new Error(`${t.message}${t.reason?" - "+t.reason:""}`);return(r.config.dht.enabled&&u("function|object")(r.modules.dht),r)}},"727b":function(e,t,r){"use strict";const n=r("f294"),i=r("c4bf"),s=r("87dd"),o=r("f2b9");class a extends o{constructor({connection:e,_switch:t,transportKey:r,peerInfo:s}){super({_switch:t,name:`inc:${t._peerInfo.id.toB58String().slice(0,8)}`}),this.conn=e,this.theirPeerInfo=s||null,this.theirB58Id=this.theirPeerInfo?this.theirPeerInfo.id.toB58String():null,this.ourPeerInfo=this.switch._peerInfo,this.transportKey=r,this.protocolMuxer=this.switch.protocolMuxer(this.transportKey),this.msListener=new i.Listener,this._state=n("DIALED",{DISCONNECTED:{disconnect:"DISCONNECTED"},DIALED:{privatize:"PRIVATIZING",encrypt:"ENCRYPTING"},PRIVATIZING:{done:"PRIVATIZED",disconnect:"DISCONNECTING"},PRIVATIZED:{encrypt:"ENCRYPTING"},ENCRYPTING:{done:"ENCRYPTED",disconnect:"DISCONNECTING"},ENCRYPTED:{upgrade:"UPGRADING",disconnect:"DISCONNECTING"},UPGRADING:{done:"MUXED"},MUXED:{disconnect:"DISCONNECTING"},DISCONNECTING:{done:"DISCONNECTED"}}),this._state.on("DISCONNECTED",()=>this._onDisconnected()),this._state.on("PRIVATIZING",()=>this._onPrivatizing()),this._state.on("PRIVATIZED",()=>this._onPrivatized()),this._state.on("ENCRYPTING",()=>this._onEncrypting()),this._state.on("ENCRYPTED",()=>{this.log("successfully encrypted connection to %s",this.theirB58Id||"unknown peer"),this.emit("encrypted",this.conn)}),this._state.on("UPGRADING",()=>this._onUpgrading()),this._state.on("MUXED",()=>{this.log("successfully muxed connection to %s",this.theirB58Id||"unknown peer"),this.emit("muxed",this.conn)}),this._state.on("DISCONNECTING",()=>{this._state("done")})}_onEncrypting(){this.log("encrypting connection via %s",this.switch.crypto.tag),this.msListener.addHandler(this.switch.crypto.tag,(e,t)=>{this.conn=this.switch.crypto.encrypt(this.ourPeerInfo.id,t,void 0,e=>{if(e)return this.close(e);this.conn.getPeerInfo((e,t)=>{this.theirPeerInfo=t,this._state("done")})})},null),this.msListener.handle(this.conn,e=>{e&&this.emit("crypto handshaking failed",e)})}_onUpgrading(){this.log("adding the protocol muxer to the connection"),this.protocolMuxer(this.conn,this.msListener),this._state("done")}}e.exports=s(a,{className:"IncomingConnectionFSM",symbolName:"libp2p-switch/IncomingConnectionFSM"})},"72af":function(e,t,r){"use strict";(function(n){const i=r("33fc"),s=r("5e55"),o=r("d1ae"),a=r("0841"),c=r("4bc2");function u(){return(~~(1e9*Math.random())).toString(36)}function l(e,t){i(s(n.isBuffer(e)?[e]:[n.from(e)]),a.encode(),o((e,r)=>{if(e)return t(e);t(null,r[0])}))}function h(e){const t=u();function r(e){return r=>{Array.isArray(r)&&(r=r.join(" ")),e("(%s) %s",t,r)}}const n=r(c("mss:"+e));return n.error=r(c("mss:"+e+":error")),n}t=e.exports,t.writeEncoded=(e,t,r)=>{l(t,(t,n)=>{if(t)return r(t);e.write(n)})},t.log={},t.log.dialer=()=>h("dialer\t"),t.log.listener=()=>h("listener\t")}).call(this,r("b639").Buffer)},"72e8":function(e,t){function r(e){var t,r=e.length;while(r--){if(t=e.readUInt8(r),255!==t){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}e.exports=r},7328:function(e,t,r){"use strict";(function(t){const{Key:n,Errors:i,utils:s}=r("7b6d"),{filter:o,map:a,take:c,sortAll:u}=s;class l{constructor(e,t){let n;t&&t.db?(n=t.db,delete t.db):n=r("d508"),this.db=this._initDb(n,e,t)}_initDb(e,t,r){return e(t,{...r,valueEncoding:"binary",compression:!1})}async open(){try{await this.db.open()}catch(e){throw i.dbOpenFailedError(e)}}async put(e,t){try{await this.db.put(e.toString(),t)}catch(r){throw i.dbWriteFailedError(r)}}async get(e){let t;try{t=await this.db.get(e.toString())}catch(r){if(r.notFound)throw i.notFoundError(r);throw i.dbWriteFailedError(r)}return t}async has(e){try{await this.db.get(e.toString())}catch(t){if(t.notFound)return!1;throw t}return!0}async delete(e){try{await this.db.del(e.toString())}catch(t){throw i.dbDeleteFailedError(t)}}close(){return this.db.close()}batch(){const e=[];return{put:(t,r)=>{e.push({type:"put",key:t.toString(),value:r})},delete:t=>{e.push({type:"del",key:t.toString()})},commit:()=>this.db.batch(e)}}query(e){let r=!0;null!=e.keysOnly&&(r=!e.keysOnly);let i=h(this.db.db.iterator({keys:!0,values:r,keyAsBuffer:!0}));if(i=a(i,({key:e,value:i})=>{const s={key:new n(e,!1)};return r&&(s.value=t.from(i)),s}),null!=e.prefix&&(i=o(i,t=>t.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(i=e.filters.reduce((e,t)=>o(e,t),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((e,t)=>u(e,t),i)),null!=e.offset){let t=0;i=o(i,()=>t++>=e.offset)}return null!=e.limit&&(i=c(i,e.limit)),i}}function h(e){return{next:()=>new Promise((t,r)=>{e.next((e,n,i)=>e?r(e):null==n?t({done:!0}):void t({done:!1,value:{key:n,value:i}}))}),return:()=>new Promise((t,r)=>{e.end(e=>{if(e)return r(e);t({done:!0})})}),[Symbol.asyncIterator](){return this}}}e.exports=l}).call(this,r("b639").Buffer)},7397:function(e,t,r){"use strict";const n=r("19e5"),i=r("2e53");e.exports={encodeBase32:e=>{const t=n.encode("base32",e).slice(1);return t.toString().toUpperCase()},validator:{func:(e,t,r)=>i.validator.validate(t,e,r)},selector:(e,t)=>i.validator.select(t[0],t[1])}},"73b5":function(e,t){function r(e){var t,r,n=!1,i=!1;function s(){if(e)return e(n&&!0!==n?n:i&&!0!==i?i:null)}function o(e){s();var r=t;t=null,r&&r(n||i)}function a(){i=i||!0,o(n||i),r&&r(n,(function(e){t&&t(e||n)}))}function c(e){return r=e,function(r,o){if(t=o,r&&(n=r),i)return o(i);n||(!0,e(r,(function(o,a){if(!1,n)return!r&&e(n,(function(){}));if(t){var c=t;t=null,o?(i=n||o,s(),c(n||o)):c(n||o,a)}})))}}return c.abort=function(e){i||(n=e||!0,a())},c}e.exports=r},"73bb":function(e,t,r){var n=r("5995");if(r("c882"),r("80f7"),r("84f3"),r("b3d5"),r("ce05"),r("58af"),r("71c7"),r("8f53"),r("3a70"),r("88cb"),r("31a0"),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.asn1,o=n.pki=n.pki||{};e.exports=o.pbe=n.pbe=n.pbe||{};var a=o.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function f(e){var t;if(e){if(t=o.oids[s.derToOid(e)],!t){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return d(t)}function d(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function p(e,t,r,i){var a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.oids[i]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")])),a}o.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,u,l=n.random.getBytesSync(r.saltSize),h=r.count,f=s.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var y,g,m;switch(r.algorithm){case"aes128":i=16,y=16,g=a["aes128-CBC"],m=n.aes.createEncryptionCipher;break;case"aes192":i=24,y=16,g=a["aes192-CBC"],m=n.aes.createEncryptionCipher;break;case"aes256":i=32,y=16,g=a["aes256-CBC"],m=n.aes.createEncryptionCipher;break;case"des":i=8,y=8,g=a["desCBC"],m=n.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}var v="hmacWith"+r.prfAlgorithm.toUpperCase(),w=d(v),_=n.pkcs5.pbkdf2(t,l,h,i,w),E=n.random.getBytesSync(y),S=m(_);S.start(E),S.update(s.toDer(e)),S.finish(),u=S.output.getBytes();var k=p(l,f,i,v);c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pkcs5PBES2"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pkcs5PBKDF2"]).getBytes()),k]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(g).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,E)])])])}else{if("3des"!==r.algorithm){b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}i=24;var C=new n.util.ByteBuffer(l);_=o.pbe.generatePkcs12Key(t,C,1,h,i),E=o.pbe.generatePkcs12Key(t,C,2,h,i),S=n.des.createEncryptionCipher(_);S.start(E),S.update(s.toDer(e)),S.finish(),u=S.output.getBytes(),c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,l),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,f.getBytes())])])}var A=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[c,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,u)]);return A},o.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!s.validate(e,c,i,a)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var l=s.derToOid(i.encryptionOid),h=o.pbe.getCipher(l,i.encryptionParams,t),f=n.util.createBuffer(i.encryptedData);return h.update(f),h.finish()&&(r=s.fromDer(h.output)),r},o.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},o.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return s.fromDer(t.body)},o.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var i=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));return i=o.encryptPrivateKeyInfo(i,t,r),o.encryptedPrivateKeyToPem(i)}var a,c,u,l;switch(r.algorithm){case"aes128":a="AES-128-CBC",u=16,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,c=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,c=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var f=n.pbe.opensslDeriveBytes(t,c.substr(0,8),u),d=l(f);d.start(c),d.update(s.toDer(o.privateKeyToAsn1(e))),d.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(p)},o.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type){var a=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw a.headerType=a,a}if(i.procType&&"ENCRYPTED"===i.procType.type){var c,u;switch(i.dekInfo.algorithm){case"DES-CBC":c=8,u=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":c=24,u=n.des.createDecryptionCipher;break;case"AES-128-CBC":c=16,u=n.aes.createDecryptionCipher;break;case"AES-192-CBC":c=24,u=n.aes.createDecryptionCipher;break;case"AES-256-CBC":c=32,u=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":c=5,u=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":c=8,u=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":c=16,u=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:a=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw a.algorithm=i.dekInfo.algorithm,a}var l=n.util.hexToBytes(i.dekInfo.parameters),h=n.pbe.opensslDeriveBytes(t,l.substr(0,8),c),f=u(h);if(f.start(l),f.update(n.util.createBuffer(i.body)),!f.finish())return r;r=f.output.getBytes()}else r=i.body;return r="ENCRYPTED PRIVATE KEY"===i.type?o.decryptPrivateKeyInfo(s.fromDer(r),t):s.fromDer(r),null!==r&&(r=o.privateKeyFromAsn1(r)),r},o.pbe.generatePkcs12Key=function(e,t,r,i,s,o){var a,c;if("undefined"===typeof o||null===o){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');o=n.md.sha1.create()}var u=o.digestLength,l=o.blockLength,h=new n.util.ByteBuffer,f=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c=0;c--)x>>=8,x+=C.at(c)+T.at(c),T.setAt(c,255&x);I.putBuffer(T)}w=I,h.putBuffer(S)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids["pkcs5PBES2"]:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},o.pbe.getCipherForPBES2=function(e,t,r){var i={},a=[];if(!s.validate(t,u,i,a)){var c=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=a,c}if(e=s.derToOid(i.kdfOid),e!==o.oids["pkcs5PBKDF2"]){c=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw c.oid=e,c.supportedOids=["pkcs5PBKDF2"],c}if(e=s.derToOid(i.encOid),e!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.oids["desCBC"]){c=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw c.oid=e,c.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],c}var l,h,d=i.kdfSalt,p=n.util.createBuffer(i.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":l=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,h=n.des.createDecryptionCipher;break;case"desCBC":l=8,h=n.des.createDecryptionCipher;break}var y=f(i.prfOid),g=n.pkcs5.pbkdf2(r,d,p,l,y),m=i.encIv,b=h(g);return b.start(m),b},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!s.validate(t,l,i,a)){var c=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=a,c}var u,h,d,p=n.util.createBuffer(i.salt),y=n.util.createBuffer(i.iterations);switch(y=y.getInt(y.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,h=8,d=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,h=8,d=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:c=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw c.oid=e,c}var g=f(i.prfOid),m=o.pbe.generatePkcs12Key(r,p,1,y,u,g);g.start();var b=o.pbe.generatePkcs12Key(r,p,2,y,h,g);return d(m,b)},o.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;oasync r=>{const i=t.init(e,null);return t.update(i,r),n.from(t.digest(i))};e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}},"746f":function(e,t,r){var n=r("428f"),i=r("5135"),s=r("e538"),o=r("9bf2").f;e.exports=function(e){var t=n.Symbol||(n.Symbol={});i(t,e)||o(t,e,{value:s.f(e)})}},7483:function(e,t,r){"use strict";(function(t){const n=r("b62c"),i=r("1f47").encode,s=r("22ac"),o=r("65e3"),a=r("d58b"),c=r("c59f"),{getRequest:u}=r("ff6b"),l=r("014a"),h=r("e73e"),f=r("4bc2")("ipfs-http-client:request");function d(e){return e.headers["content-type"]&&0===e.headers["content-type"].indexOf("application/json")}function p(e,t){const r=new Error(`Server responded with ${e.statusCode}`);if(r.statusCode=e.statusCode,!d(e))return l(e,(e,n)=>{n&&n.length&&(r.message=n.toString()),t(r)});h(e,(e,n)=>{if(e)return t(e);n&&(r.code=n.Code,r.message=n.Message||n.toString(),r.type=n.Type),t(r)})}function y(e,t){return r=>{const n=Boolean(r.headers["x-stream-output"]),i=Boolean(r.headers["x-chunked-output"]),s=d(r);if(r.req?f(r.req.method,`${r.req.getHeaders().host}${r.req.path}`,r.statusCode,r.statusMessage):f(r.url,r.statusCode,r.statusMessage),r.statusCode>=400||!r.statusCode)return p(r,t);if(n&&!e)return t(null,r);if(i&&s){const e=o.parse();return a(r,e),r.on("end",()=>{let t=r.trailers["x-stream-error"];if(t){try{t=JSON.parse(t)}catch(n){t={Message:t}}e.emit("error",new Error(t.Message))}}),t(null,e)}return s?h(r,t):l(r,t)}}function g(e,r,o){o=c(o),r.qs=r.qs||{},Array.isArray(r.path)&&(r.path=r.path.join("/")),r.args&&!Array.isArray(r.args)&&(r.args=[r.args]),r.args&&(r.qs.arg=r.args),r.progress&&(r.qs.progress=!0),r.qs.r&&(r.qs.recursive=r.qs.r,delete r.qs.r),r.qs["stream-channels"]=!0,r.stream&&(r.buffer=!1),delete r.qs.followSymlinks;const a="POST",l=Object.assign({},e.headers);if(s&&(l["User-Agent"]=e["user-agent"]),r.multipart){if(!r.multipartBoundary)return o(new Error("No multipartBoundary"));l["Content-Type"]=`multipart/form-data; boundary=${r.multipartBoundary}`}const h=n.stringify(r.qs,{arrayFormat:"repeat",encoder:e=>{if(t.isBuffer(e)){let t="";for(const r of e)if(r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||45===r||46===r||95===r||126===r)t+=String.fromCharCode(r);else{const e=r.toString(16),n=1===e.length?`0${e}`:e;t+=`%${n}`}return t}return i(e)}}),f={hostname:e.host,path:`${e["api-path"]}${r.path}?${h}`,port:e.port,method:a,headers:l,protocol:`${e.protocol}:`},d=u(f,y(r.buffer,o));return d.on("error",e=>{o(e)}),r.stream||d.end(),d}e.exports=e=>{const t=(t,r)=>"object"!==typeof t?r(new Error("no options were passed")):g(e,t,r);return t.andTransform=(e,r,n)=>t(e,(e,t)=>{if(e)return n(e);r(t,n)}),t}}).call(this,r("b639").Buffer)},"748a":function(e,t,r){(function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function y(e,t,r,n,i){var s,o=0;for(s=0;s>>8)-1}function g(e,t,r,n){return y(e,t,r,n,16)}function m(e,t,r,n){return y(e,t,r,n,32)}function b(e,t,r,n){for(var i,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=s,E=o,S=a,k=c,C=u,A=l,I=h,T=f,x=d,B=p,R=y,N=g,O=m,P=b,D=v,L=w,M=0;M<20;M+=2)i=_+O|0,C^=i<<7|i>>>25,i=C+_|0,x^=i<<9|i>>>23,i=x+C|0,O^=i<<13|i>>>19,i=O+x|0,_^=i<<18|i>>>14,i=A+E|0,B^=i<<7|i>>>25,i=B+A|0,P^=i<<9|i>>>23,i=P+B|0,E^=i<<13|i>>>19,i=E+P|0,A^=i<<18|i>>>14,i=R+I|0,D^=i<<7|i>>>25,i=D+R|0,S^=i<<9|i>>>23,i=S+D|0,I^=i<<13|i>>>19,i=I+S|0,R^=i<<18|i>>>14,i=L+N|0,k^=i<<7|i>>>25,i=k+L|0,T^=i<<9|i>>>23,i=T+k|0,N^=i<<13|i>>>19,i=N+T|0,L^=i<<18|i>>>14,i=_+k|0,E^=i<<7|i>>>25,i=E+_|0,S^=i<<9|i>>>23,i=S+E|0,k^=i<<13|i>>>19,i=k+S|0,_^=i<<18|i>>>14,i=A+C|0,I^=i<<7|i>>>25,i=I+A|0,T^=i<<9|i>>>23,i=T+I|0,C^=i<<13|i>>>19,i=C+T|0,A^=i<<18|i>>>14,i=R+B|0,N^=i<<7|i>>>25,i=N+R|0,x^=i<<9|i>>>23,i=x+N|0,B^=i<<13|i>>>19,i=B+x|0,R^=i<<18|i>>>14,i=L+D|0,O^=i<<7|i>>>25,i=O+L|0,P^=i<<9|i>>>23,i=P+O|0,D^=i<<13|i>>>19,i=D+P|0,L^=i<<18|i>>>14;_=_+s|0,E=E+o|0,S=S+a|0,k=k+c|0,C=C+u|0,A=A+l|0,I=I+h|0,T=T+f|0,x=x+d|0,B=B+p|0,R=R+y|0,N=N+g|0,O=O+m|0,P=P+b|0,D=D+v|0,L=L+w|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=E>>>0&255,e[5]=E>>>8&255,e[6]=E>>>16&255,e[7]=E>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=C>>>0&255,e[17]=C>>>8&255,e[18]=C>>>16&255,e[19]=C>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255,e[32]=x>>>0&255,e[33]=x>>>8&255,e[34]=x>>>16&255,e[35]=x>>>24&255,e[36]=B>>>0&255,e[37]=B>>>8&255,e[38]=B>>>16&255,e[39]=B>>>24&255,e[40]=R>>>0&255,e[41]=R>>>8&255,e[42]=R>>>16&255,e[43]=R>>>24&255,e[44]=N>>>0&255,e[45]=N>>>8&255,e[46]=N>>>16&255,e[47]=N>>>24&255,e[48]=O>>>0&255,e[49]=O>>>8&255,e[50]=O>>>16&255,e[51]=O>>>24&255,e[52]=P>>>0&255,e[53]=P>>>8&255,e[54]=P>>>16&255,e[55]=P>>>24&255,e[56]=D>>>0&255,e[57]=D>>>8&255,e[58]=D>>>16&255,e[59]=D>>>24&255,e[60]=L>>>0&255,e[61]=L>>>8&255,e[62]=L>>>16&255,e[63]=L>>>24&255}function v(e,t,r,n){for(var i,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=s,E=o,S=a,k=c,C=u,A=l,I=h,T=f,x=d,B=p,R=y,N=g,O=m,P=b,D=v,L=w,M=0;M<20;M+=2)i=_+O|0,C^=i<<7|i>>>25,i=C+_|0,x^=i<<9|i>>>23,i=x+C|0,O^=i<<13|i>>>19,i=O+x|0,_^=i<<18|i>>>14,i=A+E|0,B^=i<<7|i>>>25,i=B+A|0,P^=i<<9|i>>>23,i=P+B|0,E^=i<<13|i>>>19,i=E+P|0,A^=i<<18|i>>>14,i=R+I|0,D^=i<<7|i>>>25,i=D+R|0,S^=i<<9|i>>>23,i=S+D|0,I^=i<<13|i>>>19,i=I+S|0,R^=i<<18|i>>>14,i=L+N|0,k^=i<<7|i>>>25,i=k+L|0,T^=i<<9|i>>>23,i=T+k|0,N^=i<<13|i>>>19,i=N+T|0,L^=i<<18|i>>>14,i=_+k|0,E^=i<<7|i>>>25,i=E+_|0,S^=i<<9|i>>>23,i=S+E|0,k^=i<<13|i>>>19,i=k+S|0,_^=i<<18|i>>>14,i=A+C|0,I^=i<<7|i>>>25,i=I+A|0,T^=i<<9|i>>>23,i=T+I|0,C^=i<<13|i>>>19,i=C+T|0,A^=i<<18|i>>>14,i=R+B|0,N^=i<<7|i>>>25,i=N+R|0,x^=i<<9|i>>>23,i=x+N|0,B^=i<<13|i>>>19,i=B+x|0,R^=i<<18|i>>>14,i=L+D|0,O^=i<<7|i>>>25,i=O+L|0,P^=i<<9|i>>>23,i=P+O|0,D^=i<<13|i>>>19,i=D+P|0,L^=i<<18|i>>>14;e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=R>>>0&255,e[9]=R>>>8&255,e[10]=R>>>16&255,e[11]=R>>>24&255,e[12]=L>>>0&255,e[13]=L>>>8&255,e[14]=L>>>16&255,e[15]=L>>>24&255,e[16]=I>>>0&255,e[17]=I>>>8&255,e[18]=I>>>16&255,e[19]=I>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=B>>>0&255,e[29]=B>>>8&255,e[30]=B>>>16&255,e[31]=B>>>24&255}function w(e,t,r,n){b(e,t,r,n)}function _(e,t,r,n){v(e,t,r,n)}var E=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,r,n,i,s,o){var a,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=s[c];while(i>=64){for(w(l,u,o,E),c=0;c<64;c++)e[t+c]=r[n+c]^l[c];for(a=1,c=8;c<16;c++)a=a+(255&u[c])|0,u[c]=255&a,a>>>=8;i-=64,t+=64,n+=64}if(i>0)for(w(l,u,o,E),c=0;c=64){for(w(c,a,i,E),o=0;o<64;o++)e[t+o]=c[o];for(s=1,o=8;o<16;o++)s=s+(255&a[o])|0,a[o]=255&s,s>>>=8;r-=64,t+=64}if(r>0)for(w(c,a,i,E),o=0;o>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),s=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|s<<12),this.r[5]=s>>>1&8190,o=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(s>>>14|o<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(o>>>11|a<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function T(e,t,r,n,i,s){var o=new I(s);return o.update(r,n,i),o.finish(e,t),0}function x(e,t,r,n,i,s){var o=new Uint8Array(16);return T(o,0,r,n,i,s),g(e,t,o,0)}function B(e,t,r,n,i){var s;if(r<32)return-1;for(A(e,0,t,0,r,n,i),T(e,16,e,32,r-32,e),s=0;s<16;s++)e[s]=0;return 0}function R(e,t,r,n,i){var s,o=new Uint8Array(32);if(r<32)return-1;if(C(o,0,32,n,i),0!==x(t,16,t,32,r-32,o))return-1;for(A(e,0,t,0,r,n,i),s=0;s<32;s++)e[s]=0;return 0}function N(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function P(e,t,r){for(var n,i=~(r-1),s=0;s<16;s++)n=i&(e[s]^t[s]),e[s]^=n,t[s]^=n}function D(e,r){var n,i,s,o=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(O(a),O(a),O(a),i=0;i<2;i++){for(o[0]=a[0]-65517,n=1;n<15;n++)o[n]=a[n]-65535-(o[n-1]>>16&1),o[n-1]&=65535;o[15]=a[15]-32767-(o[14]>>16&1),s=o[15]>>16&1,o[14]&=65535,P(a,o,1-s)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function L(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return D(r,e),D(n,t),m(r,0,n,0)}function M(e){var t=new Uint8Array(32);return D(t,e),1&t[0]}function U(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function j(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function K(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function F(e,t,r){var n,i,s=0,o=0,a=0,c=0,u=0,l=0,h=0,f=0,d=0,p=0,y=0,g=0,m=0,b=0,v=0,w=0,_=0,E=0,S=0,k=0,C=0,A=0,I=0,T=0,x=0,B=0,R=0,N=0,O=0,P=0,D=0,L=r[0],M=r[1],U=r[2],j=r[3],K=r[4],F=r[5],V=r[6],q=r[7],z=r[8],H=r[9],G=r[10],$=r[11],W=r[12],Y=r[13],Q=r[14],J=r[15];n=t[0],s+=n*L,o+=n*M,a+=n*U,c+=n*j,u+=n*K,l+=n*F,h+=n*V,f+=n*q,d+=n*z,p+=n*H,y+=n*G,g+=n*$,m+=n*W,b+=n*Y,v+=n*Q,w+=n*J,n=t[1],o+=n*L,a+=n*M,c+=n*U,u+=n*j,l+=n*K,h+=n*F,f+=n*V,d+=n*q,p+=n*z,y+=n*H,g+=n*G,m+=n*$,b+=n*W,v+=n*Y,w+=n*Q,_+=n*J,n=t[2],a+=n*L,c+=n*M,u+=n*U,l+=n*j,h+=n*K,f+=n*F,d+=n*V,p+=n*q,y+=n*z,g+=n*H,m+=n*G,b+=n*$,v+=n*W,w+=n*Y,_+=n*Q,E+=n*J,n=t[3],c+=n*L,u+=n*M,l+=n*U,h+=n*j,f+=n*K,d+=n*F,p+=n*V,y+=n*q,g+=n*z,m+=n*H,b+=n*G,v+=n*$,w+=n*W,_+=n*Y,E+=n*Q,S+=n*J,n=t[4],u+=n*L,l+=n*M,h+=n*U,f+=n*j,d+=n*K,p+=n*F,y+=n*V,g+=n*q,m+=n*z,b+=n*H,v+=n*G,w+=n*$,_+=n*W,E+=n*Y,S+=n*Q,k+=n*J,n=t[5],l+=n*L,h+=n*M,f+=n*U,d+=n*j,p+=n*K,y+=n*F,g+=n*V,m+=n*q,b+=n*z,v+=n*H,w+=n*G,_+=n*$,E+=n*W,S+=n*Y,k+=n*Q,C+=n*J,n=t[6],h+=n*L,f+=n*M,d+=n*U,p+=n*j,y+=n*K,g+=n*F,m+=n*V,b+=n*q,v+=n*z,w+=n*H,_+=n*G,E+=n*$,S+=n*W,k+=n*Y,C+=n*Q,A+=n*J,n=t[7],f+=n*L,d+=n*M,p+=n*U,y+=n*j,g+=n*K,m+=n*F,b+=n*V,v+=n*q,w+=n*z,_+=n*H,E+=n*G,S+=n*$,k+=n*W,C+=n*Y,A+=n*Q,I+=n*J,n=t[8],d+=n*L,p+=n*M,y+=n*U,g+=n*j,m+=n*K,b+=n*F,v+=n*V,w+=n*q,_+=n*z,E+=n*H,S+=n*G,k+=n*$,C+=n*W,A+=n*Y,I+=n*Q,T+=n*J,n=t[9],p+=n*L,y+=n*M,g+=n*U,m+=n*j,b+=n*K,v+=n*F,w+=n*V,_+=n*q,E+=n*z,S+=n*H,k+=n*G,C+=n*$,A+=n*W,I+=n*Y,T+=n*Q,x+=n*J,n=t[10],y+=n*L,g+=n*M,m+=n*U,b+=n*j,v+=n*K,w+=n*F,_+=n*V,E+=n*q,S+=n*z,k+=n*H,C+=n*G,A+=n*$,I+=n*W,T+=n*Y,x+=n*Q,B+=n*J,n=t[11],g+=n*L,m+=n*M,b+=n*U,v+=n*j,w+=n*K,_+=n*F,E+=n*V,S+=n*q,k+=n*z,C+=n*H,A+=n*G,I+=n*$,T+=n*W,x+=n*Y,B+=n*Q,R+=n*J,n=t[12],m+=n*L,b+=n*M,v+=n*U,w+=n*j,_+=n*K,E+=n*F,S+=n*V,k+=n*q,C+=n*z,A+=n*H,I+=n*G,T+=n*$,x+=n*W,B+=n*Y,R+=n*Q,N+=n*J,n=t[13],b+=n*L,v+=n*M,w+=n*U,_+=n*j,E+=n*K,S+=n*F,k+=n*V,C+=n*q,A+=n*z,I+=n*H,T+=n*G,x+=n*$,B+=n*W,R+=n*Y,N+=n*Q,O+=n*J,n=t[14],v+=n*L,w+=n*M,_+=n*U,E+=n*j,S+=n*K,k+=n*F,C+=n*V,A+=n*q,I+=n*z,T+=n*H,x+=n*G,B+=n*$,R+=n*W,N+=n*Y,O+=n*Q,P+=n*J,n=t[15],w+=n*L,_+=n*M,E+=n*U,S+=n*j,k+=n*K,C+=n*F,A+=n*V,I+=n*q,T+=n*z,x+=n*H,B+=n*G,R+=n*$,N+=n*W,O+=n*Y,P+=n*Q,D+=n*J,s+=38*_,o+=38*E,a+=38*S,c+=38*k,u+=38*C,l+=38*A,h+=38*I,f+=38*T,d+=38*x,p+=38*B,y+=38*R,g+=38*N,m+=38*O,b+=38*P,v+=38*D,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=w+i+65535,i=Math.floor(n/65536),w=n-65536*i,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=w+i+65535,i=Math.floor(n/65536),w=n-65536*i,s+=i-1+37*(i-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=h,e[7]=f,e[8]=d,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=b,e[14]=v,e[15]=w}function V(e,t){F(e,t,t)}function q(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)V(i,i),2!==n&&4!==n&&F(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function z(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)V(i,i),1!==n&&F(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function H(e,r,n){var i,s,o=new Uint8Array(32),a=new Float64Array(80),u=t(),l=t(),h=t(),f=t(),d=t(),p=t();for(s=0;s<31;s++)o[s]=r[s];for(o[31]=127&r[31]|64,o[0]&=248,U(a,n),s=0;s<16;s++)l[s]=a[s],f[s]=u[s]=h[s]=0;for(u[0]=f[0]=1,s=254;s>=0;--s)i=o[s>>>3]>>>(7&s)&1,P(u,l,i),P(h,f,i),j(d,u,h),K(u,u,h),j(h,l,f),K(l,l,f),V(f,d),V(p,u),F(u,h,u),F(h,l,d),j(d,u,h),K(u,u,h),V(l,u),K(h,f,p),F(u,h,c),j(u,u,f),F(h,h,u),F(u,f,p),F(f,l,a),V(l,d),P(u,l,i),P(h,f,i);for(s=0;s<16;s++)a[s+16]=u[s],a[s+32]=h[s],a[s+48]=l[s],a[s+64]=f[s];var y=a.subarray(32),g=a.subarray(16);return q(y,y),F(g,g,y),D(e,g),0}function G(e,t){return H(e,t,s)}function $(e,t){return n(t,32),G(e,t)}function W(e,t,r){var n=new Uint8Array(32);return H(n,r,t),_(e,i,n,E)}I.prototype.blocks=function(e,t,r){var n,i,s,o,a,c,u,l,h,f,d,p,y,g,m,b,v,w,_,E=this.fin?0:2048,S=this.h[0],k=this.h[1],C=this.h[2],A=this.h[3],I=this.h[4],T=this.h[5],x=this.h[6],B=this.h[7],R=this.h[8],N=this.h[9],O=this.r[0],P=this.r[1],D=this.r[2],L=this.r[3],M=this.r[4],U=this.r[5],j=this.r[6],K=this.r[7],F=this.r[8],V=this.r[9];while(r>=16)n=255&e[t+0]|(255&e[t+1])<<8,S+=8191&n,i=255&e[t+2]|(255&e[t+3])<<8,k+=8191&(n>>>13|i<<3),s=255&e[t+4]|(255&e[t+5])<<8,C+=8191&(i>>>10|s<<6),o=255&e[t+6]|(255&e[t+7])<<8,A+=8191&(s>>>7|o<<9),a=255&e[t+8]|(255&e[t+9])<<8,I+=8191&(o>>>4|a<<12),T+=a>>>1&8191,c=255&e[t+10]|(255&e[t+11])<<8,x+=8191&(a>>>14|c<<2),u=255&e[t+12]|(255&e[t+13])<<8,B+=8191&(c>>>11|u<<5),l=255&e[t+14]|(255&e[t+15])<<8,R+=8191&(u>>>8|l<<8),N+=l>>>5|E,h=0,f=h,f+=S*O,f+=k*(5*V),f+=C*(5*F),f+=A*(5*K),f+=I*(5*j),h=f>>>13,f&=8191,f+=T*(5*U),f+=x*(5*M),f+=B*(5*L),f+=R*(5*D),f+=N*(5*P),h+=f>>>13,f&=8191,d=h,d+=S*P,d+=k*O,d+=C*(5*V),d+=A*(5*F),d+=I*(5*K),h=d>>>13,d&=8191,d+=T*(5*j),d+=x*(5*U),d+=B*(5*M),d+=R*(5*L),d+=N*(5*D),h+=d>>>13,d&=8191,p=h,p+=S*D,p+=k*P,p+=C*O,p+=A*(5*V),p+=I*(5*F),h=p>>>13,p&=8191,p+=T*(5*K),p+=x*(5*j),p+=B*(5*U),p+=R*(5*M),p+=N*(5*L),h+=p>>>13,p&=8191,y=h,y+=S*L,y+=k*D,y+=C*P,y+=A*O,y+=I*(5*V),h=y>>>13,y&=8191,y+=T*(5*F),y+=x*(5*K),y+=B*(5*j),y+=R*(5*U),y+=N*(5*M),h+=y>>>13,y&=8191,g=h,g+=S*M,g+=k*L,g+=C*D,g+=A*P,g+=I*O,h=g>>>13,g&=8191,g+=T*(5*V),g+=x*(5*F),g+=B*(5*K),g+=R*(5*j),g+=N*(5*U),h+=g>>>13,g&=8191,m=h,m+=S*U,m+=k*M,m+=C*L,m+=A*D,m+=I*P,h=m>>>13,m&=8191,m+=T*O,m+=x*(5*V),m+=B*(5*F),m+=R*(5*K),m+=N*(5*j),h+=m>>>13,m&=8191,b=h,b+=S*j,b+=k*U,b+=C*M,b+=A*L,b+=I*D,h=b>>>13,b&=8191,b+=T*P,b+=x*O,b+=B*(5*V),b+=R*(5*F),b+=N*(5*K),h+=b>>>13,b&=8191,v=h,v+=S*K,v+=k*j,v+=C*U,v+=A*M,v+=I*L,h=v>>>13,v&=8191,v+=T*D,v+=x*P,v+=B*O,v+=R*(5*V),v+=N*(5*F),h+=v>>>13,v&=8191,w=h,w+=S*F,w+=k*K,w+=C*j,w+=A*U,w+=I*M,h=w>>>13,w&=8191,w+=T*L,w+=x*D,w+=B*P,w+=R*O,w+=N*(5*V),h+=w>>>13,w&=8191,_=h,_+=S*V,_+=k*F,_+=C*K,_+=A*j,_+=I*U,h=_>>>13,_&=8191,_+=T*M,_+=x*L,_+=B*D,_+=R*P,_+=N*O,h+=_>>>13,_&=8191,h=(h<<2)+h|0,h=h+f|0,f=8191&h,h>>>=13,d+=h,S=f,k=d,C=p,A=y,I=g,T=m,x=b,B=v,R=w,N=_,t+=16,r-=16;this.h[0]=S,this.h[1]=k,this.h[2]=C,this.h[3]=A,this.h[4]=I,this.h[5]=T,this.h[6]=x,this.h[7]=B,this.h[8]=R,this.h[9]=N},I.prototype.finish=function(e,t){var r,n,i,s,o=new Uint16Array(10);if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=r,r=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,o[0]=this.h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this.h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,n=(1^r)-1,s=0;s<10;s++)o[s]&=n;for(n=~n,s=0;s<10;s++)this.h[s]=this.h[s]&n|o[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,s=1;s<8;s++)i=(this.h[s]+this.pad[s]|0)+(i>>>16)|0,this.h[s]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},I.prototype.update=function(e,t,r){var n,i;if(this.leftover){for(i=16-this.leftover,i>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128){for(E=0;E<16;E++)S=8*E+W,B[E]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],R[E]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(E=0;E<80;E++)if(i=N,s=O,o=P,a=D,c=L,u=M,l=U,h=j,f=K,d=F,p=V,y=q,g=z,m=H,b=G,v=$,k=j,C=$,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=(L>>>14|z<<18)^(L>>>18|z<<14)^(z>>>9|L<<23),C=(z>>>14|L<<18)^(z>>>18|L<<14)^(L>>>9|z<<23),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=L&M^~L&U,C=z&H^~z&G,A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=Z[2*E],C=Z[2*E+1],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=B[E%16],C=R[E%16],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,w=65535&T|x<<16,_=65535&A|I<<16,k=w,C=_,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=(N>>>28|K<<4)^(K>>>2|N<<30)^(K>>>7|N<<25),C=(K>>>28|N<<4)^(N>>>2|K<<30)^(N>>>7|K<<25),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,k=N&O^N&P^O&P,C=K&F^K&V^F&V,A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,h=65535&T|x<<16,v=65535&A|I<<16,k=a,C=y,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=w,C=_,A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,a=65535&T|x<<16,y=65535&A|I<<16,O=i,P=s,D=o,L=a,M=c,U=u,j=l,N=h,F=f,V=d,q=p,z=y,H=g,G=m,$=b,K=v,E%16===15)for(S=0;S<16;S++)k=B[S],C=R[S],A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=B[(S+9)%16],C=R[(S+9)%16],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,w=B[(S+1)%16],_=R[(S+1)%16],k=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7,C=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,w=B[(S+14)%16],_=R[(S+14)%16],k=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6,C=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,B[S]=65535&T|x<<16,R[S]=65535&A|I<<16;k=N,C=K,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[0],C=t[0],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[0]=N=65535&T|x<<16,t[0]=K=65535&A|I<<16,k=O,C=F,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[1],C=t[1],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[1]=O=65535&T|x<<16,t[1]=F=65535&A|I<<16,k=P,C=V,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[2],C=t[2],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[2]=P=65535&T|x<<16,t[2]=V=65535&A|I<<16,k=D,C=q,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[3],C=t[3],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[3]=D=65535&T|x<<16,t[3]=q=65535&A|I<<16,k=L,C=z,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[4],C=t[4],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[4]=L=65535&T|x<<16,t[4]=z=65535&A|I<<16,k=M,C=H,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[5],C=t[5],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[5]=M=65535&T|x<<16,t[5]=H=65535&A|I<<16,k=U,C=G,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[6],C=t[6],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[6]=U=65535&T|x<<16,t[6]=G=65535&A|I<<16,k=j,C=$,A=65535&C,I=C>>>16,T=65535&k,x=k>>>16,k=e[7],C=t[7],A+=65535&C,I+=C>>>16,T+=65535&k,x+=k>>>16,I+=A>>>16,T+=I>>>16,x+=T>>>16,e[7]=j=65535&T|x<<16,t[7]=$=65535&A|I<<16,W+=128,n-=128}return n}function te(e,t,r){var n,i=new Int32Array(8),s=new Int32Array(8),o=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,s[0]=4089235720,s[1]=2227873595,s[2]=4271175723,s[3]=1595750129,s[4]=2917565137,s[5]=725511199,s[6]=4215389547,s[7]=327033209,ee(i,s,t,r),r%=128,n=0;n=0;--i)n=r[i/8|0]>>(7&i)&1,ne(e,t,n),re(t,e),re(e,e),ne(e,t,n)}function oe(e,r){var n=[t(),t(),t(),t()];N(n[0],h),N(n[1],f),N(n[2],a),F(n[3],h,f),se(e,n,r)}function ae(e,r,i){var s,o=new Uint8Array(64),a=[t(),t(),t(),t()];for(i||n(r,32),te(o,r,32),o[0]&=248,o[31]&=127,o[31]|=64,oe(a,o),ie(e,a),s=0;s<32;s++)r[s+32]=e[s];return 0}var ce=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ue(e,t){var r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*ce[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ce[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function le(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ue(e,r)}function he(e,r,n,i){var s,o,a=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),h=[t(),t(),t(),t()];te(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(s=0;s>7&&K(e[0],o,e[0]),F(e[3],e[0],e[1]),0)}function de(e,r,n,i){var s,o=new Uint8Array(32),a=new Uint8Array(64),c=[t(),t(),t(),t()],u=[t(),t(),t(),t()];if(n<64)return-1;if(fe(u,i))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(Ie),t=new Uint8Array(Te);return ae(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Oe(e),e.length!==Te)throw new Error("bad secret key size");for(var t=new Uint8Array(Ie),r=0;rasync function*(e,r){const s=await i(r.bits,r.min,r.max,r.window),o=new n;let a=[];for await(const n of e){o.append(n),a.push(n);const e=s.fingerprint(t.concat(a));a=[];for(let t=0;ti(n=>{const i=r.init(e,null);return r.update(i,n),t.from(r.digest(i))});e.exports=e=>{for(let t=0;t<64;t++)e[s+t]=u(t+1,a);for(let t=0;t<32;t++)e[o+t]=u(t+1,c)}}).call(this,r("b639").Buffer)},"74c8":function(e,t,r){"use strict";const n=r("80f8");e.exports=function(e){return function(t,r){return n.readable(e._catAsyncIterator(t,r),{objectMode:!0})}}},"74fa":function(e,t,r){"use strict";var n=String.prototype.replace,i=/%20/g,s=r("1f47"),o={RFC1738:"RFC1738",RFC3986:"RFC3986"};e.exports=s.assign({default:o.RFC3986,formatters:{RFC1738:function(e){return n.call(e,i,"+")},RFC3986:function(e){return String(e)}}},o)},7566:function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=r("0e54e"),s=r("e782"),o=r("37bc");async function a(e,t,r){const n=await a.digest(e,t,r);return s.encode(n,t,r)}a.Buffer=n,a.multihash=s,a.digest=async(e,t,r)=>{const n=a.createHash(t),i=await n(e);return r?i.slice(0,r):i},a.createHash=function(e){if(!e)throw i("hash algorithm must be specified","ERR_HASH_ALGORITHM_NOT_SPECIFIED");if(e=s.coerceCode(e),!a.functions[e])throw i(`multihash function '${e}' not yet supported`,"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return a.functions[e]},a.functions={17:o.sha1,18:o.sha2256,19:o.sha2512,20:o.sha3512,21:o.sha3384,22:o.sha3256,23:o.sha3224,24:o.shake128,25:o.shake256,26:o.keccak224,27:o.keccak256,28:o.keccak384,29:o.keccak512,34:o.murmur3128,35:o.murmur332,86:o.dblSha2256},o.addBlake(a.functions),a.validate=async(e,t)=>{const r=await a(e,s.decode(t).name);return 0===n.compare(t,r)},e.exports=a},7582:function(e,t,r){"use strict";const n=r("fa4d"),i=r("2644"),s=r("1421"),o=r("b1aa"),a=r("8911"),c=r("fd4b");e.exports=e=>n((t,r,n)=>{"function"!==typeof r||n||(n=r,r={}),"function"===typeof r&&"function"===typeof n&&(n=r,r={});const u=(e,t)=>{if(Array.isArray(e)&&(e=e.find(e=>2===e.Type)),!e||2!==e.Type){const e="key was not found (type 4)";return t(c(new Error(e),"ERR_KEY_TYPE_4_NOT_FOUND"))}const r=e.Responses[0],n=new a(o.createFromB58String(r.ID));r.Addrs.forEach(e=>{const t=s(e);n.multiaddrs.add(t)}),t(null,n)};e({path:"dht/findpeer",args:t.toString(),qs:r},(e,t)=>{if(e)return n(e);i(t,u,n)})})},7584:function(e,t,r){"use strict";const n=r("9941");e.exports={tag:"/plaintext/1.0.0",encrypt(e,t,r,i){return"function"===typeof r&&(i=r,r=void 0),n(()=>i()),t}}},7619:function(e,t,r){"use strict";const n=r("c044"),i=r("8945"),s=r("c731");class o{constructor(e,t){this.originDhtKey=e,this.capacity=t,this.peerDistances=[]}get length(){return this.peerDistances.length}get peers(){return this.peerDistances.map(e=>e.peerId)}add(e,t){if(this.peerDistances.find(t=>t.peerId.id.equals(e.id)))return t();i.convertPeerId(e,(r,i)=>{if(r)return t(r);const s={peerId:e,distance:n(this.originDhtKey,i)};this.peerDistances.push(s),this.peerDistances.sort((e,t)=>n.compare(e.distance,t.distance)),this.peerDistances=this.peerDistances.slice(0,this.capacity),t()})}anyCloser(e,t){return e.length?this.length?void s(e,(e,t)=>i.convertPeerId(e,t),(e,r)=>{if(e)return t(e);const i=this.peerDistances[this.peerDistances.length-1].distance;for(const s of r){const e=n(this.originDhtKey,s);if(n.compare(e,i)<0)return t(null,!0)}return t(null,!1)}):t(null,!0):t(null,!1)}}e.exports=o},7686:function(e,t){function r(e){if("object"!==typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}r.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},r.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},r.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},r.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},r.prototype._del=function(e){this._operations.push({type:"del",key:e})},r.prototype.clear=function(){return this._checkWritten(),this._clear(),this},r.prototype._clear=function(){this._operations=[]},r.prototype.write=function(e,t){if(this._checkWritten(),"function"===typeof e&&(t=e),"function"!==typeof t)throw new Error("write() requires a callback argument");"object"===typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},r.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=r},"76a0":function(e,t,r){"use strict";const n=r("c61d");e.exports=async(e,t,{concurrency:r=1/0,stopOnError:i=!0}={})=>new Promise((s,o)=>{if("function"!==typeof t)throw new TypeError("Mapper function is required");if(!("number"===typeof r&&r>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${r}\` (${typeof r})`);const a=[],c=[],u=e[Symbol.iterator]();let l=!1,h=!1,f=0,d=0;const p=()=>{if(l)return;const e=u.next(),r=d;if(d++,e.done)return h=!0,void(0===f&&(i||0===c.length?s(a):o(new n(c))));f++,(async()=>{try{const n=await e.value;a[r]=await t(n,r),f--,p()}catch(n){i?(l=!0,o(n)):(c.push(n),f--,p())}})()};for(let e=0;e>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"===typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&u]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,u,l,h=!1,f=null,d=null,p=null,y=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(i=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=o(e[u],s[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(i=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],s[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var n=f.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var i=0;i=8)g([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var n=8===f.length()?8:8-f.length();f.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===f.length(),t))if(e)t=e(8,d,!r);else{var i=d.length(),s=d.at(i-1);s>i?t=!1:d.truncate(s)}return t}},m};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},"76a7":function(e,t,r){e.exports=r("d307")},"76bf":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=void 0;var n=r("7e5f"),i=s(n);function s(e){return e&&e.__esModule?e:{default:e}}var o="function"===typeof Symbol;function a(e){return o&&"AsyncFunction"===e[Symbol.toStringTag]}function c(e){return a(e)?(0,i.default)(e):e}t.default=c,t.isAsync=a},"76c0":function(e,t,r){"use strict";var n=r("27f0");e.exports=function(e){return e=n(e),function(t){return function r(n,i){var s,o=!0;while(o)o=!1,s=!0,t(n,(function(t,n){if(!t&&!e(n))return s?o=!0:r(t,i);i(t,n)})),s=!1}}}},"76d6":function(e,t){function r(e,t){"function"===typeof e&&(t=e,e=!1);var r,n,i,s=[];function o(e,t){e&&(r=e,n&&l(r)),n=t,u()}function a(e){i=i||e||!0,u()}function c(e){i||(n?l(r,e):s.push(e))}return e?{push:c,end:a,source:o,buffer:s}:(o.push=c,o.end=a,o.buffer=s,o);function u(){n&&(r?l(r):!s.length&&i?l(i):s.length&&l(null,s.shift()))}function l(e,r){var i=n;if(e&&t){var s=t;t=null,s(!0===e?null:e)}n=null,i(e,r)}}e.exports=r},"76d9":function(e,t,r){"use strict";const n=r("9f2e"),i=r("000a"),s=r("fa4d"),{messages:o,codes:a}=r("a41c");e.exports=e=>({put:s((t,r,s)=>{if(!e._dht)return n(s,i(new Error(o.DHT_DISABLED),a.DHT_DISABLED));e._dht.put(t,r,s)}),get:s((t,r,s)=>{if("function"===typeof r&&(s=r,r={}),!e._dht)return n(s,i(new Error(o.DHT_DISABLED),a.DHT_DISABLED));e._dht.get(t,r,s)}),getMany:s((t,r,s,c)=>{if("function"===typeof s&&(c=s,s={}),!e._dht)return n(c,i(new Error(o.DHT_DISABLED),a.DHT_DISABLED));e._dht.getMany(t,r,s,c)})})},"76e2":function(e,t,r){(function(t){const n=r("2c93"),i=r("0580"),{default:s}=r("10d9"),{timeout:o}=r("f769"),a=r("c275"),c={};let u;function l(e,t){let r;const n=new Promise(e=>{r=e});return e.add(()=>o((()=>new Promise(e=>{r(()=>{e()})}))(),t.timeout)),n}const h=(e,t)=>{if(u.isWorker)return{readLock:u.readLock(e,t),writeLock:u.writeLock(e,t)};const r=new s({concurrency:1});let n=null;return{readLock:()=>{if(n)return l(n,t);n=new s({concurrency:t.concurrency,autoStart:!1});const e=n,i=l(n,t);return r.add(()=>(e.start(),e.onIdle().then(()=>{n===e&&(n=null)}))),i},writeLock:()=>(n=null,l(r,t))}},f={concurrency:1/0,timeout:846e5,global:t,singleProcess:!1};e.exports=(e,t)=>(t||(t={}),"object"===typeof e&&(t=e,e="lock"),e||(e="lock"),t=Object.assign({},f,t),u||(u=n(t)||i(t),u.isWorker||(u.on("requestReadLock",(e,t)=>{c[e]&&c[e].readLock().then(e=>t().finally(()=>e()))}),u.on("requestWriteLock",async(e,t)=>{c[e]&&c[e].writeLock().then(e=>t().finally(()=>e()))}))),c[e]||(c[e]=h(e,t)),c[e]),e.exports.Worker=function(e,r){let n;r=r||t.Worker;try{n=new r(e)}catch(i){i.message.includes("not a constructor")&&(n=r(e))}if(!n)throw new Error("Could not create Worker from",r);return a(n),n}}).call(this,r("c8ba"))},"770a":function(e,t,r){"use strict";const n=r("76e2");let i;e.exports=e=>{if(i)return i;const t=n({singleProcess:e});return i={readLock:e=>async(...r)=>{const n=await t.readLock();try{return await e.apply(null,r)}finally{n()}},writeLock:e=>async(...r)=>{const n=await t.writeLock();try{return await e.apply(null,r)}finally{n()}}},i}},7715:function(e,t,r){const{instantiateStreaming:n}=r("49ba");function i(e={}){if(!i.supported)return null;var t=new Uint8Array([0,97,115,109,1,0,0,0,1,90,16,96,0,0,96,2,127,127,1,127,96,4,127,127,127,127,0,96,1,127,1,127,96,3,127,127,127,0,96,1,126,1,127,96,2,126,126,1,126,96,5,127,127,127,127,127,1,127,96,3,127,127,126,0,96,2,127,127,1,126,96,3,127,127,127,1,127,96,1,127,0,96,2,127,127,0,96,1,127,1,126,96,2,127,126,0,96,0,1,127,2,13,1,3,101,110,118,5,97,98,111,114,116,0,2,3,57,56,3,3,12,3,3,15,5,6,1,8,4,1,9,11,7,4,10,10,11,0,0,0,3,12,3,12,3,12,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,4,4,1,112,0,1,5,3,1,0,1,6,26,5,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,7,253,6,44,6,109,101,109,111,114,121,2,0,5,116,97,98,108,101,1,0,6,100,101,103,114,101,101,0,7,3,109,111,100,0,8,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,23,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,24,21,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,25,21,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,26,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,27,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,28,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,29,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,30,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,31,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,32,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,33,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,34,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,35,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,36,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,37,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,38,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,39,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,40,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,41,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,42,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,43,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,44,27,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,95,100,101,103,114,101,101,0,45,27,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,95,100,101,103,114,101,101,0,46,26,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,95,115,104,105,102,116,0,47,26,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,95,115,104,105,102,116,0,48,22,82,97,98,105,110,35,103,101,116,58,97,118,101,114,97,103,101,95,98,105,116,115,0,49,22,82,97,98,105,110,35,115,101,116,58,97,118,101,114,97,103,101,95,98,105,116,115,0,50,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,51,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,52,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,53,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,54,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,55,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,56,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,15,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,16,14,109,101,109,111,114,121,46,99,111,109,112,97,114,101,0,18,15,109,101,109,111,114,121,46,97,108,108,111,99,97,116,101,0,4,11,109,101,109,111,114,121,46,102,114,101,101,0,19,12,109,101,109,111,114,121,46,114,101,115,101,116,0,20,8,1,21,9,7,1,0,65,0,11,1,22,10,188,30,56,104,1,3,127,32,0,65,128,128,128,128,4,75,4,64,0,11,35,1,34,1,32,0,65,1,32,0,65,1,75,27,106,65,7,106,65,120,113,34,0,63,0,34,2,65,16,116,75,4,64,32,2,32,0,32,1,107,65,255,255,3,106,65,128,128,124,113,65,16,118,34,3,32,2,32,3,74,27,64,0,65,0,72,4,64,32,3,64,0,65,0,72,4,64,0,11,11,11,32,0,36,1,32,1,11,51,1,1,127,32,0,65,248,255,255,255,3,75,4,64,65,0,65,200,0,65,26,65,2,16,0,0,11,65,1,65,32,32,0,65,7,106,103,107,116,16,1,34,1,32,0,54,2,0,32,1,11,145,3,1,1,127,32,1,69,4,64,15,11,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,4,64,15,11,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,4,64,15,11,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,4,64,15,11,65,0,32,0,107,65,3,113,34,2,32,0,106,34,0,65,0,54,2,0,32,1,32,2,107,65,124,113,34,1,32,0,106,65,4,107,65,0,54,2,0,32,1,65,8,77,4,64,15,11,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,4,64,15,11,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,65,4,113,65,24,106,34,2,32,0,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,6,0,32,0,16,1,11,76,1,1,127,65,128,16,16,2,34,1,65,8,106,65,128,16,16,3,32,0,69,4,64,65,12,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,32,1,54,2,0,32,0,65,0,54,2,4,32,0,65,128,16,54,2,8,32,0,11,8,0,65,12,16,1,16,5,11,70,2,1,127,1,126,66,128,128,128,128,128,128,128,128,128,127,33,2,3,64,2,64,32,1,65,192,0,78,13,0,32,0,32,2,131,66,0,86,4,64,65,63,32,1,107,15,5,32,2,66,1,136,33,2,32,1,65,1,106,33,1,12,2,11,0,11,11,65,127,11,175,2,2,1,127,2,126,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,32,1,33,4,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,3,32,4,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,78,4,64,32,1,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,1,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,107,172,134,32,0,133,33,0,12,1,11,11,32,0,11,96,1,1,127,32,1,65,248,255,255,255,3,75,4,64,65,0,65,8,65,23,65,34,16,0,0,11,32,1,16,2,34,2,65,8,106,32,1,16,3,32,0,69,4,64,65,12,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,32,2,54,2,0,32,0,65,0,54,2,4,32,0,32,1,54,2,8,32,0,11,49,0,32,1,32,0,40,2,8,65,3,118,79,4,64,65,0,65,8,65,50,65,63,16,0,0,11,32,0,40,2,4,32,0,40,2,0,32,1,65,3,116,106,106,32,2,55,3,8,11,43,0,32,1,32,0,40,2,8,79,4,64,65,0,65,8,65,50,65,63,16,0,0,11,32,0,40,2,4,32,1,32,0,40,2,0,106,106,32,2,58,0,8,11,41,0,32,1,32,0,40,2,8,79,4,64,65,0,65,8,65,39,65,63,16,0,0,11,32,0,40,2,4,32,1,32,0,40,2,0,106,106,45,0,8,11,47,0,32,1,32,0,40,2,8,65,3,118,79,4,64,65,0,65,8,65,39,65,63,16,0,0,11,32,0,40,2,4,32,0,40,2,0,32,1,65,3,116,106,106,41,3,8,11,166,10,2,3,127,5,126,35,2,69,4,64,3,64,32,2,65,128,2,72,4,64,32,2,65,255,1,113,173,33,4,32,0,41,3,72,33,6,3,64,2,127,32,4,33,5,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,172,134,32,5,133,33,4,12,1,11,11,65,0,33,1,3,64,32,1,32,0,40,2,4,65,1,107,72,4,64,32,5,66,8,134,33,4,32,0,41,3,72,33,6,3,64,2,127,32,4,33,5,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,107,172,134,32,5,133,33,4,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,35,4,32,2,32,5,16,10,32,2,65,1,106,33,2,12,1,11,11,2,127,32,0,41,3,72,33,4,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,4,32,5,131,66,0,86,13,2,26,32,5,66,1,136,33,5,32,2,65,1,106,33,2,12,1,11,11,65,127,11,172,33,8,65,0,33,2,3,64,32,2,65,128,2,72,4,64,35,3,33,3,32,2,172,32,8,134,33,5,32,0,41,3,72,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,172,134,32,5,133,33,5,12,1,11,11,32,3,32,2,32,2,172,32,8,134,32,5,132,16,10,32,2,65,1,106,33,2,12,1,11,11,65,1,36,2,11,32,0,66,0,55,3,24,32,0,66,0,55,3,32,65,0,33,2,3,64,32,2,32,0,40,2,4,72,4,64,32,0,40,2,0,32,2,65,0,16,11,32,2,65,1,106,33,2,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,12,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,11,32,0,32,0,41,3,40,35,4,32,1,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,1,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,66,1,132,55,3,40,32,0,32,0,41,3,40,35,3,32,1,65,255,1,113,16,13,133,55,3,40,11,234,1,0,32,0,69,4,64,65,128,1,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,66,0,55,3,96,32,0,66,0,55,3,104,32,0,66,0,55,3,112,32,0,66,0,55,3,120,32,0,32,1,173,55,3,96,32,0,32,2,173,55,3,104,32,0,32,3,173,55,3,112,32,0,65,12,16,1,32,4,16,9,54,2,0,32,0,32,4,54,2,4,32,0,66,1,32,0,41,3,96,134,66,1,125,55,3,120,32,0,66,243,130,183,218,216,230,232,30,55,3,72,32,0,66,53,55,3,80,32,0,32,0,41,3,80,66,8,125,55,3,88,32,0,16,14,32,0,11,206,4,1,5,127,32,1,40,2,8,33,4,32,1,40,2,0,65,8,106,33,5,3,64,2,127,65,0,33,3,3,64,32,3,32,4,72,4,64,32,3,32,5,106,45,0,0,33,1,32,0,40,2,0,32,0,40,2,8,16,12,33,6,32,0,40,2,0,32,0,40,2,8,32,1,16,11,32,0,32,0,41,3,40,35,4,32,6,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,6,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,32,1,173,132,55,3,40,32,0,32,0,41,3,40,35,3,32,6,65,255,1,113,16,13,133,55,3,40,32,0,32,0,41,3,16,66,1,124,55,3,16,32,0,32,0,41,3,24,66,1,124,55,3,24,2,127,32,0,41,3,16,32,0,41,3,104,90,34,1,4,64,32,0,41,3,40,32,0,41,3,120,131,66,0,81,33,1,11,32,1,69,11,4,127,32,0,41,3,16,32,0,41,3,112,90,5,32,1,11,4,64,32,0,32,0,41,3,32,55,3,48,32,0,32,0,41,3,16,55,3,56,32,0,32,0,41,3,40,55,3,64,65,0,33,1,3,64,32,1,32,0,40,2,4,72,4,64,32,0,40,2,0,32,1,65,0,16,11,32,1,65,1,106,33,1,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,12,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,11,32,0,32,0,41,3,40,35,4,32,1,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,1,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,66,1,132,55,3,40,32,0,32,0,41,3,40,35,3,32,1,65,255,1,113,16,13,133,55,3,40,32,3,65,1,106,12,3,5,32,3,65,1,106,33,3,12,2,11,0,11,11,65,127,11,34,1,65,0,78,4,64,32,4,32,1,107,33,4,32,1,32,5,106,33,5,32,7,34,1,65,1,106,33,7,32,2,40,2,4,32,2,40,2,0,32,1,65,2,116,106,106,32,0,41,3,56,62,2,8,32,2,40,2,4,32,2,40,2,0,32,1,65,2,116,106,106,40,2,8,26,12,1,11,11,11,88,1,1,127,32,0,32,1,70,4,64,65,0,15,11,3,64,32,2,65,0,71,34,3,4,64,32,0,45,0,0,32,1,45,0,0,70,33,3,11,32,3,4,64,32,2,65,1,107,33,2,32,0,65,1,106,33,0,32,1,65,1,106,33,1,12,1,11,11,32,2,4,127,32,0,45,0,0,32,1,45,0,0,107,5,65,0,11,11,10,0,32,0,32,1,32,2,16,17,11,3,0,1,11,6,0,35,0,36,1,11,19,0,65,136,1,36,0,35,0,36,1,16,6,36,3,16,6,36,4,11,3,0,1,11,7,0,32,0,40,2,0,11,9,0,32,0,32,1,54,2,0,11,7,0,32,0,40,2,4,11,9,0,32,0,32,1,54,2,4,11,7,0,32,0,40,2,8,11,9,0,32,0,32,1,54,2,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,41,3,96,11,9,0,32,0,32,1,55,3,96,11,7,0,32,0,41,3,104,11,9,0,32,0,32,1,55,3,104,11,7,0,32,0,41,3,112,11,9,0,32,0,32,1,55,3,112,11,7,0,32,0,41,3,120,11,9,0,32,0,32,1,55,3,120,11,11,128,1,2,0,65,8,11,57,27,0,0,0,126,0,108,0,105,0,98,0,47,0,105,0,110,0,116,0,101,0,114,0,110,0,97,0,108,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,200,0,11,59,28,0,0,0,126,0,108,0,105,0,98,0,47,0,105,0,110,0,116,0,101,0,114,0,110,0,97,0,108,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,32,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,14,114,97,98,105,110,46,119,97,115,109,46,109,97,112]);return n(new Response(new Blob([t],{type:"application/wasm"})),e)}i.supported="undefined"!==typeof WebAssembly,e.exports=i},7799:function(e,t,r){var n=r("54fb"),i=r("3d38");e.exports=n,e.exports.parse=n,e.exports.stringify=i},"77be":function(e,t,r){"use strict";(function(t){const n=r("7139"),i=r("faa1"),s=r("5118"),o=r("cd3f"),a=r("83f1"),c=r("44bd"),u=r("f5be"),l=r("52b2"),h=r("d7fa"),f={pollInterval:1e3};e.exports=(e,t,r)=>new d(e,t,r);class d extends i{constructor(e,t,r){if(super(),this._ipfs=e,this._topic=t,this._options=Object.assign({},o(f),o(r)),this._peers=[],this._connections={},this._handleDirectMessage=this._handleDirectMessage.bind(this),!this._ipfs.pubsub)throw new Error("This IPFS node does not have pubsub.");this._ipfs.isOnline()?this._start():this._ipfs.on("ready",this._start.bind(this)),this._ipfs.on("stop",this.leave.bind(this))}getPeers(){return this._peers.slice(0)}hasPeer(e){return this._peers.indexOf(e)>=0}leave(){return new Promise((e,t)=>{s.clearInterval(this._interval),Object.keys(this._connections).forEach(e=>{this._connections[e].stop()}),l.emitter.removeListener(this._topic,this._handleDirectMessage),this.once("stopped",()=>e()),this.emit("stopping")})}broadcast(e){let t=u(e);this._ipfs.pubsub.publish(this._topic,t,e=>{e&&this.emit("error",e)})}sendTo(e,r){let n=this._connections[e];n||(n=new c(e,this._ipfs,this),n.on("error",e=>this.emit("error",e)),this._connections[e]=n,n.once("disconnect",()=>{delete this._connections[e],this._peers=this._peers.filter(t=>t!==e),this.emit("peer left",e)}));const i=t.from([0]),s={to:e,from:this._ipfs._peerInfo.id.toB58String(),data:t.from(r).toString("hex"),seqno:i.toString("hex"),topicIDs:[this._topic],topicCIDs:[this._topic]};n.push(t.from(JSON.stringify(s)))}_start(){this._interval=s.setInterval(this._pollPeers.bind(this),this._options.pollInterval);const e=this._onMessage.bind(this);this._ipfs.pubsub.subscribe(this._topic,e,{},e=>{e?this.emit("error",e):this.emit("subscribed",this._topic)}),this.once("stopping",()=>{this._ipfs.pubsub.unsubscribe(this._topic,e,e=>{e?this.emit("error",e):this.emit("stopped")})}),h(this._ipfs).handle(a,l.handler),l.emitter.on(this._topic,this._handleDirectMessage)}_pollPeers(){this._ipfs.pubsub.peers(this._topic,(e,t)=>{if(e)return void this.emit("error",e);const r=t.sort();this._emitChanges(r)&&(this._peers=r)})}_emitChanges(e){const t=n(this._peers,e);return t.added.forEach(e=>this.emit("peer joined",e)),t.removed.forEach(e=>this.emit("peer left",e)),t.added.length>0||t.removed.length>0}_onMessage(e){this.emit("message",e)}_handleDirectMessage(e){if(e.to===this._ipfs._peerInfo.id.toB58String()){const t=Object.assign({},e);delete t.to,this.emit("message",t)}}}}).call(this,r("b639").Buffer)},"77e5":function(e,t,r){"use strict";const{Buffer:n}=r("b639"),i=e=>{const t=new Array(4);for(let r=0;r<4;r++)t[r]=255&e,e>>=8;return n.from(t)};e.exports={fromNumberTo32BitBuf:i}},7804:function(e,t){function r(e){if("object"!==typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}r.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},r.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},r.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},r.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},r.prototype._del=function(e){this._operations.push({type:"del",key:e})},r.prototype.clear=function(){return this._checkWritten(),this._clear(),this},r.prototype._clear=function(){this._operations=[]},r.prototype.write=function(e,t){if(this._checkWritten(),"function"===typeof e&&(t=e),"function"!==typeof t)throw new Error("write() requires a callback argument");"object"===typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},r.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},e.exports=r},7849:function(e,t,r){"use strict";(function(t){const n=r("09a4"),i=r("c75d"),s=i.DAGNode,o=i.DAGLink,a=r("e3d5"),c=r("e782"),u=r("0c9a"),l=r("2091e"),h=r("7048");function f(e,r){if("string"===typeof e)return"base58"!==r&&r?t.from(e,r):e;if(t.isBuffer(e))return e;if(a.isCID(e))return e.buffer;throw new Error("unsupported multihash")}function d(e,t){switch(t){case"json":return p(e);case"protobuf":return y(e);default:throw new Error(`unkown encoding: ${t}`)}}function p(e){let r,n;try{const i=JSON.parse(e.toString());n=(i.Links||[]).map(e=>new o(e.Name||e.name,e.Size||e.size,c.fromB58String(e.Hash||e.hash||e.multihash))),r=t.from(i.Data)}catch(i){throw new Error("failed to parse JSON: "+i)}return new s(r,n)}function y(e){return i.util.deserialize(e)}function g(e,t=[]){for(const n in e){const i=e[n];if("/"===n&&1===Object.keys(e).length)try{t.push(new o("",0,new a(i)));continue}catch(r){}a.isCID(i)?t.push(new o("",0,i)):(Array.isArray(i)&&g(i,t),"object"!==typeof i||i instanceof String||g(i,t))}return t}e.exports=function(e){async function r(t,r,n){n=n||{};const i=await e.object.get(t,n),s=await e._ipld.put(r(i),u.DAG_PB,{cidVersion:0,hashAlg:u.SHA2_256});return!1!==n.preload&&e._preload(s),s}return{new:n.variadic(async(r,n)=>{let i;if(n=n||{},r&&"string"!==typeof r&&(n=r,r=null),r){if("unixfs-dir"!==r)throw new Error("unknown template");i=new l("directory").marshal()}else i=t.alloc(0);const o=new s(i),a=await e._ipld.put(o,u.DAG_PB,{cidVersion:0,hashAlg:u.SHA2_256});return!1!==n.preload&&e._preload(a),a}),put:n.variadic(async(r,n)=>{n=n||{};const i=n.enc;let o;if(t.isBuffer(r))o=i?await d(r,i):new s(r);else if(s.isDAGNode(r))o=r;else{if("object"!==typeof r)throw new Error("obj not recognized");o=new s(r.Data,r.Links)}const a=await e._gcLock.readLock();try{const t=await e._ipld.put(o,u.DAG_PB,{cidVersion:0,hashAlg:u.SHA2_256});return!1!==n.preload&&e._preload(t),t}finally{a()}}),get:n.variadic(async(t,r)=>{let n,i;r=r||{};try{n=f(t,r.enc)}catch(s){throw h(s,"ERR_INVALID_MULTIHASH")}try{i=new a(n)}catch(s){throw h(s,"ERR_INVALID_CID")}return 1===r.cidVersion&&(i=i.toV1()),!1!==r.preload&&e._preload(i),e._ipld.get(i)}),data:n.variadic(async(t,r)=>{r=r||{};const n=await e.object.get(t,r);return n.Data}),links:n.variadic(async(t,r)=>{r=r||{};const n=new a(t),i=await e.dag.get(n,r);if("raw"===n.codec)return[];if("dag-pb"===n.codec)return i.value.Links;if("dag-cbor"===n.codec)return g(i);throw new Error(`Cannot resolve links from codec ${n.codec}`)}),stat:n.variadic(async(t,r)=>{r=r||{};const n=await e.object.get(t,r),s=i.util.serialize(n),o=await i.util.cid(s,{cidVersion:0}),a=s.length,c=n.Links.reduce((e,t)=>e+t.Tsize,0);return{Hash:o.toBaseEncodedString(),NumLinks:n.Links.length,BlockSize:a,LinksSize:a-n.Data.length,DataSize:n.Data.length,CumulativeSize:a+c}}),patch:{addLink:n.variadic(async(e,t,n)=>r(e,e=>(e.addLink(t),e),n)),rmLink:n.variadic(async(e,t,n)=>r(e,e=>(e.rmLink(t.Name||t.name),e),n)),appendData:n.variadic(async(e,n,i)=>r(e,e=>{const r=t.concat([e.Data,n]);return new s(r,e.Links)},i)),setData:n.variadic(async(e,t,n)=>r(e,e=>new s(t,e.Links),n))}}}}).call(this,r("b639").Buffer)},7852:function(e,t,r){"use strict";const n=r("f106"),i="\nmessage Identify {\n // protocolVersion determines compatibility between peers\n optional string protocolVersion = 5; // e.g. ipfs/1.0.0\n\n // agentVersion is like a UserAgent string in browsers, or client version in bittorrent\n // includes the client name and client.\n optional string agentVersion = 6; // e.g. go-ipfs/0.1.0\n\n // publicKey is this node's public key (which also gives its node.ID)\n // - may not need to be sent, as secure channel implies it has been sent.\n // - then again, if we change / disable secure channel, may still want it.\n optional bytes publicKey = 1;\n\n // listenAddrs are the multiaddrs the sender node listens for open connections on\n repeated bytes listenAddrs = 2;\n\n // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives\n // this is useful information to convey to the other side, as it helps the remote endpoint\n // determine whether its connection to the local peer goes through NAT.\n optional bytes observedAddr = 4;\n\n repeated string protocols = 3;\n}\n";e.exports=n(i).Identify},"78e1":function(e,t,r){(function(t){var n=r("c0ed"),i=r("b85d");e.exports=l;var s,o=/\n/g,a=/\\n/g;function c(){}function u(){return"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof t?t:{}}function l(e){if(n.call(this,e),this.query=this.query||{},!s){var t=u();s=t.___eio=t.___eio||[]}this.index=s.length;var r=this;s.push((function(e){r.onData(e)})),this.query.j=this.index,"function"===typeof addEventListener&&addEventListener("beforeunload",(function(){r.script&&(r.script.onerror=c)}),!1)}i(l,n),l.prototype.supportsBinary=!1,l.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),n.prototype.doClose.call(this)},l.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(t,r):(document.head||document.body).appendChild(t),this.script=t;var n="undefined"!==typeof navigator&&/gecko/i.test(navigator.userAgent);n&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},l.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n,i=document.createElement("form"),s=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;i.className="socketio",i.style.position="absolute",i.style.top="-1000px",i.style.left="-1000px",i.target=c,i.method="POST",i.setAttribute("accept-charset","utf-8"),s.name="d",i.appendChild(s),document.body.appendChild(i),this.form=i,this.area=s}function u(){l(),t()}function l(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(t){r.onError("jsonp polling iframe removal error",t)}try{var e='')\n\t\tstorageContainer.close()\n\t\tstorageOwner = storageContainer.w.frames[0].document\n\t\tstorageEl = storageOwner.createElement('div')\n\t} catch(e) {\n\t\t// somehow ActiveXObject instantiation failed (perhaps some special\n\t\t// security settings or otherwse), fall back to per-path storage\n\t\tstorageEl = doc.createElement('div')\n\t\tstorageOwner = doc.body\n\t}\n\n\treturn function(storeFunction) {\n\t\tvar args = [].slice.call(arguments, 0)\n\t\targs.unshift(storageEl)\n\t\t// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx\n\t\t// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx\n\t\tstorageOwner.appendChild(storageEl)\n\t\tstorageEl.addBehavior('#default#userData')\n\t\tstorageEl.load(storageName)\n\t\tstoreFunction.apply(this, args)\n\t\tstorageOwner.removeChild(storageEl)\n\t\treturn\n\t}\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar pad_string_1 = require(\"./pad-string\");\nfunction encode(input, encoding) {\n if (encoding === void 0) { encoding = \"utf8\"; }\n if (Buffer.isBuffer(input)) {\n return fromBase64(input.toString(\"base64\"));\n }\n return fromBase64(Buffer.from(input, encoding).toString(\"base64\"));\n}\n;\nfunction decode(base64url, encoding) {\n if (encoding === void 0) { encoding = \"utf8\"; }\n return Buffer.from(toBase64(base64url), \"base64\").toString(encoding);\n}\nfunction toBase64(base64url) {\n base64url = base64url.toString();\n return pad_string_1.default(base64url)\n .replace(/\\-/g, \"+\")\n .replace(/_/g, \"/\");\n}\nfunction fromBase64(base64) {\n return base64\n .replace(/=/g, \"\")\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\");\n}\nfunction toBuffer(base64url) {\n return Buffer.from(toBase64(base64url), \"base64\");\n}\nvar base64url = encode;\nbase64url.encode = encode;\nbase64url.decode = decode;\nbase64url.toBase64 = toBase64;\nbase64url.fromBase64 = fromBase64;\nbase64url.toBuffer = toBuffer;\nexports.default = base64url;\n","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","'use strict'\n\nconst pull = require('pull-stream')\nconst pushable = require('pull-pushable')\nconst through = require('pull-through')\nconst looper = require('looper')\nconst nextTick = require('async/nextTick')\nconst EE = require('events')\nconst debug = require('debug')\n\nconst { emitError, emitStream } = require('./util')\nconst { Types, MAX_MSG_SIZE } = require('./consts')\nconst Channel = require('./channel')\nconst coder = require('./coder')\n\nconst log = debug('pull-plex')\nlog.err = debug('pull-plex:err')\n\n/**\n * @typedef {Object} Message\n * @property {number} id\n * @property {MessageType} type\n * @property {Buffer} data\n */\n\n/**\n * @fires Mplex#close Emitted when Mplex closes\n * @fires Mplex#error Emitted when an error occurs\n * @fires Mplex#stream Emitted when a new stream is opened\n */\nclass Mplex extends EE {\n /**\n * @constructor\n * @param {Object} opts\n * @param {boolean} opts.initiator Is this starting the stream. Default: `true`\n * @param {function(Channel, number)} opts.onChan A handler for new streams. Can be used instead of `.on('stream')`\n * @param {number} opts.maxChannels Maximum number of channels to have open. Default: `10000`\n * @param {number} opts.maxMsgSize Maximum size messages are allowed to be. Default: `1 << 20` (1MB)\n * @param {boolean} opts.lazy Should channels be opened lazily? If false, channels will be opened when they are created. Default: `false`\n */\n constructor (opts) {\n super()\n\n if (typeof opts === 'boolean') {\n opts = { initiator: opts }\n }\n\n opts = {\n initiator: true,\n onChan: null,\n maxChannels: 10000,\n maxMsgSize: MAX_MSG_SIZE,\n lazy: false,\n ...opts\n }\n\n this._maxChannels = opts.maxChannels\n this._maxMsgSize = opts.maxMsgSize\n this._lazy = opts.lazy\n\n this._initiator = Boolean(opts.initiator)\n this._chanId = 0\n this._inChannels = new Array(this._maxChannels / 2)\n this._outChannels = new Array(this._maxChannels / 2)\n this._endedRemote = false // remote stream ended\n this._endedLocal = false // local stream ended\n\n this._chandata = pushable((err) => {\n this._log('mplex ended')\n this._endedRemote = true\n this.close(err)\n })\n\n if (opts.onChan) {\n this.on('stream', (chan) => opts.onChan(chan, chan.id))\n }\n\n this.source = pull(\n this._chandata,\n coder.encode()\n )\n\n const self = this\n this.sink = pull(\n through(function (data) {\n // ensure data is within our max size requirement\n if (data && data.length >= self._maxMsgSize) {\n nextTick(emitError, self, new Error('message too large!'))\n return this.queue(null)\n }\n this.queue(data)\n }),\n coder.decode(),\n (read) => {\n const next = looper(() => {\n read(null, (end, data) => {\n if (self._endedLocal) { return }\n if (end === true) { return self.close() }\n if (end) { return self.destroy(end) }\n self._handle(data)\n next()\n })\n })\n next()\n })\n }\n\n /**\n * A convenience wrapper for the log that adds useful metadata to logs\n * @private\n * @param {string} name The name of the operation being logged\n * @param {Buffer|string} data Logged with the metadata. Must be `.toString` capable. Default: `''`\n */\n _log (name, data) {\n log({\n op: name,\n initiator: this._initiator,\n endedLocal: this._endedLocal,\n endedRemote: this._endedRemote,\n data: (data && data.toString()) || ''\n })\n }\n\n get initiator () {\n return this._initiator\n }\n\n /**\n * Closes all open channels\n * @param {Error} err Optional error\n */\n close (err) {\n this._log('close', err)\n\n if (this.destroyed) { return }\n\n if (err) {\n nextTick(emitError, this, err)\n }\n\n err = err || 'Underlying stream has been closed'\n this._endedLocal = true\n\n // propagate close to channels\n const chans = Array.prototype.concat(this._outChannels, this._inChannels)\n for (let chan of chans) {\n if (chan) {\n chan.close(err)\n }\n }\n\n this.emit('close')\n }\n\n get destroyed () {\n return this._endedRemote && this._endedLocal\n }\n\n /**\n * Destroys the parent stream and closes Mplex\n * @param {Error} err\n */\n destroy (err) {\n err = err || new Error('Underlying stream has been closed')\n this._chandata.end(err)\n this.close(err)\n }\n\n /**\n * Pushes data to the stream\n * @param {Buffer} data\n */\n push (data) {\n if (data.data &&\n Buffer.byteLength(data.data) > this._maxMsgSize) {\n this._chandata.end(new Error('message too large!'))\n }\n\n this._chandata.push(data)\n }\n\n /**\n * Creates a new Channel (stream). If Mplex was created with `opts.lazy` set to true,\n * the channel will not automatically be opened.\n *\n * @param {string} name The name of the channel/stream to create\n * @returns {Channel}\n */\n createStream (name) {\n if (typeof name === 'number') { name = name.toString() }\n const chan = this._newStream(null, true, false, name, this._outChannels)\n if (!this._lazy) { chan.openChan(name) }\n return chan\n }\n\n /**\n * Attempts to create a channel if it doesn't already exist.\n * If a channel already exists for `id`, `Mplex#error` will be emitted.\n *\n * @private\n * @param {number} id The id of the channel. If `null` it will be auto incremented from `Mplex._chanId`\n * @param {boolean} initiator Is the channel creating the connection\n * @param {boolean} open Should the channel be opened when created\n * @param {string} name The name of the channel\n * @param {Array} list The channel list to add the channel to\n * @returns {Channel}\n */\n _newStream (id, initiator, open, name, list) {\n if (this.chanSize >= this._maxChannels) {\n this.emit('error', new Error('max channels exceeded'))\n return\n }\n\n if (typeof initiator === 'string') {\n name = initiator\n initiator = false\n open = false\n }\n\n if (typeof open === 'string') {\n name = open\n open = false\n }\n\n id = typeof id === 'number' ? id : this._chanId++\n if (list[id]) {\n this.emit('error', new Error(`channel with id ${id} already exist!`))\n return\n }\n const chan = new Channel({\n id,\n name,\n plex: this,\n initiator,\n open: open || false\n })\n\n return this._addChan(id, chan, list)\n }\n\n /**\n * A convenience method for setting the `chan` up to be tracked.\n * @private\n * @param {number} id The id of the channel\n * @param {Channel} chan The channel to track\n * @param {Array} list The channel list to add the channel to\n * @returns {Channel} `chan`\n */\n _addChan (id, chan, list) {\n chan.once('close', () => {\n list[id] = null\n })\n chan.once('error', (err) => {\n log.err('channel error', err)\n })\n\n list[id] = chan\n return chan\n }\n\n get chanSize () {\n return this._inChannels.size + this._outChannels.size\n }\n\n /**\n * Takes the appropriate course of action based on `msg.type`.\n * If `msg.type` is not recognized `Mplex#error` will be emitted.\n * @param {Message} msg\n */\n _handle (msg) {\n this._log('_handle', msg)\n const { id, type, data } = msg\n switch (type) {\n // Create a new stream\n case Types.NEW: {\n const chan = this._newStream(id, false, true, data.toString(), this._inChannels)\n nextTick(emitStream, this, chan, id)\n break\n }\n\n // Push the data into the channel with the matching id if it exists\n case Types.OUT_MESSAGE:\n case Types.IN_MESSAGE: {\n const list = type & 1 ? this._outChannels : this._inChannels\n const chan = list[id]\n if (chan) {\n chan.push(data)\n }\n break\n }\n\n // Close the channel with the matching id\n case Types.OUT_CLOSE:\n case Types.IN_CLOSE: {\n const list = type & 1 ? this._outChannels : this._inChannels\n const chan = list[id]\n if (chan) {\n chan.close()\n }\n break\n }\n\n // Destroys the channel with the matching id\n case Types.OUT_RESET:\n case Types.IN_RESET: {\n const list = type & 1 ? this._outChannels : this._inChannels\n const chan = list[id]\n if (chan) {\n chan.destroy()\n }\n break\n }\n\n default:\n nextTick(emitError, this, new Error('Invalid message type'))\n }\n }\n}\n\nmodule.exports = Mplex\n","'use strict'\n\nconst EventEmitter = require('events')\nconst pull = require('pull-stream')\nconst Pushable = require('pull-pushable')\n\nconst PROTOCOL = require('./protocol')\nconst encoding = require('./encoding')\nconst getPeerId = require('./peer-id')\nconst libp2p = require('./libp2p')\n\nmodule.exports = class Connection extends EventEmitter {\n constructor (id, ipfs, room) {\n super()\n this._id = id\n this._ipfs = ipfs\n this._room = room\n this._connection = null\n this._connecting = false\n }\n\n push (message) {\n if (this._connection) {\n this._connection.push(encoding(message))\n } else {\n this.once('connect', () => this.push(message))\n if (!this._connecting) {\n this._getConnection()\n }\n }\n }\n\n stop () {\n if (this._connection) {\n this._connection.end()\n }\n }\n\n _getConnection () {\n this._connecting = true\n this._getPeerAddresses(this._id, (err, peerAddresses) => {\n if (err) {\n this.emit('error', err)\n return // early\n }\n\n if (!peerAddresses.length) {\n this.emit('disconnect')\n return // early\n }\n\n libp2p(this._ipfs).dialProtocol(peerAddresses[0], PROTOCOL, (err, conn) => {\n if (err) {\n this.emit('disconnect')\n return // early\n }\n this._connecting = false\n const pushable = Pushable()\n this._connection = pushable\n pull(\n pushable,\n conn,\n pull.onEnd(() => {\n delete this._connection\n this.emit('disconnect')\n })\n )\n this.emit('connect', pushable)\n })\n })\n }\n\n _getPeerAddresses (peerId, callback) {\n this._ipfs.swarm.peers((err, peersAddresses) => {\n if (err) {\n callback(err)\n return // early\n }\n\n callback(\n null,\n peersAddresses\n .filter((peerAddress) => getPeerId(peerAddress.peer) === peerId)\n .map(peerAddress => peerAddress.peer))\n })\n }\n}\n","'use strict';\nmodule.exports = function (arr) {\n\tif (!Array.isArray(arr)) {\n\t\tthrow new TypeError('Expected Array, got ' + typeof arr);\n\t}\n\n\tvar rand;\n\tvar tmp;\n\tvar len = arr.length;\n\tvar ret = arr.slice();\n\n\twhile (len) {\n\t\trand = Math.floor(Math.random() * len--);\n\t\ttmp = ret[len];\n\t\tret[len] = ret[rand];\n\t\tret[rand] = tmp;\n\t}\n\n\treturn ret;\n};\n","'use strict';\n\nfunction createError(msg, code, props) {\n var err = msg instanceof Error ? msg : new Error(msg);\n var key;\n\n if (typeof code === 'object') {\n props = code;\n } else if (code != null) {\n err.code = code;\n }\n\n if (props) {\n for (key in props) {\n err[key] = props[key];\n }\n }\n\n return err;\n}\n\nmodule.exports = createError;\n","'use strict'\n\nconst errcode = require('err-code')\n\nmodule.exports.dbOpenFailedError = (err) => {\n err = err || new Error('Cannot open database')\n return errcode(err, 'ERR_DB_OPEN_FAILED')\n}\n\nmodule.exports.dbDeleteFailedError = (err) => {\n err = err || new Error('Delete failed')\n return errcode(err, 'ERR_DB_DELETE_FAILED')\n}\n\nmodule.exports.dbWriteFailedError = (err) => {\n err = err || new Error('Write failed')\n return errcode(err, 'ERR_DB_WRITE_FAILED')\n}\n\nmodule.exports.notFoundError = (err) => {\n err = err || new Error('Not Found')\n return errcode(err, 'ERR_NOT_FOUND')\n}\n","'use strict'\n\nconst moduleConfig = require('../utils/module-config')\n\nmodule.exports = (arg) => {\n const send = moduleConfig(arg)\n\n return {\n get: require('./get')(send),\n put: require('./put')(send),\n findProvs: require('./findprovs')(send),\n findPeer: require('./findpeer')(send),\n provide: require('./provide')(send),\n // find closest peerId to given peerId\n query: require('./query')(send)\n }\n}\n","'use strict'\n\nconst ConsumableBuffer = require('./consumable-buffer')\n\nmodule.exports = function wrapHash (hashFn) {\n return function hashing (value) {\n if (value instanceof InfiniteHash) {\n // already a hash. return it\n return value\n } else {\n return new InfiniteHash(value, hashFn)\n }\n }\n}\n\nclass InfiniteHash {\n constructor (value, hashFn) {\n if ((typeof value) !== 'string' && !Buffer.isBuffer(value)) {\n throw new Error('can only hash strings or buffers')\n }\n this._value = value\n this._hashFn = hashFn\n this._depth = -1\n this._availableBits = 0\n this._currentBufferIndex = 0\n this._buffers = []\n }\n\n async take (bits) {\n let pendingBits = bits\n\n while (this._availableBits < pendingBits) {\n await this._produceMoreBits()\n }\n\n let result = 0\n\n while (pendingBits > 0) {\n const hash = this._buffers[this._currentBufferIndex]\n const available = Math.min(hash.availableBits(), pendingBits)\n const took = hash.take(available)\n result = (result << available) + took\n pendingBits -= available\n this._availableBits -= available\n\n if (hash.availableBits() === 0) {\n this._currentBufferIndex++\n }\n }\n\n return result\n }\n\n untake (bits) {\n let pendingBits = bits\n\n while (pendingBits > 0) {\n const hash = this._buffers[this._currentBufferIndex]\n const availableForUntake = Math.min(hash.totalBits() - hash.availableBits(), pendingBits)\n hash.untake(availableForUntake)\n pendingBits -= availableForUntake\n this._availableBits += availableForUntake\n\n if (this._currentBufferIndex > 0 && hash.totalBits() === hash.availableBits()) {\n this._depth--\n this._currentBufferIndex--\n }\n }\n }\n\n async _produceMoreBits () {\n this._depth++\n\n const value = this._depth ? this._value + this._depth : this._value\n const hashValue = await this._hashFn(value)\n const buffer = new ConsumableBuffer(hashValue)\n\n this._buffers.push(buffer)\n this._availableBits += buffer.availableBits()\n }\n}\n","/* eslint max-nested-callbacks: [\"error\", 8] */\n'use strict'\n\nconst callbackify = require('callbackify')\nconst errCode = require('err-code')\nconst multibase = require('multibase')\nconst { resolvePath } = require('../utils')\nconst PinManager = require('./pin/pin-manager')\nconst PinTypes = PinManager.PinTypes\n\nmodule.exports = (self) => {\n const dag = self.dag\n const pinManager = new PinManager(self._repo, dag)\n\n const pin = {\n add: callbackify.variadic(async (paths, options) => {\n options = options || {}\n\n const recursive = options.recursive !== false\n const cids = await resolvePath(self.object, paths)\n const pinAdd = async () => {\n const results = []\n\n // verify that each hash can be pinned\n for (const cid of cids) {\n const key = cid.toBaseEncodedString()\n\n if (recursive) {\n if (pinManager.recursivePins.has(key)) {\n // it's already pinned recursively\n results.push(key)\n\n continue\n }\n\n // entire graph of nested links should be pinned,\n // so make sure we have all the objects\n await pinManager.fetchCompleteDag(key, { preload: options.preload })\n\n // found all objects, we can add the pin\n results.push(key)\n } else {\n if (pinManager.recursivePins.has(key)) {\n // recursive supersedes direct, can't have both\n throw new Error(`${key} already pinned recursively`)\n }\n\n if (!pinManager.directPins.has(key)) {\n // make sure we have the object\n await dag.get(cid, { preload: options.preload })\n }\n\n results.push(key)\n }\n }\n\n // update the pin sets in memory\n const pinset = recursive ? pinManager.recursivePins : pinManager.directPins\n results.forEach(key => pinset.add(key))\n\n // persist updated pin sets to datastore\n await pinManager.flushPins()\n\n return results.map(hash => ({ hash }))\n }\n\n // When adding a file, we take a lock that gets released after pinning\n // is complete, so don't take a second lock here\n const lock = Boolean(options.lock)\n\n if (!lock) {\n return pinAdd()\n }\n\n const release = await self._gcLock.readLock()\n\n try {\n await pinAdd()\n } finally {\n release()\n }\n }),\n\n rm: callbackify.variadic(async (paths, options) => {\n options = options || {}\n\n const recursive = options.recursive == null ? true : options.recursive\n\n if (options.cidBase && !multibase.names.includes(options.cidBase)) {\n throw errCode(new Error('invalid multibase'), 'ERR_INVALID_MULTIBASE')\n }\n\n const cids = await resolvePath(self.object, paths)\n const release = await self._gcLock.readLock()\n const results = []\n\n try {\n // verify that each hash can be unpinned\n for (const cid of cids) {\n const res = await pinManager.isPinnedWithType(cid, PinTypes.all)\n\n const { pinned, reason } = res\n const key = cid.toBaseEncodedString()\n\n if (!pinned) {\n throw new Error(`${key} is not pinned`)\n }\n\n switch (reason) {\n case (PinTypes.recursive):\n if (!recursive) {\n throw new Error(`${key} is pinned recursively`)\n }\n\n results.push(key)\n\n break\n case (PinTypes.direct):\n results.push(key)\n\n break\n default:\n throw new Error(`${key} is pinned indirectly under ${reason}`)\n }\n }\n\n // update the pin sets in memory\n results.forEach(key => {\n if (recursive && pinManager.recursivePins.has(key)) {\n pinManager.recursivePins.delete(key)\n } else {\n pinManager.directPins.delete(key)\n }\n })\n\n // persist updated pin sets to datastore\n await pinManager.flushPins()\n\n self.log(`Removed pins: ${results}`)\n\n return results.map(hash => ({ hash }))\n } finally {\n release()\n }\n }),\n\n ls: callbackify.variadic(async (paths, options) => {\n options = options || {}\n\n let type = PinTypes.all\n\n if (paths && paths.type) {\n options = paths\n paths = null\n }\n\n if (options.type) {\n type = options.type\n if (typeof options.type === 'string') {\n type = options.type.toLowerCase()\n }\n const err = PinManager.checkPinType(type)\n if (err) {\n throw err\n }\n }\n\n if (paths) {\n // check the pinned state of specific hashes\n const cids = await resolvePath(self.object, paths)\n const results = []\n\n for (const cid of cids) {\n const { key, reason, pinned } = await pinManager.isPinnedWithType(cid, type)\n\n if (pinned) {\n switch (reason) {\n case PinTypes.direct:\n case PinTypes.recursive:\n results.push({\n hash: key,\n type: reason\n })\n break\n default:\n results.push({\n hash: key,\n type: `${PinTypes.indirect} through ${reason}`\n })\n }\n }\n }\n\n if (!results.length) {\n throw new Error(`path '${paths}' is not pinned`)\n }\n\n return results\n }\n\n // show all pinned items of type\n let pins = []\n\n if (type === PinTypes.direct || type === PinTypes.all) {\n pins = pins.concat(\n Array.from(pinManager.directPins).map(hash => ({\n type: PinTypes.direct,\n hash\n }))\n )\n }\n\n if (type === PinTypes.recursive || type === PinTypes.all) {\n pins = pins.concat(\n Array.from(pinManager.recursivePins).map(hash => ({\n type: PinTypes.recursive,\n hash\n }))\n )\n }\n\n if (type === PinTypes.indirect || type === PinTypes.all) {\n const indirects = await pinManager.getIndirectKeys(options)\n\n pins = pins\n // if something is pinned both directly and indirectly,\n // report the indirect entry\n .filter(({ hash }) =>\n !indirects.includes(hash) ||\n (indirects.includes(hash) && !pinManager.directPins.has(hash))\n )\n .concat(indirects.map(hash => ({\n type: PinTypes.indirect,\n hash\n })))\n\n return pins\n }\n\n return pins\n }),\n\n // used by tests\n pinManager\n }\n\n return pin\n}\n","const FixedFIFO = require('./fixed-size')\n\nmodule.exports = class FastFIFO {\n constructor (hwm) {\n this.hwm = hwm || 16\n this.head = new FixedFIFO(this.hwm)\n this.tail = this.head\n }\n\n push (val) {\n if (!this.head.push(val)) {\n const prev = this.head\n this.head = prev.next = new FixedFIFO(2 * this.head.buffer.length)\n this.head.push(val)\n }\n }\n\n shift () {\n const val = this.tail.shift()\n if (val === undefined && this.tail.next) {\n const next = this.tail.next\n this.tail.next = null\n this.tail = next\n return this.tail.shift()\n }\n return val\n }\n\n isEmpty () {\n return this.head.isEmpty()\n }\n}\n","'use strict'\n\nconst path = require('path')\nconst os = require('os')\nconst uuid = require('uuid/v4')\n\nexports.filter = (iterable, filterer) => {\n return (async function * () {\n for await (const value of iterable) {\n const keep = await filterer(value)\n if (!keep) continue\n yield value\n }\n })()\n}\n\n// Not just sort, because the sorter is given all the values and should return\n// them all sorted\nexports.sortAll = (iterable, sorter) => {\n return (async function * () {\n let values = []\n for await (const value of iterable) values.push(value)\n values = await sorter(values)\n for (const value of values) yield value\n })()\n}\n\nexports.take = (iterable, n) => {\n return (async function * () {\n if (n <= 0) return\n let i = 0\n for await (const value of iterable) {\n yield value\n i++\n if (i >= n) return\n }\n })()\n}\n\nexports.map = (iterable, mapper) => {\n return (async function * () {\n for await (const value of iterable) {\n yield mapper(value)\n }\n })()\n}\n\nexports.replaceStartWith = function (s, r) {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n\nexports.tmpdir = () => {\n return path.join(os.tmpdir(), uuid())\n}\n","'use strict'\n\nmodule.exports = function count (max) {\n var i = 0; max = max || Infinity\n return function (end, cb) {\n if(end) return cb && cb(end)\n if(i > max)\n return cb(true)\n cb(null, i++)\n }\n}\n\n\n","var inherits = require('inherits')\nvar SHA512 = require('./sha512')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar W = new Array(160)\n\nfunction Sha384 () {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha384, SHA512)\n\nSha384.prototype.init = function () {\n this._ah = 0xcbbb9d5d\n this._bh = 0x629a292a\n this._ch = 0x9159015a\n this._dh = 0x152fecd8\n this._eh = 0x67332667\n this._fh = 0x8eb44a87\n this._gh = 0xdb0c2e0d\n this._hh = 0x47b5481d\n\n this._al = 0xc1059ed8\n this._bl = 0x367cd507\n this._cl = 0x3070dd17\n this._dl = 0xf70e5939\n this._el = 0xffc00b31\n this._fl = 0x68581511\n this._gl = 0x64f98fa7\n this._hl = 0xbefa4fa4\n\n return this\n}\n\nSha384.prototype._hash = function () {\n var H = Buffer.allocUnsafe(48)\n\n function writeInt64BE (h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._ah, this._al, 0)\n writeInt64BE(this._bh, this._bl, 8)\n writeInt64BE(this._ch, this._cl, 16)\n writeInt64BE(this._dh, this._dl, 24)\n writeInt64BE(this._eh, this._el, 32)\n writeInt64BE(this._fh, this._fl, 40)\n\n return H\n}\n\nmodule.exports = Sha384\n","'use strict'\n\nconst { Key, Errors, utils } = require('interface-datastore')\nconst { filter, map, take, sortAll } = utils\n\n/**\n * A datastore backed by leveldb.\n */\nclass LevelDatastore {\n constructor (path, opts) {\n let database\n\n if (opts && opts.db) {\n database = opts.db\n delete opts.db\n } else {\n database = require('level')\n }\n\n this.db = database(path, {\n ...opts,\n valueEncoding: 'binary',\n compression: false // same default as go\n })\n }\n\n async open () {\n try {\n await this.db.open()\n } catch (err) {\n throw Errors.dbOpenFailedError(err)\n }\n }\n\n async put (key, value) {\n try {\n await this.db.put(key.toString(), value)\n } catch (err) {\n throw Errors.dbWriteFailedError(err)\n }\n }\n\n async get (key) {\n let data\n try {\n data = await this.db.get(key.toString())\n } catch (err) {\n if (err.notFound) throw Errors.notFoundError(err)\n throw Errors.dbWriteFailedError(err)\n }\n return data\n }\n\n async has (key) {\n try {\n await this.db.get(key.toString())\n } catch (err) {\n if (err.notFound) return false\n throw err\n }\n return true\n }\n\n async delete (key) {\n try {\n await this.db.del(key.toString())\n } catch (err) {\n throw Errors.dbDeleteFailedError(err)\n }\n }\n\n close () {\n return this.db.close()\n }\n\n batch () {\n const ops = []\n return {\n put: (key, value) => {\n ops.push({\n type: 'put',\n key: key.toString(),\n value: value\n })\n },\n delete: (key) => {\n ops.push({\n type: 'del',\n key: key.toString()\n })\n },\n commit: () => {\n return this.db.batch(ops)\n }\n }\n }\n\n query (q) {\n let values = true\n if (q.keysOnly != null) {\n values = !q.keysOnly\n }\n\n let it = levelIteratorToIterator(\n this.db.db.iterator({\n keys: true,\n values: values,\n keyAsBuffer: true\n })\n )\n\n it = map(it, ({ key, value }) => {\n const res = { key: new Key(key, false) }\n if (values) {\n res.value = Buffer.from(value)\n }\n return res\n })\n\n if (q.prefix != null) {\n it = filter(it, e => e.key.toString().startsWith(q.prefix))\n }\n\n if (Array.isArray(q.filters)) {\n it = q.filters.reduce((it, f) => filter(it, f), it)\n }\n\n if (Array.isArray(q.orders)) {\n it = q.orders.reduce((it, f) => sortAll(it, f), it)\n }\n\n if (q.offset != null) {\n let i = 0\n it = filter(it, () => i++ >= q.offset)\n }\n\n if (q.limit != null) {\n it = take(it, q.limit)\n }\n\n return it\n }\n}\n\nfunction levelIteratorToIterator (li) {\n return {\n next: () => new Promise((resolve, reject) => {\n li.next((err, key, value) => {\n if (err) return reject(err)\n if (key == null) return resolve({ done: true })\n resolve({ done: false, value: { key, value } })\n })\n }),\n return: () => new Promise((resolve, reject) => {\n li.end(err => {\n if (err) return reject(err)\n resolve({ done: true })\n })\n }),\n [Symbol.asyncIterator] () {\n return this\n }\n }\n}\n\nmodule.exports = LevelDatastore\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","'use strict'\n\nconst { createFromPrivKey } = require('peer-id')\nconst promisify = require('promisify-es6')\n\nconst errcode = require('err-code')\nconst debug = require('debug')\nconst log = debug('ipfs:ipns')\nlog.error = debug('ipfs:ipns:error')\n\nconst IpnsPublisher = require('./publisher')\nconst IpnsRepublisher = require('./republisher')\nconst IpnsResolver = require('./resolver')\nconst path = require('./path')\nconst { normalizePath } = require('../utils')\nconst TLRU = require('../../utils/tlru')\nconst defaultRecordTtl = 60 * 1000\n\nclass IPNS {\n constructor (routing, datastore, peerInfo, keychain, options) {\n this.publisher = new IpnsPublisher(routing, datastore)\n this.republisher = new IpnsRepublisher(this.publisher, datastore, peerInfo, keychain, options)\n this.resolver = new IpnsResolver(routing)\n this.cache = new TLRU(1000)\n this.routing = routing\n }\n\n // Publish\n async publish (privKey, value, lifetime = IpnsPublisher.defaultRecordLifetime) {\n try {\n value = normalizePath(value)\n\n const peerId = await promisify(createFromPrivKey)(privKey.bytes)\n await this.publisher.publishWithEOL(privKey, value, lifetime)\n\n log(`IPNS value ${value} was published correctly`)\n\n // // Add to cache\n const id = peerId.toB58String()\n const ttEol = parseFloat(lifetime)\n const ttl = (ttEol < defaultRecordTtl) ? ttEol : defaultRecordTtl\n\n this.cache.set(id, value, ttl)\n\n log(`IPNS value ${value} was cached correctly`)\n\n return {\n name: id,\n value: value\n }\n } catch (err) {\n log.error(err)\n\n throw err\n }\n }\n\n // Resolve\n async resolve (name, options) {\n if (typeof name !== 'string') {\n throw errcode(new Error('name received is not valid'), 'ERR_INVALID_NAME')\n }\n\n options = options || {}\n\n // If recursive, we should not try to get the cached value\n if (!options.nocache && !options.recursive) {\n // Try to get the record from cache\n const id = name.split('/')[2]\n const result = this.cache.get(id)\n\n if (result) {\n return result\n }\n }\n\n try {\n const result = await this.resolver.resolve(name, options)\n\n log(`IPNS record from ${name} was resolved correctly`)\n\n return result\n } catch (err) {\n log.error(err)\n\n throw err\n }\n }\n\n // Initialize keyspace\n // sets the ipns record for the given key to point to an empty directory\n async initializeKeyspace (privKey, value) { // eslint-disable-line require-await\n return this.publish(privKey, value, IpnsPublisher.defaultRecordLifetime)\n }\n}\n\nIPNS.path = path\n\nmodule.exports = IPNS\n","/**\n * Define a struct error.\n *\n * @type {StructError}\n */\n\nclass StructError extends TypeError {\n static format(attrs) {\n const { type, path, value } = attrs;\n const message = `Expected a value of type \\`${type}\\`${path.length ? ` for \\`${path.join('.')}\\`` : ''} but received \\`${JSON.stringify(value)}\\`.`;\n return message;\n }\n\n constructor(attrs) {\n const message = StructError.format(attrs);\n super(message);\n\n const { data, path, value, reason, type, errors = [] } = attrs;\n this.data = data;\n this.path = path;\n this.value = value;\n this.reason = reason;\n this.type = type;\n this.errors = errors;\n\n if (!errors.length) {\n errors.push(this);\n }\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = new Error().stack;\n }\n }\n}\n\nvar toString = Object.prototype.toString;\n\nvar kindOf = function kindOf(val) {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n\n var type = typeof val;\n if (type === 'boolean') return 'boolean';\n if (type === 'string') return 'string';\n if (type === 'number') return 'number';\n if (type === 'symbol') return 'symbol';\n if (type === 'function') {\n return isGeneratorFn(val) ? 'generatorfunction' : 'function';\n }\n\n if (isArray(val)) return 'array';\n if (isBuffer(val)) return 'buffer';\n if (isArguments(val)) return 'arguments';\n if (isDate(val)) return 'date';\n if (isError(val)) return 'error';\n if (isRegexp(val)) return 'regexp';\n\n switch (ctorName(val)) {\n case 'Symbol': return 'symbol';\n case 'Promise': return 'promise';\n\n // Set, Map, WeakSet, WeakMap\n case 'WeakMap': return 'weakmap';\n case 'WeakSet': return 'weakset';\n case 'Map': return 'map';\n case 'Set': return 'set';\n\n // 8-bit typed arrays\n case 'Int8Array': return 'int8array';\n case 'Uint8Array': return 'uint8array';\n case 'Uint8ClampedArray': return 'uint8clampedarray';\n\n // 16-bit typed arrays\n case 'Int16Array': return 'int16array';\n case 'Uint16Array': return 'uint16array';\n\n // 32-bit typed arrays\n case 'Int32Array': return 'int32array';\n case 'Uint32Array': return 'uint32array';\n case 'Float32Array': return 'float32array';\n case 'Float64Array': return 'float64array';\n }\n\n if (isGeneratorObj(val)) {\n return 'generator';\n }\n\n // Non-plain objects\n type = toString.call(val);\n switch (type) {\n case '[object Object]': return 'object';\n // iterators\n case '[object Map Iterator]': return 'mapiterator';\n case '[object Set Iterator]': return 'setiterator';\n case '[object String Iterator]': return 'stringiterator';\n case '[object Array Iterator]': return 'arrayiterator';\n }\n\n // other\n return type.slice(8, -1).toLowerCase().replace(/\\s/g, '');\n};\n\nfunction ctorName(val) {\n return val.constructor ? val.constructor.name : null;\n}\n\nfunction isArray(val) {\n if (Array.isArray) return Array.isArray(val);\n return val instanceof Array;\n}\n\nfunction isError(val) {\n return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');\n}\n\nfunction isDate(val) {\n if (val instanceof Date) return true;\n return typeof val.toDateString === 'function'\n && typeof val.getDate === 'function'\n && typeof val.setDate === 'function';\n}\n\nfunction isRegexp(val) {\n if (val instanceof RegExp) return true;\n return typeof val.flags === 'string'\n && typeof val.ignoreCase === 'boolean'\n && typeof val.multiline === 'boolean'\n && typeof val.global === 'boolean';\n}\n\nfunction isGeneratorFn(name, val) {\n return ctorName(name) === 'GeneratorFunction';\n}\n\nfunction isGeneratorObj(val) {\n return typeof val.throw === 'function'\n && typeof val.return === 'function'\n && typeof val.next === 'function';\n}\n\nfunction isArguments(val) {\n try {\n if (typeof val.length === 'number' && typeof val.callee === 'function') {\n return true;\n }\n } catch (err) {\n if (err.message.indexOf('callee') !== -1) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * If you need to support Safari 5-7 (8-10 yr-old browser),\n * take a look at https://github.com/feross/is-buffer\n */\n\nfunction isBuffer(val) {\n if (val.constructor && typeof val.constructor.isBuffer === 'function') {\n return val.constructor.isBuffer(val);\n }\n return false;\n}\n\n/**\n * A private string to identify structs by.\n *\n * @type {String}\n */\n\nconst IS_STRUCT = '@@__STRUCT__@@';\n\n/**\n * A private string to refer to a struct's kind.\n *\n * @type {String}\n */\n\nconst KIND = '@@__KIND__@@';\n\n/**\n * Check if a `value` is a struct.\n *\n * @param {Any} value\n * @return {Boolean}\n */\n\nfunction isStruct(value) {\n return !!(value && value[IS_STRUCT]);\n}\n\n/**\n * Resolve `defaults`, for an optional `value`.\n *\n * @param {Function|Any} defaults\n * @param {Any} value\n * @return {Any}\n */\n\nfunction resolveDefaults(defaults, value) {\n return typeof defaults === 'function' ? defaults(value) : defaults;\n}\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\n/**\n * Kind.\n *\n * @type {Kind}\n */\n\nclass Kind {\n constructor(name, type, validate) {\n this.name = name;\n this.type = type;\n this.validate = validate;\n }\n}\n\n/**\n * Any.\n *\n * @param {Array|Function|Object|String} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction any(schema, defaults$$1, options) {\n if (isStruct(schema)) {\n return schema[KIND];\n }\n\n if (schema instanceof Kind) {\n return schema;\n }\n\n switch (kindOf(schema)) {\n case 'array':\n {\n return schema.length > 1 ? tuple(schema, defaults$$1, options) : list(schema, defaults$$1, options);\n }\n\n case 'function':\n {\n return func(schema, defaults$$1, options);\n }\n\n case 'object':\n {\n return object(schema, defaults$$1, options);\n }\n\n case 'string':\n {\n let required = true;\n let type;\n\n if (schema.endsWith('?')) {\n required = false;\n schema = schema.slice(0, -1);\n }\n\n if (schema.includes('|')) {\n const scalars = schema.split(/\\s*\\|\\s*/g);\n type = union(scalars, defaults$$1, options);\n } else if (schema.includes('&')) {\n const scalars = schema.split(/\\s*&\\s*/g);\n type = intersection(scalars, defaults$$1, options);\n } else {\n type = scalar(schema, defaults$$1, options);\n }\n\n if (!required) {\n type = optional(type, undefined, options);\n }\n\n return type;\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`A schema definition must be an object, array, string or function, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n}\n\n/**\n * Dict.\n *\n * @param {Array} schema\n * @param {Object} defaults\n * @param {Object} options\n */\n\nfunction dict(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'array' || schema.length !== 2) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Dict structs must be defined as an array with two elements, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const obj = scalar('object', undefined, options);\n const keys = any(schema[0], undefined, options);\n const values = any(schema[1], undefined, options);\n const name = 'dict';\n const type = `dict<${keys.type},${values.type}>`;\n const validate = value => {\n const resolved = resolveDefaults(defaults$$1);\n value = resolved ? _extends({}, resolved, value) : value;\n const [error] = obj.validate(value);\n\n if (error) {\n error.type = type;\n return [error];\n }\n\n const ret = {};\n const errors = [];\n\n for (let k in value) {\n const v = value[k];\n const [e, r] = keys.validate(k);\n\n if (e) {\n const allE = e.errors || [e];\n allE.forEach(singleE => {\n singleE.path = [k].concat(singleE.path);\n singleE.data = value;\n errors.push(singleE);\n });\n continue;\n }\n\n k = r;\n const [e2, r2] = values.validate(v);\n\n if (e2) {\n const allE2 = e2.errors || [e2];\n allE2.forEach(singleE => {\n singleE.path = [k].concat(singleE.path);\n singleE.data = value;\n errors.push(singleE);\n });\n continue;\n }\n\n ret[k] = r2;\n }\n\n return errors.length ? [_extends({}, errors[0], { errors })] : [undefined, ret];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Enum.\n *\n * @param {Array} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction en(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'array') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Enum structs must be defined as an array, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const name = 'enum';\n const type = schema.map(s => {\n try {\n return JSON.stringify(s);\n } catch (e) {\n return String(s);\n }\n }).join(' | ');\n\n const validate = (value = resolveDefaults(defaults$$1)) => {\n return schema.includes(value) ? [undefined, value] : [{ data: value, path: [], value, type }];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Enums.\n *\n * @param {Array} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction enums(schema, defaults$$1, options) {\n const e = en(schema, undefined, options);\n const l = list([e], defaults$$1, options);\n return l;\n}\n\n/**\n * Function.\n *\n * @param {Function} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction func(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Function structs must be defined as a function, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const name = 'function';\n const type = '';\n const validate = (value = resolveDefaults(defaults$$1), data) => {\n const result = schema(value, data);\n let failure = { path: [], reason: null };\n let isValid;\n\n switch (kindOf(result)) {\n case 'boolean':\n {\n isValid = result;\n break;\n }\n case 'string':\n {\n isValid = false;\n failure.reason = result;\n break;\n }\n case 'object':\n {\n isValid = false;\n failure = _extends({}, failure, result);\n break;\n }\n default:\n {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Validator functions must return a boolean, an error reason string or an error reason object, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid result: ${result}`);\n }\n }\n }\n\n return isValid ? [undefined, value] : [_extends({ type, value, data: value }, failure)];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Instance.\n *\n * @param {Array} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction instance(schema, defaults$$1, options) {\n const name = 'instance';\n const type = `instance<${schema.name}>`;\n const validate = (value = resolveDefaults(defaults$$1)) => {\n return value instanceof schema ? [undefined, value] : [{ data: value, path: [], value, type }];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Interface.\n *\n * @param {Object} schema\n * @param {Object} defaults\n * @param {Object} options\n */\n\nfunction inter(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'object') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Interface structs must be defined as an object, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const obj = scalar('object', undefined, options);\n const ks = [];\n const properties = {};\n\n for (const key in schema) {\n ks.push(key);\n const s = schema[key];\n const kind = any(s, undefined, options);\n properties[key] = kind;\n }\n\n const name = 'interface';\n const type = `{${ks.join()}}`;\n const validate = (value = resolveDefaults(defaults$$1)) => {\n const [error] = obj.validate(value);\n\n if (error) {\n error.type = type;\n return [error];\n }\n\n const errors = [];\n const ret = value;\n\n for (const key in properties) {\n let v = value[key];\n const kind = properties[key];\n\n if (v === undefined) {\n const d = defaults$$1 && defaults$$1[key];\n v = resolveDefaults(d, value);\n }\n\n const [e, r] = kind.validate(v, value);\n\n if (e) {\n const allE = e.errors || [e];\n allE.forEach(singleE => {\n singleE.path = [key].concat(singleE.path);\n singleE.data = value;\n errors.push(singleE);\n });\n continue;\n }\n\n if (key in value || r !== undefined) {\n ret[key] = r;\n }\n }\n\n return errors.length ? [_extends({}, errors[0], { errors })] : [undefined, ret];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Lazy.\n *\n * @param {Function} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction lazy(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Lazy structs must be defined as an function that returns a schema, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n let kind;\n let struct;\n const name = 'lazy';\n const type = `lazy...`;\n const compile = value => {\n struct = schema();\n kind.name = struct.kind;\n kind.type = struct.type;\n kind.validate = struct.validate;\n return kind.validate(value);\n };\n\n kind = new Kind(name, type, compile);\n return kind;\n}\n\n/**\n * Dynamic.\n *\n * @param {Function} createSchema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction dynamic(createSchema, defaults$$1, options) {\n if (kindOf(createSchema) !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Dynamic structs must be defined as a function, but you passed: ${createSchema}`);\n } else {\n throw new Error(`Invalid schema: ${createSchema}`);\n }\n }\n\n const name = 'dynamic';\n const type = 'dynamic...';\n const validate = (value = resolveDefaults(defaults$$1), data) => {\n const schema = createSchema(value, data);\n\n if (kindOf(schema) !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Dynamic structs must return a schema, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const [error, result] = schema.validate(value);\n\n if (error) {\n return [error];\n }\n\n return [undefined, result];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * List.\n *\n * @param {Array} schema\n * @param {Array} defaults\n * @param {Object} options\n */\n\nfunction list(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'array' || schema.length !== 1) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`List structs must be defined as an array with a single element, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const array = scalar('array', undefined, options);\n const element = any(schema[0], undefined, options);\n const name = 'list';\n const type = `[${element.type}]`;\n const validate = (value = resolveDefaults(defaults$$1)) => {\n const [error, result] = array.validate(value);\n\n if (error) {\n error.type = type;\n return [error];\n }\n\n value = result;\n const errors = [];\n const ret = [];\n\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n const [e, r] = element.validate(v);\n\n if (e) {\n const allE = e.errors || [e];\n allE.forEach(singleE => {\n singleE.path = [i].concat(singleE.path);\n singleE.data = value;\n errors.push(singleE);\n });\n continue;\n }\n\n ret[i] = r;\n }\n\n return errors.length ? [_extends({}, errors[0], { errors })] : [undefined, ret];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Literal.\n *\n * @param {Array} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction literal(schema, defaults$$1, options) {\n const name = 'literal';\n const type = `literal: ${JSON.stringify(schema)}`;\n const validate = (value = resolveDefaults(defaults$$1)) => {\n return value === schema ? [undefined, value] : [{ data: value, path: [], value, type }];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Object.\n *\n * @param {Object} schema\n * @param {Object} defaults\n * @param {Object} options\n */\n\nfunction object(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'object') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Object structs must be defined as an object, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const obj = scalar('object', undefined, options);\n const ks = [];\n const properties = {};\n\n for (const key in schema) {\n ks.push(key);\n const s = schema[key];\n const kind = any(s, undefined, options);\n properties[key] = kind;\n }\n\n const name = 'object';\n const type = `{${ks.join()}}`;\n const validate = (value = resolveDefaults(defaults$$1)) => {\n const [error] = obj.validate(value);\n\n if (error) {\n error.type = type;\n return [error];\n }\n\n const errors = [];\n const ret = {};\n const valueKeys = Object.keys(value);\n const propertiesKeys = Object.keys(properties);\n const keys = new Set(valueKeys.concat(propertiesKeys));\n\n keys.forEach(key => {\n let v = value[key];\n const kind = properties[key];\n\n if (v === undefined) {\n const d = defaults$$1 && defaults$$1[key];\n v = resolveDefaults(d, value);\n }\n\n if (!kind) {\n const e = { data: value, path: [key], value: v };\n errors.push(e);\n return;\n }\n\n const [e, r] = kind.validate(v, value);\n\n if (e) {\n const allE = e.errors || [e];\n allE.forEach(singleE => {\n singleE.path = [key].concat(singleE.path);\n singleE.data = value;\n errors.push(singleE);\n });\n return;\n }\n\n if (key in value || r !== undefined) {\n ret[key] = r;\n }\n });\n\n return errors.length ? [_extends({}, errors[0], { errors })] : [undefined, ret];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Optional.\n *\n * @param {Any} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction optional(schema, defaults$$1, options) {\n return union([schema, 'undefined'], defaults$$1, options);\n}\n\n/**\n * Partial.\n *\n * @param {Object} schema\n * @param {Object} defaults\n * @param {Object} options\n */\n\nfunction partial(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'object') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Partial structs must be defined as an object, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const obj = scalar('object', undefined, options);\n const ks = [];\n const properties = {};\n\n for (const key in schema) {\n ks.push(key);\n const s = schema[key];\n const kind = any(s, undefined, options);\n properties[key] = kind;\n }\n\n const name = 'partial';\n const type = `{${ks.join()},...}`;\n const validate = (value = resolveDefaults(defaults$$1)) => {\n const [error] = obj.validate(value);\n\n if (error) {\n error.type = type;\n return [error];\n }\n\n const errors = [];\n const ret = {};\n\n for (const key in properties) {\n let v = value[key];\n const kind = properties[key];\n\n if (v === undefined) {\n const d = defaults$$1 && defaults$$1[key];\n v = resolveDefaults(d, value);\n }\n\n const [e, r] = kind.validate(v, value);\n\n if (e) {\n const allE = e.errors || [e];\n allE.forEach(singleE => {\n singleE.path = [key].concat(singleE.path);\n singleE.data = value;\n errors.push(singleE);\n });\n continue;\n }\n\n if (key in value || r !== undefined) {\n ret[key] = r;\n }\n }\n\n return errors.length ? [_extends({}, errors[0], { errors })] : [undefined, ret];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Scalar.\n *\n * @param {String} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction scalar(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'string') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Scalar structs must be defined as a string, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const { types } = options;\n const fn = types[schema];\n\n if (kindOf(fn) !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`No struct validator function found for type \"${schema}\".`);\n } else {\n throw new Error(`Invalid type: ${schema}`);\n }\n }\n\n const kind = func(fn, defaults$$1, options);\n const name = 'scalar';\n const type = schema;\n const validate = value => {\n const [error, result] = kind.validate(value);\n\n if (error) {\n error.type = type;\n return [error];\n }\n\n return [undefined, result];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Tuple.\n *\n * @param {Array} schema\n * @param {Array} defaults\n * @param {Object} options\n */\n\nfunction tuple(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'array') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Tuple structs must be defined as an array, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const kinds = schema.map(s => any(s, undefined, options));\n const array = scalar('array', undefined, options);\n const name = 'tuple';\n const type = `[${kinds.map(k => k.type).join()}]`;\n const validate = (value = resolveDefaults(defaults$$1)) => {\n const [error] = array.validate(value);\n\n if (error) {\n error.type = type;\n return [error];\n }\n\n const ret = [];\n const errors = [];\n const length = Math.max(value.length, kinds.length);\n\n for (let i = 0; i < length; i++) {\n const kind = kinds[i];\n const v = value[i];\n\n if (!kind) {\n const e = { data: value, path: [i], value: v };\n errors.push(e);\n continue;\n }\n\n const [e, r] = kind.validate(v);\n\n if (e) {\n const allE = e.errors || [e];\n allE.forEach(singleE => {\n singleE.path = [i].concat(singleE.path);\n singleE.data = value;\n errors.push(singleE);\n });\n continue;\n }\n\n ret[i] = r;\n }\n\n return errors.length ? [_extends({}, errors[0], { errors })] : [undefined, ret];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Union.\n *\n * @param {Array} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction union(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'array') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Union structs must be defined as an array, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const kinds = schema.map(s => any(s, undefined, options));\n const name = 'union';\n const type = kinds.map(k => k.type).join(' | ');\n const validate = (value = resolveDefaults(defaults$$1)) => {\n const errors = [];\n\n for (const k of kinds) {\n const [e, r] = k.validate(value);\n\n if (!e) {\n return [undefined, r];\n }\n\n errors.push(e);\n }\n errors[0].type = type;\n return errors;\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Intersection.\n *\n * @param {Array} schema\n * @param {Any} defaults\n * @param {Object} options\n */\n\nfunction intersection(schema, defaults$$1, options) {\n if (kindOf(schema) !== 'array') {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Intersection structs must be defined as an array, but you passed: ${schema}`);\n } else {\n throw new Error(`Invalid schema: ${schema}`);\n }\n }\n\n const types = schema.map(s => any(s, undefined, options));\n const name = 'intersection';\n const type = types.map(t => t.type).join(' & ');\n const validate = (value = resolveDefaults(defaults$$1)) => {\n let v = value;\n\n for (const t of types) {\n const [e, r] = t.validate(v);\n\n if (e) {\n e.type = type;\n return [e];\n }\n\n v = r;\n }\n\n return [undefined, v];\n };\n\n return new Kind(name, type, validate);\n}\n\n/**\n * Kinds.\n *\n * @type {Object}\n */\n\nconst Kinds = {\n any,\n dict,\n enum: en,\n enums,\n function: func,\n instance,\n interface: inter,\n lazy,\n list,\n literal,\n object,\n optional,\n partial,\n scalar,\n tuple,\n union,\n intersection,\n dynamic\n\n /**\n * Export.\n *\n * @type {Object}\n */\n\n};\n\n/**\n * The types that `kind-of` supports.\n *\n * @type {Array}\n */\n\nconst TYPES = ['arguments', 'array', 'boolean', 'buffer', 'error', 'float32array', 'float64array', 'function', 'generatorfunction', 'int16array', 'int32array', 'int8array', 'map', 'null', 'number', 'object', 'promise', 'regexp', 'set', 'string', 'symbol', 'uint16array', 'uint32array', 'uint8array', 'uint8clampedarray', 'undefined', 'weakmap', 'weakset'];\n\n/**\n * The default types that Superstruct ships with.\n *\n * @type {Object}\n */\n\nconst Types = {\n any: value => value !== undefined\n};\n\nTYPES.forEach(type => {\n Types[type] = value => kindOf(value) === type;\n});\n\n/**\n * Handle the 'date' case specially, to throw out invalid `Date` objects.\n *\n * @param {Mixed} value\n * @return {Boolean}\n */\n\nTypes.date = value => kindOf(value) === 'date' && !isNaN(value);\n\n/**\n * Create a struct factory with a `config`.\n *\n * @param {Object} config\n * @return {Function}\n */\n\nfunction superstruct(config = {}) {\n const types = _extends({}, Types, config.types || {});\n\n /**\n * Create a `kind` struct with `schema`, `defaults` and `options`.\n *\n * @param {Any} schema\n * @param {Any} defaults\n * @param {Object} options\n * @return {Function}\n */\n\n function struct(schema, defaults$$1, options = {}) {\n if (isStruct(schema)) {\n schema = schema.schema;\n }\n\n const kind = Kinds.any(schema, defaults$$1, _extends({}, options, { types }));\n\n function Struct(data) {\n if (this instanceof Struct) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('The `Struct` creation function should not be used with the `new` keyword.');\n } else {\n throw new Error('Invalid `new` keyword!');\n }\n }\n\n return Struct.assert(data);\n }\n\n Object.defineProperty(Struct, IS_STRUCT, { value: true });\n Object.defineProperty(Struct, KIND, { value: kind });\n\n Struct.kind = kind.name;\n Struct.type = kind.type;\n Struct.schema = schema;\n Struct.defaults = defaults$$1;\n Struct.options = options;\n\n Struct.assert = value => {\n const [error, result] = kind.validate(value);\n\n if (error) {\n throw new StructError(error);\n }\n\n return result;\n };\n\n Struct.test = value => {\n const [error] = kind.validate(value);\n return !error;\n };\n\n Struct.validate = value => {\n const [error, result] = kind.validate(value);\n\n if (error) {\n return [new StructError(error)];\n }\n\n return [undefined, result];\n };\n\n return Struct;\n }\n\n /**\n * Mix in a factory for each specific kind of struct.\n */\n\n Object.keys(Kinds).forEach(name => {\n const kind = Kinds[name];\n\n struct[name] = (schema, defaults$$1, options) => {\n const type = kind(schema, defaults$$1, _extends({}, options, { types }));\n const s = struct(type, defaults$$1, options);\n return s;\n };\n });\n\n /**\n * Return the struct factory.\n */\n\n return struct;\n}\n\n/**\n * Create a convenience `struct` factory for the default types.\n *\n * @type {Function}\n */\n\nconst struct = superstruct();\n\nexport { struct, superstruct, isStruct, StructError };\n//# sourceMappingURL=index.es.js.map\n","function AbstractIterator (db) {\n if (typeof db !== 'object' || db === null) {\n throw new TypeError('First argument must be an abstract-leveldown compliant store')\n }\n\n this.db = db\n this._ended = false\n this._nexting = false\n}\n\nAbstractIterator.prototype.next = function (callback) {\n var self = this\n\n if (typeof callback !== 'function') {\n throw new Error('next() requires a callback argument')\n }\n\n if (self._ended) {\n process.nextTick(callback, new Error('cannot call next() after end()'))\n return self\n }\n\n if (self._nexting) {\n process.nextTick(callback, new Error('cannot call next() before previous next() has completed'))\n return self\n }\n\n self._nexting = true\n self._next(function () {\n self._nexting = false\n callback.apply(null, arguments)\n })\n\n return self\n}\n\nAbstractIterator.prototype._next = function (callback) {\n process.nextTick(callback)\n}\n\nAbstractIterator.prototype.seek = function (target) {\n if (this._ended) {\n throw new Error('cannot call seek() after end()')\n }\n if (this._nexting) {\n throw new Error('cannot call seek() before next() has completed')\n }\n\n target = this.db._serializeKey(target)\n this._seek(target)\n}\n\nAbstractIterator.prototype._seek = function (target) {}\n\nAbstractIterator.prototype.end = function (callback) {\n if (typeof callback !== 'function') {\n throw new Error('end() requires a callback argument')\n }\n\n if (this._ended) {\n return process.nextTick(callback, new Error('end() already called on iterator'))\n }\n\n this._ended = true\n this._end(callback)\n}\n\nAbstractIterator.prototype._end = function (callback) {\n process.nextTick(callback)\n}\n\nmodule.exports = AbstractIterator\n","'use strict'\n\nvar AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN\nvar AbstractChainedBatch = require('abstract-leveldown').AbstractChainedBatch\nvar AbstractIterator = require('abstract-leveldown').AbstractIterator\nvar inherits = require('inherits')\nvar Codec = require('level-codec')\nvar EncodingError = require('level-errors').EncodingError\nvar rangeMethods = ['approximateSize', 'compactRange']\n\nmodule.exports = DB.default = DB\n\nfunction DB (db, opts) {\n if (!(this instanceof DB)) return new DB(db, opts)\n\n var manifest = db.supports || {}\n var additionalMethods = manifest.additionalMethods || {}\n\n AbstractLevelDOWN.call(this, manifest)\n\n this.supports.encodings = true\n this.supports.additionalMethods = {}\n\n rangeMethods.forEach(function (m) {\n // TODO (future major): remove this fallback\n var fallback = typeof db[m] === 'function'\n\n if (additionalMethods[m] || fallback) {\n this.supports.additionalMethods[m] = true\n\n this[m] = function (start, end, opts, cb) {\n start = this.codec.encodeKey(start, opts)\n end = this.codec.encodeKey(end, opts)\n return this.db[m](start, end, opts, cb)\n }\n }\n }, this)\n\n opts = opts || {}\n if (typeof opts.keyEncoding === 'undefined') opts.keyEncoding = 'utf8'\n if (typeof opts.valueEncoding === 'undefined') opts.valueEncoding = 'utf8'\n\n this.db = db\n this.codec = new Codec(opts)\n}\n\ninherits(DB, AbstractLevelDOWN)\n\nDB.prototype.type = 'encoding-down'\n\nDB.prototype._serializeKey =\nDB.prototype._serializeValue = function (datum) {\n return datum\n}\n\nDB.prototype._open = function (opts, cb) {\n this.db.open(opts, cb)\n}\n\nDB.prototype._close = function (cb) {\n this.db.close(cb)\n}\n\nDB.prototype._put = function (key, value, opts, cb) {\n key = this.codec.encodeKey(key, opts)\n value = this.codec.encodeValue(value, opts)\n this.db.put(key, value, opts, cb)\n}\n\nDB.prototype._get = function (key, opts, cb) {\n var self = this\n key = this.codec.encodeKey(key, opts)\n opts.asBuffer = this.codec.valueAsBuffer(opts)\n this.db.get(key, opts, function (err, value) {\n if (err) return cb(err)\n try {\n value = self.codec.decodeValue(value, opts)\n } catch (err) {\n return cb(new EncodingError(err))\n }\n cb(null, value)\n })\n}\n\nDB.prototype._del = function (key, opts, cb) {\n key = this.codec.encodeKey(key, opts)\n this.db.del(key, opts, cb)\n}\n\nDB.prototype._chainedBatch = function () {\n return new Batch(this)\n}\n\nDB.prototype._batch = function (ops, opts, cb) {\n ops = this.codec.encodeBatch(ops, opts)\n this.db.batch(ops, opts, cb)\n}\n\nDB.prototype._iterator = function (opts) {\n opts.keyAsBuffer = this.codec.keyAsBuffer(opts)\n opts.valueAsBuffer = this.codec.valueAsBuffer(opts)\n return new Iterator(this, opts)\n}\n\nDB.prototype._clear = function (opts, callback) {\n opts = this.codec.encodeLtgt(opts)\n this.db.clear(opts, callback)\n}\n\nfunction Iterator (db, opts) {\n AbstractIterator.call(this, db)\n this.codec = db.codec\n this.keys = opts.keys\n this.values = opts.values\n this.opts = this.codec.encodeLtgt(opts)\n this.it = db.db.iterator(this.opts)\n}\n\ninherits(Iterator, AbstractIterator)\n\nIterator.prototype._next = function (cb) {\n var self = this\n this.it.next(function (err, key, value) {\n if (err) return cb(err)\n try {\n if (self.keys && typeof key !== 'undefined') {\n key = self.codec.decodeKey(key, self.opts)\n } else {\n key = undefined\n }\n\n if (self.values && typeof value !== 'undefined') {\n value = self.codec.decodeValue(value, self.opts)\n } else {\n value = undefined\n }\n } catch (err) {\n return cb(new EncodingError(err))\n }\n cb(null, key, value)\n })\n}\n\nIterator.prototype._seek = function (key) {\n key = this.codec.encodeKey(key, this.opts)\n this.it.seek(key)\n}\n\nIterator.prototype._end = function (cb) {\n this.it.end(cb)\n}\n\nfunction Batch (db, codec) {\n AbstractChainedBatch.call(this, db)\n this.codec = db.codec\n this.batch = db.db.batch()\n}\n\ninherits(Batch, AbstractChainedBatch)\n\nBatch.prototype._put = function (key, value) {\n key = this.codec.encodeKey(key)\n value = this.codec.encodeValue(value)\n this.batch.put(key, value)\n}\n\nBatch.prototype._del = function (key) {\n key = this.codec.encodeKey(key)\n this.batch.del(key)\n}\n\nBatch.prototype._clear = function () {\n this.batch.clear()\n}\n\nBatch.prototype._write = function (opts, cb) {\n this.batch.write(opts, cb)\n}\n","'use strict'\n\nconst sortLinks = require('./sortLinks')\nconst DAGLink = require('../dag-link')\n\nconst asDAGLink = (link) => {\n if (DAGLink.isDAGLink(link)) {\n // It's a DAGLink instance\n // no need to do anything\n return link\n }\n\n // DAGNode.isDagNode() would be more appropriate here, but it can't be used\n // as it would lead to circular dependencies as `addLink` is called from\n // within the DAGNode object.\n if (!('cid' in link ||\n 'hash' in link ||\n 'Hash' in link ||\n 'multihash' in link)) {\n throw new Error('Link must be a DAGLink or DAGLink-like. Convert the DAGNode into a DAGLink via `node.toDAGLink()`.')\n }\n\n // It's a Object with name, multihash/hash/cid and size\n return new DAGLink(link.Name || link.name, link.Tsize || link.size, link.Hash || link.multihash || link.hash || link.cid)\n}\n\nconst addLink = (node, link) => {\n const dagLink = asDAGLink(link)\n node._links.push(dagLink)\n node._links = sortLinks(node._links)\n}\n\nmodule.exports = addLink\n","\nmodule.exports = isBuf;\n\nvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\nvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\nvar isView = function (obj) {\n return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n};\n\n/**\n * Returns true if obj is a buffer or an arraybuffer.\n *\n * @api private\n */\n\nfunction isBuf(obj) {\n return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n}\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"artist-page\"},[_c('ArtistTitle',{attrs:{\"prizes-unlocked\":_vm.prizesUnlocked}}),_c('div',{attrs:{\"id\":\"primary\"}},[_c('div',{staticClass:\"shrink-top\"},[_c('h3',{staticStyle:{\"margin-left\":\"25px\"}},[_vm._v(\"Ticket\")]),_c('div',{attrs:{\"id\":\"artist-card\"}},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":_vm.imageSrc}}),_c('h2',[_vm._v(_vm._s(_vm.artistName)+\" VIP Ticket\")]),_vm._m(0)])]),_c('div',{staticClass:\"shrink-top\"},[_c('h3',{staticStyle:{\"margin-left\":\"25px\"}},[_vm._v(\"Price\")]),_c('div',{attrs:{\"id\":\"curve-card\"}},[_vm._m(1),_c('div',{attrs:{\"id\":\"trade-section\"}},[_c('h5',[_vm._v(\"current value\")]),_c('div',{attrs:{\"id\":\"price-and-token\"}},[_c('h1',[_vm._v(\"$\"+_vm._s(_vm.tokenPriceUsd))]),_c('img',{attrs:{\"id\":\"token-number\",\"src\":require(\"../assets/tokenNumber.svg\")}})]),_c('div',{attrs:{\"id\":\"trade-buttons\"}},[_c('div',{staticClass:\"btn\",staticStyle:{\"background-color\":\"#398557\"},on:{\"click\":function($event){_vm.buy = true}}},[_c('p',[_vm._v(\"Buy\")])]),_c('div',{staticClass:\"btn sell-btn\",staticStyle:{\"background-color\":\"#da304c\"},on:{\"click\":function($event){_vm.sell = true}}},[_c('p',[_vm._v(\"Sell\")])])])])])])]),_c('Tests',{ref:\"Tests\",on:{\"receivedContractData\":_vm.updateContract}}),_c('Prizes',{attrs:{\"prizes-unlocked\":_vm.prizesUnlocked}}),_c('Buy',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.buy),expression:\"buy\"}],staticClass:\"modal\",on:{\"close\":function($event){_vm.buy = false},\"confirmed\":function($event){_vm.prizesUnlocked = true}}}),_c('Sell',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.sell),expression:\"sell\"}],staticClass:\"modal\",on:{\"close\":function($event){_vm.sell = false}}})],1)}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{attrs:{\"id\":\"offers\"}},[_c('li',[_vm._v(\" Exclusive access to “BUBBA” behind-the-scenes videos and production tutorials \")]),_c('li',[_vm._v(\"Receive early access to unrealeased music and videos\")]),_c('li',[_vm._v(\"A chance to win an 1 on 1 production session\")]),_c('li',[_vm._v(\"Two free VIP concert tickets for every year that you hold the token\")]),_c('li',[_vm._v(\"Submit a monthly question to Kaytranada.\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"graph-section\"}},[_c('img',{staticClass:\"graph\",attrs:{\"src\":require(\"../assets/graph.svg\")}})])}]\n\nexport { render, staticRenderFns }","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"modal-mask\"},[_c('div',{staticClass:\"modal-wrapper\"},[_c('div',{staticClass:\"modal-container\"},[_c('div',{staticClass:\"modal-body\"},[_vm._m(0),_c('div',{attrs:{\"id\":\"right-column\"}},[_c('p',{staticStyle:{\"font-weight\":\"700\"}},[_vm._v(_vm._s(_vm.tokenPriceUsd))])])]),_c('div',{staticClass:\"btn\",staticStyle:{\"background-color\":\"#398557\",\"width\":\"100%\",\"margin\":\"0\",\"margin-bottom\":\"10px\"},on:{\"click\":_vm.buyToken}},[_c('p',[_vm._v(\"Buy for \"+_vm._s(_vm.tokenPriceEth)+\" ETH\")])]),_c('div',{staticClass:\"btn btn-cancel\",staticStyle:{\"background-color\":\"transparent\",\"width\":\"100%\",\"margin\":\"0\",\"margin-bottom\":\"20px\"},attrs:{\"src\":\"../assets/CloseModal.svg\"},on:{\"click\":function($event){return _vm.$emit('close')}}},[_c('p',{staticStyle:{\"color\":\"black\"}},[_vm._v(\"Cancel\")])])])])])}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{\"width\":\"50%\",\"float\":\"left\"},attrs:{\"id\":\"left-column\"}},[_c('p',{staticStyle:{\"font-weight\":\"700\"}},[_vm._v(\"Total price\")])])}]\n\nexport { render, staticRenderFns }","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Buy.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Buy.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Buy.vue?vue&type=template&id=6be94cbe&scoped=true&\"\nimport script from \"./Buy.vue?vue&type=script&lang=js&\"\nexport * from \"./Buy.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Buy.vue?vue&type=style&index=0&id=6be94cbe&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"6be94cbe\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"modal-mask\"},[_c('div',{staticClass:\"modal-wrapper\"},[_c('div',{staticClass:\"modal-container\"},[_c('div',{staticClass:\"modal-body\"},[_vm._m(0),_c('div',{attrs:{\"id\":\"right-column\"}},[_c('p',{},[_vm._v(_vm._s(_vm.tokenPriceUsd))]),_c('p',{},[_vm._v(_vm._s(_vm.artistCutUsd))]),_c('p',{staticStyle:{\"font-weight\":\"700\"}},[_vm._v(_vm._s((_vm.tokenPriceUsd - _vm.artistCutUsd).toFixed(2)))])])]),_c('div',{staticClass:\"btn\",staticStyle:{\"background-color\":\"#da304c\",\"width\":\"100%\",\"margin\":\"0\",\"margin-bottom\":\"10px\"},on:{\"click\":_vm.sellToken}},[_c('p',[_vm._v(\"Sell for \"+_vm._s(_vm.tokenPriceEth - _vm.artistCutEth)+\" ETH\")])]),_c('div',{staticClass:\"btn btn-cancel\",staticStyle:{\"background-color\":\"transparent\",\"width\":\"100%\",\"margin\":\"0\",\"margin-bottom\":\"20px\"},attrs:{\"src\":\"../assets/CloseModal.svg\"},on:{\"click\":function($event){return _vm.$emit('close')}}},[_c('p',{staticStyle:{\"color\":\"black\"}},[_vm._v(\"Cancel\")])])])])])}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{\"width\":\"50%\",\"float\":\"left\"},attrs:{\"id\":\"left-column\"}},[_c('p',[_vm._v(\"Token value\")]),_c('p',[_vm._v(\"Artist allocation\")]),_c('p',{staticStyle:{\"font-weight\":\"700\"}},[_vm._v(\"You receive\")])])}]\n\nexport { render, staticRenderFns }","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Sell.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Sell.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Sell.vue?vue&type=template&id=231b042c&scoped=true&\"\nimport script from \"./Sell.vue?vue&type=script&lang=js&\"\nexport * from \"./Sell.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Sell.vue?vue&type=style&index=0&id=231b042c&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"231b042c\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"prizes\"}},[_c('h3',[_vm._v(\"Rewards\")]),_c('div',{directives:[{name:\"show\",rawName:\"v-show\",value:(!_vm.prizesUnlocked),expression:\"!prizesUnlocked\"}],attrs:{\"id\":\"locked\"}},[_vm._m(0)]),_c('div',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.prizesUnlocked),expression:\"prizesUnlocked\"}],attrs:{\"id\":\"unlocked-grid\"}},[_c('div',{staticClass:\"card\",on:{\"click\":function($event){_vm.redeemPrize = true}}},[_c('p',[_vm._v(\"Exclusive Song\")])]),_vm._m(1),_vm._m(2),_vm._m(3),_vm._m(4),_vm._m(5)]),_c('RedeemPrize',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.redeemPrize),expression:\"redeemPrize\"}],on:{\"close\":function($event){_vm.redeemPrize = false}}})],1)}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"locked-content\"}},[_c('img',{attrs:{\"id\":\"lockIcon\",\"src\":require(\"../assets/lock.svg\")}}),_c('p',[_vm._v(\"Buy this artist's token to unlock their content\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('p',[_vm._v(\"2 Concert Tickets\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('p',[_vm._v(\"VIP\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('p',[_vm._v(\"1 on 1\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('p',[_vm._v(\"Song\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('p',[_vm._v(\"Concert\")])])}]\n\nexport { render, staticRenderFns }","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"modal-mask\"},[_c('div',{staticClass:\"modal-wrapper\"},[_c('div',{staticClass:\"modal-container\"},[_c('div',{staticClass:\"modal-body\"}),_c('div',{attrs:{\"id\":\"album-container\"},on:{\"mouseover\":function($event){_vm.hover = true},\"mouseleave\":function($event){_vm.hover = false}}},[_c('img',{attrs:{\"id\":\"albumArt\",\"src\":require(\"../assets/KaytranadaAlbumArt.jpg\")}}),_c('img',{directives:[{name:\"show\",rawName:\"v-show\",value:(!_vm.playing && _vm.hover),expression:\"!playing && hover\"}],attrs:{\"id\":\"play\",\"src\":require(\"../assets/playIcon.svg\")},on:{\"click\":_vm.play}}),_c('img',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.playing && _vm.hover),expression:\"playing && hover\"}],attrs:{\"id\":\"pause\",\"src\":require(\"../assets/pauseIcon.svg\")},on:{\"click\":_vm.pause}})]),_c('audio',{ref:\"KaytraSong\",attrs:{\"id\":\"song\",\"src\":require(\"../assets/Kaytranada10.mp3\")}}),_vm._m(0),_c('div',{staticClass:\"btn btn-cancel\",staticStyle:{\"background-color\":\"transparent\",\"width\":\"100%\",\"margin\":\"0\",\"margin-bottom\":\"20px\"},attrs:{\"src\":\"../assets/CloseModal.svg\"},on:{\"click\":function($event){return _vm.$emit('close')}}},[_c('p',{staticStyle:{\"color\":\"black\"}},[_vm._v(\"Close\")])])])])])}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"btn\",staticStyle:{\"background-color\":\"#398557\",\"width\":\"100%\",\"margin\":\"0\",\"margin-bottom\":\"10px\",\"margin-top\":\"10px\"}},[_c('p',[_vm._v(\"Download Song\")])])}]\n\nexport { render, staticRenderFns }","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./RedeemPrize.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./RedeemPrize.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./RedeemPrize.vue?vue&type=template&id=0fc7ea69&scoped=true&\"\nimport script from \"./RedeemPrize.vue?vue&type=script&lang=js&\"\nexport * from \"./RedeemPrize.vue?vue&type=script&lang=js&\"\nimport style0 from \"./RedeemPrize.vue?vue&type=style&index=0&id=0fc7ea69&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"0fc7ea69\",\n null\n \n)\n\nexport default component.exports","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Prizes.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Prizes.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Prizes.vue?vue&type=template&id=662da522&scoped=true&\"\nimport script from \"./Prizes.vue?vue&type=script&lang=js&\"\nexport * from \"./Prizes.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Prizes.vue?vue&type=style&index=0&id=662da522&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"662da522\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"artist-title\"}},[_c('p',{attrs:{\"id\":\"artist-name\"}},[_vm._v(\"Kaytranada\")]),_vm._m(0),_c('div',{staticClass:\"tokenOwnership\",class:{ own: _vm.prizesUnlocked, dontOwn: !_vm.prizesUnlocked }},[_vm._v(\" \"+_vm._s(_vm.ownershipText)+\" \")])])}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"verified\"}},[_c('img',{attrs:{\"src\":require(\"../assets/verfied.svg\")}}),_c('p',[_vm._v(\"Official artist page\")])])}]\n\nexport { render, staticRenderFns }","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ArtistTitle.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ArtistTitle.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./ArtistTitle.vue?vue&type=template&id=2fa309b2&scoped=true&\"\nimport script from \"./ArtistTitle.vue?vue&type=script&lang=js&\"\nexport * from \"./ArtistTitle.vue?vue&type=script&lang=js&\"\nimport style0 from \"./ArtistTitle.vue?vue&type=style&index=0&id=2fa309b2&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"2fa309b2\",\n null\n \n)\n\nexport default component.exports","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ArtistPage.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ArtistPage.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./ArtistPage.vue?vue&type=template&id=b6fd9302&\"\nimport script from \"./ArtistPage.vue?vue&type=script&lang=js&\"\nexport * from \"./ArtistPage.vue?vue&type=script&lang=js&\"\nimport style0 from \"./ArtistPage.vue?vue&type=style&index=0&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","'use strict'\n\nconst { Buffer } = require('buffer')\nconst errcode = require('err-code')\nconst multihash = require('multihashes')\nconst crypto = require('./crypto')\n\n/**\n * Hash the given `buf` using the algorithm specified by `alg`.\n * @param {Buffer} buf - The value to hash.\n * @param {number|string} alg - The algorithm to use eg 'sha1'\n * @param {number} [length] - Optionally trim the result to this length.\n * @returns {Promise}\n */\nasync function Multihashing (buf, alg, length) {\n const digest = await Multihashing.digest(buf, alg, length)\n return multihash.encode(digest, alg, length)\n}\n\n/**\n * The `buffer` module for easy use in the browser.\n *\n * @type {Buffer}\n */\nMultihashing.Buffer = Buffer // for browser things\n\n/**\n * Expose multihash itself, to avoid silly double requires.\n */\nMultihashing.multihash = multihash\n\n/**\n * @param {Buffer} buf - The value to hash.\n * @param {number|string} alg - The algorithm to use eg 'sha1'\n * @param {number} [length] - Optionally trim the result to this length.\n * @returns {Promise}\n */\nMultihashing.digest = async (buf, alg, length) => {\n const hash = Multihashing.createHash(alg)\n const digest = await hash(buf)\n return length ? digest.slice(0, length) : digest\n}\n\n/**\n * Creates a function that hashes with the given algorithm\n *\n * @param {string|number} alg - The algorithm to use eg 'sha1'\n *\n * @returns {function} - The hash function corresponding to `alg`\n */\nMultihashing.createHash = function (alg) {\n if (!alg) {\n throw errcode('hash algorithm must be specified', 'ERR_HASH_ALGORITHM_NOT_SPECIFIED')\n }\n\n alg = multihash.coerceCode(alg)\n if (!Multihashing.functions[alg]) {\n throw errcode(`multihash function '${alg}' not yet supported`, 'ERR_HASH_ALGORITHM_NOT_SUPPORTED')\n }\n\n return Multihashing.functions[alg]\n}\n\n/**\n * Mapping of multihash codes to their hashing functions.\n * @type {Object}\n */\nMultihashing.functions = {\n // sha1\n 0x11: crypto.sha1,\n // sha2-256\n 0x12: crypto.sha2256,\n // sha2-512\n 0x13: crypto.sha2512,\n // sha3-512\n 0x14: crypto.sha3512,\n // sha3-384\n 0x15: crypto.sha3384,\n // sha3-256\n 0x16: crypto.sha3256,\n // sha3-224\n 0x17: crypto.sha3224,\n // shake-128\n 0x18: crypto.shake128,\n // shake-256\n 0x19: crypto.shake256,\n // keccak-224\n 0x1A: crypto.keccak224,\n // keccak-256\n 0x1B: crypto.keccak256,\n // keccak-384\n 0x1C: crypto.keccak384,\n // keccak-512\n 0x1D: crypto.keccak512,\n // murmur3-128\n 0x22: crypto.murmur3128,\n // murmur3-32\n 0x23: crypto.murmur332,\n // dbl-sha2-256\n 0x56: crypto.dblSha2256\n}\n\n// add blake functions\ncrypto.addBlake(Multihashing.functions)\n\nMultihashing.validate = async (buf, hash) => {\n const newHash = await Multihashing(buf, multihash.decode(hash).name)\n\n return Buffer.compare(hash, newHash) === 0\n}\n\nmodule.exports = Multihashing\n","'use strict'\n\nconst nodeify = require('../nodeify')\nconst webcrypto = require('../webcrypto')\nconst randomBytes = require('../random-bytes')\n\nexports.utils = require('./rsa-utils')\n\nexports.generateKey = function (bits, callback) {\n nodeify(webcrypto.subtle.generateKey(\n {\n name: 'RSASSA-PKCS1-v1_5',\n modulusLength: bits,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n hash: { name: 'SHA-256' }\n },\n true,\n ['sign', 'verify']\n )\n .then(exportKey)\n .then((keys) => ({\n privateKey: keys[0],\n publicKey: keys[1]\n })), callback)\n}\n\n// Takes a jwk key\nexports.unmarshalPrivateKey = function (key, callback) {\n const privateKey = webcrypto.subtle.importKey(\n 'jwk',\n key,\n {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n },\n true,\n ['sign']\n )\n\n nodeify(Promise.all([\n privateKey,\n derivePublicFromPrivate(key)\n ]).then((keys) => exportKey({\n privateKey: keys[0],\n publicKey: keys[1]\n })).then((keys) => ({\n privateKey: keys[0],\n publicKey: keys[1]\n })), callback)\n}\n\nexports.getRandomValues = randomBytes\n\nexports.hashAndSign = function (key, msg, callback) {\n nodeify(webcrypto.subtle.importKey(\n 'jwk',\n key,\n {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n },\n false,\n ['sign']\n ).then((privateKey) => {\n return webcrypto.subtle.sign(\n { name: 'RSASSA-PKCS1-v1_5' },\n privateKey,\n Uint8Array.from(msg)\n )\n }).then((sig) => Buffer.from(sig)), callback)\n}\n\nexports.hashAndVerify = function (key, sig, msg, callback) {\n nodeify(webcrypto.subtle.importKey(\n 'jwk',\n key,\n {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n },\n false,\n ['verify']\n ).then((publicKey) => {\n return webcrypto.subtle.verify(\n { name: 'RSASSA-PKCS1-v1_5' },\n publicKey,\n sig,\n msg\n )\n }), callback)\n}\n\nfunction exportKey (pair) {\n return Promise.all([\n webcrypto.subtle.exportKey('jwk', pair.privateKey),\n webcrypto.subtle.exportKey('jwk', pair.publicKey)\n ])\n}\n\nfunction derivePublicFromPrivate (jwKey) {\n return webcrypto.subtle.importKey(\n 'jwk',\n {\n kty: jwKey.kty,\n n: jwKey.n,\n e: jwKey.e\n },\n {\n name: 'RSASSA-PKCS1-v1_5',\n hash: { name: 'SHA-256' }\n },\n true,\n ['verify']\n )\n}\n\n/*\n\nRSA encryption/decryption for the browser with webcrypto workarround\n\"bloody dark magic. webcrypto's why.\"\n\nExplanation:\n - Convert JWK to nodeForge\n - Convert msg buffer to nodeForge buffer: ByteBuffer is a \"binary-string backed buffer\", so let's make our buffer a binary string\n - Convert resulting nodeForge buffer to buffer: it returns a binary string, turn that into a uint8array(buffer)\n\n*/\n\nconst { jwk2pub, jwk2priv } = require('./jwk2pem')\n\nfunction convertKey (key, pub, msg, handle) {\n const fkey = pub ? jwk2pub(key) : jwk2priv(key)\n const fmsg = Buffer.from(msg).toString('binary')\n const fomsg = handle(fmsg, fkey)\n return Buffer.from(fomsg, 'binary')\n}\n\nexports.encrypt = function (key, msg) {\n return convertKey(key, true, msg, (msg, key) => key.encrypt(msg))\n}\n\nexports.decrypt = function (key, msg) {\n return convertKey(key, false, msg, (msg, key) => key.decrypt(msg))\n}\n","'use strict'\n\nconst { TieredDatastore } = require('datastore-core')\nconst get = require('dlv')\n\nconst PubsubDatastore = require('./pubsub-datastore')\nconst OfflineDatastore = require('./offline-datastore')\n\nmodule.exports = (ipfs) => {\n // Setup online routing for IPNS with a tiered routing composed by a DHT and a Pubsub router (if properly enabled)\n const ipnsStores = []\n\n // Add IPNS pubsub if enabled\n let pubsubDs\n if (get(ipfs._options, 'EXPERIMENTAL.ipnsPubsub', false)) {\n const pubsub = ipfs.libp2p.pubsub\n const localDatastore = ipfs._repo.datastore\n const peerId = ipfs._peerInfo.id\n\n pubsubDs = new PubsubDatastore(pubsub, localDatastore, peerId)\n ipnsStores.push(pubsubDs)\n }\n\n // DHT should not be added as routing if we are offline or it is disabled\n if (get(ipfs._options, 'offline') || !get(ipfs._options, 'libp2p.config.dht.enabled', false)) {\n const offlineDatastore = new OfflineDatastore(ipfs._repo)\n ipnsStores.push(offlineDatastore)\n } else {\n ipnsStores.push(ipfs.libp2p.dht)\n }\n\n // Create ipns routing with a set of datastores\n return new TieredDatastore(ipnsStores)\n}\n","\nfunction isFunction (f) {\n return 'function' === typeof f\n}\n\nfunction isDuplex (d) {\n return 'object' === typeof d && isSource(d.source) && isSink(d.sink)\n}\n\nfunction isSource (s) {\n return isFunction(s) && s.length === 2\n}\n\nfunction isSink (s) {\n return isFunction(s) && s.length === 1\n}\n\nexports.isDuplex = isDuplex\nexports.isSource = isSource\nexports.isSink = isSink\n//can't do is through, it will appear as a sink til you git it a source.\n\n","'use strict'\n\nconst callbackify = require('callbackify')\nconst all = require('async-iterator-all')\n\nmodule.exports = function (self) {\n return callbackify.variadic(async function refsLocal (ipfsPath, options) { // eslint-disable-line require-await\n return all(self.refs._localAsyncIterator(ipfsPath, options))\n })\n}\n","/* eslint quote-props: off */\n/* eslint key-spacing: off */\n'use strict'\n\nexports.names = Object.freeze({\n 'identity': 0x0,\n 'sha1': 0x11,\n 'sha2-256': 0x12,\n 'sha2-512': 0x13,\n 'dbl-sha2-256': 0x56,\n 'sha3-224': 0x17,\n 'sha3-256': 0x16,\n 'sha3-384': 0x15,\n 'sha3-512': 0x14,\n 'shake-128': 0x18,\n 'shake-256': 0x19,\n 'keccak-224': 0x1A,\n 'keccak-256': 0x1B,\n 'keccak-384': 0x1C,\n 'keccak-512': 0x1D,\n 'murmur3-128': 0x22,\n 'murmur3-32': 0x23,\n 'blake2b-8': 0xb201,\n 'blake2b-16': 0xb202,\n 'blake2b-24': 0xb203,\n 'blake2b-32': 0xb204,\n 'blake2b-40': 0xb205,\n 'blake2b-48': 0xb206,\n 'blake2b-56': 0xb207,\n 'blake2b-64': 0xb208,\n 'blake2b-72': 0xb209,\n 'blake2b-80': 0xb20a,\n 'blake2b-88': 0xb20b,\n 'blake2b-96': 0xb20c,\n 'blake2b-104': 0xb20d,\n 'blake2b-112': 0xb20e,\n 'blake2b-120': 0xb20f,\n 'blake2b-128': 0xb210,\n 'blake2b-136': 0xb211,\n 'blake2b-144': 0xb212,\n 'blake2b-152': 0xb213,\n 'blake2b-160': 0xb214,\n 'blake2b-168': 0xb215,\n 'blake2b-176': 0xb216,\n 'blake2b-184': 0xb217,\n 'blake2b-192': 0xb218,\n 'blake2b-200': 0xb219,\n 'blake2b-208': 0xb21a,\n 'blake2b-216': 0xb21b,\n 'blake2b-224': 0xb21c,\n 'blake2b-232': 0xb21d,\n 'blake2b-240': 0xb21e,\n 'blake2b-248': 0xb21f,\n 'blake2b-256': 0xb220,\n 'blake2b-264': 0xb221,\n 'blake2b-272': 0xb222,\n 'blake2b-280': 0xb223,\n 'blake2b-288': 0xb224,\n 'blake2b-296': 0xb225,\n 'blake2b-304': 0xb226,\n 'blake2b-312': 0xb227,\n 'blake2b-320': 0xb228,\n 'blake2b-328': 0xb229,\n 'blake2b-336': 0xb22a,\n 'blake2b-344': 0xb22b,\n 'blake2b-352': 0xb22c,\n 'blake2b-360': 0xb22d,\n 'blake2b-368': 0xb22e,\n 'blake2b-376': 0xb22f,\n 'blake2b-384': 0xb230,\n 'blake2b-392': 0xb231,\n 'blake2b-400': 0xb232,\n 'blake2b-408': 0xb233,\n 'blake2b-416': 0xb234,\n 'blake2b-424': 0xb235,\n 'blake2b-432': 0xb236,\n 'blake2b-440': 0xb237,\n 'blake2b-448': 0xb238,\n 'blake2b-456': 0xb239,\n 'blake2b-464': 0xb23a,\n 'blake2b-472': 0xb23b,\n 'blake2b-480': 0xb23c,\n 'blake2b-488': 0xb23d,\n 'blake2b-496': 0xb23e,\n 'blake2b-504': 0xb23f,\n 'blake2b-512': 0xb240,\n 'blake2s-8': 0xb241,\n 'blake2s-16': 0xb242,\n 'blake2s-24': 0xb243,\n 'blake2s-32': 0xb244,\n 'blake2s-40': 0xb245,\n 'blake2s-48': 0xb246,\n 'blake2s-56': 0xb247,\n 'blake2s-64': 0xb248,\n 'blake2s-72': 0xb249,\n 'blake2s-80': 0xb24a,\n 'blake2s-88': 0xb24b,\n 'blake2s-96': 0xb24c,\n 'blake2s-104': 0xb24d,\n 'blake2s-112': 0xb24e,\n 'blake2s-120': 0xb24f,\n 'blake2s-128': 0xb250,\n 'blake2s-136': 0xb251,\n 'blake2s-144': 0xb252,\n 'blake2s-152': 0xb253,\n 'blake2s-160': 0xb254,\n 'blake2s-168': 0xb255,\n 'blake2s-176': 0xb256,\n 'blake2s-184': 0xb257,\n 'blake2s-192': 0xb258,\n 'blake2s-200': 0xb259,\n 'blake2s-208': 0xb25a,\n 'blake2s-216': 0xb25b,\n 'blake2s-224': 0xb25c,\n 'blake2s-232': 0xb25d,\n 'blake2s-240': 0xb25e,\n 'blake2s-248': 0xb25f,\n 'blake2s-256': 0xb260,\n 'Skein256-8': 0xb301,\n 'Skein256-16': 0xb302,\n 'Skein256-24': 0xb303,\n 'Skein256-32': 0xb304,\n 'Skein256-40': 0xb305,\n 'Skein256-48': 0xb306,\n 'Skein256-56': 0xb307,\n 'Skein256-64': 0xb308,\n 'Skein256-72': 0xb309,\n 'Skein256-80': 0xb30a,\n 'Skein256-88': 0xb30b,\n 'Skein256-96': 0xb30c,\n 'Skein256-104': 0xb30d,\n 'Skein256-112': 0xb30e,\n 'Skein256-120': 0xb30f,\n 'Skein256-128': 0xb310,\n 'Skein256-136': 0xb311,\n 'Skein256-144': 0xb312,\n 'Skein256-152': 0xb313,\n 'Skein256-160': 0xb314,\n 'Skein256-168': 0xb315,\n 'Skein256-176': 0xb316,\n 'Skein256-184': 0xb317,\n 'Skein256-192': 0xb318,\n 'Skein256-200': 0xb319,\n 'Skein256-208': 0xb31a,\n 'Skein256-216': 0xb31b,\n 'Skein256-224': 0xb31c,\n 'Skein256-232': 0xb31d,\n 'Skein256-240': 0xb31e,\n 'Skein256-248': 0xb31f,\n 'Skein256-256': 0xb320,\n 'Skein512-8': 0xb321,\n 'Skein512-16': 0xb322,\n 'Skein512-24': 0xb323,\n 'Skein512-32': 0xb324,\n 'Skein512-40': 0xb325,\n 'Skein512-48': 0xb326,\n 'Skein512-56': 0xb327,\n 'Skein512-64': 0xb328,\n 'Skein512-72': 0xb329,\n 'Skein512-80': 0xb32a,\n 'Skein512-88': 0xb32b,\n 'Skein512-96': 0xb32c,\n 'Skein512-104': 0xb32d,\n 'Skein512-112': 0xb32e,\n 'Skein512-120': 0xb32f,\n 'Skein512-128': 0xb330,\n 'Skein512-136': 0xb331,\n 'Skein512-144': 0xb332,\n 'Skein512-152': 0xb333,\n 'Skein512-160': 0xb334,\n 'Skein512-168': 0xb335,\n 'Skein512-176': 0xb336,\n 'Skein512-184': 0xb337,\n 'Skein512-192': 0xb338,\n 'Skein512-200': 0xb339,\n 'Skein512-208': 0xb33a,\n 'Skein512-216': 0xb33b,\n 'Skein512-224': 0xb33c,\n 'Skein512-232': 0xb33d,\n 'Skein512-240': 0xb33e,\n 'Skein512-248': 0xb33f,\n 'Skein512-256': 0xb340,\n 'Skein512-264': 0xb341,\n 'Skein512-272': 0xb342,\n 'Skein512-280': 0xb343,\n 'Skein512-288': 0xb344,\n 'Skein512-296': 0xb345,\n 'Skein512-304': 0xb346,\n 'Skein512-312': 0xb347,\n 'Skein512-320': 0xb348,\n 'Skein512-328': 0xb349,\n 'Skein512-336': 0xb34a,\n 'Skein512-344': 0xb34b,\n 'Skein512-352': 0xb34c,\n 'Skein512-360': 0xb34d,\n 'Skein512-368': 0xb34e,\n 'Skein512-376': 0xb34f,\n 'Skein512-384': 0xb350,\n 'Skein512-392': 0xb351,\n 'Skein512-400': 0xb352,\n 'Skein512-408': 0xb353,\n 'Skein512-416': 0xb354,\n 'Skein512-424': 0xb355,\n 'Skein512-432': 0xb356,\n 'Skein512-440': 0xb357,\n 'Skein512-448': 0xb358,\n 'Skein512-456': 0xb359,\n 'Skein512-464': 0xb35a,\n 'Skein512-472': 0xb35b,\n 'Skein512-480': 0xb35c,\n 'Skein512-488': 0xb35d,\n 'Skein512-496': 0xb35e,\n 'Skein512-504': 0xb35f,\n 'Skein512-512': 0xb360,\n 'Skein1024-8': 0xb361,\n 'Skein1024-16': 0xb362,\n 'Skein1024-24': 0xb363,\n 'Skein1024-32': 0xb364,\n 'Skein1024-40': 0xb365,\n 'Skein1024-48': 0xb366,\n 'Skein1024-56': 0xb367,\n 'Skein1024-64': 0xb368,\n 'Skein1024-72': 0xb369,\n 'Skein1024-80': 0xb36a,\n 'Skein1024-88': 0xb36b,\n 'Skein1024-96': 0xb36c,\n 'Skein1024-104': 0xb36d,\n 'Skein1024-112': 0xb36e,\n 'Skein1024-120': 0xb36f,\n 'Skein1024-128': 0xb370,\n 'Skein1024-136': 0xb371,\n 'Skein1024-144': 0xb372,\n 'Skein1024-152': 0xb373,\n 'Skein1024-160': 0xb374,\n 'Skein1024-168': 0xb375,\n 'Skein1024-176': 0xb376,\n 'Skein1024-184': 0xb377,\n 'Skein1024-192': 0xb378,\n 'Skein1024-200': 0xb379,\n 'Skein1024-208': 0xb37a,\n 'Skein1024-216': 0xb37b,\n 'Skein1024-224': 0xb37c,\n 'Skein1024-232': 0xb37d,\n 'Skein1024-240': 0xb37e,\n 'Skein1024-248': 0xb37f,\n 'Skein1024-256': 0xb380,\n 'Skein1024-264': 0xb381,\n 'Skein1024-272': 0xb382,\n 'Skein1024-280': 0xb383,\n 'Skein1024-288': 0xb384,\n 'Skein1024-296': 0xb385,\n 'Skein1024-304': 0xb386,\n 'Skein1024-312': 0xb387,\n 'Skein1024-320': 0xb388,\n 'Skein1024-328': 0xb389,\n 'Skein1024-336': 0xb38a,\n 'Skein1024-344': 0xb38b,\n 'Skein1024-352': 0xb38c,\n 'Skein1024-360': 0xb38d,\n 'Skein1024-368': 0xb38e,\n 'Skein1024-376': 0xb38f,\n 'Skein1024-384': 0xb390,\n 'Skein1024-392': 0xb391,\n 'Skein1024-400': 0xb392,\n 'Skein1024-408': 0xb393,\n 'Skein1024-416': 0xb394,\n 'Skein1024-424': 0xb395,\n 'Skein1024-432': 0xb396,\n 'Skein1024-440': 0xb397,\n 'Skein1024-448': 0xb398,\n 'Skein1024-456': 0xb399,\n 'Skein1024-464': 0xb39a,\n 'Skein1024-472': 0xb39b,\n 'Skein1024-480': 0xb39c,\n 'Skein1024-488': 0xb39d,\n 'Skein1024-496': 0xb39e,\n 'Skein1024-504': 0xb39f,\n 'Skein1024-512': 0xb3a0,\n 'Skein1024-520': 0xb3a1,\n 'Skein1024-528': 0xb3a2,\n 'Skein1024-536': 0xb3a3,\n 'Skein1024-544': 0xb3a4,\n 'Skein1024-552': 0xb3a5,\n 'Skein1024-560': 0xb3a6,\n 'Skein1024-568': 0xb3a7,\n 'Skein1024-576': 0xb3a8,\n 'Skein1024-584': 0xb3a9,\n 'Skein1024-592': 0xb3aa,\n 'Skein1024-600': 0xb3ab,\n 'Skein1024-608': 0xb3ac,\n 'Skein1024-616': 0xb3ad,\n 'Skein1024-624': 0xb3ae,\n 'Skein1024-632': 0xb3af,\n 'Skein1024-640': 0xb3b0,\n 'Skein1024-648': 0xb3b1,\n 'Skein1024-656': 0xb3b2,\n 'Skein1024-664': 0xb3b3,\n 'Skein1024-672': 0xb3b4,\n 'Skein1024-680': 0xb3b5,\n 'Skein1024-688': 0xb3b6,\n 'Skein1024-696': 0xb3b7,\n 'Skein1024-704': 0xb3b8,\n 'Skein1024-712': 0xb3b9,\n 'Skein1024-720': 0xb3ba,\n 'Skein1024-728': 0xb3bb,\n 'Skein1024-736': 0xb3bc,\n 'Skein1024-744': 0xb3bd,\n 'Skein1024-752': 0xb3be,\n 'Skein1024-760': 0xb3bf,\n 'Skein1024-768': 0xb3c0,\n 'Skein1024-776': 0xb3c1,\n 'Skein1024-784': 0xb3c2,\n 'Skein1024-792': 0xb3c3,\n 'Skein1024-800': 0xb3c4,\n 'Skein1024-808': 0xb3c5,\n 'Skein1024-816': 0xb3c6,\n 'Skein1024-824': 0xb3c7,\n 'Skein1024-832': 0xb3c8,\n 'Skein1024-840': 0xb3c9,\n 'Skein1024-848': 0xb3ca,\n 'Skein1024-856': 0xb3cb,\n 'Skein1024-864': 0xb3cc,\n 'Skein1024-872': 0xb3cd,\n 'Skein1024-880': 0xb3ce,\n 'Skein1024-888': 0xb3cf,\n 'Skein1024-896': 0xb3d0,\n 'Skein1024-904': 0xb3d1,\n 'Skein1024-912': 0xb3d2,\n 'Skein1024-920': 0xb3d3,\n 'Skein1024-928': 0xb3d4,\n 'Skein1024-936': 0xb3d5,\n 'Skein1024-944': 0xb3d6,\n 'Skein1024-952': 0xb3d7,\n 'Skein1024-960': 0xb3d8,\n 'Skein1024-968': 0xb3d9,\n 'Skein1024-976': 0xb3da,\n 'Skein1024-984': 0xb3db,\n 'Skein1024-992': 0xb3dc,\n 'Skein1024-1000': 0xb3dd,\n 'Skein1024-1008': 0xb3de,\n 'Skein1024-1016': 0xb3df,\n 'Skein1024-1024': 0xb3e0\n})\n\nexports.codes = Object.freeze({\n 0x0: 'identity',\n\n // sha family\n 0x11: 'sha1',\n 0x12: 'sha2-256',\n 0x13: 'sha2-512',\n 0x56: 'dbl-sha2-256',\n 0x17: 'sha3-224',\n 0x16: 'sha3-256',\n 0x15: 'sha3-384',\n 0x14: 'sha3-512',\n 0x18: 'shake-128',\n 0x19: 'shake-256',\n 0x1A: 'keccak-224',\n 0x1B: 'keccak-256',\n 0x1C: 'keccak-384',\n 0x1D: 'keccak-512',\n\n 0x22: 'murmur3-128',\n 0x23: 'murmur3-32',\n\n // blake2\n 0xb201: 'blake2b-8',\n 0xb202: 'blake2b-16',\n 0xb203: 'blake2b-24',\n 0xb204: 'blake2b-32',\n 0xb205: 'blake2b-40',\n 0xb206: 'blake2b-48',\n 0xb207: 'blake2b-56',\n 0xb208: 'blake2b-64',\n 0xb209: 'blake2b-72',\n 0xb20a: 'blake2b-80',\n 0xb20b: 'blake2b-88',\n 0xb20c: 'blake2b-96',\n 0xb20d: 'blake2b-104',\n 0xb20e: 'blake2b-112',\n 0xb20f: 'blake2b-120',\n 0xb210: 'blake2b-128',\n 0xb211: 'blake2b-136',\n 0xb212: 'blake2b-144',\n 0xb213: 'blake2b-152',\n 0xb214: 'blake2b-160',\n 0xb215: 'blake2b-168',\n 0xb216: 'blake2b-176',\n 0xb217: 'blake2b-184',\n 0xb218: 'blake2b-192',\n 0xb219: 'blake2b-200',\n 0xb21a: 'blake2b-208',\n 0xb21b: 'blake2b-216',\n 0xb21c: 'blake2b-224',\n 0xb21d: 'blake2b-232',\n 0xb21e: 'blake2b-240',\n 0xb21f: 'blake2b-248',\n 0xb220: 'blake2b-256',\n 0xb221: 'blake2b-264',\n 0xb222: 'blake2b-272',\n 0xb223: 'blake2b-280',\n 0xb224: 'blake2b-288',\n 0xb225: 'blake2b-296',\n 0xb226: 'blake2b-304',\n 0xb227: 'blake2b-312',\n 0xb228: 'blake2b-320',\n 0xb229: 'blake2b-328',\n 0xb22a: 'blake2b-336',\n 0xb22b: 'blake2b-344',\n 0xb22c: 'blake2b-352',\n 0xb22d: 'blake2b-360',\n 0xb22e: 'blake2b-368',\n 0xb22f: 'blake2b-376',\n 0xb230: 'blake2b-384',\n 0xb231: 'blake2b-392',\n 0xb232: 'blake2b-400',\n 0xb233: 'blake2b-408',\n 0xb234: 'blake2b-416',\n 0xb235: 'blake2b-424',\n 0xb236: 'blake2b-432',\n 0xb237: 'blake2b-440',\n 0xb238: 'blake2b-448',\n 0xb239: 'blake2b-456',\n 0xb23a: 'blake2b-464',\n 0xb23b: 'blake2b-472',\n 0xb23c: 'blake2b-480',\n 0xb23d: 'blake2b-488',\n 0xb23e: 'blake2b-496',\n 0xb23f: 'blake2b-504',\n 0xb240: 'blake2b-512',\n 0xb241: 'blake2s-8',\n 0xb242: 'blake2s-16',\n 0xb243: 'blake2s-24',\n 0xb244: 'blake2s-32',\n 0xb245: 'blake2s-40',\n 0xb246: 'blake2s-48',\n 0xb247: 'blake2s-56',\n 0xb248: 'blake2s-64',\n 0xb249: 'blake2s-72',\n 0xb24a: 'blake2s-80',\n 0xb24b: 'blake2s-88',\n 0xb24c: 'blake2s-96',\n 0xb24d: 'blake2s-104',\n 0xb24e: 'blake2s-112',\n 0xb24f: 'blake2s-120',\n 0xb250: 'blake2s-128',\n 0xb251: 'blake2s-136',\n 0xb252: 'blake2s-144',\n 0xb253: 'blake2s-152',\n 0xb254: 'blake2s-160',\n 0xb255: 'blake2s-168',\n 0xb256: 'blake2s-176',\n 0xb257: 'blake2s-184',\n 0xb258: 'blake2s-192',\n 0xb259: 'blake2s-200',\n 0xb25a: 'blake2s-208',\n 0xb25b: 'blake2s-216',\n 0xb25c: 'blake2s-224',\n 0xb25d: 'blake2s-232',\n 0xb25e: 'blake2s-240',\n 0xb25f: 'blake2s-248',\n 0xb260: 'blake2s-256',\n\n // skein\n 0xb301: 'Skein256-8',\n 0xb302: 'Skein256-16',\n 0xb303: 'Skein256-24',\n 0xb304: 'Skein256-32',\n 0xb305: 'Skein256-40',\n 0xb306: 'Skein256-48',\n 0xb307: 'Skein256-56',\n 0xb308: 'Skein256-64',\n 0xb309: 'Skein256-72',\n 0xb30a: 'Skein256-80',\n 0xb30b: 'Skein256-88',\n 0xb30c: 'Skein256-96',\n 0xb30d: 'Skein256-104',\n 0xb30e: 'Skein256-112',\n 0xb30f: 'Skein256-120',\n 0xb310: 'Skein256-128',\n 0xb311: 'Skein256-136',\n 0xb312: 'Skein256-144',\n 0xb313: 'Skein256-152',\n 0xb314: 'Skein256-160',\n 0xb315: 'Skein256-168',\n 0xb316: 'Skein256-176',\n 0xb317: 'Skein256-184',\n 0xb318: 'Skein256-192',\n 0xb319: 'Skein256-200',\n 0xb31a: 'Skein256-208',\n 0xb31b: 'Skein256-216',\n 0xb31c: 'Skein256-224',\n 0xb31d: 'Skein256-232',\n 0xb31e: 'Skein256-240',\n 0xb31f: 'Skein256-248',\n 0xb320: 'Skein256-256',\n 0xb321: 'Skein512-8',\n 0xb322: 'Skein512-16',\n 0xb323: 'Skein512-24',\n 0xb324: 'Skein512-32',\n 0xb325: 'Skein512-40',\n 0xb326: 'Skein512-48',\n 0xb327: 'Skein512-56',\n 0xb328: 'Skein512-64',\n 0xb329: 'Skein512-72',\n 0xb32a: 'Skein512-80',\n 0xb32b: 'Skein512-88',\n 0xb32c: 'Skein512-96',\n 0xb32d: 'Skein512-104',\n 0xb32e: 'Skein512-112',\n 0xb32f: 'Skein512-120',\n 0xb330: 'Skein512-128',\n 0xb331: 'Skein512-136',\n 0xb332: 'Skein512-144',\n 0xb333: 'Skein512-152',\n 0xb334: 'Skein512-160',\n 0xb335: 'Skein512-168',\n 0xb336: 'Skein512-176',\n 0xb337: 'Skein512-184',\n 0xb338: 'Skein512-192',\n 0xb339: 'Skein512-200',\n 0xb33a: 'Skein512-208',\n 0xb33b: 'Skein512-216',\n 0xb33c: 'Skein512-224',\n 0xb33d: 'Skein512-232',\n 0xb33e: 'Skein512-240',\n 0xb33f: 'Skein512-248',\n 0xb340: 'Skein512-256',\n 0xb341: 'Skein512-264',\n 0xb342: 'Skein512-272',\n 0xb343: 'Skein512-280',\n 0xb344: 'Skein512-288',\n 0xb345: 'Skein512-296',\n 0xb346: 'Skein512-304',\n 0xb347: 'Skein512-312',\n 0xb348: 'Skein512-320',\n 0xb349: 'Skein512-328',\n 0xb34a: 'Skein512-336',\n 0xb34b: 'Skein512-344',\n 0xb34c: 'Skein512-352',\n 0xb34d: 'Skein512-360',\n 0xb34e: 'Skein512-368',\n 0xb34f: 'Skein512-376',\n 0xb350: 'Skein512-384',\n 0xb351: 'Skein512-392',\n 0xb352: 'Skein512-400',\n 0xb353: 'Skein512-408',\n 0xb354: 'Skein512-416',\n 0xb355: 'Skein512-424',\n 0xb356: 'Skein512-432',\n 0xb357: 'Skein512-440',\n 0xb358: 'Skein512-448',\n 0xb359: 'Skein512-456',\n 0xb35a: 'Skein512-464',\n 0xb35b: 'Skein512-472',\n 0xb35c: 'Skein512-480',\n 0xb35d: 'Skein512-488',\n 0xb35e: 'Skein512-496',\n 0xb35f: 'Skein512-504',\n 0xb360: 'Skein512-512',\n 0xb361: 'Skein1024-8',\n 0xb362: 'Skein1024-16',\n 0xb363: 'Skein1024-24',\n 0xb364: 'Skein1024-32',\n 0xb365: 'Skein1024-40',\n 0xb366: 'Skein1024-48',\n 0xb367: 'Skein1024-56',\n 0xb368: 'Skein1024-64',\n 0xb369: 'Skein1024-72',\n 0xb36a: 'Skein1024-80',\n 0xb36b: 'Skein1024-88',\n 0xb36c: 'Skein1024-96',\n 0xb36d: 'Skein1024-104',\n 0xb36e: 'Skein1024-112',\n 0xb36f: 'Skein1024-120',\n 0xb370: 'Skein1024-128',\n 0xb371: 'Skein1024-136',\n 0xb372: 'Skein1024-144',\n 0xb373: 'Skein1024-152',\n 0xb374: 'Skein1024-160',\n 0xb375: 'Skein1024-168',\n 0xb376: 'Skein1024-176',\n 0xb377: 'Skein1024-184',\n 0xb378: 'Skein1024-192',\n 0xb379: 'Skein1024-200',\n 0xb37a: 'Skein1024-208',\n 0xb37b: 'Skein1024-216',\n 0xb37c: 'Skein1024-224',\n 0xb37d: 'Skein1024-232',\n 0xb37e: 'Skein1024-240',\n 0xb37f: 'Skein1024-248',\n 0xb380: 'Skein1024-256',\n 0xb381: 'Skein1024-264',\n 0xb382: 'Skein1024-272',\n 0xb383: 'Skein1024-280',\n 0xb384: 'Skein1024-288',\n 0xb385: 'Skein1024-296',\n 0xb386: 'Skein1024-304',\n 0xb387: 'Skein1024-312',\n 0xb388: 'Skein1024-320',\n 0xb389: 'Skein1024-328',\n 0xb38a: 'Skein1024-336',\n 0xb38b: 'Skein1024-344',\n 0xb38c: 'Skein1024-352',\n 0xb38d: 'Skein1024-360',\n 0xb38e: 'Skein1024-368',\n 0xb38f: 'Skein1024-376',\n 0xb390: 'Skein1024-384',\n 0xb391: 'Skein1024-392',\n 0xb392: 'Skein1024-400',\n 0xb393: 'Skein1024-408',\n 0xb394: 'Skein1024-416',\n 0xb395: 'Skein1024-424',\n 0xb396: 'Skein1024-432',\n 0xb397: 'Skein1024-440',\n 0xb398: 'Skein1024-448',\n 0xb399: 'Skein1024-456',\n 0xb39a: 'Skein1024-464',\n 0xb39b: 'Skein1024-472',\n 0xb39c: 'Skein1024-480',\n 0xb39d: 'Skein1024-488',\n 0xb39e: 'Skein1024-496',\n 0xb39f: 'Skein1024-504',\n 0xb3a0: 'Skein1024-512',\n 0xb3a1: 'Skein1024-520',\n 0xb3a2: 'Skein1024-528',\n 0xb3a3: 'Skein1024-536',\n 0xb3a4: 'Skein1024-544',\n 0xb3a5: 'Skein1024-552',\n 0xb3a6: 'Skein1024-560',\n 0xb3a7: 'Skein1024-568',\n 0xb3a8: 'Skein1024-576',\n 0xb3a9: 'Skein1024-584',\n 0xb3aa: 'Skein1024-592',\n 0xb3ab: 'Skein1024-600',\n 0xb3ac: 'Skein1024-608',\n 0xb3ad: 'Skein1024-616',\n 0xb3ae: 'Skein1024-624',\n 0xb3af: 'Skein1024-632',\n 0xb3b0: 'Skein1024-640',\n 0xb3b1: 'Skein1024-648',\n 0xb3b2: 'Skein1024-656',\n 0xb3b3: 'Skein1024-664',\n 0xb3b4: 'Skein1024-672',\n 0xb3b5: 'Skein1024-680',\n 0xb3b6: 'Skein1024-688',\n 0xb3b7: 'Skein1024-696',\n 0xb3b8: 'Skein1024-704',\n 0xb3b9: 'Skein1024-712',\n 0xb3ba: 'Skein1024-720',\n 0xb3bb: 'Skein1024-728',\n 0xb3bc: 'Skein1024-736',\n 0xb3bd: 'Skein1024-744',\n 0xb3be: 'Skein1024-752',\n 0xb3bf: 'Skein1024-760',\n 0xb3c0: 'Skein1024-768',\n 0xb3c1: 'Skein1024-776',\n 0xb3c2: 'Skein1024-784',\n 0xb3c3: 'Skein1024-792',\n 0xb3c4: 'Skein1024-800',\n 0xb3c5: 'Skein1024-808',\n 0xb3c6: 'Skein1024-816',\n 0xb3c7: 'Skein1024-824',\n 0xb3c8: 'Skein1024-832',\n 0xb3c9: 'Skein1024-840',\n 0xb3ca: 'Skein1024-848',\n 0xb3cb: 'Skein1024-856',\n 0xb3cc: 'Skein1024-864',\n 0xb3cd: 'Skein1024-872',\n 0xb3ce: 'Skein1024-880',\n 0xb3cf: 'Skein1024-888',\n 0xb3d0: 'Skein1024-896',\n 0xb3d1: 'Skein1024-904',\n 0xb3d2: 'Skein1024-912',\n 0xb3d3: 'Skein1024-920',\n 0xb3d4: 'Skein1024-928',\n 0xb3d5: 'Skein1024-936',\n 0xb3d6: 'Skein1024-944',\n 0xb3d7: 'Skein1024-952',\n 0xb3d8: 'Skein1024-960',\n 0xb3d9: 'Skein1024-968',\n 0xb3da: 'Skein1024-976',\n 0xb3db: 'Skein1024-984',\n 0xb3dc: 'Skein1024-992',\n 0xb3dd: 'Skein1024-1000',\n 0xb3de: 'Skein1024-1008',\n 0xb3df: 'Skein1024-1016',\n 0xb3e0: 'Skein1024-1024'\n})\n\nexports.defaultLengths = Object.freeze({\n 0x11: 20,\n 0x12: 32,\n 0x13: 64,\n 0x56: 32,\n 0x17: 28,\n 0x16: 32,\n 0x15: 48,\n 0x14: 64,\n 0x18: 32,\n 0x19: 64,\n 0x1A: 28,\n 0x1B: 32,\n 0x1C: 48,\n 0x1D: 64,\n 0x22: 32,\n\n 0xb201: 0x01,\n 0xb202: 0x02,\n 0xb203: 0x03,\n 0xb204: 0x04,\n 0xb205: 0x05,\n 0xb206: 0x06,\n 0xb207: 0x07,\n 0xb208: 0x08,\n 0xb209: 0x09,\n 0xb20a: 0x0a,\n 0xb20b: 0x0b,\n 0xb20c: 0x0c,\n 0xb20d: 0x0d,\n 0xb20e: 0x0e,\n 0xb20f: 0x0f,\n 0xb210: 0x10,\n 0xb211: 0x11,\n 0xb212: 0x12,\n 0xb213: 0x13,\n 0xb214: 0x14,\n 0xb215: 0x15,\n 0xb216: 0x16,\n 0xb217: 0x17,\n 0xb218: 0x18,\n 0xb219: 0x19,\n 0xb21a: 0x1a,\n 0xb21b: 0x1b,\n 0xb21c: 0x1c,\n 0xb21d: 0x1d,\n 0xb21e: 0x1e,\n 0xb21f: 0x1f,\n 0xb220: 0x20,\n 0xb221: 0x21,\n 0xb222: 0x22,\n 0xb223: 0x23,\n 0xb224: 0x24,\n 0xb225: 0x25,\n 0xb226: 0x26,\n 0xb227: 0x27,\n 0xb228: 0x28,\n 0xb229: 0x29,\n 0xb22a: 0x2a,\n 0xb22b: 0x2b,\n 0xb22c: 0x2c,\n 0xb22d: 0x2d,\n 0xb22e: 0x2e,\n 0xb22f: 0x2f,\n 0xb230: 0x30,\n 0xb231: 0x31,\n 0xb232: 0x32,\n 0xb233: 0x33,\n 0xb234: 0x34,\n 0xb235: 0x35,\n 0xb236: 0x36,\n 0xb237: 0x37,\n 0xb238: 0x38,\n 0xb239: 0x39,\n 0xb23a: 0x3a,\n 0xb23b: 0x3b,\n 0xb23c: 0x3c,\n 0xb23d: 0x3d,\n 0xb23e: 0x3e,\n 0xb23f: 0x3f,\n 0xb240: 0x40,\n 0xb241: 0x01,\n 0xb242: 0x02,\n 0xb243: 0x03,\n 0xb244: 0x04,\n 0xb245: 0x05,\n 0xb246: 0x06,\n 0xb247: 0x07,\n 0xb248: 0x08,\n 0xb249: 0x09,\n 0xb24a: 0x0a,\n 0xb24b: 0x0b,\n 0xb24c: 0x0c,\n 0xb24d: 0x0d,\n 0xb24e: 0x0e,\n 0xb24f: 0x0f,\n 0xb250: 0x10,\n 0xb251: 0x11,\n 0xb252: 0x12,\n 0xb253: 0x13,\n 0xb254: 0x14,\n 0xb255: 0x15,\n 0xb256: 0x16,\n 0xb257: 0x17,\n 0xb258: 0x18,\n 0xb259: 0x19,\n 0xb25a: 0x1a,\n 0xb25b: 0x1b,\n 0xb25c: 0x1c,\n 0xb25d: 0x1d,\n 0xb25e: 0x1e,\n 0xb25f: 0x1f,\n 0xb260: 0x20,\n 0xb301: 0x01,\n 0xb302: 0x02,\n 0xb303: 0x03,\n 0xb304: 0x04,\n 0xb305: 0x05,\n 0xb306: 0x06,\n 0xb307: 0x07,\n 0xb308: 0x08,\n 0xb309: 0x09,\n 0xb30a: 0x0a,\n 0xb30b: 0x0b,\n 0xb30c: 0x0c,\n 0xb30d: 0x0d,\n 0xb30e: 0x0e,\n 0xb30f: 0x0f,\n 0xb310: 0x10,\n 0xb311: 0x11,\n 0xb312: 0x12,\n 0xb313: 0x13,\n 0xb314: 0x14,\n 0xb315: 0x15,\n 0xb316: 0x16,\n 0xb317: 0x17,\n 0xb318: 0x18,\n 0xb319: 0x19,\n 0xb31a: 0x1a,\n 0xb31b: 0x1b,\n 0xb31c: 0x1c,\n 0xb31d: 0x1d,\n 0xb31e: 0x1e,\n 0xb31f: 0x1f,\n 0xb320: 0x20,\n 0xb321: 0x01,\n 0xb322: 0x02,\n 0xb323: 0x03,\n 0xb324: 0x04,\n 0xb325: 0x05,\n 0xb326: 0x06,\n 0xb327: 0x07,\n 0xb328: 0x08,\n 0xb329: 0x09,\n 0xb32a: 0x0a,\n 0xb32b: 0x0b,\n 0xb32c: 0x0c,\n 0xb32d: 0x0d,\n 0xb32e: 0x0e,\n 0xb32f: 0x0f,\n 0xb330: 0x10,\n 0xb331: 0x11,\n 0xb332: 0x12,\n 0xb333: 0x13,\n 0xb334: 0x14,\n 0xb335: 0x15,\n 0xb336: 0x16,\n 0xb337: 0x17,\n 0xb338: 0x18,\n 0xb339: 0x19,\n 0xb33a: 0x1a,\n 0xb33b: 0x1b,\n 0xb33c: 0x1c,\n 0xb33d: 0x1d,\n 0xb33e: 0x1e,\n 0xb33f: 0x1f,\n 0xb340: 0x20,\n 0xb341: 0x21,\n 0xb342: 0x22,\n 0xb343: 0x23,\n 0xb344: 0x24,\n 0xb345: 0x25,\n 0xb346: 0x26,\n 0xb347: 0x27,\n 0xb348: 0x28,\n 0xb349: 0x29,\n 0xb34a: 0x2a,\n 0xb34b: 0x2b,\n 0xb34c: 0x2c,\n 0xb34d: 0x2d,\n 0xb34e: 0x2e,\n 0xb34f: 0x2f,\n 0xb350: 0x30,\n 0xb351: 0x31,\n 0xb352: 0x32,\n 0xb353: 0x33,\n 0xb354: 0x34,\n 0xb355: 0x35,\n 0xb356: 0x36,\n 0xb357: 0x37,\n 0xb358: 0x38,\n 0xb359: 0x39,\n 0xb35a: 0x3a,\n 0xb35b: 0x3b,\n 0xb35c: 0x3c,\n 0xb35d: 0x3d,\n 0xb35e: 0x3e,\n 0xb35f: 0x3f,\n 0xb360: 0x40,\n 0xb361: 0x01,\n 0xb362: 0x02,\n 0xb363: 0x03,\n 0xb364: 0x04,\n 0xb365: 0x05,\n 0xb366: 0x06,\n 0xb367: 0x07,\n 0xb368: 0x08,\n 0xb369: 0x09,\n 0xb36a: 0x0a,\n 0xb36b: 0x0b,\n 0xb36c: 0x0c,\n 0xb36d: 0x0d,\n 0xb36e: 0x0e,\n 0xb36f: 0x0f,\n 0xb370: 0x10,\n 0xb371: 0x11,\n 0xb372: 0x12,\n 0xb373: 0x13,\n 0xb374: 0x14,\n 0xb375: 0x15,\n 0xb376: 0x16,\n 0xb377: 0x17,\n 0xb378: 0x18,\n 0xb379: 0x19,\n 0xb37a: 0x1a,\n 0xb37b: 0x1b,\n 0xb37c: 0x1c,\n 0xb37d: 0x1d,\n 0xb37e: 0x1e,\n 0xb37f: 0x1f,\n 0xb380: 0x20,\n 0xb381: 0x21,\n 0xb382: 0x22,\n 0xb383: 0x23,\n 0xb384: 0x24,\n 0xb385: 0x25,\n 0xb386: 0x26,\n 0xb387: 0x27,\n 0xb388: 0x28,\n 0xb389: 0x29,\n 0xb38a: 0x2a,\n 0xb38b: 0x2b,\n 0xb38c: 0x2c,\n 0xb38d: 0x2d,\n 0xb38e: 0x2e,\n 0xb38f: 0x2f,\n 0xb390: 0x30,\n 0xb391: 0x31,\n 0xb392: 0x32,\n 0xb393: 0x33,\n 0xb394: 0x34,\n 0xb395: 0x35,\n 0xb396: 0x36,\n 0xb397: 0x37,\n 0xb398: 0x38,\n 0xb399: 0x39,\n 0xb39a: 0x3a,\n 0xb39b: 0x3b,\n 0xb39c: 0x3c,\n 0xb39d: 0x3d,\n 0xb39e: 0x3e,\n 0xb39f: 0x3f,\n 0xb3a0: 0x40,\n 0xb3a1: 0x41,\n 0xb3a2: 0x42,\n 0xb3a3: 0x43,\n 0xb3a4: 0x44,\n 0xb3a5: 0x45,\n 0xb3a6: 0x46,\n 0xb3a7: 0x47,\n 0xb3a8: 0x48,\n 0xb3a9: 0x49,\n 0xb3aa: 0x4a,\n 0xb3ab: 0x4b,\n 0xb3ac: 0x4c,\n 0xb3ad: 0x4d,\n 0xb3ae: 0x4e,\n 0xb3af: 0x4f,\n 0xb3b0: 0x50,\n 0xb3b1: 0x51,\n 0xb3b2: 0x52,\n 0xb3b3: 0x53,\n 0xb3b4: 0x54,\n 0xb3b5: 0x55,\n 0xb3b6: 0x56,\n 0xb3b7: 0x57,\n 0xb3b8: 0x58,\n 0xb3b9: 0x59,\n 0xb3ba: 0x5a,\n 0xb3bb: 0x5b,\n 0xb3bc: 0x5c,\n 0xb3bd: 0x5d,\n 0xb3be: 0x5e,\n 0xb3bf: 0x5f,\n 0xb3c0: 0x60,\n 0xb3c1: 0x61,\n 0xb3c2: 0x62,\n 0xb3c3: 0x63,\n 0xb3c4: 0x64,\n 0xb3c5: 0x65,\n 0xb3c6: 0x66,\n 0xb3c7: 0x67,\n 0xb3c8: 0x68,\n 0xb3c9: 0x69,\n 0xb3ca: 0x6a,\n 0xb3cb: 0x6b,\n 0xb3cc: 0x6c,\n 0xb3cd: 0x6d,\n 0xb3ce: 0x6e,\n 0xb3cf: 0x6f,\n 0xb3d0: 0x70,\n 0xb3d1: 0x71,\n 0xb3d2: 0x72,\n 0xb3d3: 0x73,\n 0xb3d4: 0x74,\n 0xb3d5: 0x75,\n 0xb3d6: 0x76,\n 0xb3d7: 0x77,\n 0xb3d8: 0x78,\n 0xb3d9: 0x79,\n 0xb3da: 0x7a,\n 0xb3db: 0x7b,\n 0xb3dc: 0x7c,\n 0xb3dd: 0x7d,\n 0xb3de: 0x7e,\n 0xb3df: 0x7f,\n 0xb3e0: 0x80\n})\n","'use strict'\n\nconst toPullStream = require('async-iterator-to-pull-stream')\n\nmodule.exports = function (self) {\n return function lsPullStream (ipfsPath, options) {\n return toPullStream.source(self._lsAsyncIterator(ipfsPath, options))\n }\n}\n","/* eslint quote-props: off */\n/* eslint key-spacing: off */\n'use strict'\n\nexports.names = Object.freeze({\n 'identity': 0x0,\n 'sha1': 0x11,\n 'sha2-256': 0x12,\n 'sha2-512': 0x13,\n 'dbl-sha2-256': 0x56,\n 'sha3-224': 0x17,\n 'sha3-256': 0x16,\n 'sha3-384': 0x15,\n 'sha3-512': 0x14,\n 'shake-128': 0x18,\n 'shake-256': 0x19,\n 'keccak-224': 0x1A,\n 'keccak-256': 0x1B,\n 'keccak-384': 0x1C,\n 'keccak-512': 0x1D,\n 'murmur3-128': 0x22,\n 'murmur3-32': 0x23,\n 'blake2b-8': 0xb201,\n 'blake2b-16': 0xb202,\n 'blake2b-24': 0xb203,\n 'blake2b-32': 0xb204,\n 'blake2b-40': 0xb205,\n 'blake2b-48': 0xb206,\n 'blake2b-56': 0xb207,\n 'blake2b-64': 0xb208,\n 'blake2b-72': 0xb209,\n 'blake2b-80': 0xb20a,\n 'blake2b-88': 0xb20b,\n 'blake2b-96': 0xb20c,\n 'blake2b-104': 0xb20d,\n 'blake2b-112': 0xb20e,\n 'blake2b-120': 0xb20f,\n 'blake2b-128': 0xb210,\n 'blake2b-136': 0xb211,\n 'blake2b-144': 0xb212,\n 'blake2b-152': 0xb213,\n 'blake2b-160': 0xb214,\n 'blake2b-168': 0xb215,\n 'blake2b-176': 0xb216,\n 'blake2b-184': 0xb217,\n 'blake2b-192': 0xb218,\n 'blake2b-200': 0xb219,\n 'blake2b-208': 0xb21a,\n 'blake2b-216': 0xb21b,\n 'blake2b-224': 0xb21c,\n 'blake2b-232': 0xb21d,\n 'blake2b-240': 0xb21e,\n 'blake2b-248': 0xb21f,\n 'blake2b-256': 0xb220,\n 'blake2b-264': 0xb221,\n 'blake2b-272': 0xb222,\n 'blake2b-280': 0xb223,\n 'blake2b-288': 0xb224,\n 'blake2b-296': 0xb225,\n 'blake2b-304': 0xb226,\n 'blake2b-312': 0xb227,\n 'blake2b-320': 0xb228,\n 'blake2b-328': 0xb229,\n 'blake2b-336': 0xb22a,\n 'blake2b-344': 0xb22b,\n 'blake2b-352': 0xb22c,\n 'blake2b-360': 0xb22d,\n 'blake2b-368': 0xb22e,\n 'blake2b-376': 0xb22f,\n 'blake2b-384': 0xb230,\n 'blake2b-392': 0xb231,\n 'blake2b-400': 0xb232,\n 'blake2b-408': 0xb233,\n 'blake2b-416': 0xb234,\n 'blake2b-424': 0xb235,\n 'blake2b-432': 0xb236,\n 'blake2b-440': 0xb237,\n 'blake2b-448': 0xb238,\n 'blake2b-456': 0xb239,\n 'blake2b-464': 0xb23a,\n 'blake2b-472': 0xb23b,\n 'blake2b-480': 0xb23c,\n 'blake2b-488': 0xb23d,\n 'blake2b-496': 0xb23e,\n 'blake2b-504': 0xb23f,\n 'blake2b-512': 0xb240,\n 'blake2s-8': 0xb241,\n 'blake2s-16': 0xb242,\n 'blake2s-24': 0xb243,\n 'blake2s-32': 0xb244,\n 'blake2s-40': 0xb245,\n 'blake2s-48': 0xb246,\n 'blake2s-56': 0xb247,\n 'blake2s-64': 0xb248,\n 'blake2s-72': 0xb249,\n 'blake2s-80': 0xb24a,\n 'blake2s-88': 0xb24b,\n 'blake2s-96': 0xb24c,\n 'blake2s-104': 0xb24d,\n 'blake2s-112': 0xb24e,\n 'blake2s-120': 0xb24f,\n 'blake2s-128': 0xb250,\n 'blake2s-136': 0xb251,\n 'blake2s-144': 0xb252,\n 'blake2s-152': 0xb253,\n 'blake2s-160': 0xb254,\n 'blake2s-168': 0xb255,\n 'blake2s-176': 0xb256,\n 'blake2s-184': 0xb257,\n 'blake2s-192': 0xb258,\n 'blake2s-200': 0xb259,\n 'blake2s-208': 0xb25a,\n 'blake2s-216': 0xb25b,\n 'blake2s-224': 0xb25c,\n 'blake2s-232': 0xb25d,\n 'blake2s-240': 0xb25e,\n 'blake2s-248': 0xb25f,\n 'blake2s-256': 0xb260,\n 'Skein256-8': 0xb301,\n 'Skein256-16': 0xb302,\n 'Skein256-24': 0xb303,\n 'Skein256-32': 0xb304,\n 'Skein256-40': 0xb305,\n 'Skein256-48': 0xb306,\n 'Skein256-56': 0xb307,\n 'Skein256-64': 0xb308,\n 'Skein256-72': 0xb309,\n 'Skein256-80': 0xb30a,\n 'Skein256-88': 0xb30b,\n 'Skein256-96': 0xb30c,\n 'Skein256-104': 0xb30d,\n 'Skein256-112': 0xb30e,\n 'Skein256-120': 0xb30f,\n 'Skein256-128': 0xb310,\n 'Skein256-136': 0xb311,\n 'Skein256-144': 0xb312,\n 'Skein256-152': 0xb313,\n 'Skein256-160': 0xb314,\n 'Skein256-168': 0xb315,\n 'Skein256-176': 0xb316,\n 'Skein256-184': 0xb317,\n 'Skein256-192': 0xb318,\n 'Skein256-200': 0xb319,\n 'Skein256-208': 0xb31a,\n 'Skein256-216': 0xb31b,\n 'Skein256-224': 0xb31c,\n 'Skein256-232': 0xb31d,\n 'Skein256-240': 0xb31e,\n 'Skein256-248': 0xb31f,\n 'Skein256-256': 0xb320,\n 'Skein512-8': 0xb321,\n 'Skein512-16': 0xb322,\n 'Skein512-24': 0xb323,\n 'Skein512-32': 0xb324,\n 'Skein512-40': 0xb325,\n 'Skein512-48': 0xb326,\n 'Skein512-56': 0xb327,\n 'Skein512-64': 0xb328,\n 'Skein512-72': 0xb329,\n 'Skein512-80': 0xb32a,\n 'Skein512-88': 0xb32b,\n 'Skein512-96': 0xb32c,\n 'Skein512-104': 0xb32d,\n 'Skein512-112': 0xb32e,\n 'Skein512-120': 0xb32f,\n 'Skein512-128': 0xb330,\n 'Skein512-136': 0xb331,\n 'Skein512-144': 0xb332,\n 'Skein512-152': 0xb333,\n 'Skein512-160': 0xb334,\n 'Skein512-168': 0xb335,\n 'Skein512-176': 0xb336,\n 'Skein512-184': 0xb337,\n 'Skein512-192': 0xb338,\n 'Skein512-200': 0xb339,\n 'Skein512-208': 0xb33a,\n 'Skein512-216': 0xb33b,\n 'Skein512-224': 0xb33c,\n 'Skein512-232': 0xb33d,\n 'Skein512-240': 0xb33e,\n 'Skein512-248': 0xb33f,\n 'Skein512-256': 0xb340,\n 'Skein512-264': 0xb341,\n 'Skein512-272': 0xb342,\n 'Skein512-280': 0xb343,\n 'Skein512-288': 0xb344,\n 'Skein512-296': 0xb345,\n 'Skein512-304': 0xb346,\n 'Skein512-312': 0xb347,\n 'Skein512-320': 0xb348,\n 'Skein512-328': 0xb349,\n 'Skein512-336': 0xb34a,\n 'Skein512-344': 0xb34b,\n 'Skein512-352': 0xb34c,\n 'Skein512-360': 0xb34d,\n 'Skein512-368': 0xb34e,\n 'Skein512-376': 0xb34f,\n 'Skein512-384': 0xb350,\n 'Skein512-392': 0xb351,\n 'Skein512-400': 0xb352,\n 'Skein512-408': 0xb353,\n 'Skein512-416': 0xb354,\n 'Skein512-424': 0xb355,\n 'Skein512-432': 0xb356,\n 'Skein512-440': 0xb357,\n 'Skein512-448': 0xb358,\n 'Skein512-456': 0xb359,\n 'Skein512-464': 0xb35a,\n 'Skein512-472': 0xb35b,\n 'Skein512-480': 0xb35c,\n 'Skein512-488': 0xb35d,\n 'Skein512-496': 0xb35e,\n 'Skein512-504': 0xb35f,\n 'Skein512-512': 0xb360,\n 'Skein1024-8': 0xb361,\n 'Skein1024-16': 0xb362,\n 'Skein1024-24': 0xb363,\n 'Skein1024-32': 0xb364,\n 'Skein1024-40': 0xb365,\n 'Skein1024-48': 0xb366,\n 'Skein1024-56': 0xb367,\n 'Skein1024-64': 0xb368,\n 'Skein1024-72': 0xb369,\n 'Skein1024-80': 0xb36a,\n 'Skein1024-88': 0xb36b,\n 'Skein1024-96': 0xb36c,\n 'Skein1024-104': 0xb36d,\n 'Skein1024-112': 0xb36e,\n 'Skein1024-120': 0xb36f,\n 'Skein1024-128': 0xb370,\n 'Skein1024-136': 0xb371,\n 'Skein1024-144': 0xb372,\n 'Skein1024-152': 0xb373,\n 'Skein1024-160': 0xb374,\n 'Skein1024-168': 0xb375,\n 'Skein1024-176': 0xb376,\n 'Skein1024-184': 0xb377,\n 'Skein1024-192': 0xb378,\n 'Skein1024-200': 0xb379,\n 'Skein1024-208': 0xb37a,\n 'Skein1024-216': 0xb37b,\n 'Skein1024-224': 0xb37c,\n 'Skein1024-232': 0xb37d,\n 'Skein1024-240': 0xb37e,\n 'Skein1024-248': 0xb37f,\n 'Skein1024-256': 0xb380,\n 'Skein1024-264': 0xb381,\n 'Skein1024-272': 0xb382,\n 'Skein1024-280': 0xb383,\n 'Skein1024-288': 0xb384,\n 'Skein1024-296': 0xb385,\n 'Skein1024-304': 0xb386,\n 'Skein1024-312': 0xb387,\n 'Skein1024-320': 0xb388,\n 'Skein1024-328': 0xb389,\n 'Skein1024-336': 0xb38a,\n 'Skein1024-344': 0xb38b,\n 'Skein1024-352': 0xb38c,\n 'Skein1024-360': 0xb38d,\n 'Skein1024-368': 0xb38e,\n 'Skein1024-376': 0xb38f,\n 'Skein1024-384': 0xb390,\n 'Skein1024-392': 0xb391,\n 'Skein1024-400': 0xb392,\n 'Skein1024-408': 0xb393,\n 'Skein1024-416': 0xb394,\n 'Skein1024-424': 0xb395,\n 'Skein1024-432': 0xb396,\n 'Skein1024-440': 0xb397,\n 'Skein1024-448': 0xb398,\n 'Skein1024-456': 0xb399,\n 'Skein1024-464': 0xb39a,\n 'Skein1024-472': 0xb39b,\n 'Skein1024-480': 0xb39c,\n 'Skein1024-488': 0xb39d,\n 'Skein1024-496': 0xb39e,\n 'Skein1024-504': 0xb39f,\n 'Skein1024-512': 0xb3a0,\n 'Skein1024-520': 0xb3a1,\n 'Skein1024-528': 0xb3a2,\n 'Skein1024-536': 0xb3a3,\n 'Skein1024-544': 0xb3a4,\n 'Skein1024-552': 0xb3a5,\n 'Skein1024-560': 0xb3a6,\n 'Skein1024-568': 0xb3a7,\n 'Skein1024-576': 0xb3a8,\n 'Skein1024-584': 0xb3a9,\n 'Skein1024-592': 0xb3aa,\n 'Skein1024-600': 0xb3ab,\n 'Skein1024-608': 0xb3ac,\n 'Skein1024-616': 0xb3ad,\n 'Skein1024-624': 0xb3ae,\n 'Skein1024-632': 0xb3af,\n 'Skein1024-640': 0xb3b0,\n 'Skein1024-648': 0xb3b1,\n 'Skein1024-656': 0xb3b2,\n 'Skein1024-664': 0xb3b3,\n 'Skein1024-672': 0xb3b4,\n 'Skein1024-680': 0xb3b5,\n 'Skein1024-688': 0xb3b6,\n 'Skein1024-696': 0xb3b7,\n 'Skein1024-704': 0xb3b8,\n 'Skein1024-712': 0xb3b9,\n 'Skein1024-720': 0xb3ba,\n 'Skein1024-728': 0xb3bb,\n 'Skein1024-736': 0xb3bc,\n 'Skein1024-744': 0xb3bd,\n 'Skein1024-752': 0xb3be,\n 'Skein1024-760': 0xb3bf,\n 'Skein1024-768': 0xb3c0,\n 'Skein1024-776': 0xb3c1,\n 'Skein1024-784': 0xb3c2,\n 'Skein1024-792': 0xb3c3,\n 'Skein1024-800': 0xb3c4,\n 'Skein1024-808': 0xb3c5,\n 'Skein1024-816': 0xb3c6,\n 'Skein1024-824': 0xb3c7,\n 'Skein1024-832': 0xb3c8,\n 'Skein1024-840': 0xb3c9,\n 'Skein1024-848': 0xb3ca,\n 'Skein1024-856': 0xb3cb,\n 'Skein1024-864': 0xb3cc,\n 'Skein1024-872': 0xb3cd,\n 'Skein1024-880': 0xb3ce,\n 'Skein1024-888': 0xb3cf,\n 'Skein1024-896': 0xb3d0,\n 'Skein1024-904': 0xb3d1,\n 'Skein1024-912': 0xb3d2,\n 'Skein1024-920': 0xb3d3,\n 'Skein1024-928': 0xb3d4,\n 'Skein1024-936': 0xb3d5,\n 'Skein1024-944': 0xb3d6,\n 'Skein1024-952': 0xb3d7,\n 'Skein1024-960': 0xb3d8,\n 'Skein1024-968': 0xb3d9,\n 'Skein1024-976': 0xb3da,\n 'Skein1024-984': 0xb3db,\n 'Skein1024-992': 0xb3dc,\n 'Skein1024-1000': 0xb3dd,\n 'Skein1024-1008': 0xb3de,\n 'Skein1024-1016': 0xb3df,\n 'Skein1024-1024': 0xb3e0\n})\n\nexports.codes = Object.freeze({\n 0x0: 'identity',\n\n // sha family\n 0x11: 'sha1',\n 0x12: 'sha2-256',\n 0x13: 'sha2-512',\n 0x56: 'dbl-sha2-256',\n 0x17: 'sha3-224',\n 0x16: 'sha3-256',\n 0x15: 'sha3-384',\n 0x14: 'sha3-512',\n 0x18: 'shake-128',\n 0x19: 'shake-256',\n 0x1A: 'keccak-224',\n 0x1B: 'keccak-256',\n 0x1C: 'keccak-384',\n 0x1D: 'keccak-512',\n\n 0x22: 'murmur3-128',\n 0x23: 'murmur3-32',\n\n // blake2\n 0xb201: 'blake2b-8',\n 0xb202: 'blake2b-16',\n 0xb203: 'blake2b-24',\n 0xb204: 'blake2b-32',\n 0xb205: 'blake2b-40',\n 0xb206: 'blake2b-48',\n 0xb207: 'blake2b-56',\n 0xb208: 'blake2b-64',\n 0xb209: 'blake2b-72',\n 0xb20a: 'blake2b-80',\n 0xb20b: 'blake2b-88',\n 0xb20c: 'blake2b-96',\n 0xb20d: 'blake2b-104',\n 0xb20e: 'blake2b-112',\n 0xb20f: 'blake2b-120',\n 0xb210: 'blake2b-128',\n 0xb211: 'blake2b-136',\n 0xb212: 'blake2b-144',\n 0xb213: 'blake2b-152',\n 0xb214: 'blake2b-160',\n 0xb215: 'blake2b-168',\n 0xb216: 'blake2b-176',\n 0xb217: 'blake2b-184',\n 0xb218: 'blake2b-192',\n 0xb219: 'blake2b-200',\n 0xb21a: 'blake2b-208',\n 0xb21b: 'blake2b-216',\n 0xb21c: 'blake2b-224',\n 0xb21d: 'blake2b-232',\n 0xb21e: 'blake2b-240',\n 0xb21f: 'blake2b-248',\n 0xb220: 'blake2b-256',\n 0xb221: 'blake2b-264',\n 0xb222: 'blake2b-272',\n 0xb223: 'blake2b-280',\n 0xb224: 'blake2b-288',\n 0xb225: 'blake2b-296',\n 0xb226: 'blake2b-304',\n 0xb227: 'blake2b-312',\n 0xb228: 'blake2b-320',\n 0xb229: 'blake2b-328',\n 0xb22a: 'blake2b-336',\n 0xb22b: 'blake2b-344',\n 0xb22c: 'blake2b-352',\n 0xb22d: 'blake2b-360',\n 0xb22e: 'blake2b-368',\n 0xb22f: 'blake2b-376',\n 0xb230: 'blake2b-384',\n 0xb231: 'blake2b-392',\n 0xb232: 'blake2b-400',\n 0xb233: 'blake2b-408',\n 0xb234: 'blake2b-416',\n 0xb235: 'blake2b-424',\n 0xb236: 'blake2b-432',\n 0xb237: 'blake2b-440',\n 0xb238: 'blake2b-448',\n 0xb239: 'blake2b-456',\n 0xb23a: 'blake2b-464',\n 0xb23b: 'blake2b-472',\n 0xb23c: 'blake2b-480',\n 0xb23d: 'blake2b-488',\n 0xb23e: 'blake2b-496',\n 0xb23f: 'blake2b-504',\n 0xb240: 'blake2b-512',\n 0xb241: 'blake2s-8',\n 0xb242: 'blake2s-16',\n 0xb243: 'blake2s-24',\n 0xb244: 'blake2s-32',\n 0xb245: 'blake2s-40',\n 0xb246: 'blake2s-48',\n 0xb247: 'blake2s-56',\n 0xb248: 'blake2s-64',\n 0xb249: 'blake2s-72',\n 0xb24a: 'blake2s-80',\n 0xb24b: 'blake2s-88',\n 0xb24c: 'blake2s-96',\n 0xb24d: 'blake2s-104',\n 0xb24e: 'blake2s-112',\n 0xb24f: 'blake2s-120',\n 0xb250: 'blake2s-128',\n 0xb251: 'blake2s-136',\n 0xb252: 'blake2s-144',\n 0xb253: 'blake2s-152',\n 0xb254: 'blake2s-160',\n 0xb255: 'blake2s-168',\n 0xb256: 'blake2s-176',\n 0xb257: 'blake2s-184',\n 0xb258: 'blake2s-192',\n 0xb259: 'blake2s-200',\n 0xb25a: 'blake2s-208',\n 0xb25b: 'blake2s-216',\n 0xb25c: 'blake2s-224',\n 0xb25d: 'blake2s-232',\n 0xb25e: 'blake2s-240',\n 0xb25f: 'blake2s-248',\n 0xb260: 'blake2s-256',\n\n // skein\n 0xb301: 'Skein256-8',\n 0xb302: 'Skein256-16',\n 0xb303: 'Skein256-24',\n 0xb304: 'Skein256-32',\n 0xb305: 'Skein256-40',\n 0xb306: 'Skein256-48',\n 0xb307: 'Skein256-56',\n 0xb308: 'Skein256-64',\n 0xb309: 'Skein256-72',\n 0xb30a: 'Skein256-80',\n 0xb30b: 'Skein256-88',\n 0xb30c: 'Skein256-96',\n 0xb30d: 'Skein256-104',\n 0xb30e: 'Skein256-112',\n 0xb30f: 'Skein256-120',\n 0xb310: 'Skein256-128',\n 0xb311: 'Skein256-136',\n 0xb312: 'Skein256-144',\n 0xb313: 'Skein256-152',\n 0xb314: 'Skein256-160',\n 0xb315: 'Skein256-168',\n 0xb316: 'Skein256-176',\n 0xb317: 'Skein256-184',\n 0xb318: 'Skein256-192',\n 0xb319: 'Skein256-200',\n 0xb31a: 'Skein256-208',\n 0xb31b: 'Skein256-216',\n 0xb31c: 'Skein256-224',\n 0xb31d: 'Skein256-232',\n 0xb31e: 'Skein256-240',\n 0xb31f: 'Skein256-248',\n 0xb320: 'Skein256-256',\n 0xb321: 'Skein512-8',\n 0xb322: 'Skein512-16',\n 0xb323: 'Skein512-24',\n 0xb324: 'Skein512-32',\n 0xb325: 'Skein512-40',\n 0xb326: 'Skein512-48',\n 0xb327: 'Skein512-56',\n 0xb328: 'Skein512-64',\n 0xb329: 'Skein512-72',\n 0xb32a: 'Skein512-80',\n 0xb32b: 'Skein512-88',\n 0xb32c: 'Skein512-96',\n 0xb32d: 'Skein512-104',\n 0xb32e: 'Skein512-112',\n 0xb32f: 'Skein512-120',\n 0xb330: 'Skein512-128',\n 0xb331: 'Skein512-136',\n 0xb332: 'Skein512-144',\n 0xb333: 'Skein512-152',\n 0xb334: 'Skein512-160',\n 0xb335: 'Skein512-168',\n 0xb336: 'Skein512-176',\n 0xb337: 'Skein512-184',\n 0xb338: 'Skein512-192',\n 0xb339: 'Skein512-200',\n 0xb33a: 'Skein512-208',\n 0xb33b: 'Skein512-216',\n 0xb33c: 'Skein512-224',\n 0xb33d: 'Skein512-232',\n 0xb33e: 'Skein512-240',\n 0xb33f: 'Skein512-248',\n 0xb340: 'Skein512-256',\n 0xb341: 'Skein512-264',\n 0xb342: 'Skein512-272',\n 0xb343: 'Skein512-280',\n 0xb344: 'Skein512-288',\n 0xb345: 'Skein512-296',\n 0xb346: 'Skein512-304',\n 0xb347: 'Skein512-312',\n 0xb348: 'Skein512-320',\n 0xb349: 'Skein512-328',\n 0xb34a: 'Skein512-336',\n 0xb34b: 'Skein512-344',\n 0xb34c: 'Skein512-352',\n 0xb34d: 'Skein512-360',\n 0xb34e: 'Skein512-368',\n 0xb34f: 'Skein512-376',\n 0xb350: 'Skein512-384',\n 0xb351: 'Skein512-392',\n 0xb352: 'Skein512-400',\n 0xb353: 'Skein512-408',\n 0xb354: 'Skein512-416',\n 0xb355: 'Skein512-424',\n 0xb356: 'Skein512-432',\n 0xb357: 'Skein512-440',\n 0xb358: 'Skein512-448',\n 0xb359: 'Skein512-456',\n 0xb35a: 'Skein512-464',\n 0xb35b: 'Skein512-472',\n 0xb35c: 'Skein512-480',\n 0xb35d: 'Skein512-488',\n 0xb35e: 'Skein512-496',\n 0xb35f: 'Skein512-504',\n 0xb360: 'Skein512-512',\n 0xb361: 'Skein1024-8',\n 0xb362: 'Skein1024-16',\n 0xb363: 'Skein1024-24',\n 0xb364: 'Skein1024-32',\n 0xb365: 'Skein1024-40',\n 0xb366: 'Skein1024-48',\n 0xb367: 'Skein1024-56',\n 0xb368: 'Skein1024-64',\n 0xb369: 'Skein1024-72',\n 0xb36a: 'Skein1024-80',\n 0xb36b: 'Skein1024-88',\n 0xb36c: 'Skein1024-96',\n 0xb36d: 'Skein1024-104',\n 0xb36e: 'Skein1024-112',\n 0xb36f: 'Skein1024-120',\n 0xb370: 'Skein1024-128',\n 0xb371: 'Skein1024-136',\n 0xb372: 'Skein1024-144',\n 0xb373: 'Skein1024-152',\n 0xb374: 'Skein1024-160',\n 0xb375: 'Skein1024-168',\n 0xb376: 'Skein1024-176',\n 0xb377: 'Skein1024-184',\n 0xb378: 'Skein1024-192',\n 0xb379: 'Skein1024-200',\n 0xb37a: 'Skein1024-208',\n 0xb37b: 'Skein1024-216',\n 0xb37c: 'Skein1024-224',\n 0xb37d: 'Skein1024-232',\n 0xb37e: 'Skein1024-240',\n 0xb37f: 'Skein1024-248',\n 0xb380: 'Skein1024-256',\n 0xb381: 'Skein1024-264',\n 0xb382: 'Skein1024-272',\n 0xb383: 'Skein1024-280',\n 0xb384: 'Skein1024-288',\n 0xb385: 'Skein1024-296',\n 0xb386: 'Skein1024-304',\n 0xb387: 'Skein1024-312',\n 0xb388: 'Skein1024-320',\n 0xb389: 'Skein1024-328',\n 0xb38a: 'Skein1024-336',\n 0xb38b: 'Skein1024-344',\n 0xb38c: 'Skein1024-352',\n 0xb38d: 'Skein1024-360',\n 0xb38e: 'Skein1024-368',\n 0xb38f: 'Skein1024-376',\n 0xb390: 'Skein1024-384',\n 0xb391: 'Skein1024-392',\n 0xb392: 'Skein1024-400',\n 0xb393: 'Skein1024-408',\n 0xb394: 'Skein1024-416',\n 0xb395: 'Skein1024-424',\n 0xb396: 'Skein1024-432',\n 0xb397: 'Skein1024-440',\n 0xb398: 'Skein1024-448',\n 0xb399: 'Skein1024-456',\n 0xb39a: 'Skein1024-464',\n 0xb39b: 'Skein1024-472',\n 0xb39c: 'Skein1024-480',\n 0xb39d: 'Skein1024-488',\n 0xb39e: 'Skein1024-496',\n 0xb39f: 'Skein1024-504',\n 0xb3a0: 'Skein1024-512',\n 0xb3a1: 'Skein1024-520',\n 0xb3a2: 'Skein1024-528',\n 0xb3a3: 'Skein1024-536',\n 0xb3a4: 'Skein1024-544',\n 0xb3a5: 'Skein1024-552',\n 0xb3a6: 'Skein1024-560',\n 0xb3a7: 'Skein1024-568',\n 0xb3a8: 'Skein1024-576',\n 0xb3a9: 'Skein1024-584',\n 0xb3aa: 'Skein1024-592',\n 0xb3ab: 'Skein1024-600',\n 0xb3ac: 'Skein1024-608',\n 0xb3ad: 'Skein1024-616',\n 0xb3ae: 'Skein1024-624',\n 0xb3af: 'Skein1024-632',\n 0xb3b0: 'Skein1024-640',\n 0xb3b1: 'Skein1024-648',\n 0xb3b2: 'Skein1024-656',\n 0xb3b3: 'Skein1024-664',\n 0xb3b4: 'Skein1024-672',\n 0xb3b5: 'Skein1024-680',\n 0xb3b6: 'Skein1024-688',\n 0xb3b7: 'Skein1024-696',\n 0xb3b8: 'Skein1024-704',\n 0xb3b9: 'Skein1024-712',\n 0xb3ba: 'Skein1024-720',\n 0xb3bb: 'Skein1024-728',\n 0xb3bc: 'Skein1024-736',\n 0xb3bd: 'Skein1024-744',\n 0xb3be: 'Skein1024-752',\n 0xb3bf: 'Skein1024-760',\n 0xb3c0: 'Skein1024-768',\n 0xb3c1: 'Skein1024-776',\n 0xb3c2: 'Skein1024-784',\n 0xb3c3: 'Skein1024-792',\n 0xb3c4: 'Skein1024-800',\n 0xb3c5: 'Skein1024-808',\n 0xb3c6: 'Skein1024-816',\n 0xb3c7: 'Skein1024-824',\n 0xb3c8: 'Skein1024-832',\n 0xb3c9: 'Skein1024-840',\n 0xb3ca: 'Skein1024-848',\n 0xb3cb: 'Skein1024-856',\n 0xb3cc: 'Skein1024-864',\n 0xb3cd: 'Skein1024-872',\n 0xb3ce: 'Skein1024-880',\n 0xb3cf: 'Skein1024-888',\n 0xb3d0: 'Skein1024-896',\n 0xb3d1: 'Skein1024-904',\n 0xb3d2: 'Skein1024-912',\n 0xb3d3: 'Skein1024-920',\n 0xb3d4: 'Skein1024-928',\n 0xb3d5: 'Skein1024-936',\n 0xb3d6: 'Skein1024-944',\n 0xb3d7: 'Skein1024-952',\n 0xb3d8: 'Skein1024-960',\n 0xb3d9: 'Skein1024-968',\n 0xb3da: 'Skein1024-976',\n 0xb3db: 'Skein1024-984',\n 0xb3dc: 'Skein1024-992',\n 0xb3dd: 'Skein1024-1000',\n 0xb3de: 'Skein1024-1008',\n 0xb3df: 'Skein1024-1016',\n 0xb3e0: 'Skein1024-1024'\n})\n\nexports.defaultLengths = Object.freeze({\n 0x11: 20,\n 0x12: 32,\n 0x13: 64,\n 0x56: 32,\n 0x17: 28,\n 0x16: 32,\n 0x15: 48,\n 0x14: 64,\n 0x18: 32,\n 0x19: 64,\n 0x1A: 28,\n 0x1B: 32,\n 0x1C: 48,\n 0x1D: 64,\n 0x22: 32,\n\n 0xb201: 0x01,\n 0xb202: 0x02,\n 0xb203: 0x03,\n 0xb204: 0x04,\n 0xb205: 0x05,\n 0xb206: 0x06,\n 0xb207: 0x07,\n 0xb208: 0x08,\n 0xb209: 0x09,\n 0xb20a: 0x0a,\n 0xb20b: 0x0b,\n 0xb20c: 0x0c,\n 0xb20d: 0x0d,\n 0xb20e: 0x0e,\n 0xb20f: 0x0f,\n 0xb210: 0x10,\n 0xb211: 0x11,\n 0xb212: 0x12,\n 0xb213: 0x13,\n 0xb214: 0x14,\n 0xb215: 0x15,\n 0xb216: 0x16,\n 0xb217: 0x17,\n 0xb218: 0x18,\n 0xb219: 0x19,\n 0xb21a: 0x1a,\n 0xb21b: 0x1b,\n 0xb21c: 0x1c,\n 0xb21d: 0x1d,\n 0xb21e: 0x1e,\n 0xb21f: 0x1f,\n 0xb220: 0x20,\n 0xb221: 0x21,\n 0xb222: 0x22,\n 0xb223: 0x23,\n 0xb224: 0x24,\n 0xb225: 0x25,\n 0xb226: 0x26,\n 0xb227: 0x27,\n 0xb228: 0x28,\n 0xb229: 0x29,\n 0xb22a: 0x2a,\n 0xb22b: 0x2b,\n 0xb22c: 0x2c,\n 0xb22d: 0x2d,\n 0xb22e: 0x2e,\n 0xb22f: 0x2f,\n 0xb230: 0x30,\n 0xb231: 0x31,\n 0xb232: 0x32,\n 0xb233: 0x33,\n 0xb234: 0x34,\n 0xb235: 0x35,\n 0xb236: 0x36,\n 0xb237: 0x37,\n 0xb238: 0x38,\n 0xb239: 0x39,\n 0xb23a: 0x3a,\n 0xb23b: 0x3b,\n 0xb23c: 0x3c,\n 0xb23d: 0x3d,\n 0xb23e: 0x3e,\n 0xb23f: 0x3f,\n 0xb240: 0x40,\n 0xb241: 0x01,\n 0xb242: 0x02,\n 0xb243: 0x03,\n 0xb244: 0x04,\n 0xb245: 0x05,\n 0xb246: 0x06,\n 0xb247: 0x07,\n 0xb248: 0x08,\n 0xb249: 0x09,\n 0xb24a: 0x0a,\n 0xb24b: 0x0b,\n 0xb24c: 0x0c,\n 0xb24d: 0x0d,\n 0xb24e: 0x0e,\n 0xb24f: 0x0f,\n 0xb250: 0x10,\n 0xb251: 0x11,\n 0xb252: 0x12,\n 0xb253: 0x13,\n 0xb254: 0x14,\n 0xb255: 0x15,\n 0xb256: 0x16,\n 0xb257: 0x17,\n 0xb258: 0x18,\n 0xb259: 0x19,\n 0xb25a: 0x1a,\n 0xb25b: 0x1b,\n 0xb25c: 0x1c,\n 0xb25d: 0x1d,\n 0xb25e: 0x1e,\n 0xb25f: 0x1f,\n 0xb260: 0x20,\n 0xb301: 0x01,\n 0xb302: 0x02,\n 0xb303: 0x03,\n 0xb304: 0x04,\n 0xb305: 0x05,\n 0xb306: 0x06,\n 0xb307: 0x07,\n 0xb308: 0x08,\n 0xb309: 0x09,\n 0xb30a: 0x0a,\n 0xb30b: 0x0b,\n 0xb30c: 0x0c,\n 0xb30d: 0x0d,\n 0xb30e: 0x0e,\n 0xb30f: 0x0f,\n 0xb310: 0x10,\n 0xb311: 0x11,\n 0xb312: 0x12,\n 0xb313: 0x13,\n 0xb314: 0x14,\n 0xb315: 0x15,\n 0xb316: 0x16,\n 0xb317: 0x17,\n 0xb318: 0x18,\n 0xb319: 0x19,\n 0xb31a: 0x1a,\n 0xb31b: 0x1b,\n 0xb31c: 0x1c,\n 0xb31d: 0x1d,\n 0xb31e: 0x1e,\n 0xb31f: 0x1f,\n 0xb320: 0x20,\n 0xb321: 0x01,\n 0xb322: 0x02,\n 0xb323: 0x03,\n 0xb324: 0x04,\n 0xb325: 0x05,\n 0xb326: 0x06,\n 0xb327: 0x07,\n 0xb328: 0x08,\n 0xb329: 0x09,\n 0xb32a: 0x0a,\n 0xb32b: 0x0b,\n 0xb32c: 0x0c,\n 0xb32d: 0x0d,\n 0xb32e: 0x0e,\n 0xb32f: 0x0f,\n 0xb330: 0x10,\n 0xb331: 0x11,\n 0xb332: 0x12,\n 0xb333: 0x13,\n 0xb334: 0x14,\n 0xb335: 0x15,\n 0xb336: 0x16,\n 0xb337: 0x17,\n 0xb338: 0x18,\n 0xb339: 0x19,\n 0xb33a: 0x1a,\n 0xb33b: 0x1b,\n 0xb33c: 0x1c,\n 0xb33d: 0x1d,\n 0xb33e: 0x1e,\n 0xb33f: 0x1f,\n 0xb340: 0x20,\n 0xb341: 0x21,\n 0xb342: 0x22,\n 0xb343: 0x23,\n 0xb344: 0x24,\n 0xb345: 0x25,\n 0xb346: 0x26,\n 0xb347: 0x27,\n 0xb348: 0x28,\n 0xb349: 0x29,\n 0xb34a: 0x2a,\n 0xb34b: 0x2b,\n 0xb34c: 0x2c,\n 0xb34d: 0x2d,\n 0xb34e: 0x2e,\n 0xb34f: 0x2f,\n 0xb350: 0x30,\n 0xb351: 0x31,\n 0xb352: 0x32,\n 0xb353: 0x33,\n 0xb354: 0x34,\n 0xb355: 0x35,\n 0xb356: 0x36,\n 0xb357: 0x37,\n 0xb358: 0x38,\n 0xb359: 0x39,\n 0xb35a: 0x3a,\n 0xb35b: 0x3b,\n 0xb35c: 0x3c,\n 0xb35d: 0x3d,\n 0xb35e: 0x3e,\n 0xb35f: 0x3f,\n 0xb360: 0x40,\n 0xb361: 0x01,\n 0xb362: 0x02,\n 0xb363: 0x03,\n 0xb364: 0x04,\n 0xb365: 0x05,\n 0xb366: 0x06,\n 0xb367: 0x07,\n 0xb368: 0x08,\n 0xb369: 0x09,\n 0xb36a: 0x0a,\n 0xb36b: 0x0b,\n 0xb36c: 0x0c,\n 0xb36d: 0x0d,\n 0xb36e: 0x0e,\n 0xb36f: 0x0f,\n 0xb370: 0x10,\n 0xb371: 0x11,\n 0xb372: 0x12,\n 0xb373: 0x13,\n 0xb374: 0x14,\n 0xb375: 0x15,\n 0xb376: 0x16,\n 0xb377: 0x17,\n 0xb378: 0x18,\n 0xb379: 0x19,\n 0xb37a: 0x1a,\n 0xb37b: 0x1b,\n 0xb37c: 0x1c,\n 0xb37d: 0x1d,\n 0xb37e: 0x1e,\n 0xb37f: 0x1f,\n 0xb380: 0x20,\n 0xb381: 0x21,\n 0xb382: 0x22,\n 0xb383: 0x23,\n 0xb384: 0x24,\n 0xb385: 0x25,\n 0xb386: 0x26,\n 0xb387: 0x27,\n 0xb388: 0x28,\n 0xb389: 0x29,\n 0xb38a: 0x2a,\n 0xb38b: 0x2b,\n 0xb38c: 0x2c,\n 0xb38d: 0x2d,\n 0xb38e: 0x2e,\n 0xb38f: 0x2f,\n 0xb390: 0x30,\n 0xb391: 0x31,\n 0xb392: 0x32,\n 0xb393: 0x33,\n 0xb394: 0x34,\n 0xb395: 0x35,\n 0xb396: 0x36,\n 0xb397: 0x37,\n 0xb398: 0x38,\n 0xb399: 0x39,\n 0xb39a: 0x3a,\n 0xb39b: 0x3b,\n 0xb39c: 0x3c,\n 0xb39d: 0x3d,\n 0xb39e: 0x3e,\n 0xb39f: 0x3f,\n 0xb3a0: 0x40,\n 0xb3a1: 0x41,\n 0xb3a2: 0x42,\n 0xb3a3: 0x43,\n 0xb3a4: 0x44,\n 0xb3a5: 0x45,\n 0xb3a6: 0x46,\n 0xb3a7: 0x47,\n 0xb3a8: 0x48,\n 0xb3a9: 0x49,\n 0xb3aa: 0x4a,\n 0xb3ab: 0x4b,\n 0xb3ac: 0x4c,\n 0xb3ad: 0x4d,\n 0xb3ae: 0x4e,\n 0xb3af: 0x4f,\n 0xb3b0: 0x50,\n 0xb3b1: 0x51,\n 0xb3b2: 0x52,\n 0xb3b3: 0x53,\n 0xb3b4: 0x54,\n 0xb3b5: 0x55,\n 0xb3b6: 0x56,\n 0xb3b7: 0x57,\n 0xb3b8: 0x58,\n 0xb3b9: 0x59,\n 0xb3ba: 0x5a,\n 0xb3bb: 0x5b,\n 0xb3bc: 0x5c,\n 0xb3bd: 0x5d,\n 0xb3be: 0x5e,\n 0xb3bf: 0x5f,\n 0xb3c0: 0x60,\n 0xb3c1: 0x61,\n 0xb3c2: 0x62,\n 0xb3c3: 0x63,\n 0xb3c4: 0x64,\n 0xb3c5: 0x65,\n 0xb3c6: 0x66,\n 0xb3c7: 0x67,\n 0xb3c8: 0x68,\n 0xb3c9: 0x69,\n 0xb3ca: 0x6a,\n 0xb3cb: 0x6b,\n 0xb3cc: 0x6c,\n 0xb3cd: 0x6d,\n 0xb3ce: 0x6e,\n 0xb3cf: 0x6f,\n 0xb3d0: 0x70,\n 0xb3d1: 0x71,\n 0xb3d2: 0x72,\n 0xb3d3: 0x73,\n 0xb3d4: 0x74,\n 0xb3d5: 0x75,\n 0xb3d6: 0x76,\n 0xb3d7: 0x77,\n 0xb3d8: 0x78,\n 0xb3d9: 0x79,\n 0xb3da: 0x7a,\n 0xb3db: 0x7b,\n 0xb3dc: 0x7c,\n 0xb3dd: 0x7d,\n 0xb3de: 0x7e,\n 0xb3df: 0x7f,\n 0xb3e0: 0x80\n})\n","'use strict'\n\nconst path = require('path')\nconst os = require('os')\nconst uuid = require('uuid/v4')\n\nexports.filter = (iterable, filterer) => {\n return (async function * () {\n for await (const value of iterable) {\n const keep = await filterer(value)\n if (!keep) continue\n yield value\n }\n })()\n}\n\n// Not just sort, because the sorter is given all the values and should return\n// them all sorted\nexports.sortAll = (iterable, sorter) => {\n return (async function * () {\n let values = []\n for await (const value of iterable) values.push(value)\n values = await sorter(values)\n for (const value of values) yield value\n })()\n}\n\nexports.take = (iterable, n) => {\n return (async function * () {\n if (n <= 0) return\n let i = 0\n for await (const value of iterable) {\n yield value\n i++\n if (i >= n) return\n }\n })()\n}\n\nexports.map = (iterable, mapper) => {\n return (async function * () {\n for await (const value of iterable) {\n yield mapper(value)\n }\n })()\n}\n\nexports.replaceStartWith = function (s, r) {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n\nexports.tmpdir = () => {\n return path.join(os.tmpdir(), uuid())\n}\n","'use strict'\n\nmodule.exports = class Dir {\n constructor (props, options) {\n this.options = options || {}\n Object.assign(this, props)\n }\n}\n","'use strict'\nvar DuplexStream = require('readable-stream').Duplex\n , util = require('util')\n\nfunction BufferList (callback) {\n if (!(this instanceof BufferList))\n return new BufferList(callback)\n\n this._bufs = []\n this.length = 0\n\n if (typeof callback == 'function') {\n this._callback = callback\n\n var piper = function piper (err) {\n if (this._callback) {\n this._callback(err)\n this._callback = null\n }\n }.bind(this)\n\n this.on('pipe', function onPipe (src) {\n src.on('error', piper)\n })\n this.on('unpipe', function onUnpipe (src) {\n src.removeListener('error', piper)\n })\n } else {\n this.append(callback)\n }\n\n DuplexStream.call(this)\n}\n\n\nutil.inherits(BufferList, DuplexStream)\n\n\nBufferList.prototype._offset = function _offset (offset) {\n var tot = 0, i = 0, _t\n if (offset === 0) return [ 0, 0 ]\n for (; i < this._bufs.length; i++) {\n _t = tot + this._bufs[i].length\n if (offset < _t || i == this._bufs.length - 1) {\n return [ i, offset - tot ]\n }\n tot = _t\n }\n}\n\nBufferList.prototype._reverseOffset = function (blOffset) {\n var bufferId = blOffset[0]\n var offset = blOffset[1]\n for (var i = 0; i < bufferId; i++) {\n offset += this._bufs[i].length\n }\n return offset\n}\n\nBufferList.prototype.append = function append (buf) {\n var i = 0\n\n if (Buffer.isBuffer(buf)) {\n this._appendBuffer(buf)\n } else if (Array.isArray(buf)) {\n for (; i < buf.length; i++)\n this.append(buf[i])\n } else if (buf instanceof BufferList) {\n // unwrap argument into individual BufferLists\n for (; i < buf._bufs.length; i++)\n this.append(buf._bufs[i])\n } else if (buf != null) {\n // coerce number arguments to strings, since Buffer(number) does\n // uninitialized memory allocation\n if (typeof buf == 'number')\n buf = buf.toString()\n\n this._appendBuffer(Buffer.from(buf))\n }\n\n return this\n}\n\n\nBufferList.prototype._appendBuffer = function appendBuffer (buf) {\n this._bufs.push(buf)\n this.length += buf.length\n}\n\n\nBufferList.prototype._write = function _write (buf, encoding, callback) {\n this._appendBuffer(buf)\n\n if (typeof callback == 'function')\n callback()\n}\n\n\nBufferList.prototype._read = function _read (size) {\n if (!this.length)\n return this.push(null)\n\n size = Math.min(size, this.length)\n this.push(this.slice(0, size))\n this.consume(size)\n}\n\n\nBufferList.prototype.end = function end (chunk) {\n DuplexStream.prototype.end.call(this, chunk)\n\n if (this._callback) {\n this._callback(null, this.slice())\n this._callback = null\n }\n}\n\n\nBufferList.prototype.get = function get (index) {\n if (index > this.length || index < 0) {\n return undefined\n }\n var offset = this._offset(index)\n return this._bufs[offset[0]][offset[1]]\n}\n\n\nBufferList.prototype.slice = function slice (start, end) {\n if (typeof start == 'number' && start < 0)\n start += this.length\n if (typeof end == 'number' && end < 0)\n end += this.length\n return this.copy(null, 0, start, end)\n}\n\n\nBufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {\n if (typeof srcStart != 'number' || srcStart < 0)\n srcStart = 0\n if (typeof srcEnd != 'number' || srcEnd > this.length)\n srcEnd = this.length\n if (srcStart >= this.length)\n return dst || Buffer.alloc(0)\n if (srcEnd <= 0)\n return dst || Buffer.alloc(0)\n\n var copy = !!dst\n , off = this._offset(srcStart)\n , len = srcEnd - srcStart\n , bytes = len\n , bufoff = (copy && dstStart) || 0\n , start = off[1]\n , l\n , i\n\n // copy/slice everything\n if (srcStart === 0 && srcEnd == this.length) {\n if (!copy) { // slice, but full concat if multiple buffers\n return this._bufs.length === 1\n ? this._bufs[0]\n : Buffer.concat(this._bufs, this.length)\n }\n\n // copy, need to copy individual buffers\n for (i = 0; i < this._bufs.length; i++) {\n this._bufs[i].copy(dst, bufoff)\n bufoff += this._bufs[i].length\n }\n\n return dst\n }\n\n // easy, cheap case where it's a subset of one of the buffers\n if (bytes <= this._bufs[off[0]].length - start) {\n return copy\n ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)\n : this._bufs[off[0]].slice(start, start + bytes)\n }\n\n if (!copy) // a slice, we need something to copy in to\n dst = Buffer.allocUnsafe(len)\n\n for (i = off[0]; i < this._bufs.length; i++) {\n l = this._bufs[i].length - start\n\n if (bytes > l) {\n this._bufs[i].copy(dst, bufoff, start)\n } else {\n this._bufs[i].copy(dst, bufoff, start, start + bytes)\n break\n }\n\n bufoff += l\n bytes -= l\n\n if (start)\n start = 0\n }\n\n return dst\n}\n\nBufferList.prototype.shallowSlice = function shallowSlice (start, end) {\n start = start || 0\n end = typeof end !== 'number' ? this.length : end\n\n if (start < 0)\n start += this.length\n if (end < 0)\n end += this.length\n\n if (start === end) {\n return new BufferList()\n }\n var startOffset = this._offset(start)\n , endOffset = this._offset(end)\n , buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)\n\n if (endOffset[1] == 0)\n buffers.pop()\n else\n buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1])\n\n if (startOffset[1] != 0)\n buffers[0] = buffers[0].slice(startOffset[1])\n\n return new BufferList(buffers)\n}\n\nBufferList.prototype.toString = function toString (encoding, start, end) {\n return this.slice(start, end).toString(encoding)\n}\n\nBufferList.prototype.consume = function consume (bytes) {\n while (this._bufs.length) {\n if (bytes >= this._bufs[0].length) {\n bytes -= this._bufs[0].length\n this.length -= this._bufs[0].length\n this._bufs.shift()\n } else {\n this._bufs[0] = this._bufs[0].slice(bytes)\n this.length -= bytes\n break\n }\n }\n return this\n}\n\n\nBufferList.prototype.duplicate = function duplicate () {\n var i = 0\n , copy = new BufferList()\n\n for (; i < this._bufs.length; i++)\n copy.append(this._bufs[i])\n\n return copy\n}\n\n\nBufferList.prototype._destroy = function _destroy (err, cb) {\n this._bufs.length = 0\n this.length = 0\n cb(err)\n}\n\n\nBufferList.prototype.indexOf = function (search, offset, encoding) {\n if (encoding === undefined && typeof offset === 'string') {\n encoding = offset\n offset = undefined\n }\n if (typeof search === 'function' || Array.isArray(search)) {\n throw new TypeError('The \"value\" argument must be one of type string, Buffer, BufferList, or Uint8Array.')\n } else if (typeof search === 'number') {\n search = Buffer.from([search])\n } else if (typeof search === 'string') {\n search = Buffer.from(search, encoding)\n } else if (search instanceof BufferList) {\n search = search.slice()\n } else if (!Buffer.isBuffer(search)) {\n search = Buffer.from(search)\n }\n\n offset = Number(offset || 0)\n if (isNaN(offset)) {\n offset = 0\n }\n\n if (offset < 0) {\n offset = this.length + offset\n }\n\n if (offset < 0) {\n offset = 0\n }\n\n if (search.length === 0) {\n return offset > this.length ? this.length : offset\n }\n\n var blOffset = this._offset(offset)\n var blIndex = blOffset[0] // index of which internal buffer we're working on\n var buffOffset = blOffset[1] // offset of the internal buffer we're working on\n\n // scan over each buffer\n for (blIndex; blIndex < this._bufs.length; blIndex++) {\n var buff = this._bufs[blIndex]\n while(buffOffset < buff.length) {\n var availableWindow = buff.length - buffOffset\n if (availableWindow >= search.length) {\n var nativeSearchResult = buff.indexOf(search, buffOffset)\n if (nativeSearchResult !== -1) {\n return this._reverseOffset([blIndex, nativeSearchResult])\n }\n buffOffset = buff.length - search.length + 1 // end of native search window\n } else {\n var revOffset = this._reverseOffset([blIndex, buffOffset])\n if (this._match(revOffset, search)) {\n return revOffset\n }\n buffOffset++\n }\n }\n buffOffset = 0\n }\n return -1\n}\n\nBufferList.prototype._match = function(offset, search) {\n if (this.length - offset < search.length) {\n return false\n }\n for (var searchOffset = 0; searchOffset < search.length ; searchOffset++) {\n if(this.get(offset + searchOffset) !== search[searchOffset]){\n return false\n }\n }\n return true\n}\n\n\n;(function () {\n var methods = {\n 'readDoubleBE' : 8\n , 'readDoubleLE' : 8\n , 'readFloatBE' : 4\n , 'readFloatLE' : 4\n , 'readInt32BE' : 4\n , 'readInt32LE' : 4\n , 'readUInt32BE' : 4\n , 'readUInt32LE' : 4\n , 'readInt16BE' : 2\n , 'readInt16LE' : 2\n , 'readUInt16BE' : 2\n , 'readUInt16LE' : 2\n , 'readInt8' : 1\n , 'readUInt8' : 1\n , 'readIntBE' : null\n , 'readIntLE' : null\n , 'readUIntBE' : null\n , 'readUIntLE' : null\n }\n\n for (var m in methods) {\n (function (m) {\n if (methods[m] === null) {\n BufferList.prototype[m] = function (offset, byteLength) {\n return this.slice(offset, offset + byteLength)[m](0, byteLength)\n }\n }\n else {\n BufferList.prototype[m] = function (offset) {\n return this.slice(offset, offset + methods[m])[m](0)\n }\n }\n }(m))\n }\n}())\n\n\nmodule.exports = BufferList\n","'use strict'\n\nconst pMap = require('p-map')\nconst GSet = require('./g-set')\nconst Entry = require('./entry')\nconst LogIO = require('./log-io')\nconst LogError = require('./log-errors')\nconst Clock = require('./lamport-clock')\nconst Sorting = require('./log-sorting')\nconst { LastWriteWins, NoZeroes } = Sorting\nconst AccessController = require('./default-access-controller')\nconst { isDefined, findUniques } = require('./utils')\nconst EntryIndex = require('./entry-index')\nconst randomId = () => new Date().getTime().toString()\nconst getHash = e => e.hash\nconst flatMap = (res, acc) => res.concat(acc)\nconst getNextPointers = entry => entry.next\nconst maxClockTimeReducer = (res, acc) => Math.max(res, acc.clock.time)\nconst uniqueEntriesReducer = (res, acc) => {\n res[acc.hash] = acc\n return res\n}\n\n/**\n * Log.\n *\n * @description\n * Log implements a G-Set CRDT and adds ordering.\n *\n * From:\n * \"A comprehensive study of Convergent and Commutative Replicated Data Types\"\n * https://hal.inria.fr/inria-00555588\n */\nclass Log extends GSet {\n /**\n * Create a new Log instance\n * @param {IPFS} ipfs An IPFS instance\n * @param {Object} identity Identity (https://github.com/orbitdb/orbit-db-identity-provider/blob/master/src/identity.js)\n * @param {Object} options\n * @param {string} options.logId ID of the log\n * @param {Object} options.access AccessController (./default-access-controller)\n * @param {Array} options.entries An Array of Entries from which to create the log\n * @param {Array} options.heads Set the heads of the log\n * @param {Clock} options.clock Set the clock of the log\n * @param {Function} options.sortFn The sort function - by default LastWriteWins\n * @return {Log} The log instance\n */\n constructor (ipfs, identity, { logId, access, entries, heads, clock, sortFn, concurrency } = {}) {\n if (!isDefined(ipfs)) {\n throw LogError.IPFSNotDefinedError()\n }\n\n if (!isDefined(identity)) {\n throw new Error('Identity is required')\n }\n\n if (!isDefined(access)) {\n access = new AccessController()\n }\n\n if (isDefined(entries) && !Array.isArray(entries)) {\n throw new Error(`'entries' argument must be an array of Entry instances`)\n }\n\n if (isDefined(heads) && !Array.isArray(heads)) {\n throw new Error(`'heads' argument must be an array`)\n }\n\n if (!isDefined(sortFn)) {\n sortFn = LastWriteWins\n }\n\n super()\n\n this._sortFn = NoZeroes(sortFn)\n\n this._storage = ipfs\n this._id = logId || randomId()\n\n // Access Controller\n this._access = access\n // Identity\n this._identity = identity\n\n // Add entries to the internal cache\n const uniqueEntries = (entries || []).reduce(uniqueEntriesReducer, {})\n this._entryIndex = new EntryIndex(uniqueEntries)\n entries = Object.values(uniqueEntries) || []\n\n // Set heads if not passed as an argument\n heads = heads || Log.findHeads(entries)\n this._headsIndex = heads.reduce(uniqueEntriesReducer, {})\n\n // Index of all next pointers in this log\n this._nextsIndex = {}\n const addToNextsIndex = e => e.next.forEach(a => (this._nextsIndex[a] = e.hash))\n entries.forEach(addToNextsIndex)\n\n // Set the length, we calculate the length manually internally\n this._length = entries.length\n\n // Set the clock\n const maxTime = Math.max(clock ? clock.time : 0, this.heads.reduce(maxClockTimeReducer, 0))\n // Take the given key as the clock id is it's a Key instance,\n // otherwise if key was given, take whatever it is,\n // and if it was null, take the given id as the clock id\n this._clock = new Clock(this._identity.publicKey, maxTime)\n\n this.joinConcurrency = concurrency || 16\n }\n\n /**\n * Returns the ID of the log.\n * @returns {string}\n */\n get id () {\n return this._id\n }\n\n /**\n * Returns the clock of the log.\n * @returns {string}\n */\n get clock () {\n return this._clock\n }\n\n /**\n * Returns the length of the log.\n * @return {number} Length\n */\n get length () {\n return this._length\n }\n\n /**\n * Returns the values in the log.\n * @returns {Array}\n */\n get values () {\n return Object.values(this.traverse(this.heads)).reverse()\n }\n\n /**\n * Returns an array of heads as hashes.\n * @returns {Array}\n */\n get heads () {\n return Object.values(this._headsIndex).sort(this._sortFn).reverse()\n }\n\n /**\n * Returns an array of Entry objects that reference entries which\n * are not in the log currently.\n * @returns {Array}\n */\n get tails () {\n return Log.findTails(this.values)\n }\n\n /**\n * Returns an array of hashes that are referenced by entries which\n * are not in the log currently.\n * @returns {Array} Array of hashes\n */\n get tailHashes () {\n return Log.findTailHashes(this.values)\n }\n\n /**\n * Set the identity for the log\n * @param {Identity} [identity] The identity to be set\n */\n setIdentity (identity) {\n this._identity = identity\n // Find the latest clock from the heads\n const time = Math.max(this.clock.time, this.heads.reduce(maxClockTimeReducer, 0))\n this._clock = new Clock(this._identity.publicKey, time)\n }\n\n /**\n * Find an entry.\n * @param {string} [hash] The hashes of the entry\n * @returns {Entry|undefined}\n */\n get (hash) {\n return this._entryIndex.get(hash)\n }\n\n /**\n * Checks if a entry is part of the log\n * @param {string} hash The hash of the entry\n * @returns {boolean}\n */\n has (entry) {\n return this._entryIndex.get(entry.hash || entry) !== undefined\n }\n\n traverse (rootEntries, amount = -1, endHash) {\n // Sort the given given root entries and use as the starting stack\n let stack = rootEntries.sort(this._sortFn).reverse()\n\n // Cache for checking if we've processed an entry already\n let traversed = {}\n // End result\n let result = {}\n let count = 0\n // Named function for getting an entry from the log\n const getEntry = e => this.get(e)\n\n // Add an entry to the stack and traversed nodes index\n const addToStack = entry => {\n // If we've already processed the entry, don't add it to the stack\n if (!entry || traversed[entry.hash]) {\n return\n }\n\n // Add the entry in front of the stack and sort\n stack = [entry, ...stack]\n .sort(this._sortFn)\n .reverse()\n // Add to the cache of processed entries\n traversed[entry.hash] = true\n }\n\n const addEntry = rootEntry => {\n result[rootEntry.hash] = rootEntry\n traversed[rootEntry.hash] = true\n count++\n }\n\n // Start traversal\n // Process stack until it's empty (traversed the full log)\n // or when we have the requested amount of entries\n // If requested entry amount is -1, traverse all\n while (stack.length > 0 && (count < amount || amount < 0)) { // eslint-disable-line no-unmodified-loop-condition\n // Get the next element from the stack\n const entry = stack.shift()\n // Add to the result\n addEntry(entry)\n // If it is the specified end hash, break out of the while loop\n if (endHash && endHash === entry.hash) break\n\n // Add entry's next references to the stack\n const entries = entry.next.map(getEntry)\n const defined = entries.filter(isDefined)\n defined.forEach(addToStack)\n }\n\n stack = []\n traversed = {}\n // End result\n return result\n }\n\n /**\n * Append an entry to the log.\n * @param {Entry} entry Entry to add\n * @return {Log} New Log containing the appended value\n */\n async append (data, pointerCount = 1, pin = false) {\n // Update the clock (find the latest clock)\n const newTime = Math.max(this.clock.time, this.heads.reduce(maxClockTimeReducer, 0)) + 1\n this._clock = new Clock(this.clock.id, newTime)\n\n const all = Object.values(this.traverse(this.heads, Math.max(pointerCount, this.heads.length)))\n\n // If pointer count is 4, returns 2\n // If pointer count is 8, returns 3 references\n // If pointer count is 512, returns 9 references\n // If pointer count is 2048, returns 11 references\n const getEveryPow2 = (maxDistance) => {\n let entries = new Set()\n for (let i = 1; i <= maxDistance; i *= 2) {\n const index = Math.min(i - 1, all.length - 1)\n entries.add(all[index])\n }\n return entries\n }\n const references = getEveryPow2(Math.min(pointerCount, all.length))\n\n // Always include the last known reference\n if (all.length < pointerCount && all[all.length - 1]) {\n references.add(all[all.length - 1])\n }\n\n // Create the next pointers from heads\n const nexts = Object.keys(this.heads.reverse().reduce(uniqueEntriesReducer, {}))\n const isNext = e => !nexts.includes(e)\n // Delete the heads from the refs\n const refs = Array.from(references).map(getHash).filter(isNext)\n\n // @TODO: Split Entry.create into creating object, checking permission, signing and then posting to IPFS\n // Create the entry and add it to the internal cache\n const entry = await Entry.create(\n this._storage,\n this._identity,\n this.id,\n data,\n nexts,\n this.clock,\n refs,\n pin\n )\n\n const canAppend = await this._access.canAppend(entry, this._identity.provider)\n if (!canAppend) {\n throw new Error(`Could not append entry, key \"${this._identity.id}\" is not allowed to write to the log`)\n }\n\n this._entryIndex.set(entry.hash, entry)\n nexts.forEach(e => (this._nextsIndex[e] = entry.hash))\n this._headsIndex = {}\n this._headsIndex[entry.hash] = entry\n // Update the length\n this._length++\n return entry\n }\n\n /*\n * Creates a javscript iterator over log entries\n *\n * @param {Object} options\n * @param {string|Array} options.gt Beginning hash of the iterator, non-inclusive\n * @param {string|Array} options.gte Beginning hash of the iterator, inclusive\n * @param {string|Array} options.lt Ending hash of the iterator, non-inclusive\n * @param {string|Array} options.lte Ending hash of the iterator, inclusive\n * @param {amount} options.amount Number of entried to return to / from the gte / lte hash\n * @returns {Symbol.Iterator} Iterator object containing log entries\n *\n * @examples\n *\n * (async () => {\n * log1 = new Log(ipfs, testIdentity, { logId: 'X' })\n *\n * for (let i = 0; i <= 100; i++) {\n * await log1.append('entry' + i)\n * }\n *\n * let it = log1.iterator({\n * lte: 'zdpuApFd5XAPkCTmSx7qWQmQzvtdJPtx2K5p9to6ytCS79bfk',\n * amount: 10\n * })\n *\n * [...it].length // 10\n * })()\n *\n *\n */\n iterator ({ gt = undefined, gte = undefined, lt = undefined, lte = undefined, amount = -1 } =\n {}) {\n if (amount === 0) return (function * () {})()\n if (typeof lte === 'string') lte = [this.get(lte)]\n if (typeof lt === 'string') lt = [this.get(this.get(lt).next)]\n\n if (lte && !Array.isArray(lte)) throw LogError.LtOrLteMustBeStringOrArray()\n if (lt && !Array.isArray(lt)) throw LogError.LtOrLteMustBeStringOrArray()\n\n let start = (lte || (lt || this.heads)).filter(isDefined)\n let endHash = gte ? this.get(gte).hash : gt ? this.get(gt).hash : null\n let count = endHash ? -1 : amount || -1\n\n let entries = this.traverse(start, count, endHash)\n let entryValues = Object.values(entries)\n\n // Strip off last entry if gt is non-inclusive\n if (gt) entryValues.pop()\n\n // Deal with the amount argument working backwards from gt/gte\n if ((gt || gte) && amount > -1) {\n entryValues = entryValues.slice(entryValues.length - amount, entryValues.length)\n }\n\n return (function * () {\n for (let i in entryValues) {\n yield entryValues[i]\n }\n })()\n }\n\n /**\n * Join two logs.\n *\n * Joins another log into this one.\n *\n * @param {Log} log Log to join with this Log\n * @param {number} [size=-1] Max size of the joined log\n * @returns {Promise} This Log instance\n * @example\n * await log1.join(log2)\n */\n async join (log, size = -1) {\n if (!isDefined(log)) throw LogError.LogNotDefinedError()\n if (!Log.isLog(log)) throw LogError.NotALogError()\n if (this.id !== log.id) return\n\n // Get the difference of the logs\n const newItems = Log.difference(log, this)\n\n const identityProvider = this._identity.provider\n // Verify if entries are allowed to be added to the log and throws if\n // there's an invalid entry\n const permitted = async (entry) => {\n const canAppend = await this._access.canAppend(entry, identityProvider)\n if (!canAppend) {\n throw new Error(`Could not append entry, key \"${entry.identity.id}\" is not allowed to write to the log`)\n }\n }\n\n // Verify signature for each entry and throws if there's an invalid signature\n const verify = async (entry) => {\n const isValid = await Entry.verify(identityProvider, entry)\n const publicKey = entry.identity ? entry.identity.publicKey : entry.key\n if (!isValid) throw new Error(`Could not validate signature \"${entry.sig}\" for entry \"${entry.hash}\" and key \"${publicKey}\"`)\n }\n\n const entriesToJoin = Object.values(newItems)\n await pMap(entriesToJoin, async e => {\n await permitted(e)\n await verify(e)\n }, { concurrency: this.joinConcurrency })\n\n // Update the internal next pointers index\n const addToNextsIndex = e => {\n const entry = this.get(e.hash)\n if (!entry) this._length++ /* istanbul ignore else */\n e.next.forEach(a => (this._nextsIndex[a] = e.hash))\n }\n Object.values(newItems).forEach(addToNextsIndex)\n\n // Update the internal entry index\n this._entryIndex.add(newItems)\n\n // Merge the heads\n const notReferencedByNewItems = e => !nextsFromNewItems.find(a => a === e.hash)\n const notInCurrentNexts = e => !this._nextsIndex[e.hash]\n const nextsFromNewItems = Object.values(newItems).map(getNextPointers).reduce(flatMap, [])\n const mergedHeads = Log.findHeads(Object.values(Object.assign({}, this._headsIndex, log._headsIndex)))\n .filter(notReferencedByNewItems)\n .filter(notInCurrentNexts)\n .reduce(uniqueEntriesReducer, {})\n\n this._headsIndex = mergedHeads\n\n // Slice to the requested size\n if (size > -1) {\n let tmp = this.values\n tmp = tmp.slice(-size)\n this._entryIndex = null\n this._entryIndex = new EntryIndex(tmp.reduce(uniqueEntriesReducer, {}))\n this._headsIndex = Log.findHeads(tmp).reduce(uniqueEntriesReducer, {})\n this._length = this._entryIndex.length\n }\n\n // Find the latest clock from the heads\n const maxClock = Object.values(this._headsIndex).reduce(maxClockTimeReducer, 0)\n this._clock = new Clock(this.clock.id, Math.max(this.clock.time, maxClock))\n return this\n }\n\n /**\n * Get the log in JSON format.\n * @returns {Object} An object with the id and heads properties\n */\n toJSON () {\n return {\n id: this.id,\n heads: this.heads\n .sort(this._sortFn) // default sorting\n .reverse() // we want the latest as the first element\n .map(getHash) // return only the head hashes\n }\n }\n\n /**\n * Get the log in JSON format as a snapshot.\n * @returns {Object} An object with the id, heads and value properties\n */\n toSnapshot () {\n return {\n id: this.id,\n heads: this.heads,\n values: this.values\n }\n }\n\n /**\n * Get the log as a Buffer.\n * @returns {Buffer}\n */\n toBuffer () {\n return Buffer.from(JSON.stringify(this.toJSON()))\n }\n\n /**\n * Returns the log entries as a formatted string.\n * @returns {string}\n * @example\n * two\n * └─one\n * └─three\n */\n toString (payloadMapper) {\n return this.values\n .slice()\n .reverse()\n .map((e, idx) => {\n const parents = Entry.findChildren(e, this.values)\n const len = parents.length\n let padding = new Array(Math.max(len - 1, 0))\n padding = len > 1 ? padding.fill(' ') : padding\n padding = len > 0 ? padding.concat(['└─']) : padding\n /* istanbul ignore next */\n return padding.join('') + (payloadMapper ? payloadMapper(e.payload) : e.payload)\n })\n .join('\\n')\n }\n\n /**\n * Check whether an object is a Log instance.\n * @param {Object} log An object to check\n * @returns {boolean}\n */\n static isLog (log) {\n return log.id !== undefined &&\n log.heads !== undefined &&\n log._entryIndex !== undefined\n }\n\n /**\n * Get the log's multihash.\n * @returns {Promise} Multihash of the Log as Base58 encoded string.\n */\n toMultihash ({ format } = {}) {\n return LogIO.toMultihash(this._storage, this, { format })\n }\n\n /**\n * Create a log from a hashes.\n * @param {IPFS} ipfs An IPFS instance\n * @param {Identity} identity The identity instance\n * @param {string} hash The log hash\n * @param {Object} options\n * @param {AccessController} options.access The access controller instance\n * @param {number} options.length How many items to include in the log\n * @param {Array} options.exclude Entries to not fetch (cached)\n * @param {function(hash, entry, parent, depth)} options.onProgressCallback\n * @param {Function} options.sortFn The sort function - by default LastWriteWins\n * @returns {Promise}\n */\n static async fromMultihash (ipfs, identity, hash,\n { access, length = -1, exclude = [], timeout, concurrency, sortFn, onProgressCallback } = {}) {\n // TODO: need to verify the entries with 'key'\n const { logId, entries, heads } = await LogIO.fromMultihash(ipfs, hash,\n { length, exclude, timeout, onProgressCallback, concurrency, sortFn })\n return new Log(ipfs, identity, { logId, access, entries, heads, sortFn })\n }\n\n /**\n * Create a log from a single entry's hash.\n * @param {IPFS} ipfs An IPFS instance\n * @param {Identity} identity The identity instance\n * @param {string} hash The entry's hash\n * @param {Object} options\n * @param {string} options.logId The ID of the log\n * @param {AccessController} options.access The access controller instance\n * @param {number} options.length How many entries to include in the log\n * @param {Array} options.exclude Entries to not fetch (cached)\n * @param {function(hash, entry, parent, depth)} options.onProgressCallback\n * @param {Function} options.sortFn The sort function - by default LastWriteWins\n * @return {Promise} New Log\n */\n static async fromEntryHash (ipfs, identity, hash,\n { logId, access, length = -1, exclude = [], timeout, concurrency, sortFn, onProgressCallback } = {}) {\n // TODO: need to verify the entries with 'key'\n const { entries } = await LogIO.fromEntryHash(ipfs, hash,\n { length, exclude, timeout, concurrency, onProgressCallback })\n return new Log(ipfs, identity, { logId, access, entries, sortFn })\n }\n\n /**\n * Create a log from a Log Snapshot JSON.\n * @param {IPFS} ipfs An IPFS instance\n * @param {Identity} identity The identity instance\n * @param {Object} json Log snapshot as JSON object\n * @param {Object} options\n * @param {AccessController} options.access The access controller instance\n * @param {number} options.length How many entries to include in the log\n * @param {function(hash, entry, parent, depth)} [options.onProgressCallback]\n * @param {Function} options.sortFn The sort function - by default LastWriteWins\n * @return {Promise} New Log\n */\n static async fromJSON (ipfs, identity, json,\n { access, length = -1, timeout, sortFn, onProgressCallback } = {}) {\n // TODO: need to verify the entries with 'key'\n const { logId, entries } = await LogIO.fromJSON(ipfs, json,\n { length, timeout, onProgressCallback })\n return new Log(ipfs, identity, { logId, access, entries, sortFn })\n }\n\n /**\n * Create a new log from an Entry instance.\n * @param {IPFS} ipfs An IPFS instance\n * @param {Identity} identity The identity instance\n * @param {Entry|Array} sourceEntries An Entry or an array of entries to fetch a log from\n * @param {Object} options\n * @param {AccessController} options.access The access controller instance\n * @param {number} options.length How many entries to include. Default: infinite.\n * @param {Array} options.exclude Entries to not fetch (cached)\n * @param {function(hash, entry, parent, depth)} [options.onProgressCallback]\n * @param {Function} options.sortFn The sort function - by default LastWriteWins\n * @return {Promise} New Log\n */\n static async fromEntry (ipfs, identity, sourceEntries,\n { access, length = -1, exclude = [], timeout, concurrency, sortFn, onProgressCallback } = {}) {\n // TODO: need to verify the entries with 'key'\n const { logId, entries } = await LogIO.fromEntry(ipfs, sourceEntries,\n { length, exclude, timeout, concurrency, onProgressCallback })\n return new Log(ipfs, identity, { logId, access, entries, sortFn })\n }\n\n /**\n * Find heads from a collection of entries.\n *\n * Finds entries that are the heads of this collection,\n * ie. entries that are not referenced by other entries.\n *\n * @param {Array} entries Entries to search heads from\n * @returns {Array}\n */\n static findHeads (entries) {\n var indexReducer = (res, entry, idx, arr) => {\n var addToResult = e => (res[e] = entry.hash)\n entry.next.forEach(addToResult)\n return res\n }\n\n var items = entries.reduce(indexReducer, {})\n\n var exists = e => items[e.hash] === undefined\n var compareIds = (a, b) => a.clock.id > b.clock.id\n\n return entries.filter(exists).sort(compareIds)\n }\n\n // Find entries that point to another entry that is not in the\n // input array\n static findTails (entries) {\n // Reverse index { next -> entry }\n var reverseIndex = {}\n // Null index containing entries that have no parents (nexts)\n var nullIndex = []\n // Hashes for all entries for quick lookups\n var hashes = {}\n // Hashes of all next entries\n var nexts = []\n\n var addToIndex = (e) => {\n if (e.next.length === 0) {\n nullIndex.push(e)\n }\n var addToReverseIndex = (a) => {\n /* istanbul ignore else */\n if (!reverseIndex[a]) reverseIndex[a] = []\n reverseIndex[a].push(e)\n }\n\n // Add all entries and their parents to the reverse index\n e.next.forEach(addToReverseIndex)\n // Get all next references\n nexts = nexts.concat(e.next)\n // Get the hashes of input entries\n hashes[e.hash] = true\n }\n\n // Create our indices\n entries.forEach(addToIndex)\n\n var addUniques = (res, entries, idx, arr) => res.concat(findUniques(entries, 'hash'))\n var exists = e => hashes[e] === undefined\n var findFromReverseIndex = e => reverseIndex[e]\n\n // Drop hashes that are not in the input entries\n const tails = nexts // For every hash in nexts:\n .filter(exists) // Remove undefineds and nulls\n .map(findFromReverseIndex) // Get the Entry from the reverse index\n .reduce(addUniques, []) // Flatten the result and take only uniques\n .concat(nullIndex) // Combine with tails the have no next refs (ie. first-in-their-chain)\n\n return findUniques(tails, 'hash').sort(Entry.compare)\n }\n\n // Find the hashes to entries that are not in a collection\n // but referenced by other entries\n static findTailHashes (entries) {\n var hashes = {}\n var addToIndex = e => (hashes[e.hash] = true)\n var reduceTailHashes = (res, entry, idx, arr) => {\n var addToResult = (e) => {\n /* istanbul ignore else */\n if (hashes[e] === undefined) {\n res.splice(0, 0, e)\n }\n }\n entry.next.reverse().forEach(addToResult)\n return res\n }\n\n entries.forEach(addToIndex)\n return entries.reduce(reduceTailHashes, [])\n }\n\n static difference (a, b) {\n let stack = Object.keys(a._headsIndex)\n let traversed = {}\n let res = {}\n\n const pushToStack = hash => {\n if (!traversed[hash] && !b.get(hash)) {\n stack.push(hash)\n traversed[hash] = true\n }\n }\n\n while (stack.length > 0) {\n const hash = stack.shift()\n const entry = a.get(hash)\n if (entry && !b.get(hash) && entry.id === b.id) {\n res[entry.hash] = entry\n traversed[entry.hash] = true\n entry.next.forEach(pushToStack)\n }\n }\n return res\n }\n}\n\nmodule.exports = Log\nmodule.exports.Sorting = Sorting\nmodule.exports.Entry = Entry\nmodule.exports.AccessController = AccessController\n","'use strict';\n\nconst inherits = require('inherits');\nconst Buffer = require('buffer').Buffer;\nconst Node = require('../base/node');\n\n// Import DER constants\nconst der = require('../constants/der');\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n}\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\ninherits(DERNode, Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag,\n primitive,\n cls,\n content) {\n const encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n\n // Short form\n if (content.length < 0x80) {\n const header = new Buffer(2);\n header[0] = encodedTag;\n header[1] = content.length;\n return this._createEncoderBuffer([ header, content ]);\n }\n\n // Long form\n // Count octets required to store length\n let lenOctets = 1;\n for (let i = content.length; i >= 0x100; i >>= 8)\n lenOctets++;\n\n const header = new Buffer(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)\n header[i] = j & 0xff;\n\n return this._createEncoderBuffer([ header, content ]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'bitstr') {\n return this._createEncoderBuffer([ str.unused | 0, str.data ]);\n } else if (tag === 'bmpstr') {\n const buf = new Buffer(str.length * 2);\n for (let i = 0; i < str.length; i++) {\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n }\n return this._createEncoderBuffer(buf);\n } else if (tag === 'numstr') {\n if (!this._isNumstr(str)) {\n return this.reporter.error('Encoding of string type: numstr supports ' +\n 'only digits and space');\n }\n return this._createEncoderBuffer(str);\n } else if (tag === 'printstr') {\n if (!this._isPrintstr(str)) {\n return this.reporter.error('Encoding of string type: printstr supports ' +\n 'only latin upper and lower case letters, ' +\n 'digits, space, apostrophe, left and rigth ' +\n 'parenthesis, plus sign, comma, hyphen, ' +\n 'dot, slash, colon, equal sign, ' +\n 'question mark');\n }\n return this._createEncoderBuffer(str);\n } else if (/str$/.test(tag)) {\n return this._createEncoderBuffer(str);\n } else if (tag === 'objDesc') {\n return this._createEncoderBuffer(str);\n } else {\n return this.reporter.error('Encoding of string type: ' + tag +\n ' unsupported');\n }\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values)\n return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id))\n return this.reporter.error('objid not found in values map');\n id = values[id].split(/[\\s.]+/g);\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n } else if (Array.isArray(id)) {\n id = id.slice();\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' +\n 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n\n // Count number of octets\n let size = 0;\n for (let i = 0; i < id.length; i++) {\n let ident = id[i];\n for (size++; ident >= 0x80; ident >>= 7)\n size++;\n }\n\n const objid = new Buffer(size);\n let offset = objid.length - 1;\n for (let i = id.length - 1; i >= 0; i--) {\n let ident = id[i];\n objid[offset--] = ident & 0x7f;\n while ((ident >>= 7) > 0)\n objid[offset--] = 0x80 | (ident & 0x7f);\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num < 10)\n return '0' + num;\n else\n return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n let str;\n const date = new Date(time);\n\n if (tag === 'gentime') {\n str = [\n two(date.getUTCFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else if (tag === 'utctime') {\n str = [\n two(date.getUTCFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values)\n return this.reporter.error('String int or enum given, but no values map');\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' +\n JSON.stringify(num));\n }\n num = values[num];\n }\n\n // Bignum, assume big endian\n if (typeof num !== 'number' && !Buffer.isBuffer(num)) {\n const numArray = num.toArray();\n if (!num.sign && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n num = new Buffer(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n let size = num.length;\n if (num.length === 0)\n size++;\n\n const out = new Buffer(size);\n num.copy(out);\n if (num.length === 0)\n out[0] = 0;\n return this._createEncoderBuffer(out);\n }\n\n if (num < 0x80)\n return this._createEncoderBuffer(num);\n\n if (num < 0x100)\n return this._createEncoderBuffer([0, num]);\n\n let size = 1;\n for (let i = num; i >= 0x100; i >>= 8)\n size++;\n\n const out = new Array(size);\n for (let i = out.length - 1; i >= 0; i--) {\n out[i] = num & 0xff;\n num >>= 8;\n }\n if(out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(new Buffer(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n const state = this._baseState;\n let i;\n if (state['default'] === null)\n return false;\n\n const data = dataBuffer.join();\n if (state.defaultBuffer === undefined)\n state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n\n if (data.length !== state.defaultBuffer.length)\n return false;\n\n for (i=0; i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return false;\n\n return true;\n};\n\n// Utility methods\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n let res;\n\n if (tag === 'seqof')\n tag = 'seq';\n else if (tag === 'setof')\n tag = 'set';\n\n if (der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag === 'number' && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error('Unknown tag: ' + tag);\n\n if (res >= 0x1f)\n return reporter.error('Multi-octet tag encoding unsupported');\n\n if (!primitive)\n res |= 0x20;\n\n res |= (der.tagClassByName[cls || 'universal'] << 6);\n\n return res;\n}\n","'use strict'\n\nconst WantManager = require('./want-manager')\nconst Network = require('./network')\nconst DecisionEngine = require('./decision-engine')\nconst Notifications = require('./notifications')\nconst logger = require('./utils').logger\nconst Stats = require('./stats')\n\nconst defaultOptions = {\n statsEnabled: false,\n statsComputeThrottleTimeout: 1000,\n statsComputeThrottleMaxQueueSize: 1000\n}\nconst statsKeys = [\n 'blocksReceived',\n 'dataReceived',\n 'dupBlksReceived',\n 'dupDataReceived',\n 'blocksSent',\n 'dataSent',\n 'providesBufferLength',\n 'wantListLength',\n 'peerCount'\n]\n\n/**\n * JavaScript implementation of the Bitswap 'data exchange' protocol\n * used by IPFS.\n *\n * @param {Libp2p} libp2p\n * @param {Blockstore} blockstore\n * @param {Object} options\n */\nclass Bitswap {\n constructor (libp2p, blockstore, options) {\n this._libp2p = libp2p\n this._log = logger(this.peerInfo.id)\n\n this._options = Object.assign({}, defaultOptions, options)\n\n // stats\n this._stats = new Stats(statsKeys, {\n enabled: this._options.statsEnabled,\n computeThrottleTimeout: this._options.statsComputeThrottleTimeout,\n computeThrottleMaxQueueSize: this._options.statsComputeThrottleMaxQueueSize\n })\n\n // the network delivers messages\n this.network = new Network(libp2p, this, {}, this._stats)\n\n // local database\n this.blockstore = blockstore\n\n this.engine = new DecisionEngine(this.peerInfo.id, blockstore, this.network, this._stats)\n\n // handle message sending\n this.wm = new WantManager(this.peerInfo.id, this.network, this._stats)\n\n this.notifications = new Notifications(this.peerInfo.id)\n }\n\n get peerInfo () {\n return this._libp2p.peerInfo\n }\n\n // handle messages received through the network\n async _receiveMessage (peerId, incoming) {\n try {\n await this.engine.messageReceived(peerId, incoming)\n } catch (err) {\n // Only logging the issue to process as much as possible\n // of the message. Currently `messageReceived` does not\n // throw any errors, but this could change in the future.\n this._log('failed to receive message', incoming)\n }\n\n if (incoming.blocks.size === 0) {\n return\n }\n\n const blocks = Array.from(incoming.blocks.values())\n\n // quickly send out cancels, reduces chances of duplicate block receives\n const wanted = blocks\n .filter((b) => this.wm.wantlist.contains(b.cid))\n .map((b) => b.cid)\n\n this.wm.cancelWants(wanted)\n\n await Promise.all(blocks.map(async (b) => {\n const wasWanted = wanted.includes(b.cid)\n await this._handleReceivedBlock(peerId, b, wasWanted)\n }))\n }\n\n async _handleReceivedBlock (peerId, block, wasWanted) {\n this._log('received block')\n\n const has = await this.blockstore.has(block.cid)\n this._updateReceiveCounters(peerId.toB58String(), block, has)\n\n if (has || !wasWanted) {\n return\n }\n\n await this.put(block)\n }\n\n _updateReceiveCounters (peerId, block, exists) {\n this._stats.push(peerId, 'blocksReceived', 1)\n this._stats.push(peerId, 'dataReceived', block.data.length)\n\n if (exists) {\n this._stats.push(peerId, 'dupBlksReceived', 1)\n this._stats.push(peerId, 'dupDataReceived', block.data.length)\n }\n }\n\n // handle errors on the receiving channel\n _receiveError (err) {\n this._log.error('ReceiveError: %s', err.message)\n }\n\n // handle new peers\n _onPeerConnected (peerId) {\n this.wm.connected(peerId)\n }\n\n // handle peers being disconnected\n _onPeerDisconnected (peerId) {\n this.wm.disconnected(peerId)\n this.engine.peerDisconnected(peerId)\n this._stats.disconnected(peerId)\n }\n\n /**\n * @returns {void}\n */\n enableStats () {\n this._stats.enable()\n }\n\n /**\n * @returns {void}\n */\n disableStats () {\n this._stats.disable()\n }\n\n /**\n * Return the current wantlist for a given `peerId`\n *\n * @param {PeerId} peerId\n * @returns {Map}\n */\n wantlistForPeer (peerId) {\n return this.engine.wantlistForPeer(peerId)\n }\n\n /**\n * Return ledger information for a given `peerId`\n *\n * @param {PeerId} peerId\n * @returns {Object}\n */\n ledgerForPeer (peerId) {\n return this.engine.ledgerForPeer(peerId)\n }\n\n /**\n * Fetch a given block by cid. If the block is in the local\n * blockstore it is returned, otherwise the block is added to the wantlist and returned once another node sends it to us.\n *\n * @param {CID} cid\n * @returns {Promise}\n */\n async get (cid) {\n for await (const block of this.getMany([cid])) {\n return block\n }\n }\n\n /**\n * Fetch a a list of blocks by cid. If the blocks are in the local\n * blockstore they are returned, otherwise the blocks are added to the wantlist and returned once another node sends them to us.\n *\n * @param {Iterable} cids\n * @returns {Promise>}\n */\n async * getMany (cids) {\n let pendingStart = cids.length\n const wantList = []\n let promptedNetwork = false\n\n const fetchFromNetwork = async (cid) => {\n wantList.push(cid)\n\n const blockP = this.notifications.wantBlock(cid)\n\n if (!pendingStart) {\n this.wm.wantBlocks(wantList)\n }\n\n const block = await blockP\n this.wm.cancelWants([cid])\n\n return block\n }\n\n for (const cid of cids) {\n const has = await this.blockstore.has(cid)\n pendingStart--\n if (has) {\n if (!pendingStart) {\n this.wm.wantBlocks(wantList)\n }\n yield this.blockstore.get(cid)\n\n continue\n }\n\n if (!promptedNetwork) {\n promptedNetwork = true\n this.network.findAndConnect(cids[0]).catch((err) => this._log.error(err))\n }\n\n // we don't have the block locally so fetch it from the network\n yield fetchFromNetwork(cid)\n }\n }\n\n /**\n * Removes the given CIDs from the wantlist independent of any ref counts\n *\n * @param {Iterable} cids\n * @returns {void}\n */\n unwant (cids) {\n if (!Array.isArray(cids)) {\n cids = [cids]\n }\n\n this.wm.unwantBlocks(cids)\n cids.forEach((cid) => this.notifications.unwantBlock(cid))\n }\n\n /**\n * Removes the given keys from the want list\n *\n * @param {Iterable} cids\n * @returns {void}\n */\n cancelWants (cids) {\n if (!Array.isArray(cids)) {\n cids = [cids]\n }\n this.wm.cancelWants(cids)\n }\n\n /**\n * Put the given block to the underlying blockstore and\n * send it to nodes that have it in their wantlist.\n *\n * @param {Block} block\n * @returns {Promise}\n */\n async put (block) { // eslint-disable-line require-await\n return this.putMany([block])\n }\n\n /**\n * Put the given blocks to the underlying blockstore and\n * send it to nodes that have it them their wantlist.\n *\n * @param {AsyncIterable|Iterable} blocks\n * @returns {Promise}\n */\n async putMany (blocks) { // eslint-disable-line require-await\n const self = this\n\n return this.blockstore.putMany(async function * () {\n for await (const block of blocks) {\n if (await self.blockstore.has(block.cid)) {\n continue\n }\n\n yield block\n\n self.notifications.hasBlock(block)\n self.engine.receivedBlocks([block.cid])\n // Note: Don't wait for provide to finish before returning\n self.network.provide(block.cid).catch((err) => {\n self._log.error('Failed to provide: %s', err.message)\n })\n }\n }())\n }\n\n /**\n * Get the current list of wants.\n *\n * @returns {Iterator}\n */\n getWantlist () {\n return this.wm.wantlist.entries()\n }\n\n /**\n * Get the current list of partners.\n *\n * @returns {Iterator}\n */\n peers () {\n return this.engine.peers()\n }\n\n /**\n * Get stats about the bitswap node.\n *\n * @returns {Object}\n */\n stat () {\n return this._stats\n }\n\n /**\n * Start the bitswap node.\n *\n * @returns {void}\n */\n start () {\n this.wm.start()\n this.network.start()\n this.engine.start()\n }\n\n /**\n * Stop the bitswap node.\n *\n * @returns {void}\n */\n stop () {\n this._stats.stop()\n this.wm.stop()\n this.network.stop()\n this.engine.stop()\n }\n}\n\nmodule.exports = Bitswap\n","module.exports = read\n\nvar MSB = 0x80\n , REST = 0x7F\n\nfunction read(buf, offset) {\n var res = 0\n , offset = offset || 0\n , shift = 0\n , counter = offset\n , b\n , l = buf.length\n\n do {\n if (counter >= l) {\n read.bytes = 0\n throw new RangeError('Could not decode varint')\n }\n b = buf[counter++]\n res += shift < 28\n ? (b & REST) << shift\n : (b & REST) * Math.pow(2, shift)\n shift += 7\n } while (b >= MSB)\n\n read.bytes = counter - offset\n\n return res\n}\n","/**\n * Javascript implementation of PKCS#1 PSS signature padding.\n *\n * @author Stefan Siegl\n *\n * Copyright (c) 2012 Stefan Siegl \n */\nvar forge = require('./forge');\nrequire('./random');\nrequire('./util');\n\n// shortcut for PSS API\nvar pss = module.exports = forge.pss = forge.pss || {};\n\n/**\n * Creates a PSS signature scheme object.\n *\n * There are several ways to provide a salt for encoding:\n *\n * 1. Specify the saltLength only and the built-in PRNG will generate it.\n * 2. Specify the saltLength and a custom PRNG with 'getBytesSync' defined that\n * will be used.\n * 3. Specify the salt itself as a forge.util.ByteBuffer.\n *\n * @param options the options to use:\n * md the message digest object to use, a forge md instance.\n * mgf the mask generation function to use, a forge mgf instance.\n * [saltLength] the length of the salt in octets.\n * [prng] the pseudo-random number generator to use to produce a salt.\n * [salt] the salt to use when encoding.\n *\n * @return a signature scheme object.\n */\npss.create = function(options) {\n // backwards compatibility w/legacy args: hash, mgf, sLen\n if(arguments.length === 3) {\n options = {\n md: arguments[0],\n mgf: arguments[1],\n saltLength: arguments[2]\n };\n }\n\n var hash = options.md;\n var mgf = options.mgf;\n var hLen = hash.digestLength;\n\n var salt_ = options.salt || null;\n if(typeof salt_ === 'string') {\n // assume binary-encoded string\n salt_ = forge.util.createBuffer(salt_);\n }\n\n var sLen;\n if('saltLength' in options) {\n sLen = options.saltLength;\n } else if(salt_ !== null) {\n sLen = salt_.length();\n } else {\n throw new Error('Salt length not specified or specific salt not given.');\n }\n\n if(salt_ !== null && salt_.length() !== sLen) {\n throw new Error('Given salt length does not match length of given salt.');\n }\n\n var prng = options.prng || forge.random;\n\n var pssobj = {};\n\n /**\n * Encodes a PSS signature.\n *\n * This function implements EMSA-PSS-ENCODE as per RFC 3447, section 9.1.1.\n *\n * @param md the message digest object with the hash to sign.\n * @param modsBits the length of the RSA modulus in bits.\n *\n * @return the encoded message as a binary-encoded string of length\n * ceil((modBits - 1) / 8).\n */\n pssobj.encode = function(md, modBits) {\n var i;\n var emBits = modBits - 1;\n var emLen = Math.ceil(emBits / 8);\n\n /* 2. Let mHash = Hash(M), an octet string of length hLen. */\n var mHash = md.digest().getBytes();\n\n /* 3. If emLen < hLen + sLen + 2, output \"encoding error\" and stop. */\n if(emLen < hLen + sLen + 2) {\n throw new Error('Message is too long to encrypt.');\n }\n\n /* 4. Generate a random octet string salt of length sLen; if sLen = 0,\n * then salt is the empty string. */\n var salt;\n if(salt_ === null) {\n salt = prng.getBytesSync(sLen);\n } else {\n salt = salt_.bytes();\n }\n\n /* 5. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt; */\n var m_ = new forge.util.ByteBuffer();\n m_.fillWithByte(0, 8);\n m_.putBytes(mHash);\n m_.putBytes(salt);\n\n /* 6. Let H = Hash(M'), an octet string of length hLen. */\n hash.start();\n hash.update(m_.getBytes());\n var h = hash.digest().getBytes();\n\n /* 7. Generate an octet string PS consisting of emLen - sLen - hLen - 2\n * zero octets. The length of PS may be 0. */\n var ps = new forge.util.ByteBuffer();\n ps.fillWithByte(0, emLen - sLen - hLen - 2);\n\n /* 8. Let DB = PS || 0x01 || salt; DB is an octet string of length\n * emLen - hLen - 1. */\n ps.putByte(0x01);\n ps.putBytes(salt);\n var db = ps.getBytes();\n\n /* 9. Let dbMask = MGF(H, emLen - hLen - 1). */\n var maskLen = emLen - hLen - 1;\n var dbMask = mgf.generate(h, maskLen);\n\n /* 10. Let maskedDB = DB \\xor dbMask. */\n var maskedDB = '';\n for(i = 0; i < maskLen; i++) {\n maskedDB += String.fromCharCode(db.charCodeAt(i) ^ dbMask.charCodeAt(i));\n }\n\n /* 11. Set the leftmost 8emLen - emBits bits of the leftmost octet in\n * maskedDB to zero. */\n var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF;\n maskedDB = String.fromCharCode(maskedDB.charCodeAt(0) & ~mask) +\n maskedDB.substr(1);\n\n /* 12. Let EM = maskedDB || H || 0xbc.\n * 13. Output EM. */\n return maskedDB + h + String.fromCharCode(0xbc);\n };\n\n /**\n * Verifies a PSS signature.\n *\n * This function implements EMSA-PSS-VERIFY as per RFC 3447, section 9.1.2.\n *\n * @param mHash the message digest hash, as a binary-encoded string, to\n * compare against the signature.\n * @param em the encoded message, as a binary-encoded string\n * (RSA decryption result).\n * @param modsBits the length of the RSA modulus in bits.\n *\n * @return true if the signature was verified, false if not.\n */\n pssobj.verify = function(mHash, em, modBits) {\n var i;\n var emBits = modBits - 1;\n var emLen = Math.ceil(emBits / 8);\n\n /* c. Convert the message representative m to an encoded message EM\n * of length emLen = ceil((modBits - 1) / 8) octets, where modBits\n * is the length in bits of the RSA modulus n */\n em = em.substr(-emLen);\n\n /* 3. If emLen < hLen + sLen + 2, output \"inconsistent\" and stop. */\n if(emLen < hLen + sLen + 2) {\n throw new Error('Inconsistent parameters to PSS signature verification.');\n }\n\n /* 4. If the rightmost octet of EM does not have hexadecimal value\n * 0xbc, output \"inconsistent\" and stop. */\n if(em.charCodeAt(emLen - 1) !== 0xbc) {\n throw new Error('Encoded message does not end in 0xBC.');\n }\n\n /* 5. Let maskedDB be the leftmost emLen - hLen - 1 octets of EM, and\n * let H be the next hLen octets. */\n var maskLen = emLen - hLen - 1;\n var maskedDB = em.substr(0, maskLen);\n var h = em.substr(maskLen, hLen);\n\n /* 6. If the leftmost 8emLen - emBits bits of the leftmost octet in\n * maskedDB are not all equal to zero, output \"inconsistent\" and stop. */\n var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF;\n if((maskedDB.charCodeAt(0) & mask) !== 0) {\n throw new Error('Bits beyond keysize not zero as expected.');\n }\n\n /* 7. Let dbMask = MGF(H, emLen - hLen - 1). */\n var dbMask = mgf.generate(h, maskLen);\n\n /* 8. Let DB = maskedDB \\xor dbMask. */\n var db = '';\n for(i = 0; i < maskLen; i++) {\n db += String.fromCharCode(maskedDB.charCodeAt(i) ^ dbMask.charCodeAt(i));\n }\n\n /* 9. Set the leftmost 8emLen - emBits bits of the leftmost octet\n * in DB to zero. */\n db = String.fromCharCode(db.charCodeAt(0) & ~mask) + db.substr(1);\n\n /* 10. If the emLen - hLen - sLen - 2 leftmost octets of DB are not zero\n * or if the octet at position emLen - hLen - sLen - 1 (the leftmost\n * position is \"position 1\") does not have hexadecimal value 0x01,\n * output \"inconsistent\" and stop. */\n var checkLen = emLen - hLen - sLen - 2;\n for(i = 0; i < checkLen; i++) {\n if(db.charCodeAt(i) !== 0x00) {\n throw new Error('Leftmost octets not zero as expected');\n }\n }\n\n if(db.charCodeAt(checkLen) !== 0x01) {\n throw new Error('Inconsistent PSS signature, 0x01 marker not found');\n }\n\n /* 11. Let salt be the last sLen octets of DB. */\n var salt = db.substr(-sLen);\n\n /* 12. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt */\n var m_ = new forge.util.ByteBuffer();\n m_.fillWithByte(0, 8);\n m_.putBytes(mHash);\n m_.putBytes(salt);\n\n /* 13. Let H' = Hash(M'), an octet string of length hLen. */\n hash.start();\n hash.update(m_.getBytes());\n var h_ = hash.digest().getBytes();\n\n /* 14. If H = H', output \"consistent.\" Otherwise, output \"inconsistent.\" */\n return h === h_;\n };\n\n return pssobj;\n};\n","'use strict'\n\nconst multihash = require('multihashes')\nconst crypto = require('./crypto')\n\nmodule.exports = Multihashing\n\n/**\n * Hash the given `buf` using the algorithm specified\n * by `func`.\n *\n * @param {Buffer} buf - The value to hash.\n * @param {number|string} func - The algorithm to use.\n * @param {number} [length] - Optionally trim the result to this length.\n * @param {function(Error, Buffer)} callback\n * @returns {undefined}\n */\nfunction Multihashing (buf, func, length, callback) {\n if (typeof length === 'function') {\n callback = length\n length = undefined\n }\n\n if (!callback) {\n throw new Error('Missing callback')\n }\n\n Multihashing.digest(buf, func, length, (err, digest) => {\n if (err) {\n return callback(err)\n }\n\n callback(null, multihash.encode(digest, func, length))\n })\n}\n\n/**\n * The `buffer` module for easy use in the browser.\n *\n * @type {Buffer}\n */\nMultihashing.Buffer = Buffer // for browser things\n\n/**\n * Expose multihash itself, to avoid silly double requires.\n */\nMultihashing.multihash = multihash\n\n/**\n * @param {Buffer} buf - The value to hash.\n * @param {number|string} func - The algorithm to use.\n * @param {number} [length] - Optionally trim the result to this length.\n * @param {function(Error, Buffer)} callback\n * @returns {undefined}\n */\nMultihashing.digest = function (buf, func, length, callback) {\n if (typeof length === 'function') {\n callback = length\n length = undefined\n }\n\n if (!callback) {\n throw new Error('Missing callback')\n }\n\n let cb = callback\n if (length) {\n cb = (err, digest) => {\n if (err) {\n return callback(err)\n }\n\n callback(null, digest.slice(0, length))\n }\n }\n\n let hash\n try {\n hash = Multihashing.createHash(func)\n } catch (err) {\n return cb(err)\n }\n\n hash(buf, cb)\n}\n\n/**\n * @param {string|number} func\n *\n * @returns {function} - The to `func` corresponding hash function.\n */\nMultihashing.createHash = function (func) {\n func = multihash.coerceCode(func)\n if (!Multihashing.functions[func]) {\n throw new Error('multihash function ' + func + ' not yet supported')\n }\n\n return Multihashing.functions[func]\n}\n\n/**\n * Mapping of multihash codes to their hashing functions.\n * @type {Object}\n */\nMultihashing.functions = {\n // sha1\n 0x11: crypto.sha1,\n // sha2-256\n 0x12: crypto.sha2256,\n // sha2-512\n 0x13: crypto.sha2512,\n // sha3-512\n 0x14: crypto.sha3512,\n // sha3-384\n 0x15: crypto.sha3384,\n // sha3-256\n 0x16: crypto.sha3256,\n // sha3-224\n 0x17: crypto.sha3224,\n // shake-128\n 0x18: crypto.shake128,\n // shake-256\n 0x19: crypto.shake256,\n // keccak-224\n 0x1A: crypto.keccak224,\n // keccak-256\n 0x1B: crypto.keccak256,\n // keccak-384\n 0x1C: crypto.keccak384,\n // keccak-512\n 0x1D: crypto.keccak512,\n // murmur3-128\n 0x22: crypto.murmur3128,\n // murmur3-32\n 0x23: crypto.murmur332,\n // dbl-sha2-256\n 0x56: crypto.dblSha2256\n}\n\n// add blake functions\ncrypto.addBlake(Multihashing.functions)\n\nMultihashing.validate = (data, hash, callback) => {\n let algo = multihash.decode(hash).name\n Multihashing(data, algo, (err, newHash) => {\n if (err) return callback(err)\n callback(err, Buffer.compare(hash, newHash) === 0)\n })\n}\n","'use strict'\n\nconst CID = require('cids')\n\nconst util = require('./util')\n\n/**\n * Resolves a path within a PB block.\n *\n * Returns the value or a link and the partial mising path. This way the\n * IPLD Resolver can fetch the link and continue to resolve.\n *\n * @param {Buffer} binaryBlob - Binary representation of a PB block\n * @param {string} [path='/'] - Path that should be resolved\n * @returns {Object} result - Result of the path it it was resolved successfully\n * @returns {*} result.value - Value the path resolves to\n * @returns {string} result.remainderPath - If the path resolves half-way to a\n * link, then the `remainderPath` is the part after the link that can be used\n * for further resolving\n */\nexports.resolve = (binaryBlob, path) => {\n let node = util.deserialize(binaryBlob)\n\n const parts = path.split('/').filter(Boolean)\n while (parts.length) {\n const key = parts.shift()\n if (node[key] === undefined) {\n throw new Error(`Object has no property '${key}'`)\n }\n\n node = node[key]\n if (CID.isCID(node)) {\n return {\n value: node,\n remainderPath: parts.join('/')\n }\n }\n }\n\n return {\n value: node,\n remainderPath: ''\n }\n}\n\nconst traverse = function * (node, path) {\n // Traverse only objects and arrays\n if (Buffer.isBuffer(node) || CID.isCID(node) || typeof node === 'string' ||\n node === null) {\n return\n }\n for (const item of Object.keys(node)) {\n const nextpath = path === undefined ? item : path + '/' + item\n yield nextpath\n yield * traverse(node[item], nextpath)\n }\n}\n\n/**\n * Return all available paths of a block.\n *\n * @generator\n * @param {Buffer} binaryBlob - Binary representation of a PB block\n * @yields {string} - A single path\n */\nexports.tree = function * (binaryBlob) {\n const node = util.deserialize(binaryBlob)\n\n yield * traverse(node)\n}\n","'use strict'\n\nconst promisify = require('promisify-es6')\nconst streamToValueWithTransformer = require('../utils/stream-to-value-with-transformer')\n\nconst PeerId = require('peer-id')\nconst PeerInfo = require('peer-info')\n\nmodule.exports = (send) => {\n return promisify((peerId, opts, callback) => {\n if (typeof opts === 'function' && !callback) {\n callback = opts\n opts = {}\n }\n\n // opts is the real callback --\n // 'callback' is being injected by promisify\n if (typeof opts === 'function' && typeof callback === 'function') {\n callback = opts\n opts = {}\n }\n\n const handleResult = (res, callback) => {\n const peerIds = res.map((r) => (new PeerInfo(PeerId.createFromB58String(r.ID))))\n\n callback(null, peerIds)\n }\n\n send({\n path: 'dht/query',\n args: peerId,\n qs: opts\n }, (err, result) => {\n if (err) {\n return callback(err)\n }\n\n streamToValueWithTransformer(result, handleResult, callback)\n })\n })\n}\n","\"use strict\";\n\nconst hasBigInt64 = typeof BigUint64Array !== \"undefined\";\nconst thisPtr = Symbol();\n\n/** Gets a string from an U32 and an U16 view on a memory. */\nfunction getStringImpl(U32, U16, ptr) {\n var dataLength = U32[ptr >>> 2];\n var dataOffset = (ptr + 4) >>> 1;\n var dataRemain = dataLength;\n var parts = [];\n const chunkSize = 1024;\n while (dataRemain > chunkSize) {\n let last = U16[dataOffset + chunkSize - 1];\n let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize;\n let part = U16.subarray(dataOffset, dataOffset += size);\n parts.push(String.fromCharCode.apply(String, part));\n dataRemain -= size;\n }\n return parts.join(\"\") + String.fromCharCode.apply(String, U16.subarray(dataOffset, dataOffset + dataRemain));\n}\n\n/** Prepares the base module prior to instantiation. */\nfunction preInstantiate(imports) {\n var baseModule = {};\n\n function getString(memory, ptr) {\n if (!memory) return \"\";\n var buffer = memory.buffer;\n return getStringImpl(new Uint32Array(buffer), new Uint16Array(buffer), ptr);\n }\n\n // add common imports used by stdlib for convenience\n var env = (imports.env = imports.env || {});\n env.abort = env.abort || function abort(mesg, file, line, colm) {\n var memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported\n throw Error(\"abort: \" + getString(memory, mesg) + \" at \" + getString(memory, file) + \":\" + line + \":\" + colm);\n }\n env.trace = env.trace || function trace(mesg, n) {\n var memory = baseModule.memory || env.memory;\n console.log(\"trace: \" + getString(memory, mesg) + (n ? \" \" : \"\") + Array.prototype.slice.call(arguments, 2, 2 + n).join(\", \"));\n }\n imports.Math = imports.Math || Math;\n imports.Date = imports.Date || Date;\n\n return baseModule;\n}\n\n/** Prepares the final module once instantiation is complete. */\nfunction postInstantiate(baseModule, instance) {\n var rawExports = instance.exports;\n var memory = rawExports.memory;\n var memory_allocate = rawExports[\"memory.allocate\"];\n var memory_fill = rawExports[\"memory.fill\"];\n var memory_free = rawExports[\"memory.free\"];\n var table = rawExports.table;\n var setargc = rawExports._setargc || function() {};\n\n // Provide views for all sorts of basic values\n var buffer, I8, U8, I16, U16, I32, U32, F32, F64, I64, U64;\n\n /** Updates memory views if memory has grown meanwhile. */\n function checkMem() {\n // see: https://github.com/WebAssembly/design/issues/1210\n if (buffer !== memory.buffer) {\n buffer = memory.buffer;\n I8 = new Int8Array(buffer);\n U8 = new Uint8Array(buffer);\n I16 = new Int16Array(buffer);\n U16 = new Uint16Array(buffer);\n I32 = new Int32Array(buffer);\n U32 = new Uint32Array(buffer);\n if (hasBigInt64) {\n I64 = new BigInt64Array(buffer);\n U64 = new BigUint64Array(buffer);\n }\n F32 = new Float32Array(buffer);\n F64 = new Float64Array(buffer);\n }\n }\n checkMem();\n\n /** Allocates a new string in the module's memory and returns its pointer. */\n function newString(str) {\n var dataLength = str.length;\n var ptr = memory_allocate(4 + (dataLength << 1));\n var dataOffset = (4 + ptr) >>> 1;\n checkMem();\n U32[ptr >>> 2] = dataLength;\n for (let i = 0; i < dataLength; ++i) U16[dataOffset + i] = str.charCodeAt(i);\n return ptr;\n }\n\n baseModule.newString = newString;\n\n /** Gets a string from the module's memory by its pointer. */\n function getString(ptr) {\n checkMem();\n return getStringImpl(U32, U16, ptr);\n }\n\n baseModule.getString = getString;\n\n function computeBufferSize(byteLength) {\n const HEADER_SIZE = 8;\n return 1 << (32 - Math.clz32(byteLength + HEADER_SIZE - 1));\n }\n\n /** Creates a new typed array in the module's memory and returns its pointer. */\n function newArray(view, length, unsafe) {\n var ctor = view.constructor;\n if (ctor === Function) { // TypedArray constructor created in memory\n ctor = view;\n view = null;\n } else { // TypedArray instance copied into memory\n if (length === undefined) length = view.length;\n }\n var elementSize = ctor.BYTES_PER_ELEMENT;\n if (!elementSize) throw Error(\"not a typed array\");\n var byteLength = elementSize * length;\n var ptr = memory_allocate(12); // TypedArray header\n var buf = memory_allocate(computeBufferSize(byteLength)); // ArrayBuffer\n checkMem();\n U32[ ptr >>> 2] = buf; // .buffer\n U32[(ptr + 4) >>> 2] = 0; // .byteOffset\n U32[(ptr + 8) >>> 2] = byteLength; // .byteLength\n U32[ buf >>> 2] = byteLength; // .byteLength\n U32[(buf + 4) >>> 2] = 0; // 0\n if (view) {\n new ctor(buffer, buf + 8, length).set(view);\n if (view.length < length && !unsafe) {\n let setLength = elementSize * view.length;\n memory_fill(buf + 8 + setLength, 0, byteLength - setLength);\n }\n } else if (!unsafe) {\n memory_fill(buf + 8, 0, byteLength);\n }\n return ptr;\n }\n\n baseModule.newArray = newArray;\n\n /** Gets a view on a typed array in the module's memory by its pointer. */\n function getArray(ctor, ptr) {\n var elementSize = ctor.BYTES_PER_ELEMENT;\n if (!elementSize) throw Error(\"not a typed array\");\n checkMem();\n var buf = U32[ ptr >>> 2];\n var byteOffset = U32[(ptr + 4) >>> 2];\n var byteLength = U32[(ptr + 8) >>> 2];\n return new ctor(buffer, buf + 8 + byteOffset, (byteLength - byteOffset) / elementSize);\n }\n\n baseModule.getArray = getArray;\n\n /** Frees a typed array in the module's memory. Must not be accessed anymore afterwards. */\n function freeArray(ptr) {\n checkMem();\n var buf = U32[ptr >>> 2];\n memory_free(buf);\n memory_free(ptr);\n }\n\n baseModule.freeArray = freeArray;\n\n /**\n * Creates a new function in the module's table and returns its pointer. Note that only actual\n * WebAssembly functions, i.e. as exported by the module, are supported.\n */\n function newFunction(fn) {\n if (typeof fn.original === \"function\") fn = fn.original;\n var index = table.length;\n table.grow(1);\n table.set(index, fn);\n return index;\n }\n\n baseModule.newFunction = newFunction;\n\n /** Gets a function by its pointer. */\n function getFunction(ptr) {\n return wrapFunction(table.get(ptr), setargc);\n }\n\n baseModule.getFunction = getFunction;\n\n // Pull basic exports to baseModule so code in preInstantiate can use them\n baseModule.memory = baseModule.memory || memory;\n baseModule.table = baseModule.table || table;\n\n // Demangle exports and provide the usual utility on the prototype\n return demangle(rawExports, Object.defineProperties(baseModule, {\n I8: { get: function() { checkMem(); return I8; } },\n U8: { get: function() { checkMem(); return U8; } },\n I16: { get: function() { checkMem(); return I16; } },\n U16: { get: function() { checkMem(); return U16; } },\n I32: { get: function() { checkMem(); return I32; } },\n U32: { get: function() { checkMem(); return U32; } },\n I64: { get: function() { checkMem(); return I64; } },\n U64: { get: function() { checkMem(); return U64; } },\n F32: { get: function() { checkMem(); return F32; } },\n F64: { get: function() { checkMem(); return F64; } }\n }));\n}\n\n/** Wraps a WebAssembly function while also taking care of variable arguments. */\nfunction wrapFunction(fn, setargc) {\n var wrap = (...args) => {\n setargc(args.length);\n return fn(...args);\n }\n // adding a function to the table with `newFunction` is limited to actual WebAssembly functions,\n // hence we can't use the wrapper and instead need to provide a reference to the original\n wrap.original = fn;\n return wrap;\n}\n\n/** Instantiates an AssemblyScript module using the specified imports. */\nfunction instantiate(module, imports) {\n return postInstantiate(\n preInstantiate(imports || (imports = {})),\n new WebAssembly.Instance(module, imports)\n );\n}\n\nexports.instantiate = instantiate;\n\n/** Instantiates an AssemblyScript module from a buffer using the specified imports. */\nfunction instantiateBuffer(buffer, imports) {\n return instantiate(new WebAssembly.Module(buffer), imports);\n}\n\nexports.instantiateBuffer = instantiateBuffer;\n\n/** Instantiates an AssemblyScript module from a response using the specified imports. */\nasync function instantiateStreaming(response, imports) {\n return postInstantiate(\n preInstantiate(imports || (imports = {})),\n (await WebAssembly.instantiateStreaming(response, imports)).instance\n );\n}\n\nexports.instantiateStreaming = instantiateStreaming;\n\n/** Demangles an AssemblyScript module's exports to a friendly object structure. */\nfunction demangle(exports, baseModule) {\n var module = baseModule ? Object.create(baseModule) : {};\n var setargc = exports._setargc || function() {};\n function hasOwnProperty(elem, prop) {\n return Object.prototype.hasOwnProperty.call(elem, prop);\n }\n for (let internalName in exports) {\n if (!hasOwnProperty(exports, internalName)) continue;\n let elem = exports[internalName];\n let parts = internalName.split(\".\");\n let curr = module;\n while (parts.length > 1) {\n let part = parts.shift();\n if (!hasOwnProperty(curr, part)) curr[part] = {};\n curr = curr[part];\n }\n let name = parts[0];\n let hash = name.indexOf(\"#\");\n if (hash >= 0) {\n let className = name.substring(0, hash);\n let classElem = curr[className];\n if (typeof classElem === \"undefined\" || !classElem.prototype) {\n let ctor = function(...args) {\n return ctor.wrap(ctor.prototype.constructor(0, ...args));\n };\n ctor.prototype = {};\n ctor.wrap = function(thisValue) {\n return Object.create(ctor.prototype, { [thisPtr]: { value: thisValue, writable: false } });\n };\n if (classElem) Object.getOwnPropertyNames(classElem).forEach(name =>\n Object.defineProperty(ctor, name, Object.getOwnPropertyDescriptor(classElem, name))\n );\n curr[className] = ctor;\n }\n name = name.substring(hash + 1);\n curr = curr[className].prototype;\n if (/^(get|set):/.test(name)) {\n if (!hasOwnProperty(curr, name = name.substring(4))) {\n let getter = exports[internalName.replace(\"set:\", \"get:\")];\n let setter = exports[internalName.replace(\"get:\", \"set:\")];\n Object.defineProperty(curr, name, {\n get: function() { return getter(this[thisPtr]); },\n set: function(value) { setter(this[thisPtr], value); },\n enumerable: true\n });\n }\n } else {\n if (name === 'constructor') {\n curr[name] = wrapFunction(elem, setargc);\n } else { // for methods\n Object.defineProperty(curr, name, {\n value: function (...args) {\n setargc(args.length);\n return elem(this[thisPtr], ...args);\n }\n });\n }\n }\n } else {\n if (/^(get|set):/.test(name)) {\n if (!hasOwnProperty(curr, name = name.substring(4))) {\n Object.defineProperty(curr, name, {\n get: exports[internalName.replace(\"set:\", \"get:\")],\n set: exports[internalName.replace(\"get:\", \"set:\")],\n enumerable: true\n });\n }\n } else if (typeof elem === \"function\") {\n curr[name] = wrapFunction(elem, setargc);\n } else {\n curr[name] = elem;\n }\n }\n }\n\n return module;\n}\n\nexports.demangle = demangle;\n","'use strict'\n\n// from: https://github.com/ipfs/go-ipfs/blob/master/exchange/bitswap/message/pb/message.proto\n\nmodule.exports = `\n message Message {\n message Wantlist {\n message Entry {\n // changed from string to bytes, it makes a difference in JavaScript\n optional bytes block = 1; // the block cid (cidV0 in bitswap 1.0.0, cidV1 in bitswap 1.1.0)\n optional int32 priority = 2; // the priority (normalized). default to 1\n optional bool cancel = 3; // whether this revokes an entry\n }\n\n repeated Entry entries = 1; // a list of wantlist entries\n optional bool full = 2; // whether this is the full wantlist. default to false\n }\n\n message Block {\n optional bytes prefix = 1; // CID prefix (cid version, multicodec and multihash prefix (type + length)\n optional bytes data = 2;\n }\n\n optional Wantlist wantlist = 1;\n repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0\n repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0\n }\n`\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = parallelLimit;\n\nvar _eachOf = require('./eachOf');\n\nvar _eachOf2 = _interopRequireDefault(_eachOf);\n\nvar _parallel = require('./internal/parallel');\n\nvar _parallel2 = _interopRequireDefault(_parallel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Run the `tasks` collection of functions in parallel, without waiting until\n * the previous function has completed. If any of the functions pass an error to\n * its callback, the main `callback` is immediately called with the value of the\n * error. Once the `tasks` have completed, the results are passed to the final\n * `callback` as an array.\n *\n * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about\n * parallel execution of code. If your tasks do not use any timers or perform\n * any I/O, they will actually be executed in series. Any synchronous setup\n * sections for each task will happen one after the other. JavaScript remains\n * single-threaded.\n *\n * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the\n * execution of other tasks when a task fails.\n *\n * It is also possible to use an object instead of an array. Each property will\n * be run as a function and the results will be passed to the final `callback`\n * as an object instead of an array. This can be a more readable way of handling\n * results from {@link async.parallel}.\n *\n * @name parallel\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Array|Iterable|Object} tasks - A collection of\n * [async functions]{@link AsyncFunction} to run.\n * Each async function can complete with any number of optional `result` values.\n * @param {Function} [callback] - An optional callback to run once all the\n * functions have completed successfully. This function gets a results array\n * (or object) containing all the result arguments passed to the task callbacks.\n * Invoked with (err, results).\n *\n * @example\n * async.parallel([\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'one');\n * }, 200);\n * },\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'two');\n * }, 100);\n * }\n * ],\n * // optional callback\n * function(err, results) {\n * // the results array will equal ['one','two'] even though\n * // the second function had a shorter timeout.\n * });\n *\n * // an example using an object instead of an array\n * async.parallel({\n * one: function(callback) {\n * setTimeout(function() {\n * callback(null, 1);\n * }, 200);\n * },\n * two: function(callback) {\n * setTimeout(function() {\n * callback(null, 2);\n * }, 100);\n * }\n * }, function(err, results) {\n * // results is now equals to: {one: 1, two: 2}\n * });\n */\nfunction parallelLimit(tasks, callback) {\n (0, _parallel2.default)(_eachOf2.default, tasks, callback);\n}\nmodule.exports = exports['default'];","export const version = \"providers/5.0.0-beta.153\";\n","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","'use strict';\n\nconst inherits = require('inherits');\n\nfunction Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n}\nexports.Reporter = Reporter;\n\nReporter.prototype.isError = function isError(obj) {\n return obj instanceof ReporterError;\n};\n\nReporter.prototype.save = function save() {\n const state = this._reporterState;\n\n return { obj: state.obj, pathLen: state.path.length };\n};\n\nReporter.prototype.restore = function restore(data) {\n const state = this._reporterState;\n\n state.obj = data.obj;\n state.path = state.path.slice(0, data.pathLen);\n};\n\nReporter.prototype.enterKey = function enterKey(key) {\n return this._reporterState.path.push(key);\n};\n\nReporter.prototype.exitKey = function exitKey(index) {\n const state = this._reporterState;\n\n state.path = state.path.slice(0, index - 1);\n};\n\nReporter.prototype.leaveKey = function leaveKey(index, key, value) {\n const state = this._reporterState;\n\n this.exitKey(index);\n if (state.obj !== null)\n state.obj[key] = value;\n};\n\nReporter.prototype.path = function path() {\n return this._reporterState.path.join('/');\n};\n\nReporter.prototype.enterObject = function enterObject() {\n const state = this._reporterState;\n\n const prev = state.obj;\n state.obj = {};\n return prev;\n};\n\nReporter.prototype.leaveObject = function leaveObject(prev) {\n const state = this._reporterState;\n\n const now = state.obj;\n state.obj = prev;\n return now;\n};\n\nReporter.prototype.error = function error(msg) {\n let err;\n const state = this._reporterState;\n\n const inherited = msg instanceof ReporterError;\n if (inherited) {\n err = msg;\n } else {\n err = new ReporterError(state.path.map(function(elem) {\n return '[' + JSON.stringify(elem) + ']';\n }).join(''), msg.message || msg, msg.stack);\n }\n\n if (!state.options.partial)\n throw err;\n\n if (!inherited)\n state.errors.push(err);\n\n return err;\n};\n\nReporter.prototype.wrapResult = function wrapResult(result) {\n const state = this._reporterState;\n if (!state.options.partial)\n return result;\n\n return {\n result: this.isError(result) ? null : result,\n errors: state.errors\n };\n};\n\nfunction ReporterError(path, msg) {\n this.path = path;\n this.rethrow(msg);\n}\ninherits(ReporterError, Error);\n\nReporterError.prototype.rethrow = function rethrow(msg) {\n this.message = msg + ' at: ' + (this.path || '(shallow)');\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, ReporterError);\n\n if (!this.stack) {\n try {\n // IE only adds stack when thrown\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n }\n return this;\n};\n","// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar eos;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\n\nvar _require$codes = require('../../../errors').codes,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = require('./end-of-stream');\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true; // request.destroy just do .end - .abort is what we want\n\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\n\nfunction call(fn) {\n fn();\n}\n\nfunction pipe(from, to) {\n return from.pipe(to);\n}\n\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\n\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\n\nmodule.exports = pipeline;","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// This gets overridden by rollup\nvar exportWordlist = false;\nvar hash_1 = require(\"@ethersproject/hash\");\nvar properties_1 = require(\"@ethersproject/properties\");\nvar logger_1 = require(\"@ethersproject/logger\");\nvar _version_1 = require(\"./_version\");\nexports.logger = new logger_1.Logger(_version_1.version);\nvar Wordlist = /** @class */ (function () {\n function Wordlist(locale) {\n var _newTarget = this.constructor;\n exports.logger.checkAbstract(_newTarget, Wordlist);\n properties_1.defineReadOnly(this, \"locale\", locale);\n }\n // Subclasses may override this\n Wordlist.prototype.split = function (mnemonic) {\n return mnemonic.toLowerCase().split(/ +/g);\n };\n // Subclasses may override this\n Wordlist.prototype.join = function (words) {\n return words.join(\" \");\n };\n Wordlist.check = function (wordlist) {\n var words = [];\n for (var i = 0; i < 2048; i++) {\n var word = wordlist.getWord(i);\n if (i !== wordlist.getWordIndex(word)) {\n return \"0x\";\n }\n words.push(word);\n }\n return hash_1.id(words.join(\"\\n\") + \"\\n\");\n };\n Wordlist.register = function (lang, name) {\n if (!name) {\n name = lang.locale;\n }\n if (exportWordlist) {\n try {\n var anyGlobal = window;\n if (anyGlobal._ethers && anyGlobal._ethers.wordlists) {\n if (!anyGlobal._ethers.wordlists[name]) {\n properties_1.defineReadOnly(anyGlobal._ethers.wordlists, name, lang);\n }\n }\n }\n catch (error) { }\n }\n };\n return Wordlist;\n}());\nexports.Wordlist = Wordlist;\n","'use strict'\nmodule.exports = {\n keys: require('./keys'),\n once: require('./once'),\n values: require('./values'),\n count: require('./count'),\n infinite: require('./infinite'),\n empty: require('./empty'),\n error: require('./error')\n}\n","'use strict';\n\nmodule.exports = (string, count = 1, options) => {\n\toptions = {\n\t\tindent: ' ',\n\t\tincludeEmptyLines: false,\n\t\t...options\n\t};\n\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`input\\` to be a \\`string\\`, got \\`${typeof string}\\``\n\t\t);\n\t}\n\n\tif (typeof count !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`count\\` to be a \\`number\\`, got \\`${typeof count}\\``\n\t\t);\n\t}\n\n\tif (typeof options.indent !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`options.indent\\` to be a \\`string\\`, got \\`${typeof options.indent}\\``\n\t\t);\n\t}\n\n\tif (count === 0) {\n\t\treturn string;\n\t}\n\n\tconst regex = options.includeEmptyLines ? /^/gm : /^(?!\\s*$)/gm;\n\n\treturn string.replace(regex, options.indent.repeat(count));\n};\n","'use strict';\nconst isOptionObject = require('is-plain-obj');\n\nconst {hasOwnProperty} = Object.prototype;\nconst {propertyIsEnumerable} = Object;\nconst defineProperty = (obj, name, value) => Object.defineProperty(obj, name, {\n\tvalue,\n\twritable: true,\n\tenumerable: true,\n\tconfigurable: true\n});\n\nconst globalThis = this;\nconst defaultMergeOpts = {\n\tconcatArrays: false,\n\tignoreUndefined: false\n};\n\nconst getEnumerableOwnPropertyKeys = value => {\n\tconst keys = [];\n\n\tfor (const key in value) {\n\t\tif (hasOwnProperty.call(value, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\n\t/* istanbul ignore else */\n\tif (Object.getOwnPropertySymbols) {\n\t\tconst symbols = Object.getOwnPropertySymbols(value);\n\n\t\tfor (const symbol of symbols) {\n\t\t\tif (propertyIsEnumerable.call(value, symbol)) {\n\t\t\t\tkeys.push(symbol);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn keys;\n};\n\nfunction clone(value) {\n\tif (Array.isArray(value)) {\n\t\treturn cloneArray(value);\n\t}\n\n\tif (isOptionObject(value)) {\n\t\treturn cloneOptionObject(value);\n\t}\n\n\treturn value;\n}\n\nfunction cloneArray(array) {\n\tconst result = array.slice(0, 0);\n\n\tgetEnumerableOwnPropertyKeys(array).forEach(key => {\n\t\tdefineProperty(result, key, clone(array[key]));\n\t});\n\n\treturn result;\n}\n\nfunction cloneOptionObject(obj) {\n\tconst result = Object.getPrototypeOf(obj) === null ? Object.create(null) : {};\n\n\tgetEnumerableOwnPropertyKeys(obj).forEach(key => {\n\t\tdefineProperty(result, key, clone(obj[key]));\n\t});\n\n\treturn result;\n}\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {string[]} keys keys to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nconst mergeKeys = (merged, source, keys, config) => {\n\tkeys.forEach(key => {\n\t\tif (typeof source[key] === 'undefined' && config.ignoreUndefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Do not recurse into prototype chain of merged\n\t\tif (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {\n\t\t\tdefineProperty(merged, key, merge(merged[key], source[key], config));\n\t\t} else {\n\t\t\tdefineProperty(merged, key, clone(source[key]));\n\t\t}\n\t});\n\n\treturn merged;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n *\n * see [Array.prototype.concat ( ...arguments )](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat)\n */\nconst concatArrays = (merged, source, config) => {\n\tlet result = merged.slice(0, 0);\n\tlet resultIndex = 0;\n\n\t[merged, source].forEach(array => {\n\t\tconst indices = [];\n\n\t\t// `result.concat(array)` with cloning\n\t\tfor (let k = 0; k < array.length; k++) {\n\t\t\tif (!hasOwnProperty.call(array, k)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tindices.push(String(k));\n\n\t\t\tif (array === merged) {\n\t\t\t\t// Already cloned\n\t\t\t\tdefineProperty(result, resultIndex++, array[k]);\n\t\t\t} else {\n\t\t\t\tdefineProperty(result, resultIndex++, clone(array[k]));\n\t\t\t}\n\t\t}\n\n\t\t// Merge non-index keys\n\t\tresult = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(key => !indices.includes(key)), config);\n\t});\n\n\treturn result;\n};\n\n/**\n * @param {*} merged already cloned\n * @param {*} source something to merge\n * @param {Object} config Config Object\n * @returns {*} cloned Object\n */\nfunction merge(merged, source, config) {\n\tif (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {\n\t\treturn concatArrays(merged, source, config);\n\t}\n\n\tif (!isOptionObject(source) || !isOptionObject(merged)) {\n\t\treturn clone(source);\n\t}\n\n\treturn mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);\n}\n\nmodule.exports = function (...options) {\n\tconst config = merge(clone(defaultMergeOpts), (this !== globalThis && this) || {}, defaultMergeOpts);\n\tlet merged = {_: {}};\n\n\tfor (const option of options) {\n\t\tif (option === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!isOptionObject(option)) {\n\t\t\tthrow new TypeError('`' + option + '` is not an Option Object');\n\t\t}\n\n\t\tmerged = merge(merged, {_: option}, config);\n\t}\n\n\treturn merged._;\n};\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\nfunction log(...args) {\n\t// This hackery is required for IE8/9, where\n\t// the `console.log` function doesn't have 'apply'\n\treturn typeof console === 'object' &&\n\t\tconsole.log &&\n\t\tconsole.log(...args);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","'use strict'\n\nconst log = require('debug')('ipfs:mfs:utils:update-tree')\nconst addLink = require('./add-link')\n\nconst defaultOptions = {\n shardSplitThreshold: 1000\n}\n\n// loop backwards through the trail, replacing links of all components to update CIDs\nconst updateTree = async (context, trail, options) => {\n options = Object.assign({}, defaultOptions, options)\n\n log('Trail', trail)\n trail = trail.slice().reverse()\n\n let index = 0\n let child\n\n for await (const node of context.ipld.getMany(trail.map(node => node.cid))) {\n const cid = trail[index].cid\n const name = trail[index].name\n index++\n\n if (!child) {\n child = {\n cid,\n name,\n size: node.size\n }\n\n continue\n }\n\n const result = await addLink(context, {\n parent: node,\n name: child.name,\n cid: child.cid,\n size: child.size,\n flush: options.flush,\n shardSplitThreshold: options.shardSplitThreshold,\n format: options.format,\n hashAlg: options.hashAlg,\n cidVersion: options.cidVersion\n })\n\n // new child for next loop\n child = {\n cid: result.cid,\n name,\n size: result.node.size\n }\n }\n\n log(`Final CID ${child.cid}`)\n\n return child.cid\n}\n\nmodule.exports = updateTree\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = createDebug.debug = createDebug['default'] = createDebug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\nexports.formatters = {};\n\n/**\n * Previous log timestamp.\n */\n\nvar prevTime;\n\n/**\n * Select a color.\n * @param {String} namespace\n * @return {Number}\n * @api private\n */\n\nfunction selectColor(namespace) {\n var hash = 0, i;\n\n for (i in namespace) {\n hash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return exports.colors[Math.abs(hash) % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction createDebug(namespace) {\n\n function debug() {\n // disabled?\n if (!debug.enabled) return;\n\n var self = debug;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // turn the `arguments` into a proper Array\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %O\n args.unshift('%O');\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n // apply env-specific formatting (colors, etc.)\n exports.formatArgs.call(self, args);\n\n var logFn = debug.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = exports.enabled(namespace);\n debug.useColors = exports.useColors();\n debug.color = selectColor(namespace);\n\n // env-specific initialization logic for debug instances\n if ('function' === typeof exports.init) {\n exports.init(debug);\n }\n\n return debug;\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n exports.names = [];\n exports.skips = [];\n\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (var i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n","'use strict'\n\nconst path = require('path')\nconst os = require('os')\nconst uuid = require('uuid/v4')\n\nexports.filter = (iterable, filterer) => {\n return (async function * () {\n for await (const value of iterable) {\n const keep = await filterer(value)\n if (!keep) continue\n yield value\n }\n })()\n}\n\n// Not just sort, because the sorter is given all the values and should return\n// them all sorted\nexports.sortAll = (iterable, sorter) => {\n return (async function * () {\n let values = []\n for await (const value of iterable) values.push(value)\n values = await sorter(values)\n for (const value of values) yield value\n })()\n}\n\nexports.take = (iterable, n) => {\n return (async function * () {\n if (n <= 0) return\n let i = 0\n for await (const value of iterable) {\n yield value\n i++\n if (i >= n) return\n }\n })()\n}\n\nexports.map = (iterable, mapper) => {\n return (async function * () {\n for await (const value of iterable) {\n yield mapper(value)\n }\n })()\n}\n\nexports.replaceStartWith = function (s, r) {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n\nexports.tmpdir = () => {\n return path.join(os.tmpdir(), uuid())\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst lower_bound_1 = require(\"./lower-bound\");\nclass PriorityQueue {\n constructor() {\n Object.defineProperty(this, \"_queue\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: []\n });\n }\n enqueue(run, options) {\n options = Object.assign({ priority: 0 }, options);\n const element = {\n priority: options.priority,\n run\n };\n if (this.size && this._queue[this.size - 1].priority >= options.priority) {\n this._queue.push(element);\n return;\n }\n const index = lower_bound_1.default(this._queue, element, (a, b) => b.priority - a.priority);\n this._queue.splice(index, 0, element);\n }\n dequeue() {\n const item = this._queue.shift();\n return item && item.run;\n }\n get size() {\n return this._queue.length;\n }\n}\nexports.default = PriorityQueue;\n","'use strict';\n\nvar _Object$setPrototypeO;\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar finished = require('./end-of-stream');\n\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\n\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\n\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n\n if (resolve !== null) {\n var data = iter[kStream].read(); // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\n\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\n\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\n\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n\n next: function next() {\n var _this = this;\n\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n\n if (error !== null) {\n return Promise.reject(error);\n }\n\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n } // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n\n\n var lastPromise = this[kLastPromise];\n var promise;\n\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n\n promise = new Promise(this[kHandlePromise]);\n }\n\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\n\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n\n iterator[kError] = err;\n return;\n }\n\n var resolve = iterator[kLastResolve];\n\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\n\nmodule.exports = createReadableStreamAsyncIterator;","var xor = require('buffer-xor')\nvar Buffer = require('safe-buffer').Buffer\nvar incr32 = require('../incr32')\n\nfunction getBlock (self) {\n var out = self._cipher.encryptBlockRaw(self._prev)\n incr32(self._prev)\n return out\n}\n\nvar blockSize = 16\nexports.encrypt = function (self, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize)\n var start = self._cache.length\n self._cache = Buffer.concat([\n self._cache,\n Buffer.allocUnsafe(chunkNum * blockSize)\n ])\n for (var i = 0; i < chunkNum; i++) {\n var out = getBlock(self)\n var offset = start + i * blockSize\n self._cache.writeUInt32BE(out[0], offset + 0)\n self._cache.writeUInt32BE(out[1], offset + 4)\n self._cache.writeUInt32BE(out[2], offset + 8)\n self._cache.writeUInt32BE(out[3], offset + 12)\n }\n var pad = self._cache.slice(0, chunk.length)\n self._cache = self._cache.slice(chunk.length)\n return xor(chunk, pad)\n}\n","'use strict'\n\nconst promisify = require('promisify-es6')\nconst streamToValueWithTransformer = require('../utils/stream-to-value-with-transformer')\n\nconst multiaddr = require('multiaddr')\nconst PeerId = require('peer-id')\nconst PeerInfo = require('peer-info')\n\nmodule.exports = (send) => {\n return promisify((cid, opts, callback) => {\n if (typeof opts === 'function' && !callback) {\n callback = opts\n opts = {}\n }\n\n // opts is the real callback --\n // 'callback' is being injected by promisify\n if (typeof opts === 'function' && typeof callback === 'function') {\n callback = opts\n opts = {}\n }\n\n const handleResult = (res, callback) => {\n // Inconsistent return values in the browser vs node\n if (!Array.isArray(res)) {\n res = [res]\n }\n\n let responses = []\n res.forEach(result => {\n // 4 = Provider\n if (result.Type !== 4) return\n result.Responses.forEach(response => {\n const peerInfo = new PeerInfo(PeerId.createFromB58String(response.ID))\n\n if (response.Addrs) {\n response.Addrs.forEach((addr) => {\n const ma = multiaddr(addr)\n peerInfo.multiaddrs.add(ma)\n })\n }\n\n responses.push(peerInfo)\n })\n })\n\n callback(null, responses)\n }\n\n send({\n path: 'dht/findprovs',\n args: cid.toString(),\n qs: opts\n }, (err, result) => {\n if (err) {\n return callback(err)\n }\n\n streamToValueWithTransformer(result, handleResult, callback)\n })\n })\n}\n","// originally pulled out of simple-peer\n\nmodule.exports = function getBrowserRTC () {\n if (typeof window === 'undefined') return null\n var wrtc = {\n RTCPeerConnection: window.RTCPeerConnection || window.mozRTCPeerConnection ||\n window.webkitRTCPeerConnection,\n RTCSessionDescription: window.RTCSessionDescription ||\n window.mozRTCSessionDescription || window.webkitRTCSessionDescription,\n RTCIceCandidate: window.RTCIceCandidate || window.mozRTCIceCandidate ||\n window.webkitRTCIceCandidate\n }\n if (!wrtc.RTCPeerConnection) return null\n return wrtc\n}\n","/* @flow */\n'use strict'\n\n/* :: import type {Batch, Query, QueryResult, Callback} from './' */\n\nconst { filter, sortAll, take, map } = require('./utils')\nconst Key = require('./key')\n\n// Errors\nconst Errors = require('./errors')\n\nclass MemoryDatastore {\n /* :: data: {[key: string]: Buffer} */\n\n constructor () {\n this.data = {}\n }\n\n async open () /* : Promise */ {}\n\n async put (key /* : Key */, val /* : Buffer */) /* : Promise */ {\n this.data[key.toString()] = val\n }\n\n async get (key /* : Key */) /* : Promise */ {\n const exists = await this.has(key)\n if (!exists) throw Errors.notFoundError()\n return this.data[key.toString()]\n }\n\n async has (key /* : Key */) /* : Promise */ {\n return this.data[key.toString()] !== undefined\n }\n\n async delete (key /* : Key */) /* : Promise */ {\n delete this.data[key.toString()]\n }\n\n batch () /* : Batch */ {\n let puts = []\n let dels = []\n\n return {\n put (key /* : Key */, value /* : Buffer */) /* : void */ {\n puts.push([key, value])\n },\n delete (key /* : Key */) /* : void */ {\n dels.push(key)\n },\n commit: async () /* : Promise */ => {\n puts.forEach(v => {\n this.data[v[0].toString()] = v[1]\n })\n puts = []\n\n dels.forEach(key => {\n delete this.data[key.toString()]\n })\n dels = []\n }\n }\n }\n\n query (q /* : Query */) /* : Iterator */ {\n let it = Object.entries(this.data)\n\n it = map(it, entry => ({ key: new Key(entry[0]), value: entry[1] }))\n\n if (q.prefix != null) {\n it = filter(it, e => e.key.toString().startsWith(q.prefix))\n }\n\n if (Array.isArray(q.filters)) {\n it = q.filters.reduce((it, f) => filter(it, f), it)\n }\n\n if (Array.isArray(q.orders)) {\n it = q.orders.reduce((it, f) => sortAll(it, f), it)\n }\n\n if (q.offset != null) {\n let i = 0\n it = filter(it, () => i++ >= q.offset)\n }\n\n if (q.limit != null) {\n it = take(it, q.limit)\n }\n\n if (q.keysOnly === true) {\n it = map(it, e => ({ key: e.key }))\n }\n\n return it\n }\n\n async close () /* : Promise */ {}\n}\n\nmodule.exports = MemoryDatastore\n","var AbstractIterator = require('abstract-leveldown').AbstractIterator\nvar inherits = require('inherits')\n\nfunction DeferredIterator (db, options) {\n AbstractIterator.call(this, db)\n\n this._options = options\n this._iterator = null\n this._operations = []\n}\n\ninherits(DeferredIterator, AbstractIterator)\n\nDeferredIterator.prototype.setDb = function (db) {\n var it = this._iterator = db.iterator(this._options)\n this._operations.forEach(function (op) {\n it[op.method].apply(it, op.args)\n })\n}\n\nDeferredIterator.prototype._operation = function (method, args) {\n if (this._iterator) return this._iterator[method].apply(this._iterator, args)\n this._operations.push({ method: method, args: args })\n}\n\n'next end'.split(' ').forEach(function (m) {\n DeferredIterator.prototype['_' + m] = function () {\n this._operation(m, arguments)\n }\n})\n\n// Must defer seek() rather than _seek() because it requires db._serializeKey to be available\nDeferredIterator.prototype.seek = function () {\n this._operation('seek', arguments)\n}\n\nmodule.exports = DeferredIterator\n","'use strict';\n\nfunction createError(msg, code, props) {\n var err = msg instanceof Error ? msg : new Error(msg);\n var key;\n\n if (typeof code === 'object') {\n props = code;\n } else if (code != null) {\n err.code = code;\n }\n\n if (props) {\n for (key in props) {\n err[key] = props[key];\n }\n }\n\n return err;\n}\n\nmodule.exports = createError;\n","'use strict';\n\nconst pFinally = require('p-finally');\n\nclass TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\nconst pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reject) => {\n\tif (typeof milliseconds !== 'number' || milliseconds < 0) {\n\t\tthrow new TypeError('Expected `milliseconds` to be a positive number');\n\t}\n\n\tif (milliseconds === Infinity) {\n\t\tresolve(promise);\n\t\treturn;\n\t}\n\n\tconst timer = setTimeout(() => {\n\t\tif (typeof fallback === 'function') {\n\t\t\ttry {\n\t\t\t\tresolve(fallback());\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`;\n\t\tconst timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);\n\n\t\tif (typeof promise.cancel === 'function') {\n\t\t\tpromise.cancel();\n\t\t}\n\n\t\treject(timeoutError);\n\t}, milliseconds);\n\n\t// TODO: Use native `finally` keyword when targeting Node.js 10\n\tpFinally(\n\t\t// eslint-disable-next-line promise/prefer-await-to-then\n\t\tpromise.then(resolve, reject),\n\t\t() => {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t);\n});\n\nmodule.exports = pTimeout;\n// TODO: Remove this for the next major release\nmodule.exports.default = pTimeout;\n\nmodule.exports.TimeoutError = TimeoutError;\n","/* global IDBKeyRange */\n\n'use strict'\n\nvar inherits = require('inherits')\nvar AbstractIterator = require('abstract-leveldown').AbstractIterator\nvar ltgt = require('ltgt')\nvar mixedToBuffer = require('./util/mixed-to-buffer')\nvar setImmediate = require('./util/immediate')\nvar noop = function () {}\n\nmodule.exports = Iterator\n\nfunction Iterator (db, location, options) {\n AbstractIterator.call(this, db)\n\n this._limit = options.limit\n this._count = 0\n this._callback = null\n this._cache = []\n this._completed = false\n this._aborted = false\n this._error = null\n this._transaction = null\n\n this._keyAsBuffer = options.keyAsBuffer\n this._valueAsBuffer = options.valueAsBuffer\n\n if (this._limit === 0) {\n this._completed = true\n return\n }\n\n try {\n var keyRange = this.createKeyRange(options)\n } catch (e) {\n // The lower key is greater than the upper key.\n // IndexedDB throws an error, but we'll just return 0 results.\n this._completed = true\n return\n }\n\n this.createIterator(location, keyRange, options.reverse)\n}\n\ninherits(Iterator, AbstractIterator)\n\nIterator.prototype.createKeyRange = function (options) {\n var lower = ltgt.lowerBound(options)\n var upper = ltgt.upperBound(options)\n var lowerOpen = ltgt.lowerBoundExclusive(options)\n var upperOpen = ltgt.upperBoundExclusive(options)\n\n if (lower !== undefined && upper !== undefined) {\n return IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen)\n } else if (lower !== undefined) {\n return IDBKeyRange.lowerBound(lower, lowerOpen)\n } else if (upper !== undefined) {\n return IDBKeyRange.upperBound(upper, upperOpen)\n } else {\n return null\n }\n}\n\nIterator.prototype.createIterator = function (location, keyRange, reverse) {\n var self = this\n var transaction = this.db.db.transaction([location], 'readonly')\n var store = transaction.objectStore(location)\n var req = store.openCursor(keyRange, reverse ? 'prev' : 'next')\n\n req.onsuccess = function (ev) {\n var cursor = ev.target.result\n if (cursor) self.onItem(cursor)\n }\n\n this._transaction = transaction\n\n // If an error occurs (on the request), the transaction will abort.\n transaction.onabort = function () {\n self.onAbort(self._transaction.error || new Error('aborted by user'))\n }\n\n transaction.oncomplete = function () {\n self.onComplete()\n }\n}\n\nIterator.prototype.onItem = function (cursor) {\n this._cache.push(cursor.key, cursor.value)\n\n if (this._limit <= 0 || ++this._count < this._limit) {\n cursor['continue']()\n }\n\n this.maybeNext()\n}\n\nIterator.prototype.onAbort = function (err) {\n this._aborted = true\n this._error = err\n this.maybeNext()\n}\n\nIterator.prototype.onComplete = function () {\n this._completed = true\n this.maybeNext()\n}\n\nIterator.prototype.maybeNext = function () {\n if (this._callback) {\n this._next(this._callback)\n this._callback = null\n }\n}\n\nIterator.prototype._next = function (callback) {\n if (this._aborted) {\n // The error should be picked up by either next() or end().\n var err = this._error\n this._error = null\n\n setImmediate(function () {\n callback(err)\n })\n } else if (this._cache.length > 0) {\n var key = this._cache.shift()\n var value = this._cache.shift()\n\n if (this._keyAsBuffer) key = mixedToBuffer(key)\n if (this._valueAsBuffer) value = mixedToBuffer(value)\n\n setImmediate(function () {\n callback(null, key, value)\n })\n } else if (this._completed) {\n setImmediate(callback)\n } else {\n this._callback = callback\n }\n}\n\nIterator.prototype._end = function (callback) {\n if (this._aborted || this._completed) {\n var err = this._error\n\n setImmediate(function () {\n callback(err)\n })\n\n return\n }\n\n // Don't advance the cursor anymore, and the transaction will complete\n // on its own in the next tick. This approach is much cleaner than calling\n // transaction.abort() with its unpredictable event order.\n this.onItem = noop\n this.onAbort = callback\n this.onComplete = callback\n}\n","'use strict'\n\nconst { Buffer } = require('buffer')\n\nconst crypto = self.crypto || self.msCrypto\n\nmodule.exports = (algorithm) => {\n if (typeof self === 'undefined' || (!self.crypto && !self.msCrypto)) {\n throw new Error(\n 'Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context'\n )\n }\n\n return async (data) => {\n switch (algorithm) {\n case 'sha1':\n return Buffer.from(await crypto.subtle.digest({ name: 'SHA-1' }, data))\n case 'sha2-256':\n return Buffer.from(await crypto.subtle.digest({ name: 'SHA-256' }, data))\n case 'sha2-512':\n return Buffer.from(await crypto.subtle.digest({ name: 'SHA-512' }, data))\n case 'dbl-sha2-256': {\n const d = await crypto.subtle.digest({ name: 'SHA-256' }, data)\n return Buffer.from(await crypto.subtle.digest({ name: 'SHA-256' }, d))\n }\n default:\n throw new Error(`${algorithm} is not a supported algorithm`)\n }\n }\n}\n","'use strict'\n\nconst Store = require('orbit-db-store')\nconst KeyValueIndex = require('./KeyValueIndex')\n\nclass KeyValueStore extends Store {\n constructor(ipfs, id, dbname, options) {\n let opts = Object.assign({}, { Index: KeyValueIndex })\n Object.assign(opts, options)\n super(ipfs, id, dbname, opts)\n this._type = 'keyvalue'\n }\n\n get all () {\n return this._index._index\n }\n\n get (key) {\n return this._index.get(key)\n }\n\n set (key, data, options = {}) {\n return this.put(key, data, options)\n }\n\n put (key, data, options = {}) {\n return this._addOperation({\n op: 'PUT',\n key: key,\n value: data\n }, options)\n }\n\n del (key, options = {}) {\n return this._addOperation({\n op: 'DEL',\n key: key,\n value: null\n }, options)\n }\n}\n\nmodule.exports = KeyValueStore\n","/**\n * Object IDs for ASN.1.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\n\nforge.pki = forge.pki || {};\nvar oids = module.exports = forge.pki.oids = forge.oids = forge.oids || {};\n\n// set id to name mapping and name to id mapping\nfunction _IN(id, name) {\n oids[id] = name;\n oids[name] = id;\n}\n// set id to name mapping only\nfunction _I_(id, name) {\n oids[id] = name;\n}\n\n// algorithm OIDs\n_IN('1.2.840.113549.1.1.1', 'rsaEncryption');\n// Note: md2 & md4 not implemented\n//_IN('1.2.840.113549.1.1.2', 'md2WithRSAEncryption');\n//_IN('1.2.840.113549.1.1.3', 'md4WithRSAEncryption');\n_IN('1.2.840.113549.1.1.4', 'md5WithRSAEncryption');\n_IN('1.2.840.113549.1.1.5', 'sha1WithRSAEncryption');\n_IN('1.2.840.113549.1.1.7', 'RSAES-OAEP');\n_IN('1.2.840.113549.1.1.8', 'mgf1');\n_IN('1.2.840.113549.1.1.9', 'pSpecified');\n_IN('1.2.840.113549.1.1.10', 'RSASSA-PSS');\n_IN('1.2.840.113549.1.1.11', 'sha256WithRSAEncryption');\n_IN('1.2.840.113549.1.1.12', 'sha384WithRSAEncryption');\n_IN('1.2.840.113549.1.1.13', 'sha512WithRSAEncryption');\n// Edwards-curve Digital Signature Algorithm (EdDSA) Ed25519\n_IN('1.3.101.112', 'EdDSA25519');\n\n_IN('1.2.840.10040.4.3', 'dsa-with-sha1');\n\n_IN('1.3.14.3.2.7', 'desCBC');\n\n_IN('1.3.14.3.2.26', 'sha1');\n_IN('2.16.840.1.101.3.4.2.1', 'sha256');\n_IN('2.16.840.1.101.3.4.2.2', 'sha384');\n_IN('2.16.840.1.101.3.4.2.3', 'sha512');\n_IN('1.2.840.113549.2.5', 'md5');\n\n// pkcs#7 content types\n_IN('1.2.840.113549.1.7.1', 'data');\n_IN('1.2.840.113549.1.7.2', 'signedData');\n_IN('1.2.840.113549.1.7.3', 'envelopedData');\n_IN('1.2.840.113549.1.7.4', 'signedAndEnvelopedData');\n_IN('1.2.840.113549.1.7.5', 'digestedData');\n_IN('1.2.840.113549.1.7.6', 'encryptedData');\n\n// pkcs#9 oids\n_IN('1.2.840.113549.1.9.1', 'emailAddress');\n_IN('1.2.840.113549.1.9.2', 'unstructuredName');\n_IN('1.2.840.113549.1.9.3', 'contentType');\n_IN('1.2.840.113549.1.9.4', 'messageDigest');\n_IN('1.2.840.113549.1.9.5', 'signingTime');\n_IN('1.2.840.113549.1.9.6', 'counterSignature');\n_IN('1.2.840.113549.1.9.7', 'challengePassword');\n_IN('1.2.840.113549.1.9.8', 'unstructuredAddress');\n_IN('1.2.840.113549.1.9.14', 'extensionRequest');\n\n_IN('1.2.840.113549.1.9.20', 'friendlyName');\n_IN('1.2.840.113549.1.9.21', 'localKeyId');\n_IN('1.2.840.113549.1.9.22.1', 'x509Certificate');\n\n// pkcs#12 safe bags\n_IN('1.2.840.113549.1.12.10.1.1', 'keyBag');\n_IN('1.2.840.113549.1.12.10.1.2', 'pkcs8ShroudedKeyBag');\n_IN('1.2.840.113549.1.12.10.1.3', 'certBag');\n_IN('1.2.840.113549.1.12.10.1.4', 'crlBag');\n_IN('1.2.840.113549.1.12.10.1.5', 'secretBag');\n_IN('1.2.840.113549.1.12.10.1.6', 'safeContentsBag');\n\n// password-based-encryption for pkcs#12\n_IN('1.2.840.113549.1.5.13', 'pkcs5PBES2');\n_IN('1.2.840.113549.1.5.12', 'pkcs5PBKDF2');\n\n_IN('1.2.840.113549.1.12.1.1', 'pbeWithSHAAnd128BitRC4');\n_IN('1.2.840.113549.1.12.1.2', 'pbeWithSHAAnd40BitRC4');\n_IN('1.2.840.113549.1.12.1.3', 'pbeWithSHAAnd3-KeyTripleDES-CBC');\n_IN('1.2.840.113549.1.12.1.4', 'pbeWithSHAAnd2-KeyTripleDES-CBC');\n_IN('1.2.840.113549.1.12.1.5', 'pbeWithSHAAnd128BitRC2-CBC');\n_IN('1.2.840.113549.1.12.1.6', 'pbewithSHAAnd40BitRC2-CBC');\n\n// hmac OIDs\n_IN('1.2.840.113549.2.7', 'hmacWithSHA1');\n_IN('1.2.840.113549.2.8', 'hmacWithSHA224');\n_IN('1.2.840.113549.2.9', 'hmacWithSHA256');\n_IN('1.2.840.113549.2.10', 'hmacWithSHA384');\n_IN('1.2.840.113549.2.11', 'hmacWithSHA512');\n\n// symmetric key algorithm oids\n_IN('1.2.840.113549.3.7', 'des-EDE3-CBC');\n_IN('2.16.840.1.101.3.4.1.2', 'aes128-CBC');\n_IN('2.16.840.1.101.3.4.1.22', 'aes192-CBC');\n_IN('2.16.840.1.101.3.4.1.42', 'aes256-CBC');\n\n// certificate issuer/subject OIDs\n_IN('2.5.4.3', 'commonName');\n_IN('2.5.4.5', 'serialName');\n_IN('2.5.4.6', 'countryName');\n_IN('2.5.4.7', 'localityName');\n_IN('2.5.4.8', 'stateOrProvinceName');\n_IN('2.5.4.9', 'streetAddress');\n_IN('2.5.4.10', 'organizationName');\n_IN('2.5.4.11', 'organizationalUnitName');\n_IN('2.5.4.13', 'description');\n_IN('2.5.4.15', 'businessCategory');\n_IN('2.5.4.17', 'postalCode');\n_IN('1.3.6.1.4.1.311.60.2.1.2', 'jurisdictionOfIncorporationStateOrProvinceName');\n_IN('1.3.6.1.4.1.311.60.2.1.3', 'jurisdictionOfIncorporationCountryName');\n\n// X.509 extension OIDs\n_IN('2.16.840.1.113730.1.1', 'nsCertType');\n_IN('2.16.840.1.113730.1.13', 'nsComment'); // deprecated in theory; still widely used\n_I_('2.5.29.1', 'authorityKeyIdentifier'); // deprecated, use .35\n_I_('2.5.29.2', 'keyAttributes'); // obsolete use .37 or .15\n_I_('2.5.29.3', 'certificatePolicies'); // deprecated, use .32\n_I_('2.5.29.4', 'keyUsageRestriction'); // obsolete use .37 or .15\n_I_('2.5.29.5', 'policyMapping'); // deprecated use .33\n_I_('2.5.29.6', 'subtreesConstraint'); // obsolete use .30\n_I_('2.5.29.7', 'subjectAltName'); // deprecated use .17\n_I_('2.5.29.8', 'issuerAltName'); // deprecated use .18\n_I_('2.5.29.9', 'subjectDirectoryAttributes');\n_I_('2.5.29.10', 'basicConstraints'); // deprecated use .19\n_I_('2.5.29.11', 'nameConstraints'); // deprecated use .30\n_I_('2.5.29.12', 'policyConstraints'); // deprecated use .36\n_I_('2.5.29.13', 'basicConstraints'); // deprecated use .19\n_IN('2.5.29.14', 'subjectKeyIdentifier');\n_IN('2.5.29.15', 'keyUsage');\n_I_('2.5.29.16', 'privateKeyUsagePeriod');\n_IN('2.5.29.17', 'subjectAltName');\n_IN('2.5.29.18', 'issuerAltName');\n_IN('2.5.29.19', 'basicConstraints');\n_I_('2.5.29.20', 'cRLNumber');\n_I_('2.5.29.21', 'cRLReason');\n_I_('2.5.29.22', 'expirationDate');\n_I_('2.5.29.23', 'instructionCode');\n_I_('2.5.29.24', 'invalidityDate');\n_I_('2.5.29.25', 'cRLDistributionPoints'); // deprecated use .31\n_I_('2.5.29.26', 'issuingDistributionPoint'); // deprecated use .28\n_I_('2.5.29.27', 'deltaCRLIndicator');\n_I_('2.5.29.28', 'issuingDistributionPoint');\n_I_('2.5.29.29', 'certificateIssuer');\n_I_('2.5.29.30', 'nameConstraints');\n_IN('2.5.29.31', 'cRLDistributionPoints');\n_IN('2.5.29.32', 'certificatePolicies');\n_I_('2.5.29.33', 'policyMappings');\n_I_('2.5.29.34', 'policyConstraints'); // deprecated use .36\n_IN('2.5.29.35', 'authorityKeyIdentifier');\n_I_('2.5.29.36', 'policyConstraints');\n_IN('2.5.29.37', 'extKeyUsage');\n_I_('2.5.29.46', 'freshestCRL');\n_I_('2.5.29.54', 'inhibitAnyPolicy');\n\n// extKeyUsage purposes\n_IN('1.3.6.1.4.1.11129.2.4.2', 'timestampList');\n_IN('1.3.6.1.5.5.7.1.1', 'authorityInfoAccess');\n_IN('1.3.6.1.5.5.7.3.1', 'serverAuth');\n_IN('1.3.6.1.5.5.7.3.2', 'clientAuth');\n_IN('1.3.6.1.5.5.7.3.3', 'codeSigning');\n_IN('1.3.6.1.5.5.7.3.4', 'emailProtection');\n_IN('1.3.6.1.5.5.7.3.8', 'timeStamping');\n","'use strict'\n\nconst toMfsPath = require('./to-mfs-path')\n\nasync function toSources (context, args) {\n // Support weird mfs.mv([source, dest], options, callback) signature\n if (Array.isArray(args[0])) {\n args = args[0]\n }\n\n const sources = args\n .filter(arg => typeof arg === 'string')\n .map(source => source.trim())\n\n return {\n sources: await toMfsPath(context, sources)\n }\n}\n\nmodule.exports = toSources\n","'use strict'\n\nconst Qs = require('qs')\nconst qsDefaultEncoder = require('qs/lib/utils').encode\nconst isNode = require('detect-node')\nconst ndjson = require('ndjson')\nconst pump = require('pump')\nconst once = require('once')\nconst { getRequest } = require('iso-stream-http')\nconst streamToValue = require('./stream-to-value')\nconst streamToJsonValue = require('./stream-to-json-value')\nconst log = require('debug')('ipfs-http-client:request')\n\n// -- Internal\n\nfunction hasJSONHeaders (res) {\n return res.headers['content-type'] &&\n res.headers['content-type'].indexOf('application/json') === 0\n}\n\nfunction parseError (res, cb) {\n const error = new Error(`Server responded with ${res.statusCode}`)\n error.statusCode = res.statusCode\n\n if (!hasJSONHeaders(res)) {\n return streamToValue(res, (err, data) => { // eslint-disable-line handle-callback-err\n // the `err` here refers to errors in stream processing, which\n // we ignore here, since we already have a valid `error` response\n // from the server above that we have to report to the caller.\n if (data && data.length) {\n error.message = data.toString()\n }\n cb(error)\n })\n }\n\n streamToJsonValue(res, (err, payload) => {\n if (err) {\n return cb(err)\n }\n\n if (payload) {\n error.code = payload.Code\n error.message = payload.Message || payload.toString()\n error.type = payload.Type\n }\n cb(error)\n })\n}\n\nfunction onRes (buffer, cb) {\n return (res) => {\n const stream = Boolean(res.headers['x-stream-output'])\n const chunkedObjects = Boolean(res.headers['x-chunked-output'])\n const isJson = hasJSONHeaders(res)\n\n if (res.req) {\n log(res.req.method, `${res.req.getHeaders().host}${res.req.path}`, res.statusCode, res.statusMessage)\n } else {\n log(res.url, res.statusCode, res.statusMessage)\n }\n\n if (res.statusCode >= 400 || !res.statusCode) {\n return parseError(res, cb)\n }\n\n // Return the response stream directly\n if (stream && !buffer) {\n return cb(null, res)\n }\n\n // Return a stream of JSON objects\n if (chunkedObjects && isJson) {\n const outputStream = ndjson.parse()\n pump(res, outputStream)\n res.on('end', () => {\n let err = res.trailers['x-stream-error']\n if (err) {\n // Not all errors are JSON\n try {\n err = JSON.parse(err)\n } catch (e) {\n err = { Message: err }\n }\n outputStream.emit('error', new Error(err.Message))\n }\n })\n return cb(null, outputStream)\n }\n\n // Return a JSON object\n if (isJson) {\n return streamToJsonValue(res, cb)\n }\n\n // Return a value\n return streamToValue(res, cb)\n }\n}\n\nfunction requestAPI (config, options, callback) {\n callback = once(callback)\n options.qs = options.qs || {}\n\n if (Array.isArray(options.path)) {\n options.path = options.path.join('/')\n }\n if (options.args && !Array.isArray(options.args)) {\n options.args = [options.args]\n }\n if (options.args) {\n options.qs.arg = options.args\n }\n if (options.progress) {\n options.qs.progress = true\n }\n\n if (options.qs.r) {\n options.qs.recursive = options.qs.r\n // From IPFS 0.4.0, it throws an error when both r and recursive are passed\n delete options.qs.r\n }\n\n options.qs['stream-channels'] = true\n\n if (options.stream) {\n options.buffer = false\n }\n\n // this option is only used internally, not passed to daemon\n delete options.qs.followSymlinks\n\n const method = 'POST'\n const headers = Object.assign({}, config.headers)\n\n if (isNode) {\n // Browsers do not allow you to modify the user agent\n headers['User-Agent'] = config['user-agent']\n }\n\n if (options.multipart) {\n if (!options.multipartBoundary) {\n return callback(new Error('No multipartBoundary'))\n }\n\n headers['Content-Type'] = `multipart/form-data; boundary=${options.multipartBoundary}`\n }\n\n const qs = Qs.stringify(options.qs, {\n arrayFormat: 'repeat',\n encoder: data => {\n // TODO: future releases of qs will provide the default\n // encoder as a 2nd argument to this function; it will\n // no longer be necessary to import qsDefaultEncoder\n if (Buffer.isBuffer(data)) {\n let uriEncoded = ''\n for (const byte of data) {\n // https://tools.ietf.org/html/rfc3986#page-14\n // ALPHA (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E)\n if (\n (byte >= 0x41 && byte <= 0x5A) ||\n (byte >= 0x61 && byte <= 0x7A) ||\n (byte >= 0x30 && byte <= 0x39) ||\n (byte === 0x2D) ||\n (byte === 0x2E) ||\n (byte === 0x5F) ||\n (byte === 0x7E)\n ) {\n uriEncoded += String.fromCharCode(byte)\n } else {\n const hex = byte.toString(16)\n // String.prototype.padStart() not widely supported yet\n const padded = hex.length === 1 ? `0${hex}` : hex\n uriEncoded += `%${padded}`\n }\n }\n return uriEncoded\n }\n return qsDefaultEncoder(data)\n }\n })\n const reqOptions = {\n hostname: config.host,\n path: `${config['api-path']}${options.path}?${qs}`,\n port: config.port,\n method: method,\n headers: headers,\n protocol: `${config.protocol}:`\n }\n\n const req = getRequest(reqOptions, onRes(options.buffer, callback))\n\n req.on('error', (err) => {\n callback(err)\n })\n\n if (!options.stream) {\n req.end()\n }\n\n return req\n}\n\n//\n// -- Module Interface\n\nexports = module.exports = (config) => {\n /*\n * options: {\n * path: // API path (like /add or /config) - type: string\n * args: // Arguments to the command - type: object\n * qs: // Opts as query string opts to the command --something - type: object\n * files: // files to be sent - type: string, buffer or array of strings or buffers\n * buffer: // buffer the request before sending it - type: bool\n * }\n */\n const send = (options, callback) => {\n if (typeof options !== 'object') {\n return callback(new Error('no options were passed'))\n }\n\n return requestAPI(config, options, callback)\n }\n\n // Send a HTTP request and pass via a transform function\n // to convert the response data to wanted format before\n // returning it to the callback.\n // Eg. send.andTransform({}, (e) => JSON.parse(e), (err, res) => ...)\n send.andTransform = (options, transform, callback) => {\n return send(options, (err, res) => {\n if (err) {\n return callback(err)\n }\n transform(res, callback)\n })\n }\n\n return send\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar $filter = require('../internals/array-iteration').filter;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar arrayMethodUsesToLength = require('../internals/array-method-uses-to-length');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');\n// Edge 14- issue\nvar USES_TO_LENGTH = arrayMethodUsesToLength('filter');\n\n// `Array.prototype.filter` method\n// https://tc39.github.io/ecma262/#sec-array.prototype.filter\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict'\n\nconst callbackify = require('callbackify')\nconst OFFLINE_ERROR = require('../utils').OFFLINE_ERROR\nconst errcode = require('err-code')\n\nmodule.exports = function pubsub (self) {\n function checkOnlineAndEnabled () {\n if (!self.isOnline()) {\n throw errcode(new Error(OFFLINE_ERROR), 'ERR_OFFLINE')\n }\n\n if (!self.libp2p.pubsub) {\n throw errcode(new Error('pubsub is not enabled'), 'ERR_PUBSUB_DISABLED')\n }\n }\n\n return {\n subscribe: (topic, handler, options, callback) => {\n if (typeof options === 'function') {\n callback = options\n options = {}\n }\n\n if (typeof callback === 'function') {\n try {\n checkOnlineAndEnabled()\n } catch (err) {\n return callback(err)\n }\n\n self.libp2p.pubsub.subscribe(topic, handler, options, callback)\n return\n }\n\n try {\n checkOnlineAndEnabled()\n } catch (err) {\n return Promise.reject(err)\n }\n\n return self.libp2p.pubsub.subscribe(topic, handler, options)\n },\n\n unsubscribe: (topic, handler, callback) => {\n if (typeof callback === 'function') {\n try {\n checkOnlineAndEnabled()\n } catch (err) {\n return callback(err)\n }\n\n self.libp2p.pubsub.unsubscribe(topic, handler, callback)\n return\n }\n\n try {\n checkOnlineAndEnabled()\n } catch (err) {\n return Promise.reject(err)\n }\n\n return self.libp2p.pubsub.unsubscribe(topic, handler)\n },\n\n publish: callbackify(async (topic, data) => { // eslint-disable-line require-await\n checkOnlineAndEnabled()\n\n await self.libp2p.pubsub.publish(topic, data)\n }),\n\n ls: callbackify(async () => { // eslint-disable-line require-await\n checkOnlineAndEnabled()\n\n return self.libp2p.pubsub.ls()\n }),\n\n peers: callbackify(async (topic) => { // eslint-disable-line require-await\n checkOnlineAndEnabled()\n\n return self.libp2p.pubsub.peers(topic)\n }),\n\n setMaxListeners (n) {\n checkOnlineAndEnabled()\n\n self.libp2p.pubsub.setMaxListeners(n)\n }\n }\n}\n","'use strict';\nvar bind = require('../internals/function-bind-context');\nvar toObject = require('../internals/to-object');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar toLength = require('../internals/to-length');\nvar createProperty = require('../internals/create-property');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\n// `Array.from` method implementation\n// https://tc39.github.io/ecma262/#sec-array.from\nmodule.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = iteratorMethod.call(O);\n next = iterator.next;\n result = new C();\n for (;!(step = next.call(iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = toLength(O.length);\n result = new C(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n};\n","import mod from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Prizes.vue?vue&type=style&index=0&id=662da522&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Prizes.vue?vue&type=style&index=0&id=662da522&lang=scss&scoped=true&\"","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;","'use strict';\n\nvar utils = require('../utils');\n\nvar SHA512 = require('./512');\n\nfunction SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384();\n\n SHA512.call(this);\n this.h = [\n 0xcbbb9d5d, 0xc1059ed8,\n 0x629a292a, 0x367cd507,\n 0x9159015a, 0x3070dd17,\n 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31,\n 0x8eb44a87, 0x68581511,\n 0xdb0c2e0d, 0x64f98fa7,\n 0x47b5481d, 0xbefa4fa4 ];\n}\nutils.inherits(SHA384, SHA512);\nmodule.exports = SHA384;\n\nSHA384.blockSize = 1024;\nSHA384.outSize = 384;\nSHA384.hmacStrength = 192;\nSHA384.padLength = 128;\n\nSHA384.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 12), 'big');\n else\n return utils.split32(this.h.slice(0, 12), 'big');\n};\n","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","'use strict'\n\nconst second = exports.second = 1000\nconst minute = exports.minute = 60 * second\n\n// Protocol identifiers\nexports.FloodSubID = '/floodsub/1.0.0'\nexports.GossipSubID = '/meshsub/1.0.0'\n\n// Overlay parameters\nexports.GossipSubD = 6\nexports.GossipSubDlo = 4\nexports.GossipSubDhi = 12\n\n// Gossip parameters\nexports.GossipSubHistoryLength = 5\nexports.GossipSubHistoryGossip = 3\n\n// Heartbeat interval\nexports.GossipSubHeartbeatInitialDelay = 100 / second\nexports.GossipSubHeartbeatInterval = second\n\n// Fanout ttl\nexports.GossipSubFanoutTTL = minute\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nexports.default = function (fn) {\n return function () /*...args, callback*/{\n var args = (0, _slice2.default)(arguments);\n var callback = args.pop();\n fn.call(this, args, callback);\n };\n};\n\nvar _slice = require('./slice');\n\nvar _slice2 = _interopRequireDefault(_slice);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = exports['default'];","var Buffer = require('safe-buffer').Buffer\nvar MD5 = require('md5.js')\n\n/* eslint-disable camelcase */\nfunction EVP_BytesToKey (password, salt, keyBits, ivLen) {\n if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')\n if (salt) {\n if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')\n if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')\n }\n\n var keyLen = keyBits / 8\n var key = Buffer.alloc(keyLen)\n var iv = Buffer.alloc(ivLen || 0)\n var tmp = Buffer.alloc(0)\n\n while (keyLen > 0 || ivLen > 0) {\n var hash = new MD5()\n hash.update(tmp)\n hash.update(password)\n if (salt) hash.update(salt)\n tmp = hash.digest()\n\n var used = 0\n\n if (keyLen > 0) {\n var keyStart = key.length - keyLen\n used = Math.min(keyLen, tmp.length)\n tmp.copy(key, keyStart, 0, used)\n keyLen -= used\n }\n\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen\n var length = Math.min(ivLen, tmp.length - used)\n tmp.copy(iv, ivStart, used, used + length)\n ivLen -= length\n }\n }\n\n tmp.fill(0)\n return { key: key, iv: iv }\n}\n\nmodule.exports = EVP_BytesToKey\n","'use strict'\n\nconst { Buffer } = require('buffer')\nconst sha3 = require('js-sha3')\nconst mur = require('murmurhash3js-revisited')\nconst sha = require('./sha')\nconst { fromNumberTo32BitBuf } = require('./utils')\n\n// Note that although this function doesn't do any asynchronous work, we mark\n// the function as async because it must return a Promise to match the API\n// for other functions that do perform asynchronous work (see sha.browser.js)\nconst hash = (algorithm) => async (data) => {\n switch (algorithm) {\n case 'sha3-224':\n return Buffer.from(sha3.sha3_224.arrayBuffer(data))\n case 'sha3-256':\n return Buffer.from(sha3.sha3_256.arrayBuffer(data))\n case 'sha3-384':\n return Buffer.from(sha3.sha3_384.arrayBuffer(data))\n case 'sha3-512':\n return Buffer.from(sha3.sha3_512.arrayBuffer(data))\n case 'shake-128':\n return Buffer.from(sha3.shake128.create(128).update(data).arrayBuffer())\n case 'shake-256':\n return Buffer.from(sha3.shake256.create(256).update(data).arrayBuffer())\n case 'keccak-224':\n return Buffer.from(sha3.keccak224.arrayBuffer(data))\n case 'keccak-256':\n return Buffer.from(sha3.keccak256.arrayBuffer(data))\n case 'keccak-384':\n return Buffer.from(sha3.keccak384.arrayBuffer(data))\n case 'keccak-512':\n return Buffer.from(sha3.keccak512.arrayBuffer(data))\n case 'murmur3-128':\n return Buffer.from(mur.x64.hash128(data), 'hex')\n case 'murmur3-32':\n return fromNumberTo32BitBuf(mur.x86.hash32(data))\n\n default:\n throw new TypeError(`${algorithm} is not a supported algorithm`)\n }\n}\n\nmodule.exports = {\n sha1: sha('sha1'),\n sha2256: sha('sha2-256'),\n sha2512: sha('sha2-512'),\n dblSha2256: sha('dbl-sha2-256'),\n sha3224: hash('sha3-224'),\n sha3256: hash('sha3-256'),\n sha3384: hash('sha3-384'),\n sha3512: hash('sha3-512'),\n shake128: hash('shake-128'),\n shake256: hash('shake-256'),\n keccak224: hash('keccak-224'),\n keccak256: hash('keccak-256'),\n keccak384: hash('keccak-384'),\n keccak512: hash('keccak-512'),\n murmur3128: hash('murmur3-128'),\n murmur332: hash('murmur3-32'),\n addBlake: require('./blake')\n}\n","/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',\n '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',\n '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',\n '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',\n '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',\n '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',\n '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',\n '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',\n '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',\n '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',\n '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {\n return true;\n }\n\n // Internet Explorer and Edge do not support colors.\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n\n // is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n // double check webkit in userAgent just in case we are in a worker\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (err) {\n return '[UnexpectedJSONParseError]: ' + err.message;\n }\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return;\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit')\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n try {\n return window.localStorage;\n } catch (e) {}\n}\n","module.exports = Node\n\n/**\n * a linked-list node\n * @class\n * @param {any} value - node's value\n * @param {Node} next - next node\n */\nfunction Node (value, next) {\n this.value = value\n this.next = next\n}\n\n/**\n * checks if this node or any of its children has the value\n * @param {any} value - value to check if linked-list contains\n * @return {boolean} true if the list contains the value; false if not\n */\nNode.prototype.contains = function (value) {\n var cursor = this\n\n while (cursor) {\n if (cursor.value === value) return true\n cursor = cursor.next\n }\n\n return false\n}\n","'use strict'\n\nconst pull = require('pull-stream/pull')\nconst Connection = require('interface-connection').Connection\nconst assert = require('assert')\nconst PeerInfo = require('peer-info')\nconst debug = require('debug')\nconst once = require('once')\nconst log = debug('libp2p:secio')\nlog.error = debug('libp2p:secio:error')\n\nconst handshake = require('./handshake')\nconst State = require('./state')\n\nmodule.exports = {\n tag: '/secio/1.0.0',\n encrypt (localId, conn, remoteId, callback) {\n assert(localId, 'no local private key provided')\n assert(conn, 'no connection for the handshake provided')\n\n if (typeof remoteId === 'function') {\n callback = remoteId\n remoteId = undefined\n }\n\n callback = once(callback || function (err) {\n if (err) { log.error(err) }\n })\n\n const timeout = 60 * 1000 * 5\n\n const state = new State(localId, remoteId, timeout, callback)\n\n function finish (err) {\n if (err) { return callback(err) }\n\n conn.getPeerInfo((err, peerInfo) => {\n encryptedConnection.setInnerConn(new Connection(state.secure, conn))\n\n if (err) { // no peerInfo yet, means I'm the receiver\n encryptedConnection.setPeerInfo(new PeerInfo(state.id.remote))\n }\n\n callback()\n })\n }\n\n const encryptedConnection = new Connection(undefined, conn)\n\n pull(\n conn,\n handshake(state, finish),\n conn\n )\n\n return encryptedConnection\n }\n}\n","'use strict'\n\nconst Base = require('./base.js')\nconst baseX = require('base-x')\nconst base16 = require('./base16')\nconst base32 = require('./base32')\nconst base64 = require('./base64')\n\n// name, code, implementation, alphabet\nconst constants = [\n ['base1', '1', '', '1'],\n ['base2', '0', baseX, '01'],\n ['base8', '7', baseX, '01234567'],\n ['base10', '9', baseX, '0123456789'],\n ['base16', 'f', base16, '0123456789abcdef'],\n ['base32', 'b', base32, 'abcdefghijklmnopqrstuvwxyz234567'],\n ['base32pad', 'c', base32, 'abcdefghijklmnopqrstuvwxyz234567='],\n ['base32hex', 'v', base32, '0123456789abcdefghijklmnopqrstuv'],\n ['base32hexpad', 't', base32, '0123456789abcdefghijklmnopqrstuv='],\n ['base32z', 'h', base32, 'ybndrfg8ejkmcpqxot1uwisza345h769'],\n ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'],\n ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'],\n ['base64', 'm', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'],\n ['base64pad', 'M', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='],\n ['base64url', 'u', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'],\n ['base64urlpad', 'U', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=']\n]\n\nconst names = constants.reduce((prev, tupple) => {\n prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3])\n return prev\n}, {})\n\nconst codes = constants.reduce((prev, tupple) => {\n prev[tupple[1]] = names[tupple[0]]\n return prev\n}, {})\n\nmodule.exports = {\n names: names,\n codes: codes\n}\n","var prr = require('prr')\n\nfunction init (type, message, cause) {\n if (!!message && typeof message != 'string') {\n message = message.message || message.name\n }\n prr(this, {\n type : type\n , name : type\n // can be passed just a 'cause'\n , cause : typeof message != 'string' ? message : cause\n , message : message\n }, 'ewr')\n}\n\n// generic prototype, not intended to be actually used - helpful for `instanceof`\nfunction CustomError (message, cause) {\n Error.call(this)\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, this.constructor)\n init.call(this, 'CustomError', message, cause)\n}\n\nCustomError.prototype = new Error()\n\nfunction createError (errno, type, proto) {\n var err = function (message, cause) {\n init.call(this, type, message, cause)\n //TODO: the specificity here is stupid, errno should be available everywhere\n if (type == 'FilesystemError') {\n this.code = this.cause.code\n this.path = this.cause.path\n this.errno = this.cause.errno\n this.message =\n (errno.errno[this.cause.errno]\n ? errno.errno[this.cause.errno].description\n : this.cause.message)\n + (this.cause.path ? ' [' + this.cause.path + ']' : '')\n }\n Error.call(this)\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, err)\n }\n err.prototype = !!proto ? new proto() : new CustomError()\n return err\n}\n\nmodule.exports = function (errno) {\n var ce = function (type, proto) {\n return createError(errno, type, proto)\n }\n return {\n CustomError : CustomError\n , FilesystemError : ce('FilesystemError')\n , createError : ce\n }\n}\n","/* global self */\n\n'use strict'\n\nconst nodeify = require('nodeify')\n\nconst webCrypto = getWebCrypto()\n\nfunction getWebCrypto () {\n if (self.crypto) {\n return self.crypto.subtle || self.crypto.webkitSubtle\n }\n\n if (self.msCrypto) {\n return self.msCrypto.subtle\n }\n}\n\nfunction webCryptoHash (type) {\n if (!webCrypto) {\n throw new Error('Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context')\n }\n\n return (data, callback) => {\n const res = webCrypto.digest({ name: type }, data)\n\n if (typeof res.then !== 'function') { // IE11\n res.onerror = () => {\n callback(new Error(`hashing data using ${type}`))\n }\n res.oncomplete = (e) => {\n callback(null, e.target.result)\n }\n return\n }\n\n nodeify(\n res.then((raw) => Buffer.from(new Uint8Array(raw))),\n callback\n )\n }\n}\n\nfunction sha1 (buf, callback) {\n webCryptoHash('SHA-1')(buf, callback)\n}\n\nfunction sha2256 (buf, callback) {\n webCryptoHash('SHA-256')(buf, callback)\n}\n\nfunction sha2512 (buf, callback) {\n webCryptoHash('SHA-512')(buf, callback)\n}\n\nmodule.exports = {\n sha1: sha1,\n sha2256: sha2256,\n sha2512: sha2512\n}\n","'use strict'\n\nconst toPullStream = require('async-iterator-to-pull-stream')\n\nmodule.exports = function (self) {\n return function catPullStream (ipfsPath, options) {\n return toPullStream.source(self._catAsyncIterator(ipfsPath, options))\n }\n}\n","'use strict'\n\nconst errCode = require('err-code')\nconst UnixFS = require('ipfs-unixfs')\nconst findShardCid = require('../../utils/find-cid-in-shard')\n\nconst findLinkCid = (node, name) => {\n const link = node.Links.find(link => link.Name === name)\n\n return link && link.Hash\n}\n\nconst contentExporters = {\n raw: require('./content/file'),\n file: require('./content/file'),\n directory: require('./content/directory'),\n 'hamt-sharded-directory': require('./content/hamt-sharded-directory'),\n metadata: (cid, node, unixfs, path, resolve, depth, ipld) => {},\n symlink: (cid, node, unixfs, path, resolve, depth, ipld) => {}\n}\n\nconst unixFsResolver = async (cid, name, path, toResolve, resolve, depth, ipld) => {\n const node = await ipld.get(cid)\n let unixfs\n let next\n\n if (!name) {\n name = cid.toBaseEncodedString()\n }\n\n try {\n unixfs = UnixFS.unmarshal(node.Data)\n } catch (err) {\n // non-UnixFS dag-pb node? It could happen.\n throw errCode(err, 'ERR_NOT_UNIXFS')\n }\n\n if (!path) {\n path = name\n }\n\n if (toResolve.length) {\n let linkCid\n\n if (unixfs && unixfs.type === 'hamt-sharded-directory') {\n // special case - unixfs v1 hamt shards\n linkCid = await findShardCid(node, toResolve[0], ipld)\n } else {\n linkCid = findLinkCid(node, toResolve[0])\n }\n\n if (!linkCid) {\n throw errCode(new Error(`file does not exist`), 'ERR_NOT_FOUND')\n }\n\n // remove the path component we have resolved\n const nextName = toResolve.shift()\n const nextPath = `${path}/${nextName}`\n\n next = {\n cid: linkCid,\n toResolve,\n name: nextName,\n path: nextPath\n }\n }\n\n return {\n entry: {\n name,\n path,\n cid,\n node,\n content: contentExporters[unixfs.type](cid, node, unixfs, path, resolve, depth, ipld),\n unixfs,\n depth\n },\n next\n }\n}\n\nmodule.exports = unixFsResolver\n","'use strict'\n\n// Default configuration for a repo in the browser\nmodule.exports = {\n lock: 'memory',\n storageBackends: {\n root: require('datastore-level'),\n blocks: require('datastore-level'),\n keys: require('datastore-level'),\n datastore: require('datastore-level')\n },\n storageBackendOptions: {\n root: {\n extension: '',\n prefix: '',\n version: 2\n },\n blocks: {\n sharding: false,\n prefix: '',\n version: 2\n },\n keys: {\n sharding: false,\n prefix: '',\n version: 2\n },\n datastore: {\n sharding: false,\n prefix: '',\n version: 2\n }\n }\n}\n","/**\n * Secure Hash Algorithm with a 1024-bit block size implementation.\n *\n * This includes: SHA-512, SHA-384, SHA-512/224, and SHA-512/256. For\n * SHA-256 (block size 512 bits), see sha256.js.\n *\n * See FIPS 180-4 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2014-2015 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nrequire('./md');\nrequire('./util');\n\nvar sha512 = module.exports = forge.sha512 = forge.sha512 || {};\n\n// SHA-512\nforge.md.sha512 = forge.md.algorithms.sha512 = sha512;\n\n// SHA-384\nvar sha384 = forge.sha384 = forge.sha512.sha384 = forge.sha512.sha384 || {};\nsha384.create = function() {\n return sha512.create('SHA-384');\n};\nforge.md.sha384 = forge.md.algorithms.sha384 = sha384;\n\n// SHA-512/256\nforge.sha512.sha256 = forge.sha512.sha256 || {\n create: function() {\n return sha512.create('SHA-512/256');\n }\n};\nforge.md['sha512/256'] = forge.md.algorithms['sha512/256'] =\n forge.sha512.sha256;\n\n// SHA-512/224\nforge.sha512.sha224 = forge.sha512.sha224 || {\n create: function() {\n return sha512.create('SHA-512/224');\n }\n};\nforge.md['sha512/224'] = forge.md.algorithms['sha512/224'] =\n forge.sha512.sha224;\n\n/**\n * Creates a SHA-2 message digest object.\n *\n * @param algorithm the algorithm to use (SHA-512, SHA-384, SHA-512/224,\n * SHA-512/256).\n *\n * @return a message digest object.\n */\nsha512.create = function(algorithm) {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n if(typeof algorithm === 'undefined') {\n algorithm = 'SHA-512';\n }\n\n if(!(algorithm in _states)) {\n throw new Error('Invalid SHA-512 algorithm: ' + algorithm);\n }\n\n // SHA-512 state contains eight 64-bit integers (each as two 32-bit ints)\n var _state = _states[algorithm];\n var _h = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for 64-bit word storage\n var _w = new Array(80);\n for(var wi = 0; wi < 80; ++wi) {\n _w[wi] = new Array(2);\n }\n\n // determine digest length by algorithm name (default)\n var digestLength = 64;\n switch(algorithm) {\n case 'SHA-384':\n digestLength = 48;\n break;\n case 'SHA-512/256':\n digestLength = 32;\n break;\n case 'SHA-512/224':\n digestLength = 28;\n break;\n }\n\n // message digest object\n var md = {\n // SHA-512 => sha512\n algorithm: algorithm.replace('-', '').toLowerCase(),\n blockLength: 128,\n digestLength: digestLength,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 16\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength128 for backwards-compatibility)\n md.fullMessageLength = md.messageLength128 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _h = new Array(_state.length);\n for(var i = 0; i < _state.length; ++i) {\n _h[i] = _state[i].slice(0);\n }\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_h, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-512 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 896 mod 1024. In other words,\n the data to be digested must be a multiple of 1024 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 16 bytes (128\n bits), that means that the last segment of the data must have 112 bytes\n (896 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 896 mod 1024 because\n 1024 - 128 = 896.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 896 mod 1024, then 1024 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var h = new Array(_h.length);\n for(var i = 0; i < _h.length; ++i) {\n h[i] = _h[i].slice(0);\n }\n _update(h, _w, finalBlock);\n var rval = forge.util.createBuffer();\n var hlen;\n if(algorithm === 'SHA-512') {\n hlen = h.length;\n } else if(algorithm === 'SHA-384') {\n hlen = h.length - 2;\n } else {\n hlen = h.length - 4;\n }\n for(var i = 0; i < hlen; ++i) {\n rval.putInt32(h[i][0]);\n if(i !== hlen - 1 || algorithm !== 'SHA-512/224') {\n rval.putInt32(h[i][1]);\n }\n }\n return rval;\n };\n\n return md;\n};\n\n// sha-512 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n// table of constants\nvar _k = null;\n\n// initial hash states\nvar _states = null;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 128);\n\n // create K table for SHA-512\n _k = [\n [0x428a2f98, 0xd728ae22], [0x71374491, 0x23ef65cd],\n [0xb5c0fbcf, 0xec4d3b2f], [0xe9b5dba5, 0x8189dbbc],\n [0x3956c25b, 0xf348b538], [0x59f111f1, 0xb605d019],\n [0x923f82a4, 0xaf194f9b], [0xab1c5ed5, 0xda6d8118],\n [0xd807aa98, 0xa3030242], [0x12835b01, 0x45706fbe],\n [0x243185be, 0x4ee4b28c], [0x550c7dc3, 0xd5ffb4e2],\n [0x72be5d74, 0xf27b896f], [0x80deb1fe, 0x3b1696b1],\n [0x9bdc06a7, 0x25c71235], [0xc19bf174, 0xcf692694],\n [0xe49b69c1, 0x9ef14ad2], [0xefbe4786, 0x384f25e3],\n [0x0fc19dc6, 0x8b8cd5b5], [0x240ca1cc, 0x77ac9c65],\n [0x2de92c6f, 0x592b0275], [0x4a7484aa, 0x6ea6e483],\n [0x5cb0a9dc, 0xbd41fbd4], [0x76f988da, 0x831153b5],\n [0x983e5152, 0xee66dfab], [0xa831c66d, 0x2db43210],\n [0xb00327c8, 0x98fb213f], [0xbf597fc7, 0xbeef0ee4],\n [0xc6e00bf3, 0x3da88fc2], [0xd5a79147, 0x930aa725],\n [0x06ca6351, 0xe003826f], [0x14292967, 0x0a0e6e70],\n [0x27b70a85, 0x46d22ffc], [0x2e1b2138, 0x5c26c926],\n [0x4d2c6dfc, 0x5ac42aed], [0x53380d13, 0x9d95b3df],\n [0x650a7354, 0x8baf63de], [0x766a0abb, 0x3c77b2a8],\n [0x81c2c92e, 0x47edaee6], [0x92722c85, 0x1482353b],\n [0xa2bfe8a1, 0x4cf10364], [0xa81a664b, 0xbc423001],\n [0xc24b8b70, 0xd0f89791], [0xc76c51a3, 0x0654be30],\n [0xd192e819, 0xd6ef5218], [0xd6990624, 0x5565a910],\n [0xf40e3585, 0x5771202a], [0x106aa070, 0x32bbd1b8],\n [0x19a4c116, 0xb8d2d0c8], [0x1e376c08, 0x5141ab53],\n [0x2748774c, 0xdf8eeb99], [0x34b0bcb5, 0xe19b48a8],\n [0x391c0cb3, 0xc5c95a63], [0x4ed8aa4a, 0xe3418acb],\n [0x5b9cca4f, 0x7763e373], [0x682e6ff3, 0xd6b2b8a3],\n [0x748f82ee, 0x5defb2fc], [0x78a5636f, 0x43172f60],\n [0x84c87814, 0xa1f0ab72], [0x8cc70208, 0x1a6439ec],\n [0x90befffa, 0x23631e28], [0xa4506ceb, 0xde82bde9],\n [0xbef9a3f7, 0xb2c67915], [0xc67178f2, 0xe372532b],\n [0xca273ece, 0xea26619c], [0xd186b8c7, 0x21c0c207],\n [0xeada7dd6, 0xcde0eb1e], [0xf57d4f7f, 0xee6ed178],\n [0x06f067aa, 0x72176fba], [0x0a637dc5, 0xa2c898a6],\n [0x113f9804, 0xbef90dae], [0x1b710b35, 0x131c471b],\n [0x28db77f5, 0x23047d84], [0x32caab7b, 0x40c72493],\n [0x3c9ebe0a, 0x15c9bebc], [0x431d67c4, 0x9c100d4c],\n [0x4cc5d4be, 0xcb3e42b6], [0x597f299c, 0xfc657e2a],\n [0x5fcb6fab, 0x3ad6faec], [0x6c44198c, 0x4a475817]\n ];\n\n // initial hash states\n _states = {};\n _states['SHA-512'] = [\n [0x6a09e667, 0xf3bcc908],\n [0xbb67ae85, 0x84caa73b],\n [0x3c6ef372, 0xfe94f82b],\n [0xa54ff53a, 0x5f1d36f1],\n [0x510e527f, 0xade682d1],\n [0x9b05688c, 0x2b3e6c1f],\n [0x1f83d9ab, 0xfb41bd6b],\n [0x5be0cd19, 0x137e2179]\n ];\n _states['SHA-384'] = [\n [0xcbbb9d5d, 0xc1059ed8],\n [0x629a292a, 0x367cd507],\n [0x9159015a, 0x3070dd17],\n [0x152fecd8, 0xf70e5939],\n [0x67332667, 0xffc00b31],\n [0x8eb44a87, 0x68581511],\n [0xdb0c2e0d, 0x64f98fa7],\n [0x47b5481d, 0xbefa4fa4]\n ];\n _states['SHA-512/256'] = [\n [0x22312194, 0xFC2BF72C],\n [0x9F555FA3, 0xC84C64C2],\n [0x2393B86B, 0x6F53B151],\n [0x96387719, 0x5940EABD],\n [0x96283EE2, 0xA88EFFE3],\n [0xBE5E1E25, 0x53863992],\n [0x2B0199FC, 0x2C85B8AA],\n [0x0EB72DDC, 0x81C52CA2]\n ];\n _states['SHA-512/224'] = [\n [0x8C3D37C8, 0x19544DA2],\n [0x73E19966, 0x89DCD4D6],\n [0x1DFAB7AE, 0x32FF9C82],\n [0x679DD514, 0x582F9FCF],\n [0x0F6D2B69, 0x7BD44DA8],\n [0x77E36F73, 0x04C48942],\n [0x3F9D85A8, 0x6A1D36C8],\n [0x1112E6AD, 0x91D692A1]\n ];\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-512 state with the given byte buffer.\n *\n * @param s the SHA-512 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (128 byte) chunks\n var t1_hi, t1_lo;\n var t2_hi, t2_lo;\n var s0_hi, s0_lo;\n var s1_hi, s1_lo;\n var ch_hi, ch_lo;\n var maj_hi, maj_lo;\n var a_hi, a_lo;\n var b_hi, b_lo;\n var c_hi, c_lo;\n var d_hi, d_lo;\n var e_hi, e_lo;\n var f_hi, f_lo;\n var g_hi, g_lo;\n var h_hi, h_lo;\n var i, hi, lo, w2, w7, w15, w16;\n var len = bytes.length();\n while(len >= 128) {\n // the w array will be populated with sixteen 64-bit big-endian words\n // and then extended into 64 64-bit words according to SHA-512\n for(i = 0; i < 16; ++i) {\n w[i][0] = bytes.getInt32() >>> 0;\n w[i][1] = bytes.getInt32() >>> 0;\n }\n for(; i < 80; ++i) {\n // for word 2 words ago: ROTR 19(x) ^ ROTR 61(x) ^ SHR 6(x)\n w2 = w[i - 2];\n hi = w2[0];\n lo = w2[1];\n\n // high bits\n t1_hi = (\n ((hi >>> 19) | (lo << 13)) ^ // ROTR 19\n ((lo >>> 29) | (hi << 3)) ^ // ROTR 61/(swap + ROTR 29)\n (hi >>> 6)) >>> 0; // SHR 6\n // low bits\n t1_lo = (\n ((hi << 13) | (lo >>> 19)) ^ // ROTR 19\n ((lo << 3) | (hi >>> 29)) ^ // ROTR 61/(swap + ROTR 29)\n ((hi << 26) | (lo >>> 6))) >>> 0; // SHR 6\n\n // for word 15 words ago: ROTR 1(x) ^ ROTR 8(x) ^ SHR 7(x)\n w15 = w[i - 15];\n hi = w15[0];\n lo = w15[1];\n\n // high bits\n t2_hi = (\n ((hi >>> 1) | (lo << 31)) ^ // ROTR 1\n ((hi >>> 8) | (lo << 24)) ^ // ROTR 8\n (hi >>> 7)) >>> 0; // SHR 7\n // low bits\n t2_lo = (\n ((hi << 31) | (lo >>> 1)) ^ // ROTR 1\n ((hi << 24) | (lo >>> 8)) ^ // ROTR 8\n ((hi << 25) | (lo >>> 7))) >>> 0; // SHR 7\n\n // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^64 (carry lo overflow)\n w7 = w[i - 7];\n w16 = w[i - 16];\n lo = (t1_lo + w7[1] + t2_lo + w16[1]);\n w[i][0] = (t1_hi + w7[0] + t2_hi + w16[0] +\n ((lo / 0x100000000) >>> 0)) >>> 0;\n w[i][1] = lo >>> 0;\n }\n\n // initialize hash value for this chunk\n a_hi = s[0][0];\n a_lo = s[0][1];\n b_hi = s[1][0];\n b_lo = s[1][1];\n c_hi = s[2][0];\n c_lo = s[2][1];\n d_hi = s[3][0];\n d_lo = s[3][1];\n e_hi = s[4][0];\n e_lo = s[4][1];\n f_hi = s[5][0];\n f_lo = s[5][1];\n g_hi = s[6][0];\n g_lo = s[6][1];\n h_hi = s[7][0];\n h_lo = s[7][1];\n\n // round function\n for(i = 0; i < 80; ++i) {\n // Sum1(e) = ROTR 14(e) ^ ROTR 18(e) ^ ROTR 41(e)\n s1_hi = (\n ((e_hi >>> 14) | (e_lo << 18)) ^ // ROTR 14\n ((e_hi >>> 18) | (e_lo << 14)) ^ // ROTR 18\n ((e_lo >>> 9) | (e_hi << 23))) >>> 0; // ROTR 41/(swap + ROTR 9)\n s1_lo = (\n ((e_hi << 18) | (e_lo >>> 14)) ^ // ROTR 14\n ((e_hi << 14) | (e_lo >>> 18)) ^ // ROTR 18\n ((e_lo << 23) | (e_hi >>> 9))) >>> 0; // ROTR 41/(swap + ROTR 9)\n\n // Ch(e, f, g) (optimized the same way as SHA-1)\n ch_hi = (g_hi ^ (e_hi & (f_hi ^ g_hi))) >>> 0;\n ch_lo = (g_lo ^ (e_lo & (f_lo ^ g_lo))) >>> 0;\n\n // Sum0(a) = ROTR 28(a) ^ ROTR 34(a) ^ ROTR 39(a)\n s0_hi = (\n ((a_hi >>> 28) | (a_lo << 4)) ^ // ROTR 28\n ((a_lo >>> 2) | (a_hi << 30)) ^ // ROTR 34/(swap + ROTR 2)\n ((a_lo >>> 7) | (a_hi << 25))) >>> 0; // ROTR 39/(swap + ROTR 7)\n s0_lo = (\n ((a_hi << 4) | (a_lo >>> 28)) ^ // ROTR 28\n ((a_lo << 30) | (a_hi >>> 2)) ^ // ROTR 34/(swap + ROTR 2)\n ((a_lo << 25) | (a_hi >>> 7))) >>> 0; // ROTR 39/(swap + ROTR 7)\n\n // Maj(a, b, c) (optimized the same way as SHA-1)\n maj_hi = ((a_hi & b_hi) | (c_hi & (a_hi ^ b_hi))) >>> 0;\n maj_lo = ((a_lo & b_lo) | (c_lo & (a_lo ^ b_lo))) >>> 0;\n\n // main algorithm\n // t1 = (h + s1 + ch + _k[i] + _w[i]) modulo 2^64 (carry lo overflow)\n lo = (h_lo + s1_lo + ch_lo + _k[i][1] + w[i][1]);\n t1_hi = (h_hi + s1_hi + ch_hi + _k[i][0] + w[i][0] +\n ((lo / 0x100000000) >>> 0)) >>> 0;\n t1_lo = lo >>> 0;\n\n // t2 = s0 + maj modulo 2^64 (carry lo overflow)\n lo = s0_lo + maj_lo;\n t2_hi = (s0_hi + maj_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n t2_lo = lo >>> 0;\n\n h_hi = g_hi;\n h_lo = g_lo;\n\n g_hi = f_hi;\n g_lo = f_lo;\n\n f_hi = e_hi;\n f_lo = e_lo;\n\n // e = (d + t1) modulo 2^64 (carry lo overflow)\n lo = d_lo + t1_lo;\n e_hi = (d_hi + t1_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n e_lo = lo >>> 0;\n\n d_hi = c_hi;\n d_lo = c_lo;\n\n c_hi = b_hi;\n c_lo = b_lo;\n\n b_hi = a_hi;\n b_lo = a_lo;\n\n // a = (t1 + t2) modulo 2^64 (carry lo overflow)\n lo = t1_lo + t2_lo;\n a_hi = (t1_hi + t2_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n a_lo = lo >>> 0;\n }\n\n // update hash state (additional modulo 2^64)\n lo = s[0][1] + a_lo;\n s[0][0] = (s[0][0] + a_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[0][1] = lo >>> 0;\n\n lo = s[1][1] + b_lo;\n s[1][0] = (s[1][0] + b_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[1][1] = lo >>> 0;\n\n lo = s[2][1] + c_lo;\n s[2][0] = (s[2][0] + c_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[2][1] = lo >>> 0;\n\n lo = s[3][1] + d_lo;\n s[3][0] = (s[3][0] + d_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[3][1] = lo >>> 0;\n\n lo = s[4][1] + e_lo;\n s[4][0] = (s[4][0] + e_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[4][1] = lo >>> 0;\n\n lo = s[5][1] + f_lo;\n s[5][0] = (s[5][0] + f_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[5][1] = lo >>> 0;\n\n lo = s[6][1] + g_lo;\n s[6][0] = (s[6][0] + g_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[6][1] = lo >>> 0;\n\n lo = s[7][1] + h_lo;\n s[7][0] = (s[7][0] + h_hi + ((lo / 0x100000000) >>> 0)) >>> 0;\n s[7][1] = lo >>> 0;\n\n len -= 128;\n }\n}\n","'use strict'\n\nconst EventEmitter = require('events').EventEmitter\nconst Connection = require('interface-connection').Connection\nconst nextTick = require('async/nextTick')\nconst debug = require('debug')\n\nconst MULTIPLEX_CODEC = require('./codec')\n\nconst log = debug('libp2p-mplex:muxer')\nlog.err = debug('libp2p-mplex:muxer:error')\n\nfunction noop () {}\n\nclass MultiplexMuxer extends EventEmitter {\n /**\n * @constructor\n * @param {Connection} conn\n * @param {Mplex} multiplex\n */\n constructor (conn, multiplex) {\n super()\n this.conn = conn\n this.multiplex = multiplex\n this.multicodec = MULTIPLEX_CODEC\n\n multiplex.on('close', () => this.emit('close'))\n multiplex.on('error', (err) => this.emit('error', err))\n\n multiplex.on('stream', (stream) => {\n // install default error handler so that it doesn't throw\n stream.on('error', (err) => {\n log.err('receiver stream errored', err)\n })\n this.emit('stream', new Connection(stream, this.conn))\n })\n }\n\n /**\n * Creates a new stream from the `Connection` used in creating the muxer\n * @param {function(Error, Connection)} callback\n * @returns {Connection}\n */\n newStream (callback) {\n callback = callback || noop\n let stream = this.multiplex.createStream()\n // install default error handler so that it doesn't throw\n stream.on('error', (err) => {\n log.err('initiator stream errored', err)\n })\n const conn = new Connection(stream, this.conn)\n nextTick(callback, null, conn)\n return conn\n }\n\n /**\n * Ends the connection and all of its streams\n * @param {function(Error)} callback\n * @returns {void}\n */\n end (callback) {\n callback = callback || noop\n if (this.multiplex.destroyed) {\n return nextTick(callback)\n }\n this.multiplex.once('close', callback)\n this.multiplex.close()\n }\n}\n\nmodule.exports = MultiplexMuxer\n","'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n","'use strict'\n\nconst tryEach = require('async/tryEach')\nconst parallel = require('async/parallel')\nconst errCode = require('err-code')\nconst promisify = require('promisify-es6')\n\nmodule.exports = (node) => {\n const routers = node._modules.contentRouting || []\n\n // If we have the dht, make it first\n if (node._dht) {\n routers.unshift(node._dht)\n }\n\n return {\n /**\n * Iterates over all content routers in series to find providers of the given key.\n * Once a content router succeeds, iteration will stop.\n *\n * @param {CID} key The CID key of the content to find\n * @param {object} options\n * @param {number} options.maxTimeout How long the query should run\n * @param {number} options.maxNumProviders - maximum number of providers to find\n * @param {function(Error, Result)} callback\n * @returns {void}\n */\n findProviders: promisify((key, options, callback) => {\n if (typeof options === 'function') {\n callback = options\n options = {}\n } else if (typeof options === 'number') { // This can be deprecated in a future release\n options = {\n maxTimeout: options\n }\n }\n\n if (!routers.length) {\n return callback(errCode(new Error('No content routers available'), 'NO_ROUTERS_AVAILABLE'))\n }\n\n const tasks = routers.map((router) => {\n return (cb) => router.findProviders(key, options, (err, results) => {\n if (err) {\n return cb(err)\n }\n\n // If we don't have any results, we need to provide an error to keep trying\n if (!results || Object.keys(results).length === 0) {\n return cb(errCode(new Error('not found'), 'NOT_FOUND'), null)\n }\n\n cb(null, results)\n })\n })\n\n tryEach(tasks, (err, results) => {\n if (err && err.code !== 'NOT_FOUND') {\n return callback(err)\n }\n results = results || []\n callback(null, results)\n })\n }),\n\n /**\n * Iterates over all content routers in parallel to notify it is\n * a provider of the given key.\n *\n * @param {CID} key The CID key of the content to find\n * @param {function(Error)} callback\n * @returns {void}\n */\n provide: promisify((key, callback) => {\n if (!routers.length) {\n return callback(errCode(new Error('No content routers available'), 'NO_ROUTERS_AVAILABLE'))\n }\n\n parallel(routers.map((router) => {\n return (cb) => router.provide(key, cb)\n }), callback)\n })\n }\n}\n","var scope = (typeof global !== \"undefined\" && global) ||\n (typeof self !== \"undefined\" && self) ||\n window;\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(scope, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\nrequire(\"setimmediate\");\n// On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== \"undefined\" && self.setImmediate) ||\n (typeof global !== \"undefined\" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== \"undefined\" && self.clearImmediate) ||\n (typeof global !== \"undefined\" && global.clearImmediate) ||\n (this && this.clearImmediate);\n","/**\n * Cipher base API.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nrequire('./util');\n\nmodule.exports = forge.cipher = forge.cipher || {};\n\n// registered algorithms\nforge.cipher.algorithms = forge.cipher.algorithms || {};\n\n/**\n * Creates a cipher object that can be used to encrypt data using the given\n * algorithm and key. The algorithm may be provided as a string value for a\n * previously registered algorithm or it may be given as a cipher algorithm\n * API object.\n *\n * @param algorithm the algorithm to use, either a string or an algorithm API\n * object.\n * @param key the key to use, as a binary-encoded string of bytes or a\n * byte buffer.\n *\n * @return the cipher.\n */\nforge.cipher.createCipher = function(algorithm, key) {\n var api = algorithm;\n if(typeof api === 'string') {\n api = forge.cipher.getAlgorithm(api);\n if(api) {\n api = api();\n }\n }\n if(!api) {\n throw new Error('Unsupported algorithm: ' + algorithm);\n }\n\n // assume block cipher\n return new forge.cipher.BlockCipher({\n algorithm: api,\n key: key,\n decrypt: false\n });\n};\n\n/**\n * Creates a decipher object that can be used to decrypt data using the given\n * algorithm and key. The algorithm may be provided as a string value for a\n * previously registered algorithm or it may be given as a cipher algorithm\n * API object.\n *\n * @param algorithm the algorithm to use, either a string or an algorithm API\n * object.\n * @param key the key to use, as a binary-encoded string of bytes or a\n * byte buffer.\n *\n * @return the cipher.\n */\nforge.cipher.createDecipher = function(algorithm, key) {\n var api = algorithm;\n if(typeof api === 'string') {\n api = forge.cipher.getAlgorithm(api);\n if(api) {\n api = api();\n }\n }\n if(!api) {\n throw new Error('Unsupported algorithm: ' + algorithm);\n }\n\n // assume block cipher\n return new forge.cipher.BlockCipher({\n algorithm: api,\n key: key,\n decrypt: true\n });\n};\n\n/**\n * Registers an algorithm by name. If the name was already registered, the\n * algorithm API object will be overwritten.\n *\n * @param name the name of the algorithm.\n * @param algorithm the algorithm API object.\n */\nforge.cipher.registerAlgorithm = function(name, algorithm) {\n name = name.toUpperCase();\n forge.cipher.algorithms[name] = algorithm;\n};\n\n/**\n * Gets a registered algorithm by name.\n *\n * @param name the name of the algorithm.\n *\n * @return the algorithm, if found, null if not.\n */\nforge.cipher.getAlgorithm = function(name) {\n name = name.toUpperCase();\n if(name in forge.cipher.algorithms) {\n return forge.cipher.algorithms[name];\n }\n return null;\n};\n\nvar BlockCipher = forge.cipher.BlockCipher = function(options) {\n this.algorithm = options.algorithm;\n this.mode = this.algorithm.mode;\n this.blockSize = this.mode.blockSize;\n this._finish = false;\n this._input = null;\n this.output = null;\n this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt;\n this._decrypt = options.decrypt;\n this.algorithm.initialize(options);\n};\n\n/**\n * Starts or restarts the encryption or decryption process, whichever\n * was previously configured.\n *\n * For non-GCM mode, the IV may be a binary-encoded string of bytes, an array\n * of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in\n * bytes, then it must be Nb (16) bytes in length. If the IV is given in as\n * 32-bit integers, then it must be 4 integers long.\n *\n * Note: an IV is not required or used in ECB mode.\n *\n * For GCM-mode, the IV must be given as a binary-encoded string of bytes or\n * a byte buffer. The number of bytes should be 12 (96 bits) as recommended\n * by NIST SP-800-38D but another length may be given.\n *\n * @param options the options to use:\n * iv the initialization vector to use as a binary-encoded string of\n * bytes, null to reuse the last ciphered block from a previous\n * update() (this \"residue\" method is for legacy support only).\n * additionalData additional authentication data as a binary-encoded\n * string of bytes, for 'GCM' mode, (default: none).\n * tagLength desired length of authentication tag, in bits, for\n * 'GCM' mode (0-128, default: 128).\n * tag the authentication tag to check if decrypting, as a\n * binary-encoded string of bytes.\n * output the output the buffer to write to, null to create one.\n */\nBlockCipher.prototype.start = function(options) {\n options = options || {};\n var opts = {};\n for(var key in options) {\n opts[key] = options[key];\n }\n opts.decrypt = this._decrypt;\n this._finish = false;\n this._input = forge.util.createBuffer();\n this.output = options.output || forge.util.createBuffer();\n this.mode.start(opts);\n};\n\n/**\n * Updates the next block according to the cipher mode.\n *\n * @param input the buffer to read from.\n */\nBlockCipher.prototype.update = function(input) {\n if(input) {\n // input given, so empty it into the input buffer\n this._input.putBuffer(input);\n }\n\n // do cipher operation until it needs more input and not finished\n while(!this._op.call(this.mode, this._input, this.output, this._finish) &&\n !this._finish) {}\n\n // free consumed memory from input buffer\n this._input.compact();\n};\n\n/**\n * Finishes encrypting or decrypting.\n *\n * @param pad a padding function to use in CBC mode, null for default,\n * signature(blockSize, buffer, decrypt).\n *\n * @return true if successful, false on error.\n */\nBlockCipher.prototype.finish = function(pad) {\n // backwards-compatibility w/deprecated padding API\n // Note: will overwrite padding functions even after another start() call\n if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) {\n this.mode.pad = function(input) {\n return pad(this.blockSize, input, false);\n };\n this.mode.unpad = function(output) {\n return pad(this.blockSize, output, true);\n };\n }\n\n // build options for padding and afterFinish functions\n var options = {};\n options.decrypt = this._decrypt;\n\n // get # of bytes that won't fill a block\n options.overflow = this._input.length() % this.blockSize;\n\n if(!this._decrypt && this.mode.pad) {\n if(!this.mode.pad(this._input, options)) {\n return false;\n }\n }\n\n // do final update\n this._finish = true;\n this.update();\n\n if(this._decrypt && this.mode.unpad) {\n if(!this.mode.unpad(this.output, options)) {\n return false;\n }\n }\n\n if(this.mode.afterFinish) {\n if(!this.mode.afterFinish(this.output, options)) {\n return false;\n }\n }\n\n return true;\n};\n","/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n(function(){\n \"use strict\";\n\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n // Use a lookup table to find the index.\n var lookup = new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n\n exports.encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer),\n i, len = bytes.length, base64 = \"\";\n\n for (i = 0; i < len; i+=3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if ((len % 3) === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n\n return base64;\n };\n\n exports.decode = function(base64) {\n var bufferLength = base64.length * 0.75,\n len = base64.length, i, p = 0,\n encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (i = 0; i < len; i+=4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i+1)];\n encoded3 = lookup[base64.charCodeAt(i+2)];\n encoded4 = lookup[base64.charCodeAt(i+3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arraybuffer;\n };\n})();\n","'use strict'\nvar abortCb = require('../util/abort-cb')\n\nmodule.exports = function once (value, onAbort) {\n return function (abort, cb) {\n if(abort)\n return abortCb(cb, abort, onAbort)\n if(value != null) {\n var _value = value; value = null\n cb(null, _value)\n } else\n cb(true)\n }\n}\n\n\n","'use strict'\n\nconst toStream = require('it-to-stream')\n\nmodule.exports = function (self) {\n return function refsReadableStream (ipfsPath, options) {\n return toStream.readable(self._refsAsyncIterator(ipfsPath, options), {\n objectMode: true\n })\n }\n}\n","var Buffer = require('safe-buffer').Buffer\nvar Transform = require('stream').Transform\nvar StringDecoder = require('string_decoder').StringDecoder\nvar inherits = require('inherits')\n\nfunction CipherBase (hashMode) {\n Transform.call(this)\n this.hashMode = typeof hashMode === 'string'\n if (this.hashMode) {\n this[hashMode] = this._finalOrDigest\n } else {\n this.final = this._finalOrDigest\n }\n if (this._final) {\n this.__final = this._final\n this._final = null\n }\n this._decoder = null\n this._encoding = null\n}\ninherits(CipherBase, Transform)\n\nCipherBase.prototype.update = function (data, inputEnc, outputEnc) {\n if (typeof data === 'string') {\n data = Buffer.from(data, inputEnc)\n }\n\n var outData = this._update(data)\n if (this.hashMode) return this\n\n if (outputEnc) {\n outData = this._toString(outData, outputEnc)\n }\n\n return outData\n}\n\nCipherBase.prototype.setAutoPadding = function () {}\nCipherBase.prototype.getAuthTag = function () {\n throw new Error('trying to get auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAuthTag = function () {\n throw new Error('trying to set auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAAD = function () {\n throw new Error('trying to set aad in unsupported state')\n}\n\nCipherBase.prototype._transform = function (data, _, next) {\n var err\n try {\n if (this.hashMode) {\n this._update(data)\n } else {\n this.push(this._update(data))\n }\n } catch (e) {\n err = e\n } finally {\n next(err)\n }\n}\nCipherBase.prototype._flush = function (done) {\n var err\n try {\n this.push(this.__final())\n } catch (e) {\n err = e\n }\n\n done(err)\n}\nCipherBase.prototype._finalOrDigest = function (outputEnc) {\n var outData = this.__final() || Buffer.alloc(0)\n if (outputEnc) {\n outData = this._toString(outData, outputEnc, true)\n }\n return outData\n}\n\nCipherBase.prototype._toString = function (value, enc, fin) {\n if (!this._decoder) {\n this._decoder = new StringDecoder(enc)\n this._encoding = enc\n }\n\n if (this._encoding !== enc) throw new Error('can\\'t switch encodings')\n\n var out = this._decoder.write(value)\n if (fin) {\n out += this._decoder.end()\n }\n\n return out\n}\n\nmodule.exports = CipherBase\n","'use strict'\n\nconst {\n DAGNode,\n DAGLink\n} = require('ipld-dag-pb')\nconst CID = require('cids')\nconst log = require('debug')('ipfs:mfs:core:utils:remove-link')\nconst UnixFS = require('ipfs-unixfs')\nconst {\n generatePath,\n updateHamtDirectory\n} = require('./hamt-utils')\nconst errCode = require('err-code')\nconst mc = require('multicodec')\nconst mh = require('multihashes')\n\nconst removeLink = async (context, options) => {\n if (!options.parentCid && !options.parent) {\n throw errCode(new Error('No parent node or CID passed to removeLink'), 'EINVALIDPARENT')\n }\n\n if (options.parentCid && !CID.isCID(options.parentCid)) {\n throw errCode(new Error('Invalid CID passed to removeLink'), 'EINVALIDPARENTCID')\n }\n\n if (!options.parent) {\n log(`Loading parent node ${options.parentCid}`)\n\n options.parent = await context.ipld.get(options.parentCid)\n }\n\n if (!options.name) {\n throw errCode(new Error('No child name passed to removeLink'), 'EINVALIDCHILDNAME')\n }\n\n const meta = UnixFS.unmarshal(options.parent.Data)\n\n if (meta.type === 'hamt-sharded-directory') {\n log(`Removing ${options.name} from sharded directory`)\n\n return removeFromShardedDirectory(context, options)\n }\n\n log(`Removing link ${options.name} regular directory`)\n\n return removeFromDirectory(context, options)\n}\n\nconst removeFromDirectory = async (context, options) => {\n const format = mc[options.format.toUpperCase().replace(/-/g, '_')]\n const hashAlg = mh.names[options.hashAlg]\n\n options.parent.rmLink(options.name)\n const cid = await context.ipld.put(options.parent, format, {\n cidVersion: options.cidVersion,\n hashAlg\n })\n\n log(`Updated regular directory ${cid}`)\n\n return {\n node: options.parent,\n cid\n }\n}\n\nconst removeFromShardedDirectory = async (context, options) => {\n const {\n rootBucket, path\n } = await generatePath(context, options.name, options.parent)\n\n await rootBucket.del(options.name)\n\n const {\n node\n } = await updateShard(context, path, {\n name: options.name,\n cid: options.cid,\n size: options.size,\n hashAlg: options.hashAlg,\n format: options.format,\n cidVersion: options.cidVersion,\n flush: options.flush\n }, options)\n\n return updateHamtDirectory(context, node.Links, rootBucket, options)\n}\n\nconst updateShard = async (context, positions, child, options) => {\n const {\n bucket,\n prefix,\n node\n } = positions.pop()\n\n const link = node.Links\n .find(link => link.Name.substring(0, 2) === prefix)\n\n if (!link) {\n throw errCode(new Error(`No link found with prefix ${prefix} for file ${child.name}`), 'ERR_NOT_FOUND')\n }\n\n if (link.Name === `${prefix}${child.name}`) {\n log(`Removing existing link ${link.Name}`)\n\n node.rmLink(link.Name)\n\n await bucket.del(child.name)\n\n return updateHamtDirectory(context, node.Links, bucket, options)\n }\n\n log(`Descending into sub-shard ${link.Name} for ${prefix}${child.name}`)\n\n const result = await updateShard(context, positions, child, options)\n\n let newName = prefix\n\n if (result.node.Links.length === 1) {\n log(`Removing subshard for ${prefix}`)\n\n // convert shard back to normal dir\n result.cid = result.node.Links[0].Hash\n result.node = result.node.Links[0]\n\n newName = `${prefix}${result.node.Name.substring(2)}`\n }\n\n log(`Updating shard ${prefix} with name ${newName}`)\n\n const size = DAGNode.isDAGNode(result.node) ? result.node.size : result.node.Tsize\n\n return updateShardParent(context, bucket, node, prefix, newName, size, result.cid, options)\n}\n\nconst updateShardParent = (context, bucket, parent, oldName, newName, size, cid, options) => {\n parent.rmLink(oldName)\n parent.addLink(new DAGLink(newName, size, cid))\n\n return updateHamtDirectory(context, parent.Links, bucket, options)\n}\n\nmodule.exports = removeLink\n","'use strict'\nvar State = require('./state')\n\nfunction isInteger (i) {\n return Number.isFinite(i)\n}\n\nfunction isFunction (f) {\n return 'function' === typeof f\n}\n\nfunction maxDelay(fn, delay) {\n if(!delay) return fn\n return function (a, cb) {\n var timer = setTimeout(function () {\n fn(new Error('pull-reader: read exceeded timeout'), cb)\n }, delay)\n fn(a, function (err, value) {\n clearTimeout(timer)\n cb(err, value)\n })\n\n }\n\n}\n\nmodule.exports = function (timeout) {\n\n var queue = [], read, readTimed, reading = false\n var state = State(), ended, streaming, abort\n\n function drain () {\n while (queue.length) {\n if(null == queue[0].length && state.has(1)) {\n queue.shift().cb(null, state.get())\n }\n else if(state.has(queue[0].length)) {\n var next = queue.shift()\n next.cb(null, state.get(next.length))\n }\n else if(ended == true && queue[0].length && state.length < queue[0].length) {\n var msg = 'stream ended with:'+state.length+' but wanted:'+queue[0].length\n queue.shift().cb(new Error(msg))\n }\n else if(ended)\n queue.shift().cb(ended)\n else\n return !!queue.length\n }\n //always read a little data\n return queue.length || !state.has(1) || abort\n }\n\n function more () {\n var d = drain()\n if(d && !reading)\n if(read && !reading && !streaming) {\n reading = true\n readTimed (null, function (err, data) {\n reading = false\n if(err) {\n ended = err\n return drain()\n }\n state.add(data)\n more()\n })\n }\n }\n\n function reader (_read) {\n if(abort) {\n while(queue.length) queue.shift().cb(abort)\n return cb && cb(abort)\n }\n readTimed = maxDelay(_read, timeout)\n read = _read\n more()\n }\n\n reader.abort = function (err, cb) {\n abort = err || true\n if(read) {\n reading = true\n read(abort, function () {\n while(queue.length) queue.shift().cb(abort)\n cb && cb(abort)\n })\n }\n else\n cb()\n }\n\n reader.read = function (len, _timeout, cb) {\n if(isFunction(_timeout))\n cb = _timeout, _timeout = timeout\n if(isFunction(cb)) {\n queue.push({length: isInteger(len) ? len : null, cb: cb})\n more()\n }\n else {\n //switch into streaming mode for the rest of the stream.\n streaming = true\n //wait for the current read to complete\n return function (abort, cb) {\n //if there is anything still in the queue,\n if(reading || state.has(1)) {\n if(abort) return read(abort, cb)\n queue.push({length: null, cb: cb})\n more()\n }\n else\n maxDelay(read, _timeout)(abort, function (err, data) {\n cb(err, data)\n })\n }\n }\n }\n\n return reader\n}\n\n\n\n\n\n\n","'use strict'\nconst mergeOptions = require('merge-options')\nconst ipldDagCbor = require('ipld-dag-cbor')\nconst ipldDagPb = require('ipld-dag-pb')\nconst ipldRaw = require('ipld-raw')\n\nmodule.exports = (blockService, options) => {\n options = options || {}\n\n return mergeOptions.call(\n // ensure we have the defaults formats even if the user overrides `formats: []`\n { concatArrays: true },\n {\n blockService: blockService,\n formats: [ipldDagCbor, ipldDagPb, ipldRaw]\n }, options)\n}\n","'use strict'\n\nconst CID = require('cids')\nconst errCode = require('err-code')\n\nconst resolve = async (cid, name, path, toResolve, resolve, depth, ipld) => {\n const node = await ipld.get(cid)\n let subObject = node\n let subPath = path\n\n while (toResolve.length) {\n const prop = toResolve[0]\n\n if (prop in subObject) {\n // remove the bit of the path we have resolved\n toResolve.shift()\n subPath = `${subPath}/${prop}`\n\n if (CID.isCID(subObject[prop])) {\n return {\n entry: {\n name,\n path,\n cid,\n node,\n depth\n },\n next: {\n cid: subObject[prop],\n name: prop,\n path: subPath,\n toResolve\n }\n }\n }\n\n subObject = subObject[prop]\n } else {\n // cannot resolve further\n throw errCode(new Error(`No property named ${prop} found in cbor node ${cid.toBaseEncodedString()}`), 'ERR_NO_PROP')\n }\n }\n\n return {\n entry: {\n name,\n path,\n cid,\n node,\n depth\n }\n }\n}\n\nmodule.exports = resolve\n","'use strict'\n\nmodule.exports = `// can't use, because protocol-buffers doesn't support imports\n// so we have to duplicate for now :(\n// import \"record.proto\";\n\nmessage Record {\n // adjusted for javascript\n optional bytes key = 1;\n optional bytes value = 2;\n optional bytes author = 3;\n optional bytes signature = 4;\n optional string timeReceived = 5;\n}\n\nmessage Message {\n enum MessageType {\n PUT_VALUE = 0;\n GET_VALUE = 1;\n ADD_PROVIDER = 2;\n GET_PROVIDERS = 3;\n FIND_NODE = 4;\n PING = 5;\n }\n\n enum ConnectionType {\n // sender does not have a connection to peer, and no extra information (default)\n NOT_CONNECTED = 0;\n\n // sender has a live connection to peer\n CONNECTED = 1;\n\n // sender recently connected to peer\n CAN_CONNECT = 2;\n\n // sender recently tried to connect to peer repeatedly but failed to connect\n // (\"try\" here is loose, but this should signal \"made strong effort, failed\")\n CANNOT_CONNECT = 3;\n }\n\n message Peer {\n // ID of a given peer.\n optional bytes id = 1;\n\n // multiaddrs for a given peer\n repeated bytes addrs = 2;\n\n // used to signal the sender's connection capabilities to the peer\n optional ConnectionType connection = 3;\n }\n\n // defines what type of message it is.\n optional MessageType type = 1;\n\n // defines what coral cluster level this query/response belongs to.\n // in case we want to implement coral's cluster rings in the future.\n optional int32 clusterLevelRaw = 10;\n\n // Used to specify the key associated with this message.\n // PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS\n // adjusted for javascript\n optional bytes key = 2;\n\n // Used to return a value\n // PUT_VALUE, GET_VALUE\n // adjusted Record to bytes for js\n optional bytes record = 3;\n\n // Used to return peers closer to a key in a query\n // GET_VALUE, GET_PROVIDERS, FIND_NODE\n repeated Peer closerPeers = 8;\n\n // Used to return Providers\n // GET_VALUE, ADD_PROVIDER, GET_PROVIDERS\n repeated Peer providerPeers = 9;\n}`\n","'use strict'\n\nconst pull = require('pull-stream')\nconst EventEmitter = require('events')\n\nconst emitter = new EventEmitter()\n\nfunction handler (protocol, conn) {\n conn.getPeerInfo((err, peerInfo) => {\n if (err) {\n console.log(err)\n return\n }\n\n const peerId = peerInfo.id.toB58String()\n\n pull(\n conn,\n pull.map((message) => {\n let msg\n try {\n msg = JSON.parse(message.toString())\n } catch (err) {\n emitter.emit('warning', err.message)\n return // early\n }\n\n if (peerId !== msg.from) {\n emitter.emit('warning', 'no peerid match ' + msg.from)\n return // early\n }\n\n const topicIDs = msg.topicIDs\n if (!Array.isArray(topicIDs)) {\n emitter.emit('warning', 'no topic IDs')\n return // early\n }\n\n msg.data = Buffer.from(msg.data, 'hex')\n msg.seqno = Buffer.from(msg.seqno, 'hex')\n\n topicIDs.forEach((topic) => {\n emitter.emit(topic, msg)\n })\n\n return msg\n }),\n pull.onEnd(() => {\n // do nothing\n })\n )\n })\n}\n\nexports = module.exports = {\n handler: handler,\n emitter: emitter\n}\n","'use strict'\n\nfunction id (e) { return e }\nvar prop = require('../util/prop')\n\nmodule.exports = function asyncMap (map) {\n if(!map) return id\n map = prop(map)\n var busy = false, abortCb, aborted\n return function (read) {\n return function next (abort, cb) {\n if(aborted) return cb(aborted)\n if(abort) {\n aborted = abort\n if(!busy) read(abort, function (err) {\n //incase the source has already ended normally,\n //we should pass our own error.\n cb(abort)\n })\n else read(abort, function (err) {\n //if we are still busy, wait for the mapper to complete.\n if(busy) abortCb = cb\n else cb(abort)\n })\n }\n else\n read(null, function (end, data) {\n if(end) cb(end)\n else if(aborted) cb(aborted)\n else {\n busy = true\n map(data, function (err, data) {\n busy = false\n if(aborted) {\n cb(aborted)\n abortCb && abortCb(aborted)\n }\n else if(err) next (err, cb)\n else cb(null, data)\n })\n }\n })\n }\n }\n}\n\n\n\n\n\n\n\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","module.exports = require('events').EventEmitter;\n","var isFunction = require('./isFunction'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","'use strict';\n\nfunction createError(msg, code, props) {\n var err = msg instanceof Error ? msg : new Error(msg);\n var key;\n\n if (typeof code === 'object') {\n props = code;\n } else if (code != null) {\n err.code = code;\n }\n\n if (props) {\n for (key in props) {\n err[key] = props[key];\n }\n }\n\n return err;\n}\n\nmodule.exports = createError;\n","var EventEmitter = require('events').EventEmitter\nvar inherits = require('util').inherits\nvar extend = require('xtend')\nvar DeferredLevelDOWN = require('deferred-leveldown')\nvar IteratorStream = require('level-iterator-stream')\nvar Batch = require('./batch')\nvar errors = require('level-errors')\nvar assert = require('assert')\nvar promisify = require('./promisify')\nvar getCallback = require('./common').getCallback\nvar getOptions = require('./common').getOptions\n\nvar WriteError = errors.WriteError\nvar ReadError = errors.ReadError\nvar NotFoundError = errors.NotFoundError\nvar OpenError = errors.OpenError\nvar InitializationError = errors.InitializationError\n\n// Possible AbstractLevelDOWN#status values:\n// - 'new' - newly created, not opened or closed\n// - 'opening' - waiting for the database to be opened, post open()\n// - 'open' - successfully opened the database, available for use\n// - 'closing' - waiting for the database to be closed, post close()\n// - 'closed' - database has been successfully closed, should not be\n// used except for another open() operation\n\nfunction LevelUP (db, options, callback) {\n if (!(this instanceof LevelUP)) {\n return new LevelUP(db, options, callback)\n }\n\n var error\n\n EventEmitter.call(this)\n this.setMaxListeners(Infinity)\n\n if (typeof options === 'function') {\n callback = options\n options = {}\n }\n\n options = options || {}\n\n if (!db || typeof db !== 'object') {\n error = new InitializationError('First argument must be an abstract-leveldown compliant store')\n if (typeof callback === 'function') {\n return process.nextTick(callback, error)\n }\n throw error\n }\n\n assert.strictEqual(typeof db.status, 'string', '.status required, old abstract-leveldown')\n\n this.options = getOptions(options)\n this._db = db\n this.db = new DeferredLevelDOWN(db)\n this.open(callback)\n}\n\nLevelUP.prototype.emit = EventEmitter.prototype.emit\nLevelUP.prototype.once = EventEmitter.prototype.once\ninherits(LevelUP, EventEmitter)\n\nLevelUP.prototype.open = function (opts, callback) {\n var self = this\n var promise\n\n if (typeof opts === 'function') {\n callback = opts\n opts = null\n }\n\n if (!callback) {\n callback = promisify()\n promise = callback.promise\n }\n\n if (!opts) {\n opts = this.options\n }\n\n if (this.isOpen()) {\n process.nextTick(callback, null, self)\n return promise\n }\n\n if (this._isOpening()) {\n this.once('open', function () { callback(null, self) })\n return promise\n }\n\n this.emit('opening')\n\n this.db.open(opts, function (err) {\n if (err) {\n return callback(new OpenError(err))\n }\n self.db = self._db\n callback(null, self)\n self.emit('open')\n self.emit('ready')\n })\n\n return promise\n}\n\nLevelUP.prototype.close = function (callback) {\n var self = this\n var promise\n\n if (!callback) {\n callback = promisify()\n promise = callback.promise\n }\n\n if (this.isOpen()) {\n this.db.close(function () {\n self.emit('closed')\n callback.apply(null, arguments)\n })\n this.emit('closing')\n this.db = new DeferredLevelDOWN(this._db)\n } else if (this.isClosed()) {\n process.nextTick(callback)\n } else if (this.db.status === 'closing') {\n this.once('closed', callback)\n } else if (this._isOpening()) {\n this.once('open', function () {\n self.close(callback)\n })\n }\n\n return promise\n}\n\nLevelUP.prototype.isOpen = function () {\n return this.db.status === 'open'\n}\n\nLevelUP.prototype._isOpening = function () {\n return this.db.status === 'opening'\n}\n\nLevelUP.prototype.isClosed = function () {\n return (/^clos|new/).test(this.db.status)\n}\n\nLevelUP.prototype.get = function (key, options, callback) {\n if (key === null || key === undefined) {\n throw new ReadError('get() requires a key argument')\n }\n\n var promise\n\n callback = getCallback(options, callback)\n\n if (!callback) {\n callback = promisify()\n promise = callback.promise\n }\n\n if (maybeError(this, callback)) { return promise }\n\n options = getOptions(options)\n\n this.db.get(key, options, function (err, value) {\n if (err) {\n if ((/notfound/i).test(err) || err.notFound) {\n err = new NotFoundError('Key not found in database [' + key + ']', err)\n } else {\n err = new ReadError(err)\n }\n return callback(err)\n }\n callback(null, value)\n })\n\n return promise\n}\n\nLevelUP.prototype.put = function (key, value, options, callback) {\n if (key === null || key === undefined) {\n throw new WriteError('put() requires a key argument')\n }\n\n var self = this\n var promise\n\n callback = getCallback(options, callback)\n\n if (!callback) {\n callback = promisify()\n promise = callback.promise\n }\n\n if (maybeError(this, callback)) { return promise }\n\n options = getOptions(options)\n\n this.db.put(key, value, options, function (err) {\n if (err) {\n return callback(new WriteError(err))\n }\n self.emit('put', key, value)\n callback()\n })\n\n return promise\n}\n\nLevelUP.prototype.del = function (key, options, callback) {\n if (key === null || key === undefined) {\n throw new WriteError('del() requires a key argument')\n }\n\n var self = this\n var promise\n\n callback = getCallback(options, callback)\n\n if (!callback) {\n callback = promisify()\n promise = callback.promise\n }\n\n if (maybeError(this, callback)) { return promise }\n\n options = getOptions(options)\n\n this.db.del(key, options, function (err) {\n if (err) {\n return callback(new WriteError(err))\n }\n self.emit('del', key)\n callback()\n })\n\n return promise\n}\n\nLevelUP.prototype.batch = function (arr, options, callback) {\n if (!arguments.length) {\n return new Batch(this)\n }\n\n if (!Array.isArray(arr)) {\n throw new WriteError('batch() requires an array argument')\n }\n\n var self = this\n var promise\n\n callback = getCallback(options, callback)\n\n if (!callback) {\n callback = promisify()\n promise = callback.promise\n }\n\n if (maybeError(this, callback)) { return promise }\n\n options = getOptions(options)\n\n this.db.batch(arr, options, function (err) {\n if (err) {\n return callback(new WriteError(err))\n }\n self.emit('batch', arr)\n callback()\n })\n\n return promise\n}\n\nLevelUP.prototype.iterator = function (options) {\n return this.db.iterator(options)\n}\n\nLevelUP.prototype.readStream =\nLevelUP.prototype.createReadStream = function (options) {\n options = extend({ keys: true, values: true }, options)\n if (typeof options.limit !== 'number') { options.limit = -1 }\n return new IteratorStream(this.db.iterator(options), options)\n}\n\nLevelUP.prototype.keyStream =\nLevelUP.prototype.createKeyStream = function (options) {\n return this.createReadStream(extend(options, { keys: true, values: false }))\n}\n\nLevelUP.prototype.valueStream =\nLevelUP.prototype.createValueStream = function (options) {\n return this.createReadStream(extend(options, { keys: false, values: true }))\n}\n\nLevelUP.prototype.toString = function () {\n return 'LevelUP'\n}\n\nfunction maybeError (db, callback) {\n if (!db._isOpening() && !db.isOpen()) {\n process.nextTick(callback, new ReadError('Database is not open'))\n return true\n }\n}\n\nLevelUP.errors = errors\nmodule.exports = LevelUP.default = LevelUP\n","'use strict'\n\n/* eslint no-warning-comments: off */\n\nconst parallel = require('async/parallel')\nconst once = require('once')\nconst debug = require('debug')\nconst log = debug('libp2p:switch:transport')\n\nconst LimitDialer = require('./limit-dialer')\nconst { DIAL_TIMEOUT } = require('./constants')\nconst { uniqueBy } = require('./utils')\n\n// number of concurrent outbound dials to make per peer, same as go-libp2p-swtch\nconst defaultPerPeerRateLimit = 8\n\n/**\n * Manages the transports for the switch. This simplifies dialing and listening across\n * multiple transports.\n */\nclass TransportManager {\n constructor (_switch) {\n this.switch = _switch\n this.dialer = new LimitDialer(defaultPerPeerRateLimit, this.switch._options.dialTimeout || DIAL_TIMEOUT)\n }\n\n /**\n * Adds a `Transport` to the list of transports on the switch, and assigns it to the given key\n *\n * @param {String} key\n * @param {Transport} transport\n * @returns {void}\n */\n add (key, transport) {\n log('adding %s', key)\n if (this.switch.transports[key]) {\n throw new Error('There is already a transport with this key')\n }\n\n this.switch.transports[key] = transport\n if (!this.switch.transports[key].listeners) {\n this.switch.transports[key].listeners = []\n }\n }\n\n /**\n * Closes connections for the given transport key\n * and removes it from the switch.\n *\n * @param {String} key\n * @param {function(Error)} callback\n * @returns {void}\n */\n remove (key, callback) {\n callback = callback || function () {}\n\n if (!this.switch.transports[key]) {\n return callback()\n }\n\n this.close(key, (err) => {\n delete this.switch.transports[key]\n callback(err)\n })\n }\n\n /**\n * Calls `remove` on each transport the switch has\n *\n * @param {function(Error)} callback\n * @returns {void}\n */\n removeAll (callback) {\n const tasks = Object.keys(this.switch.transports).map((key) => {\n return (cb) => {\n this.remove(key, cb)\n }\n })\n\n parallel(tasks, callback)\n }\n\n /**\n * For a given transport `key`, dial to all that transport multiaddrs\n *\n * @param {String} key Key of the `Transport` to dial\n * @param {PeerInfo} peerInfo\n * @param {function(Error, Connection)} callback\n * @returns {void}\n */\n dial (key, peerInfo, callback) {\n const transport = this.switch.transports[key]\n let multiaddrs = peerInfo.multiaddrs.toArray()\n\n if (!Array.isArray(multiaddrs)) {\n multiaddrs = [multiaddrs]\n }\n\n // filter the multiaddrs that are actually valid for this transport\n multiaddrs = TransportManager.dialables(transport, multiaddrs, this.switch._peerInfo)\n log('dialing %s', key, multiaddrs.map((m) => m.toString()))\n\n // dial each of the multiaddrs with the given transport\n this.dialer.dialMany(peerInfo.id, transport, multiaddrs, (errors, success) => {\n if (errors) {\n return callback(errors)\n }\n\n peerInfo.connect(success.multiaddr)\n callback(null, success.conn)\n })\n }\n\n /**\n * For a given Transport `key`, listen on all multiaddrs in the switch's `_peerInfo`.\n * If a `handler` is not provided, the Switch's `protocolMuxer` will be used.\n *\n * @param {String} key\n * @param {*} _options Currently ignored\n * @param {function(Connection)} handler\n * @param {function(Error)} callback\n * @returns {void}\n */\n listen (key, _options, handler, callback) {\n handler = this.switch._connectionHandler(key, handler)\n\n const transport = this.switch.transports[key]\n let originalAddrs = this.switch._peerInfo.multiaddrs.toArray()\n\n // Until TCP can handle distinct addresses on listen, https://github.com/libp2p/interface-transport/issues/41,\n // make sure we aren't trying to listen on duplicate ports. This also applies to websockets.\n originalAddrs = uniqueBy(originalAddrs, (addr) => {\n // Any non 0 port should register as unique\n const port = Number(addr.toOptions().port)\n return isNaN(port) || port === 0 ? addr.toString() : port\n })\n\n const multiaddrs = TransportManager.dialables(transport, originalAddrs)\n\n if (!transport.listeners) {\n transport.listeners = []\n }\n\n let freshMultiaddrs = []\n\n const createListeners = multiaddrs.map((ma) => {\n return (cb) => {\n const done = once(cb)\n const listener = transport.createListener(handler)\n listener.once('error', done)\n\n listener.listen(ma, (err) => {\n if (err) {\n return done(err)\n }\n listener.removeListener('error', done)\n listener.getAddrs((err, addrs) => {\n if (err) {\n return done(err)\n }\n freshMultiaddrs = freshMultiaddrs.concat(addrs)\n transport.listeners.push(listener)\n done()\n })\n })\n }\n })\n\n parallel(createListeners, (err) => {\n if (err) {\n return callback(err)\n }\n\n // cause we can listen on port 0 or 0.0.0.0\n this.switch._peerInfo.multiaddrs.replace(multiaddrs, freshMultiaddrs)\n callback()\n })\n }\n\n /**\n * Closes the transport with the given key, by closing all of its listeners\n *\n * @param {String} key\n * @param {function(Error)} callback\n * @returns {void}\n */\n close (key, callback) {\n const transport = this.switch.transports[key]\n\n if (!transport) {\n return callback(new Error(`Trying to close non existing transport: ${key}`))\n }\n\n parallel(transport.listeners.map((listener) => {\n return (cb) => {\n listener.close(cb)\n }\n }), callback)\n }\n\n /**\n * For a given transport, return its multiaddrs that match the given multiaddrs\n *\n * @param {Transport} transport\n * @param {Array} multiaddrs\n * @param {PeerInfo} peerInfo Optional - a peer whose addresses should not be returned\n * @returns {Array}\n */\n static dialables (transport, multiaddrs, peerInfo) {\n // If we dont have a proper transport, return no multiaddrs\n if (!transport || !transport.filter) return []\n\n const transportAddrs = transport.filter(multiaddrs)\n if (!peerInfo || !transportAddrs.length) {\n return transportAddrs\n }\n\n const ourAddrs = ourAddresses(peerInfo)\n\n const result = transportAddrs.filter(transportAddr => {\n // If our address is in the destination address, filter it out\n return !ourAddrs.some(a => getDestination(transportAddr).startsWith(a))\n })\n\n return result\n }\n}\n\n/**\n * Expand addresses in peer info into array of addresses with and without peer\n * ID suffix.\n *\n * @param {PeerInfo} peerInfo Our peer info object\n * @returns {String[]}\n */\nfunction ourAddresses (peerInfo) {\n const ourPeerId = peerInfo.id.toB58String()\n return peerInfo.multiaddrs.toArray()\n .reduce((ourAddrs, addr) => {\n const peerId = addr.getPeerId()\n addr = addr.toString()\n const otherAddr = peerId\n ? addr.slice(0, addr.lastIndexOf(`/ipfs/${peerId}`))\n : `${addr}/ipfs/${ourPeerId}`\n return ourAddrs.concat([addr, otherAddr])\n }, [])\n .filter(a => Boolean(a))\n .concat(`/ipfs/${ourPeerId}`)\n}\n\nconst RelayProtos = [\n 'p2p-circuit',\n 'p2p-websocket-star',\n 'p2p-webrtc-star',\n 'p2p-stardust'\n]\n\n/**\n * Get the destination address of a (possibly relay) multiaddr as a string\n *\n * @param {Multiaddr} addr\n * @returns {String}\n */\nfunction getDestination (addr) {\n const protos = addr.protoNames().reverse()\n const splitProto = protos.find(p => RelayProtos.includes(p))\n addr = addr.toString()\n if (!splitProto) return addr\n return addr.slice(addr.lastIndexOf(splitProto) + splitProto.length)\n}\n\nmodule.exports = TransportManager\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n'use strict';\n/**/\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n\n for (var key in obj) {\n keys.push(key);\n }\n\n return keys;\n};\n/**/\n\n\nmodule.exports = Duplex;\n\nvar Readable = require('./_stream_readable');\n\nvar Writable = require('./_stream_writable');\n\nrequire('inherits')(Duplex, Readable);\n\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n}); // the no-half-open enforcer\n\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return; // no more data can be written.\n // But allow more writes to happen in this tick.\n\n process.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});","/**\n * Password-Based Key-Derivation Function #2 implementation.\n *\n * See RFC 2898 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nrequire('./hmac');\nrequire('./md');\nrequire('./util');\n\nvar pkcs5 = forge.pkcs5 = forge.pkcs5 || {};\n\nvar crypto;\nif(forge.util.isNodejs && !forge.options.usePureJavaScript) {\n crypto = require('crypto');\n}\n\n/**\n * Derives a key from a password.\n *\n * @param p the password as a binary-encoded string of bytes.\n * @param s the salt as a binary-encoded string of bytes.\n * @param c the iteration count, a positive integer.\n * @param dkLen the intended length, in bytes, of the derived key,\n * (max: 2^32 - 1) * hash length of the PRF.\n * @param [md] the message digest (or algorithm identifier as a string) to use\n * in the PRF, defaults to SHA-1.\n * @param [callback(err, key)] presence triggers asynchronous version, called\n * once the operation completes.\n *\n * @return the derived key, as a binary-encoded string of bytes, for the\n * synchronous version (if no callback is specified).\n */\nmodule.exports = forge.pbkdf2 = pkcs5.pbkdf2 = function(\n p, s, c, dkLen, md, callback) {\n if(typeof md === 'function') {\n callback = md;\n md = null;\n }\n\n // use native implementation if possible and not disabled, note that\n // some node versions only support SHA-1, others allow digest to be changed\n if(forge.util.isNodejs && !forge.options.usePureJavaScript &&\n crypto.pbkdf2 && (md === null || typeof md !== 'object') &&\n (crypto.pbkdf2Sync.length > 4 || (!md || md === 'sha1'))) {\n if(typeof md !== 'string') {\n // default prf to SHA-1\n md = 'sha1';\n }\n p = Buffer.from(p, 'binary');\n s = Buffer.from(s, 'binary');\n if(!callback) {\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2Sync(p, s, c, dkLen).toString('binary');\n }\n return crypto.pbkdf2Sync(p, s, c, dkLen, md).toString('binary');\n }\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2(p, s, c, dkLen, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n return crypto.pbkdf2(p, s, c, dkLen, md, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n\n if(typeof md === 'undefined' || md === null) {\n // default prf to SHA-1\n md = 'sha1';\n }\n if(typeof md === 'string') {\n if(!(md in forge.md.algorithms)) {\n throw new Error('Unknown hash algorithm: ' + md);\n }\n md = forge.md[md].create();\n }\n\n var hLen = md.digestLength;\n\n /* 1. If dkLen > (2^32 - 1) * hLen, output \"derived key too long\" and\n stop. */\n if(dkLen > (0xFFFFFFFF * hLen)) {\n var err = new Error('Derived key is too long.');\n if(callback) {\n return callback(err);\n }\n throw err;\n }\n\n /* 2. Let len be the number of hLen-octet blocks in the derived key,\n rounding up, and let r be the number of octets in the last\n block:\n\n len = CEIL(dkLen / hLen),\n r = dkLen - (len - 1) * hLen. */\n var len = Math.ceil(dkLen / hLen);\n var r = dkLen - (len - 1) * hLen;\n\n /* 3. For each block of the derived key apply the function F defined\n below to the password P, the salt S, the iteration count c, and\n the block index to compute the block:\n\n T_1 = F(P, S, c, 1),\n T_2 = F(P, S, c, 2),\n ...\n T_len = F(P, S, c, len),\n\n where the function F is defined as the exclusive-or sum of the\n first c iterates of the underlying pseudorandom function PRF\n applied to the password P and the concatenation of the salt S\n and the block index i:\n\n F(P, S, c, i) = u_1 XOR u_2 XOR ... XOR u_c\n\n where\n\n u_1 = PRF(P, S || INT(i)),\n u_2 = PRF(P, u_1),\n ...\n u_c = PRF(P, u_{c-1}).\n\n Here, INT(i) is a four-octet encoding of the integer i, most\n significant octet first. */\n var prf = forge.hmac.create();\n prf.start(md, p);\n var dk = '';\n var xor, u_c, u_c1;\n\n // sync version\n if(!callback) {\n for(var i = 1; i <= len; ++i) {\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n for(var j = 2; j <= c; ++j) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n }\n /* 5. Output the derived key DK. */\n return dk;\n }\n\n // async version\n var i = 1, j;\n function outer() {\n if(i > len) {\n // done\n return callback(null, dk);\n }\n\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n j = 2;\n inner();\n }\n\n function inner() {\n if(j <= c) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n ++j;\n return forge.util.setImmediate(inner);\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n\n ++i;\n outer();\n }\n\n outer();\n};\n","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _toConsumableArray2 = _interopRequireDefault(require(\"@babel/runtime/helpers/toConsumableArray\"));\n\nvar _regenerator = _interopRequireDefault(require(\"@babel/runtime/regenerator\"));\n\nvar _asyncToGenerator2 = _interopRequireDefault(require(\"@babel/runtime/helpers/asyncToGenerator\"));\n\nvar _classCallCheck2 = _interopRequireDefault(require(\"@babel/runtime/helpers/classCallCheck\"));\n\nvar _createClass2 = _interopRequireDefault(require(\"@babel/runtime/helpers/createClass\"));\n\nvar _possibleConstructorReturn2 = _interopRequireDefault(require(\"@babel/runtime/helpers/possibleConstructorReturn\"));\n\nvar _getPrototypeOf2 = _interopRequireDefault(require(\"@babel/runtime/helpers/getPrototypeOf\"));\n\nvar _inherits2 = _interopRequireDefault(require(\"@babel/runtime/helpers/inherits\"));\n\nvar EventEmitter = require('events').EventEmitter;\n\nvar _require = require('did-jwt'),\n verifyJWT = _require.verifyJWT;\n\nvar Room = require('ipfs-pubsub-room');\n\nvar DEFAULT_BACKLOG_LIMIT = 100;\n\nvar GhostThread =\n/*#__PURE__*/\nfunction (_EventEmitter) {\n (0, _inherits2[\"default\"])(GhostThread, _EventEmitter);\n\n function GhostThread(name, _ref) {\n var _this;\n\n var ipfs = _ref.ipfs;\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n (0, _classCallCheck2[\"default\"])(this, GhostThread);\n _this = (0, _possibleConstructorReturn2[\"default\"])(this, (0, _getPrototypeOf2[\"default\"])(GhostThread).call(this));\n _this._name = name;\n _this._spaceName = name.split('.')[2];\n _this._room = Room(ipfs, name); // instance of ipfs pubsub room\n\n _this._ipfs = ipfs;\n _this._peerId = ipfs._peerInfo.id.toB58String();\n _this._members = {};\n _this._backlog = new Set(); // set of past messages\n\n _this._backlogLimit = opts.ghostBacklogLimit || DEFAULT_BACKLOG_LIMIT;\n _this._filters = opts.ghostFilters || [];\n\n _this._room.on('message',\n /*#__PURE__*/\n function () {\n var _ref3 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee(_ref2) {\n var from, data, payload, issuer, verified, passesFilters;\n return _regenerator[\"default\"].wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n from = _ref2.from, data = _ref2.data;\n\n if (!data.toString().startsWith('{')) {\n _context.next = 7;\n break;\n }\n\n // we got a non signed message (can only be backlog request, or response)\n payload = JSON.parse(data);\n\n if (!(payload.type !== 'request_backlog' && payload.type !== 'backlog_response')) {\n _context.next = 5;\n break;\n }\n\n return _context.abrupt(\"return\");\n\n case 5:\n _context.next = 12;\n break;\n\n case 7:\n _context.next = 9;\n return _this._verifyData(data);\n\n case 9:\n verified = _context.sent;\n payload = verified.payload;\n issuer = verified.issuer;\n\n case 12:\n // we pass the payload, issuer and peerID (from) to each filter in our filters array and reduce the value to a single boolean\n // this boolean indicates whether the message passed the filters\n passesFilters = _this._filters.reduce(function (acc, filter) {\n return acc && filter(payload, issuer, from);\n }, true);\n\n if (!(payload && passesFilters)) {\n _context.next = 25;\n break;\n }\n\n _context.t0 = payload.type;\n _context.next = _context.t0 === 'join' ? 17 : _context.t0 === 'request_backlog' ? 19 : _context.t0 === 'backlog_response' ? 21 : 24;\n break;\n\n case 17:\n _this._userJoined(issuer, from);\n\n return _context.abrupt(\"break\", 25);\n\n case 19:\n _this.getPosts(_this._backlogLimit).then(function (posts) {\n return _this._sendDirect({\n type: 'backlog_response',\n message: posts\n }, from, true);\n });\n\n return _context.abrupt(\"break\", 25);\n\n case 21:\n payload.message.map(function (msg) {\n _this._backlog.add(JSON.stringify(msg));\n });\n\n _this.emit('backlog-received', {\n type: 'backlog',\n author: issuer,\n message: payload.message,\n timestamp: payload.iat\n });\n\n return _context.abrupt(\"break\", 25);\n\n case 24:\n _this._messageReceived(payload);\n\n case 25:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function (_x) {\n return _ref3.apply(this, arguments);\n };\n }());\n\n _this._room.on('peer joined', function (peer) {\n _this._announce(peer);\n\n _this._requestBacklog(peer);\n });\n\n _this._room.on('peer left', function (peer) {\n return _this._userLeft(peer);\n });\n\n return _this;\n }\n\n (0, _createClass2[\"default\"])(GhostThread, [{\n key: \"_set3id\",\n value: function _set3id(threeId) {\n var _this2 = this;\n\n this._3id = threeId; // announce to other peers that we are online\n\n this.listMembers().then(function (members) {\n _this2._room.getPeers().map(function (id) {\n _this2._announce(id);\n });\n });\n }\n /**\n * Get a list of users online\n *\n * @return {Array} users online\n */\n\n }, {\n key: \"listMembers\",\n value: function () {\n var _listMembers = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee2() {\n return _regenerator[\"default\"].wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", Object.keys(this._members).filter(function (id) {\n return !id.startsWith('Qm');\n }));\n\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function listMembers() {\n return _listMembers.apply(this, arguments);\n }\n\n return listMembers;\n }()\n /**\n * Get a peerId's corresponding 3ID\n *\n * @param {String} did The DID of the user\n * @return {String} ipfs peer id\n */\n\n }, {\n key: \"_threeIdToPeerId\",\n value: function _threeIdToPeerId(did) {\n return this._members[did];\n }\n /**\n * Get backlog of all past messages\n *\n * @return {Array} users online\n */\n\n }, {\n key: \"getPosts\",\n value: function () {\n var _getPosts = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee3() {\n var num,\n posts,\n _args3 = arguments;\n return _regenerator[\"default\"].wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n num = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : 0;\n posts = (0, _toConsumableArray2[\"default\"])(this._backlog).map(function (msg) {\n return JSON.parse(msg);\n }).sort(function (p1, p2) {\n return p1.timestamp - p2.timestamp;\n }).slice(-num);\n return _context3.abrupt(\"return\", posts);\n\n case 3:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function getPosts() {\n return _getPosts.apply(this, arguments);\n }\n\n return getPosts;\n }()\n /**\n * Announce entry in chat and share our 3id and peerID\n *\n * @param {String} to The PeerID of a user (optional)\n */\n\n }, {\n key: \"_announce\",\n value: function () {\n var _announce2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee4(to) {\n return _regenerator[\"default\"].wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!this._3id) {\n _context4.next = 8;\n break;\n }\n\n if (to) {\n _context4.next = 6;\n break;\n }\n\n _context4.next = 4;\n return this._broadcast({\n type: 'join'\n });\n\n case 4:\n _context4.next = 8;\n break;\n\n case 6:\n _context4.next = 8;\n return this._sendDirect({\n type: 'join'\n }, to);\n\n case 8:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n\n function _announce(_x2) {\n return _announce2.apply(this, arguments);\n }\n\n return _announce;\n }()\n /**\n * Post a message to the thread\n *\n * @param {Object} message The message\n * @param {String} to PeerID to send the message to (optional)\n */\n\n }, {\n key: \"post\",\n value: function () {\n var _post = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee5(message, to) {\n return _regenerator[\"default\"].wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n if (to) {\n _context5.next = 5;\n break;\n }\n\n _context5.next = 3;\n return this._broadcast({\n type: 'chat',\n message: message\n });\n\n case 3:\n _context5.next = 7;\n break;\n\n case 5:\n _context5.next = 7;\n return this._sendDirect({\n type: 'chat',\n message: message\n }, to);\n\n case 7:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n\n function post(_x3, _x4) {\n return _post.apply(this, arguments);\n }\n\n return post;\n }()\n }, {\n key: \"deletePost\",\n value: function () {\n var _deletePost = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee6(hash) {\n return _regenerator[\"default\"].wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n throw new Error('Not possible to delete post in Ghost Thread');\n\n case 1:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n\n function deletePost(_x5) {\n return _deletePost.apply(this, arguments);\n }\n\n return deletePost;\n }()\n }, {\n key: \"addModerator\",\n value: function () {\n var _addModerator = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee7(id) {\n return _regenerator[\"default\"].wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n throw new Error('Not possible to add moderator in Ghost Thread');\n\n case 1:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n }));\n\n function addModerator(_x6) {\n return _addModerator.apply(this, arguments);\n }\n\n return addModerator;\n }()\n }, {\n key: \"listModerators\",\n value: function () {\n var _listModerators = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee8() {\n return _regenerator[\"default\"].wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n throw new Error('Not possible to list moderators in Ghost Thread');\n\n case 1:\n case \"end\":\n return _context8.stop();\n }\n }\n }, _callee8);\n }));\n\n function listModerators() {\n return _listModerators.apply(this, arguments);\n }\n\n return listModerators;\n }()\n }, {\n key: \"addMember\",\n value: function () {\n var _addMember = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee9(id) {\n return _regenerator[\"default\"].wrap(function _callee9$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n throw new Error('Not possible to add member in Ghost Thread');\n\n case 1:\n case \"end\":\n return _context9.stop();\n }\n }\n }, _callee9);\n }));\n\n function addMember(_x7) {\n return _addMember.apply(this, arguments);\n }\n\n return addMember;\n }()\n /**\n * Request a backlog of past messages from peers in the chat\n *\n * @param {String} to The PeerID of a user (optional)\n */\n\n }, {\n key: \"_requestBacklog\",\n value: function () {\n var _requestBacklog2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee10(to) {\n return _regenerator[\"default\"].wrap(function _callee10$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n if (to) {\n _context10.next = 5;\n break;\n }\n\n _context10.next = 3;\n return this._broadcast({\n type: 'request_backlog'\n });\n\n case 3:\n _context10.next = 7;\n break;\n\n case 5:\n _context10.next = 7;\n return this._sendDirect({\n type: 'request_backlog'\n }, to, true);\n\n case 7:\n case \"end\":\n return _context10.stop();\n }\n }\n }, _callee10, this);\n }));\n\n function _requestBacklog(_x8) {\n return _requestBacklog2.apply(this, arguments);\n }\n\n return _requestBacklog;\n }()\n /**\n * Leave the chat\n *\n */\n\n }, {\n key: \"close\",\n value: function () {\n var _close = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee11() {\n return _regenerator[\"default\"].wrap(function _callee11$(_context11) {\n while (1) {\n switch (_context11.prev = _context11.next) {\n case 0:\n _context11.next = 2;\n return this._room.leave();\n\n case 2:\n case \"end\":\n return _context11.stop();\n }\n }\n }, _callee11, this);\n }));\n\n function close() {\n return _close.apply(this, arguments);\n }\n\n return close;\n }()\n /**\n * Broadcast a message to peers in the room\n *\n * @param {Object} message The message\n */\n\n }, {\n key: \"_broadcast\",\n value: function () {\n var _broadcast2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee12(message, noSignature) {\n var payload;\n return _regenerator[\"default\"].wrap(function _callee12$(_context12) {\n while (1) {\n switch (_context12.prev = _context12.next) {\n case 0:\n if (!(!this._3id ? !noSignature : false)) {\n _context12.next = 2;\n break;\n }\n\n throw new Error('Can not send message if not authenticated');\n\n case 2:\n if (!noSignature) {\n _context12.next = 6;\n break;\n }\n\n _context12.t0 = JSON.stringify(message);\n _context12.next = 9;\n break;\n\n case 6:\n _context12.next = 8;\n return this._3id.signJWT(message);\n\n case 8:\n _context12.t0 = _context12.sent;\n\n case 9:\n payload = _context12.t0;\n\n this._room.broadcast(payload);\n\n case 11:\n case \"end\":\n return _context12.stop();\n }\n }\n }, _callee12, this);\n }));\n\n function _broadcast(_x9, _x10) {\n return _broadcast2.apply(this, arguments);\n }\n\n return _broadcast;\n }()\n /**\n * Send a direct message to a peer\n *\n * @param {Object} message The message\n * @param {String} to The PeerID or 3ID of the receiver\n */\n\n }, {\n key: \"_sendDirect\",\n value: function () {\n var _sendDirect2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee13(message, to, noSignature) {\n var payload;\n return _regenerator[\"default\"].wrap(function _callee13$(_context13) {\n while (1) {\n switch (_context13.prev = _context13.next) {\n case 0:\n if (!(!this._3id ? !noSignature : false)) {\n _context13.next = 2;\n break;\n }\n\n throw new Error('Can not send message if not authenticated');\n\n case 2:\n if (!noSignature) {\n _context13.next = 6;\n break;\n }\n\n _context13.t0 = JSON.stringify(message);\n _context13.next = 9;\n break;\n\n case 6:\n _context13.next = 8;\n return this._3id.signJWT(message);\n\n case 8:\n _context13.t0 = _context13.sent;\n\n case 9:\n payload = _context13.t0;\n to.startsWith('Qm') ? this._room.sendTo(to, payload) : this._room.sendTo(this._threeIdToPeerId(to), payload);\n\n case 11:\n case \"end\":\n return _context13.stop();\n }\n }\n }, _callee13, this);\n }));\n\n function _sendDirect(_x11, _x12, _x13) {\n return _sendDirect2.apply(this, arguments);\n }\n\n return _sendDirect;\n }()\n /**\n * Register a function to be called after new updates\n * have been received from the network or locally.\n *\n * @param {Function} updateFn The function that will get called\n */\n\n }, {\n key: \"onUpdate\",\n value: function onUpdate(updateFn) {\n this.removeAllListeners('message');\n this.removeAllListeners('backlog-received');\n this.on('message', updateFn);\n this.on('backlog-received', updateFn);\n }\n /**\n * Register a function to be called after new capabilities\n * have been received from the network or locally.\n *\n * @param {Function} updateFn The function that will get called\n */\n\n }, {\n key: \"onNewCapabilities\",\n value: function onNewCapabilities(updateFn) {\n this.removeAllListeners('user-joined');\n this.removeAllListeners('user-left');\n this.on('user-joined', updateFn);\n this.on('user-left', updateFn);\n }\n /**\n * Handler function for users joining\n *\n * @param {String} did The DID of the user\n * @param {Object} peerID The peerID of the user\n */\n\n }, {\n key: \"_userJoined\",\n value: function () {\n var _userJoined2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee14(did, peerID) {\n var members;\n return _regenerator[\"default\"].wrap(function _callee14$(_context14) {\n while (1) {\n switch (_context14.prev = _context14.next) {\n case 0:\n _context14.next = 2;\n return this.listMembers();\n\n case 2:\n members = _context14.sent;\n\n if (!members.includes(did) && (!this._3id || this._3id.DID !== did)) {\n this._members[did] = peerID;\n this._members[peerID] = did;\n this.emit('user-joined', 'joined', did, peerID);\n }\n\n case 4:\n case \"end\":\n return _context14.stop();\n }\n }\n }, _callee14, this);\n }));\n\n function _userJoined(_x14, _x15) {\n return _userJoined2.apply(this, arguments);\n }\n\n return _userJoined;\n }()\n /**\n * Handler function for users leaving\n *\n * @param {String} peerID The peerID of the user\n */\n\n }, {\n key: \"_userLeft\",\n value: function () {\n var _userLeft2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee15(peerID) {\n var did;\n return _regenerator[\"default\"].wrap(function _callee15$(_context15) {\n while (1) {\n switch (_context15.prev = _context15.next) {\n case 0:\n did = this._members[peerID];\n delete this._members[did];\n delete this._members[peerID];\n this.emit('user-left', 'left', did, peerID);\n\n case 4:\n case \"end\":\n return _context15.stop();\n }\n }\n }, _callee15, this);\n }));\n\n function _userLeft(_x16) {\n return _userLeft2.apply(this, arguments);\n }\n\n return _userLeft;\n }()\n /**\n * Handler function for received messages\n *\n * @param {String} issuer The issuer of the message\n * @param {Object} payload The payload of the message\n */\n\n }, {\n key: \"_messageReceived\",\n value: function () {\n var _messageReceived2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee16(payload) {\n var type, message, author, timestamp, postId;\n return _regenerator[\"default\"].wrap(function _callee16$(_context16) {\n while (1) {\n switch (_context16.prev = _context16.next) {\n case 0:\n type = payload.type, message = payload.message, author = payload.iss, timestamp = payload.iat, postId = payload.postId;\n\n this._backlog.add(JSON.stringify({\n type: type,\n author: author,\n message: message,\n timestamp: timestamp,\n postId: postId\n }));\n\n this.emit('message', {\n type: type,\n author: author,\n message: message,\n timestamp: timestamp,\n postId: postId\n });\n\n case 3:\n case \"end\":\n return _context16.stop();\n }\n }\n }, _callee16, this);\n }));\n\n function _messageReceived(_x17) {\n return _messageReceived2.apply(this, arguments);\n }\n\n return _messageReceived;\n }()\n /**\n * Verifies the data received\n *\n * @param {Buffer} data A buffer of the jwt\n * @return {JWT} A verified JWT with our payload and issuer\n */\n\n }, {\n key: \"_verifyData\",\n value: function () {\n var _verifyData2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee17(data) {\n var jwt, cidPromise, verified;\n return _regenerator[\"default\"].wrap(function _callee17$(_context17) {\n while (1) {\n switch (_context17.prev = _context17.next) {\n case 0:\n jwt = data.toString();\n cidPromise = this._ipfs.dag.put(jwt);\n _context17.prev = 2;\n _context17.next = 5;\n return verifyJWT(jwt);\n\n case 5:\n verified = _context17.sent;\n _context17.next = 8;\n return cidPromise;\n\n case 8:\n verified.payload.postId = _context17.sent.toString();\n return _context17.abrupt(\"return\", verified);\n\n case 12:\n _context17.prev = 12;\n _context17.t0 = _context17[\"catch\"](2);\n console.log(_context17.t0);\n\n case 15:\n case \"end\":\n return _context17.stop();\n }\n }\n }, _callee17, this, [[2, 12]]);\n }));\n\n function _verifyData(_x18) {\n return _verifyData2.apply(this, arguments);\n }\n\n return _verifyData;\n }()\n }, {\n key: \"isGhost\",\n get: function get() {\n return true;\n }\n }]);\n return GhostThread;\n}(EventEmitter);\n\nmodule.exports = GhostThread;","/* globals self, window, global */\n/* eslint no-negated-condition: 0, no-new-func: 0 */\n\n'use strict';\n\nif (typeof self !== 'undefined') {\n\tmodule.exports = self;\n} else if (typeof window !== 'undefined') {\n\tmodule.exports = window;\n} else if (typeof global !== 'undefined') {\n\tmodule.exports = global;\n} else {\n\tmodule.exports = Function('return this')();\n}\n","exports.AbstractLevelDOWN = require('./abstract-leveldown')\nexports.AbstractIterator = require('./abstract-iterator')\nexports.AbstractChainedBatch = require('./abstract-chained-batch')\n","'use strict'\n\nconst multiaddr = require('multiaddr')\n\nfunction ensureMultiaddr (ma) {\n if (multiaddr.isMultiaddr(ma)) {\n return ma\n }\n\n return multiaddr(ma)\n}\n\nmodule.exports = {\n ensureMultiaddr: ensureMultiaddr\n}\n","exports.AbstractLevelDOWN = require('./abstract-leveldown')\nexports.AbstractIterator = require('./abstract-iterator')\nexports.AbstractChainedBatch = require('./abstract-chained-batch')\n","function promisify () {\n var callback\n var promise = new Promise(function (resolve, reject) {\n callback = function callback (err, value) {\n if (err) reject(err)\n else resolve(value)\n }\n })\n callback.promise = promise\n return callback\n}\n\nmodule.exports = promisify\n","'use strict'\n\nconst path = require('path')\nconst os = require('os')\nconst uuid = require('uuid/v4')\n\nexports.filter = (iterable, filterer) => {\n return (async function * () {\n for await (const value of iterable) {\n const keep = await filterer(value)\n if (!keep) continue\n yield value\n }\n })()\n}\n\n// Not just sort, because the sorter is given all the values and should return\n// them all sorted\nexports.sortAll = (iterable, sorter) => {\n return (async function * () {\n let values = []\n for await (const value of iterable) values.push(value)\n values = await sorter(values)\n for (const value of values) yield value\n })()\n}\n\nexports.take = (iterable, n) => {\n return (async function * () {\n if (n <= 0) return\n let i = 0\n for await (const value of iterable) {\n yield value\n i++\n if (i >= n) return\n }\n })()\n}\n\nexports.map = (iterable, mapper) => {\n return (async function * () {\n for await (const value of iterable) {\n yield mapper(value)\n }\n })()\n}\n\nexports.replaceStartWith = function (s, r) {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n\nexports.tmpdir = () => {\n return path.join(os.tmpdir(), uuid())\n}\n","export const version = \"bytes/5.0.0-beta.136\";\n","\"use strict\";\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nexport function isBytesLike(value) {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\nexport function isBytes(value) {\n if (value == null) {\n return false;\n }\n if (value.constructor === Uint8Array) {\n return true;\n }\n if (typeof (value) === \"string\") {\n return false;\n }\n if (value.length == null) {\n return false;\n }\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (v < 0 || v >= 256 || (v % 1)) {\n return false;\n }\n }\n return true;\n}\nexport function arrayify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value /= 256;\n }\n if (result.length === 0) {\n result.push(0);\n }\n return addSlice(new Uint8Array(result));\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (isHexString(value)) {\n let hex = value.substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0x0\" + hex.substring(2);\n }\n else if (options.hexPad === \"right\") {\n hex += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\nexport function concat(items) {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n const result = new Uint8Array(length);\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n return addSlice(result);\n}\nexport function stripZeros(value) {\n let result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nexport function zeroPad(value, length) {\n value = arrayify(value);\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n const result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nexport function isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nconst HexCharacters = \"0123456789abcdef\";\nexport function hexlify(value, options) {\n if (!options) {\n options = {};\n }\n if (typeof (value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0x0f] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = \"0\" + hex;\n }\n return \"0x\" + hex;\n }\n return \"0x00\";\n }\n if (options.allowMissingPrefix && typeof (value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (isHexString(value)) {\n if (value.length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + value.substring(2);\n }\n else if (options.hexPad === \"right\") {\n value += \"0\";\n }\n else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return value.toLowerCase();\n }\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nexport function hexDataLength(data) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nexport function hexDataSlice(data, offset, endOffset) {\n if (typeof (data) !== \"string\") {\n data = hexlify(data);\n }\n else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data);\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n return \"0x\" + data.substring(offset);\n}\nexport function hexConcat(items) {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\nexport function hexValue(value) {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") {\n return \"0x0\";\n }\n return trimmed;\n}\nexport function hexStripZeros(value) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") {\n offset++;\n }\n return \"0x\" + value.substring(offset);\n}\nexport function hexZeroPad(value, length) {\n if (typeof (value) !== \"string\") {\n value = hexlify(value);\n }\n else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n return value;\n}\nexport function splitSignature(signature) {\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0\n };\n if (isBytesLike(signature)) {\n const bytes = arrayify(signature);\n if (bytes.length !== 65) {\n logger.throwArgumentError(\"invalid signature string; must be 65 bytes\", \"signature\", signature);\n }\n // Get the r, s and v\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n }\n else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) {\n bytes[32] |= 0x80;\n }\n result._vs = hexlify(bytes.slice(32, 64));\n }\n else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1 : 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n }\n else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n }\n else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n }\n else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n }\n else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n }\n else if (result.recoveryParam !== (1 - (result.v % 2))) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n }\n else {\n result.r = hexZeroPad(result.r, 32);\n }\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n }\n else {\n result.s = hexZeroPad(result.s, 32);\n }\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) {\n vs[0] |= 0x80;\n }\n const _vs = hexlify(vs);\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n }\n else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n return result;\n}\nexport function joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\" : \"0x1b\")\n ]));\n}\n","var AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN\nvar inherits = require('inherits')\nvar DeferredIterator = require('./deferred-iterator')\nvar deferrables = 'put get del batch'.split(' ')\n\nfunction DeferredLevelDOWN (db) {\n AbstractLevelDOWN.call(this, '')\n this._db = db\n this._operations = []\n this._iterators = []\n closed(this)\n}\n\ninherits(DeferredLevelDOWN, AbstractLevelDOWN)\n\nDeferredLevelDOWN.prototype._open = function (options, callback) {\n var self = this\n\n this._db.open(options, function (err) {\n if (err) return callback(err)\n\n self._operations.forEach(function (op) {\n self._db[op.method].apply(self._db, op.args)\n })\n self._operations = []\n self._iterators.forEach(function (it) {\n it.setDb(self._db)\n })\n self._iterators = []\n open(self)\n callback()\n })\n}\n\nDeferredLevelDOWN.prototype._close = function (callback) {\n var self = this\n\n this._db.close(function (err) {\n if (err) return callback(err)\n closed(self)\n callback()\n })\n}\n\nfunction open (self) {\n deferrables.concat('iterator').forEach(function (m) {\n self['_' + m] = function () {\n return this._db[m].apply(this._db, arguments)\n }\n })\n if (self._db.approximateSize) {\n self.approximateSize = function () {\n return this._db.approximateSize.apply(this._db, arguments)\n }\n }\n}\n\nfunction closed (self) {\n deferrables.forEach(function (m) {\n self['_' + m] = function () {\n this._operations.push({ method: m, args: arguments })\n }\n })\n if (typeof self._db.approximateSize === 'function') {\n self.approximateSize = function () {\n this._operations.push({\n method: 'approximateSize',\n args: arguments\n })\n }\n }\n self._iterator = function (options) {\n var it = new DeferredIterator(options)\n this._iterators.push(it)\n return it\n }\n}\n\nDeferredLevelDOWN.prototype._serializeKey = function (key) {\n return key\n}\n\nDeferredLevelDOWN.prototype._serializeValue = function (value) {\n return value\n}\n\nmodule.exports = DeferredLevelDOWN\nmodule.exports.DeferredIterator = DeferredIterator\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var tokenize = require('./tokenize')\nvar MAX_RANGE = 0x1FFFFFFF\n\n// \"Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared \"packed\".\"\n// https://developers.google.com/protocol-buffers/docs/encoding#optional\nvar PACKABLE_TYPES = [\n // varint wire types\n 'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64', 'bool',\n // + ENUMS\n // 64-bit wire types\n 'fixed64', 'sfixed64', 'double',\n // 32-bit wire types\n 'fixed32', 'sfixed32', 'float'\n]\n\nvar onfieldoptions = function (tokens) {\n var opts = {}\n\n while (tokens.length) {\n switch (tokens[0]) {\n case '[':\n case ',':\n tokens.shift()\n var name = tokens.shift()\n if (name === '(') { // handling [(A) = B]\n name = tokens.shift()\n tokens.shift() // remove the end of bracket\n }\n if (tokens[0] !== '=') throw new Error('Unexpected token in field options: ' + tokens[0])\n tokens.shift()\n if (tokens[0] === ']') throw new Error('Unexpected ] in field option')\n opts[name] = tokens.shift()\n break\n case ']':\n tokens.shift()\n return opts\n\n default:\n throw new Error('Unexpected token in field options: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for field options')\n}\n\nvar onfield = function (tokens) {\n var field = {\n name: null,\n type: null,\n tag: -1,\n map: null,\n oneof: null,\n required: false,\n repeated: false,\n options: {}\n }\n\n while (tokens.length) {\n switch (tokens[0]) {\n case '=':\n tokens.shift()\n field.tag = Number(tokens.shift())\n break\n\n case 'map':\n field.type = 'map'\n field.map = {from: null, to: null}\n tokens.shift()\n if (tokens[0] !== '<') throw new Error('Unexpected token in map type: ' + tokens[0])\n tokens.shift()\n field.map.from = tokens.shift()\n if (tokens[0] !== ',') throw new Error('Unexpected token in map type: ' + tokens[0])\n tokens.shift()\n field.map.to = tokens.shift()\n if (tokens[0] !== '>') throw new Error('Unexpected token in map type: ' + tokens[0])\n tokens.shift()\n field.name = tokens.shift()\n break\n\n case 'repeated':\n case 'required':\n case 'optional':\n var t = tokens.shift()\n field.required = t === 'required'\n field.repeated = t === 'repeated'\n field.type = tokens.shift()\n field.name = tokens.shift()\n break\n\n case '[':\n field.options = onfieldoptions(tokens)\n break\n\n case ';':\n if (field.name === null) throw new Error('Missing field name')\n if (field.type === null) throw new Error('Missing type in message field: ' + field.name)\n if (field.tag === -1) throw new Error('Missing tag number in message field: ' + field.name)\n tokens.shift()\n return field\n\n default:\n throw new Error('Unexpected token in message field: ' + tokens[0])\n }\n }\n\n throw new Error('No ; found for message field')\n}\n\nvar onmessagebody = function (tokens) {\n var body = {\n enums: [],\n messages: [],\n fields: [],\n extends: [],\n extensions: null\n }\n\n while (tokens.length) {\n switch (tokens[0]) {\n case 'map':\n case 'repeated':\n case 'optional':\n case 'required':\n body.fields.push(onfield(tokens))\n break\n\n case 'enum':\n body.enums.push(onenum(tokens))\n break\n\n case 'message':\n body.messages.push(onmessage(tokens))\n break\n\n case 'extensions':\n body.extensions = onextensions(tokens)\n break\n\n case 'oneof':\n tokens.shift()\n var name = tokens.shift()\n if (tokens[0] !== '{') throw new Error('Unexpected token in oneof: ' + tokens[0])\n tokens.shift()\n while (tokens[0] !== '}') {\n tokens.unshift('optional')\n var field = onfield(tokens)\n field.oneof = name\n body.fields.push(field)\n }\n tokens.shift()\n break\n\n case 'extend':\n body.extends.push(onextend(tokens))\n break\n\n case ';':\n tokens.shift()\n break\n\n case 'reserved':\n case 'option':\n tokens.shift()\n while (tokens[0] !== ';') {\n tokens.shift()\n }\n break\n\n default:\n // proto3 does not require the use of optional/required, assumed as optional\n // \"singular: a well-formed message can have zero or one of this field (but not more than one).\"\n // https://developers.google.com/protocol-buffers/docs/proto3#specifying-field-rules\n tokens.unshift('optional')\n body.fields.push(onfield(tokens))\n }\n }\n\n return body\n}\n\nvar onextend = function (tokens) {\n var out = {\n name: tokens[1],\n message: onmessage(tokens)\n }\n return out\n}\n\nvar onextensions = function (tokens) {\n tokens.shift()\n var from = Number(tokens.shift())\n if (isNaN(from)) throw new Error('Invalid from in extensions definition')\n if (tokens.shift() !== 'to') throw new Error(\"Expected keyword 'to' in extensions definition\")\n var to = tokens.shift()\n if (to === 'max') to = MAX_RANGE\n to = Number(to)\n if (isNaN(to)) throw new Error('Invalid to in extensions definition')\n if (tokens.shift() !== ';') throw new Error('Missing ; in extensions definition')\n return {from: from, to: to}\n}\nvar onmessage = function (tokens) {\n tokens.shift()\n\n var lvl = 1\n var body = []\n var msg = {\n name: tokens.shift(),\n enums: [],\n extends: [],\n messages: [],\n fields: []\n }\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift()\n\n while (tokens.length) {\n if (tokens[0] === '{') lvl++\n else if (tokens[0] === '}') lvl--\n\n if (!lvl) {\n tokens.shift()\n body = onmessagebody(body)\n msg.enums = body.enums\n msg.messages = body.messages\n msg.fields = body.fields\n msg.extends = body.extends\n msg.extensions = body.extensions\n return msg\n }\n\n body.push(tokens.shift())\n }\n\n if (lvl) throw new Error('No closing tag for message')\n}\n\nvar onpackagename = function (tokens) {\n tokens.shift()\n var name = tokens.shift()\n if (tokens[0] !== ';') throw new Error('Expected ; but found ' + tokens[0])\n tokens.shift()\n return name\n}\n\nvar onsyntaxversion = function (tokens) {\n tokens.shift()\n\n if (tokens[0] !== '=') throw new Error('Expected = but found ' + tokens[0])\n tokens.shift()\n\n var version = tokens.shift()\n switch (version) {\n case '\"proto2\"':\n version = 2\n break\n\n case '\"proto3\"':\n version = 3\n break\n\n default:\n throw new Error('Expected protobuf syntax version but found ' + version)\n }\n\n if (tokens[0] !== ';') throw new Error('Expected ; but found ' + tokens[0])\n tokens.shift()\n\n return version\n}\n\nvar onenumvalue = function (tokens) {\n if (tokens.length < 4) throw new Error('Invalid enum value: ' + tokens.slice(0, 3).join(' '))\n if (tokens[1] !== '=') throw new Error('Expected = but found ' + tokens[1])\n if (tokens[3] !== ';' && tokens[3] !== '[') throw new Error('Expected ; or [ but found ' + tokens[1])\n\n var name = tokens.shift()\n tokens.shift()\n var val = {\n value: null,\n options: {}\n }\n val.value = Number(tokens.shift())\n if (tokens[0] === '[') {\n val.options = onfieldoptions(tokens)\n }\n tokens.shift() // expecting the semicolon here\n\n return {\n name: name,\n val: val\n }\n}\n\nvar onenum = function (tokens) {\n tokens.shift()\n var options = {}\n var e = {\n name: tokens.shift(),\n values: {},\n options: {}\n }\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift()\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift()\n // there goes optional semicolon after the enclosing \"}\"\n if (tokens[0] === ';') tokens.shift()\n return e\n }\n if (tokens[0] === 'option') {\n options = onoption(tokens)\n e.options[options.name] = options.value\n continue\n }\n var val = onenumvalue(tokens)\n e.values[val.name] = val.val\n }\n\n throw new Error('No closing tag for enum')\n}\n\nvar onoption = function (tokens) {\n var name = null\n var value = null\n\n var parse = function (value) {\n if (value === 'true') return true\n if (value === 'false') return false\n return value.replace(/^\"+|\"+$/gm, '')\n }\n\n while (tokens.length) {\n if (tokens[0] === ';') {\n tokens.shift()\n return {name: name, value: value}\n }\n switch (tokens[0]) {\n case 'option':\n tokens.shift()\n\n var hasBracket = tokens[0] === '('\n if (hasBracket) tokens.shift()\n\n name = tokens.shift()\n\n if (hasBracket) {\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift()\n }\n\n if (tokens[0][0] === '.') {\n name += tokens.shift()\n }\n\n break\n\n case '=':\n tokens.shift()\n if (name === null) throw new Error('Expected key for option with value: ' + tokens[0])\n value = parse(tokens.shift())\n\n if (name === 'optimize_for' && !/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(value)) {\n throw new Error('Unexpected value for option optimize_for: ' + value)\n } else if (value === '{') {\n // option foo = {bar: baz}\n value = onoptionMap(tokens)\n }\n break\n\n default:\n throw new Error('Unexpected token in option: ' + tokens[0])\n }\n }\n}\n\nvar onoptionMap = function (tokens) {\n var parse = function (value) {\n if (value === 'true') return true\n if (value === 'false') return false\n return value.replace(/^\"+|\"+$/gm, '')\n }\n\n var map = {}\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift()\n return map\n }\n\n var hasBracket = tokens[0] === '('\n if (hasBracket) tokens.shift()\n\n var key = tokens.shift()\n if (hasBracket) {\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift()\n }\n\n var value = null\n\n switch (tokens[0]) {\n case ':':\n if (map[key] !== undefined) throw new Error('Duplicate option map key ' + key)\n\n tokens.shift()\n\n value = parse(tokens.shift())\n\n if (value === '{') {\n // option foo = {bar: baz}\n value = onoptionMap(tokens)\n }\n\n map[key] = value\n\n if (tokens[0] === ';') {\n tokens.shift()\n }\n break\n\n case '{':\n tokens.shift()\n value = onoptionMap(tokens)\n\n if (map[key] === undefined) map[key] = []\n if (!Array.isArray(map[key])) throw new Error('Duplicate option map key ' + key)\n\n map[key].push(value)\n break\n\n default:\n throw new Error('Unexpected token in option map: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for option map')\n}\n\nvar onimport = function (tokens) {\n tokens.shift()\n var file = tokens.shift().replace(/^\"+|\"+$/gm, '')\n\n if (tokens[0] !== ';') throw new Error('Unexpected token: ' + tokens[0] + '. Expected \";\"')\n\n tokens.shift()\n return file\n}\n\nvar onservice = function (tokens) {\n tokens.shift()\n\n var service = {\n name: tokens.shift(),\n methods: [],\n options: {}\n }\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift()\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift()\n // there goes optional semicolon after the enclosing \"}\"\n if (tokens[0] === ';') tokens.shift()\n return service\n }\n\n switch (tokens[0]) {\n case 'option':\n var opt = onoption(tokens)\n if (service.options[opt.name] !== undefined) throw new Error('Duplicate option ' + opt.name)\n service.options[opt.name] = opt.value\n break\n case 'rpc':\n service.methods.push(onrpc(tokens))\n break\n default:\n throw new Error('Unexpected token in service: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for service')\n}\n\nvar onrpc = function (tokens) {\n tokens.shift()\n\n var rpc = {\n name: tokens.shift(),\n input_type: null,\n output_type: null,\n client_streaming: false,\n server_streaming: false,\n options: {}\n }\n\n if (tokens[0] !== '(') throw new Error('Expected ( but found ' + tokens[0])\n tokens.shift()\n\n if (tokens[0] === 'stream') {\n tokens.shift()\n rpc.client_streaming = true\n }\n\n rpc.input_type = tokens.shift()\n\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift()\n\n if (tokens[0] !== 'returns') throw new Error('Expected returns but found ' + tokens[0])\n tokens.shift()\n\n if (tokens[0] !== '(') throw new Error('Expected ( but found ' + tokens[0])\n tokens.shift()\n\n if (tokens[0] === 'stream') {\n tokens.shift()\n rpc.server_streaming = true\n }\n\n rpc.output_type = tokens.shift()\n\n if (tokens[0] !== ')') throw new Error('Expected ) but found ' + tokens[0])\n tokens.shift()\n\n if (tokens[0] === ';') {\n tokens.shift()\n return rpc\n }\n\n if (tokens[0] !== '{') throw new Error('Expected { but found ' + tokens[0])\n tokens.shift()\n\n while (tokens.length) {\n if (tokens[0] === '}') {\n tokens.shift()\n // there goes optional semicolon after the enclosing \"}\"\n if (tokens[0] === ';') tokens.shift()\n return rpc\n }\n\n if (tokens[0] === 'option') {\n var opt = onoption(tokens)\n if (rpc.options[opt.name] !== undefined) throw new Error('Duplicate option ' + opt.name)\n rpc.options[opt.name] = opt.value\n } else {\n throw new Error('Unexpected token in rpc options: ' + tokens[0])\n }\n }\n\n throw new Error('No closing tag for rpc')\n}\n\nvar parse = function (buf) {\n var tokens = tokenize(buf.toString())\n // check for isolated strings in tokens by looking for opening quote\n for (var i = 0; i < tokens.length; i++) {\n if (/^(\"|')([^'\"]*)$/.test(tokens[i])) {\n var j\n if (tokens[i].length === 1) {\n j = i + 1\n } else {\n j = i\n }\n // look ahead for the closing quote and collapse all\n // in-between tokens into a single token\n for (j; j < tokens.length; j++) {\n if (/^([^'\"]*)(\"|')$/.test(tokens[j])) {\n tokens = tokens.slice(0, i).concat(tokens.slice(i, j + 1).join('')).concat(tokens.slice(j + 1))\n break\n }\n }\n }\n }\n var schema = {\n syntax: 3,\n package: null,\n imports: [],\n enums: [],\n messages: [],\n options: {},\n extends: []\n }\n\n var firstline = true\n\n while (tokens.length) {\n switch (tokens[0]) {\n case 'package':\n schema.package = onpackagename(tokens)\n break\n\n case 'syntax':\n if (!firstline) throw new Error('Protobuf syntax version should be first thing in file')\n schema.syntax = onsyntaxversion(tokens)\n break\n\n case 'message':\n schema.messages.push(onmessage(tokens))\n break\n\n case 'enum':\n schema.enums.push(onenum(tokens))\n break\n\n case 'option':\n var opt = onoption(tokens)\n if (schema.options[opt.name]) throw new Error('Duplicate option ' + opt.name)\n schema.options[opt.name] = opt.value\n break\n\n case 'import':\n schema.imports.push(onimport(tokens))\n break\n\n case 'extend':\n schema.extends.push(onextend(tokens))\n break\n\n case 'service':\n if (!schema.services) schema.services = []\n schema.services.push(onservice(tokens))\n break\n\n default:\n throw new Error('Unexpected token: ' + tokens[0])\n }\n firstline = false\n }\n\n // now iterate over messages and propagate extends\n schema.extends.forEach(function (ext) {\n schema.messages.forEach(function (msg) {\n if (msg.name === ext.name) {\n ext.message.fields.forEach(function (field) {\n if (!msg.extensions || field.tag < msg.extensions.from || field.tag > msg.extensions.to) {\n throw new Error(msg.name + ' does not declare ' + field.tag + ' as an extension number')\n }\n msg.fields.push(field)\n })\n }\n })\n })\n\n schema.messages.forEach(function (msg) {\n msg.fields.forEach(function (field) {\n var fieldSplit\n var messageName\n var nestedEnumName\n var message\n\n function enumNameIsFieldType (en) {\n return en.name === field.type\n }\n\n function enumNameIsNestedEnumName (en) {\n return en.name === nestedEnumName\n }\n\n if (field.options && field.options.packed === 'true') {\n if (PACKABLE_TYPES.indexOf(field.type) === -1) {\n // let's see if it's an enum\n if (field.type.indexOf('.') === -1) {\n if (msg.enums && msg.enums.some(enumNameIsFieldType)) {\n return\n }\n } else {\n fieldSplit = field.type.split('.')\n if (fieldSplit.length > 2) {\n throw new Error('what is this?')\n }\n\n messageName = fieldSplit[0]\n nestedEnumName = fieldSplit[1]\n\n schema.messages.some(function (msg) {\n if (msg.name === messageName) {\n message = msg\n return msg\n }\n })\n\n if (message && message.enums && message.enums.some(enumNameIsNestedEnumName)) {\n return\n }\n }\n\n throw new Error(\n 'Fields of type ' + field.type + ' cannot be declared [packed=true]. ' +\n 'Only repeated fields of primitive numeric types (types which use ' +\n 'the varint, 32-bit, or 64-bit wire types) can be declared \"packed\". ' +\n 'See https://developers.google.com/protocol-buffers/docs/encoding#optional'\n )\n }\n }\n })\n })\n\n return schema\n}\n\nmodule.exports = parse\n","// base-x encoding\n// Forked from https://github.com/cryptocoinjs/bs58\n// Originally written by Mike Hearn for BitcoinJ\n// Copyright (c) 2011 Google Inc\n// Ported to JavaScript by Stefan Thomas\n// Merged Buffer refactorings from base58-native by Stephen Pair\n// Copyright (c) 2013 BitPay Inc\n\nvar Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function base (ALPHABET) {\n var ALPHABET_MAP = {}\n var BASE = ALPHABET.length\n var LEADER = ALPHABET.charAt(0)\n\n // pre-compute lookup table\n for (var z = 0; z < ALPHABET.length; z++) {\n var x = ALPHABET.charAt(z)\n\n if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous')\n ALPHABET_MAP[x] = z\n }\n\n function encode (source) {\n if (source.length === 0) return ''\n\n var digits = [0]\n for (var i = 0; i < source.length; ++i) {\n for (var j = 0, carry = source[i]; j < digits.length; ++j) {\n carry += digits[j] << 8\n digits[j] = carry % BASE\n carry = (carry / BASE) | 0\n }\n\n while (carry > 0) {\n digits.push(carry % BASE)\n carry = (carry / BASE) | 0\n }\n }\n\n var string = ''\n\n // deal with leading zeros\n for (var k = 0; source[k] === 0 && k < source.length - 1; ++k) string += LEADER\n // convert digits to a string\n for (var q = digits.length - 1; q >= 0; --q) string += ALPHABET[digits[q]]\n\n return string\n }\n\n function decodeUnsafe (string) {\n if (typeof string !== 'string') throw new TypeError('Expected String')\n if (string.length === 0) return Buffer.allocUnsafe(0)\n\n var bytes = [0]\n for (var i = 0; i < string.length; i++) {\n var value = ALPHABET_MAP[string[i]]\n if (value === undefined) return\n\n for (var j = 0, carry = value; j < bytes.length; ++j) {\n carry += bytes[j] * BASE\n bytes[j] = carry & 0xff\n carry >>= 8\n }\n\n while (carry > 0) {\n bytes.push(carry & 0xff)\n carry >>= 8\n }\n }\n\n // deal with leading zeros\n for (var k = 0; string[k] === LEADER && k < string.length - 1; ++k) {\n bytes.push(0)\n }\n\n return Buffer.from(bytes.reverse())\n }\n\n function decode (string) {\n var buffer = decodeUnsafe(string)\n if (buffer) return buffer\n\n throw new Error('Non-base' + BASE + ' character')\n }\n\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n }\n}\n","'use strict'\n\nconst toStream = require('it-to-stream')\n\nmodule.exports = function (self) {\n return function lsReadableStream (ipfsPath, options) {\n return toStream.readable(self._lsAsyncIterator(ipfsPath, options), {\n objectMode: true\n })\n }\n}\n","'use strict'\n\nconst base58 = require('bs58')\nconst multihash = require('multihashes')\nconst multibase = require('multibase')\nconst Multiaddr = require('multiaddr')\nconst mafmt = require('mafmt')\nconst CID = require('cids')\n\nconst urlPattern = /^https?:\\/\\/[^/]+\\/(ip(f|n)s)\\/((\\w+).*)/\nconst pathPattern = /^\\/(ip(f|n)s)\\/((\\w+).*)/\nconst defaultProtocolMatch = 1\nconst defaultHashMath = 4\n\nconst fqdnPattern = /^https?:\\/\\/([^/]+)\\.(ip(?:f|n)s)\\.[^/]+/\nconst fqdnHashMatch = 1\nconst fqdnProtocolMatch = 2\n\nfunction isMultihash (hash) {\n const formatted = convertToString(hash)\n try {\n const buffer = Buffer.from(base58.decode(formatted))\n multihash.decode(buffer)\n return true\n } catch (e) {\n return false\n }\n}\n\nfunction isMultibase (hash) {\n try {\n return multibase.isEncoded(hash)\n } catch (e) {\n return false\n }\n}\n\nfunction isCID (hash) {\n try {\n new CID(hash) // eslint-disable-line no-new\n return true\n } catch (e) {\n return false\n }\n}\n\nfunction isMultiaddr (input) {\n if (!input) return false\n if (Multiaddr.isMultiaddr(input)) return true\n try {\n new Multiaddr(input) // eslint-disable-line no-new\n return true\n } catch (e) {\n return false\n }\n}\n\nfunction isPeerMultiaddr (input) {\n return isMultiaddr(input) && mafmt.IPFS.matches(input)\n}\n\nfunction isIpfs (input, pattern, protocolMatch = defaultProtocolMatch, hashMatch = defaultHashMath) {\n const formatted = convertToString(input)\n if (!formatted) {\n return false\n }\n\n const match = formatted.match(pattern)\n if (!match) {\n return false\n }\n\n if (match[protocolMatch] !== 'ipfs') {\n return false\n }\n\n let hash = match[hashMatch]\n\n if (hash && pattern === fqdnPattern) {\n // when doing checks for subdomain context\n // ensure hash is case-insensitive\n // (browsers force-lowercase authority compotent anyway)\n hash = hash.toLowerCase()\n }\n\n return isCID(hash)\n}\n\nfunction isIpns (input, pattern, protocolMatch = defaultProtocolMatch, hashMatch) {\n const formatted = convertToString(input)\n if (!formatted) {\n return false\n }\n const match = formatted.match(pattern)\n if (!match) {\n return false\n }\n\n if (match[protocolMatch] !== 'ipns') {\n return false\n }\n\n if (hashMatch && pattern === fqdnPattern) {\n let hash = match[hashMatch]\n // when doing checks for subdomain context\n // ensure hash is case-insensitive\n // (browsers force-lowercase authority compotent anyway)\n hash = hash.toLowerCase()\n return isCID(hash)\n }\n\n return true\n}\n\nfunction isString (input) {\n return typeof input === 'string'\n}\n\nfunction convertToString (input) {\n if (Buffer.isBuffer(input)) {\n return base58.encode(input)\n }\n\n if (isString(input)) {\n return input\n }\n\n return false\n}\n\nconst ipfsSubdomain = (url) => isIpfs(url, fqdnPattern, fqdnProtocolMatch, fqdnHashMatch)\nconst ipnsSubdomain = (url) => isIpns(url, fqdnPattern, fqdnProtocolMatch, fqdnHashMatch)\n\nmodule.exports = {\n multihash: isMultihash,\n multiaddr: isMultiaddr,\n peerMultiaddr: isPeerMultiaddr,\n cid: isCID,\n base32cid: (cid) => (isMultibase(cid) === 'base32' && isCID(cid)),\n ipfsSubdomain: ipfsSubdomain,\n ipnsSubdomain: ipnsSubdomain,\n subdomain: (url) => (ipfsSubdomain(url) || ipnsSubdomain(url)),\n subdomainPattern: fqdnPattern,\n ipfsUrl: (url) => isIpfs(url, urlPattern),\n ipnsUrl: (url) => isIpns(url, urlPattern),\n url: (url) => (isIpfs(url, urlPattern) || isIpns(url, urlPattern)),\n urlPattern: urlPattern,\n ipfsPath: (path) => isIpfs(path, pathPattern),\n ipnsPath: (path) => isIpns(path, pathPattern),\n path: (path) => (isIpfs(path, pathPattern) || isIpns(path, pathPattern)),\n pathPattern: pathPattern,\n urlOrPath: (x) => (isIpfs(x, urlPattern) || isIpns(x, urlPattern) || isIpfs(x, pathPattern) || isIpns(x, pathPattern)),\n cidPath: path => isString(path) && !isCID(path) && isIpfs(`/ipfs/${path}`, pathPattern)\n}\n","'use strict';\n\nconst asn1 = exports;\n\nasn1.bignum = require('bn.js');\n\nasn1.define = require('./asn1/api').define;\nasn1.base = require('./asn1/base');\nasn1.constants = require('./asn1/constants');\nasn1.decoders = require('./asn1/decoders');\nasn1.encoders = require('./asn1/encoders');\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = eachLimit;\n\nvar _eachOfLimit = require('./internal/eachOfLimit');\n\nvar _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);\n\nvar _withoutIndex = require('./internal/withoutIndex');\n\nvar _withoutIndex2 = _interopRequireDefault(_withoutIndex);\n\nvar _wrapAsync = require('./internal/wrapAsync');\n\nvar _wrapAsync2 = _interopRequireDefault(_wrapAsync);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.\n *\n * @name eachLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.each]{@link module:Collections.each}\n * @alias forEachLimit\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The array index is not passed to the iteratee.\n * If you need the index, use `eachOfLimit`.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called when all\n * `iteratee` functions have finished, or an error occurs. Invoked with (err).\n */\nfunction eachLimit(coll, limit, iteratee, callback) {\n (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);\n}\nmodule.exports = exports['default'];","/**\n * Javascript implementation of X.509 and related components (such as\n * Certification Signing Requests) of a Public Key Infrastructure.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n *\n * The ASN.1 representation of an X.509v3 certificate is as follows\n * (see RFC 2459):\n *\n * Certificate ::= SEQUENCE {\n * tbsCertificate TBSCertificate,\n * signatureAlgorithm AlgorithmIdentifier,\n * signatureValue BIT STRING\n * }\n *\n * TBSCertificate ::= SEQUENCE {\n * version [0] EXPLICIT Version DEFAULT v1,\n * serialNumber CertificateSerialNumber,\n * signature AlgorithmIdentifier,\n * issuer Name,\n * validity Validity,\n * subject Name,\n * subjectPublicKeyInfo SubjectPublicKeyInfo,\n * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,\n * -- If present, version shall be v2 or v3\n * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,\n * -- If present, version shall be v2 or v3\n * extensions [3] EXPLICIT Extensions OPTIONAL\n * -- If present, version shall be v3\n * }\n *\n * Version ::= INTEGER { v1(0), v2(1), v3(2) }\n *\n * CertificateSerialNumber ::= INTEGER\n *\n * Name ::= CHOICE {\n * // only one possible choice for now\n * RDNSequence\n * }\n *\n * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName\n *\n * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue\n *\n * AttributeTypeAndValue ::= SEQUENCE {\n * type AttributeType,\n * value AttributeValue\n * }\n * AttributeType ::= OBJECT IDENTIFIER\n * AttributeValue ::= ANY DEFINED BY AttributeType\n *\n * Validity ::= SEQUENCE {\n * notBefore Time,\n * notAfter Time\n * }\n *\n * Time ::= CHOICE {\n * utcTime UTCTime,\n * generalTime GeneralizedTime\n * }\n *\n * UniqueIdentifier ::= BIT STRING\n *\n * SubjectPublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * subjectPublicKey BIT STRING\n * }\n *\n * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension\n *\n * Extension ::= SEQUENCE {\n * extnID OBJECT IDENTIFIER,\n * critical BOOLEAN DEFAULT FALSE,\n * extnValue OCTET STRING\n * }\n *\n * The only key algorithm currently supported for PKI is RSA.\n *\n * RSASSA-PSS signatures are described in RFC 3447 and RFC 4055.\n *\n * PKCS#10 v1.7 describes certificate signing requests:\n *\n * CertificationRequestInfo:\n *\n * CertificationRequestInfo ::= SEQUENCE {\n * version INTEGER { v1(0) } (v1,...),\n * subject Name,\n * subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},\n * attributes [0] Attributes{{ CRIAttributes }}\n * }\n *\n * Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}\n *\n * CRIAttributes ATTRIBUTE ::= {\n * ... -- add any locally defined attributes here -- }\n *\n * Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {\n * type ATTRIBUTE.&id({IOSet}),\n * values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type})\n * }\n *\n * CertificationRequest ::= SEQUENCE {\n * certificationRequestInfo CertificationRequestInfo,\n * signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},\n * signature BIT STRING\n * }\n */\nvar forge = require('./forge');\nrequire('./aes');\nrequire('./asn1');\nrequire('./des');\nrequire('./md');\nrequire('./mgf');\nrequire('./oids');\nrequire('./pem');\nrequire('./pss');\nrequire('./rsa');\nrequire('./util');\n\n// shortcut for asn.1 API\nvar asn1 = forge.asn1;\n\n/* Public Key Infrastructure (PKI) implementation. */\nvar pki = module.exports = forge.pki = forge.pki || {};\nvar oids = pki.oids;\n\n// short name OID mappings\nvar _shortNames = {};\n_shortNames['CN'] = oids['commonName'];\n_shortNames['commonName'] = 'CN';\n_shortNames['C'] = oids['countryName'];\n_shortNames['countryName'] = 'C';\n_shortNames['L'] = oids['localityName'];\n_shortNames['localityName'] = 'L';\n_shortNames['ST'] = oids['stateOrProvinceName'];\n_shortNames['stateOrProvinceName'] = 'ST';\n_shortNames['O'] = oids['organizationName'];\n_shortNames['organizationName'] = 'O';\n_shortNames['OU'] = oids['organizationalUnitName'];\n_shortNames['organizationalUnitName'] = 'OU';\n_shortNames['E'] = oids['emailAddress'];\n_shortNames['emailAddress'] = 'E';\n\n// validator for an SubjectPublicKeyInfo structure\n// Note: Currently only works with an RSA public key\nvar publicKeyValidator = forge.pki.rsa.publicKeyValidator;\n\n// validator for an X.509v3 certificate\nvar x509CertificateValidator = {\n name: 'Certificate',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'Certificate.TBSCertificate',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'tbsCertificate',\n value: [{\n name: 'Certificate.TBSCertificate.version',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 0,\n constructed: true,\n optional: true,\n value: [{\n name: 'Certificate.TBSCertificate.version.integer',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'certVersion'\n }]\n }, {\n name: 'Certificate.TBSCertificate.serialNumber',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'certSerialNumber'\n }, {\n name: 'Certificate.TBSCertificate.signature',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'Certificate.TBSCertificate.signature.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'certinfoSignatureOid'\n }, {\n name: 'Certificate.TBSCertificate.signature.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n optional: true,\n captureAsn1: 'certinfoSignatureParams'\n }]\n }, {\n name: 'Certificate.TBSCertificate.issuer',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'certIssuer'\n }, {\n name: 'Certificate.TBSCertificate.validity',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n // Note: UTC and generalized times may both appear so the capture\n // names are based on their detected order, the names used below\n // are only for the common case, which validity time really means\n // \"notBefore\" and which means \"notAfter\" will be determined by order\n value: [{\n // notBefore (Time) (UTC time case)\n name: 'Certificate.TBSCertificate.validity.notBefore (utc)',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.UTCTIME,\n constructed: false,\n optional: true,\n capture: 'certValidity1UTCTime'\n }, {\n // notBefore (Time) (generalized time case)\n name: 'Certificate.TBSCertificate.validity.notBefore (generalized)',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.GENERALIZEDTIME,\n constructed: false,\n optional: true,\n capture: 'certValidity2GeneralizedTime'\n }, {\n // notAfter (Time) (only UTC time is supported)\n name: 'Certificate.TBSCertificate.validity.notAfter (utc)',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.UTCTIME,\n constructed: false,\n optional: true,\n capture: 'certValidity3UTCTime'\n }, {\n // notAfter (Time) (only UTC time is supported)\n name: 'Certificate.TBSCertificate.validity.notAfter (generalized)',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.GENERALIZEDTIME,\n constructed: false,\n optional: true,\n capture: 'certValidity4GeneralizedTime'\n }]\n }, {\n // Name (subject) (RDNSequence)\n name: 'Certificate.TBSCertificate.subject',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'certSubject'\n },\n // SubjectPublicKeyInfo\n publicKeyValidator,\n {\n // issuerUniqueID (optional)\n name: 'Certificate.TBSCertificate.issuerUniqueID',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 1,\n constructed: true,\n optional: true,\n value: [{\n name: 'Certificate.TBSCertificate.issuerUniqueID.id',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.BITSTRING,\n constructed: false,\n // TODO: support arbitrary bit length ids\n captureBitStringValue: 'certIssuerUniqueId'\n }]\n }, {\n // subjectUniqueID (optional)\n name: 'Certificate.TBSCertificate.subjectUniqueID',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 2,\n constructed: true,\n optional: true,\n value: [{\n name: 'Certificate.TBSCertificate.subjectUniqueID.id',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.BITSTRING,\n constructed: false,\n // TODO: support arbitrary bit length ids\n captureBitStringValue: 'certSubjectUniqueId'\n }]\n }, {\n // Extensions (optional)\n name: 'Certificate.TBSCertificate.extensions',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 3,\n constructed: true,\n captureAsn1: 'certExtensions',\n optional: true\n }]\n }, {\n // AlgorithmIdentifier (signature algorithm)\n name: 'Certificate.signatureAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // algorithm\n name: 'Certificate.signatureAlgorithm.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'certSignatureOid'\n }, {\n name: 'Certificate.TBSCertificate.signature.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n optional: true,\n captureAsn1: 'certSignatureParams'\n }]\n }, {\n // SignatureValue\n name: 'Certificate.signatureValue',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.BITSTRING,\n constructed: false,\n captureBitStringValue: 'certSignature'\n }]\n};\n\nvar rsassaPssParameterValidator = {\n name: 'rsapss',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'rsapss.hashAlgorithm',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 0,\n constructed: true,\n value: [{\n name: 'rsapss.hashAlgorithm.AlgorithmIdentifier',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Class.SEQUENCE,\n constructed: true,\n optional: true,\n value: [{\n name: 'rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'hashOid'\n /* parameter block omitted, for SHA1 NULL anyhow. */\n }]\n }]\n }, {\n name: 'rsapss.maskGenAlgorithm',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 1,\n constructed: true,\n value: [{\n name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Class.SEQUENCE,\n constructed: true,\n optional: true,\n value: [{\n name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'maskGenOid'\n }, {\n name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'maskGenHashOid'\n /* parameter block omitted, for SHA1 NULL anyhow. */\n }]\n }]\n }]\n }, {\n name: 'rsapss.saltLength',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 2,\n optional: true,\n value: [{\n name: 'rsapss.saltLength.saltLength',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Class.INTEGER,\n constructed: false,\n capture: 'saltLength'\n }]\n }, {\n name: 'rsapss.trailerField',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 3,\n optional: true,\n value: [{\n name: 'rsapss.trailer.trailer',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Class.INTEGER,\n constructed: false,\n capture: 'trailer'\n }]\n }]\n};\n\n// validator for a CertificationRequestInfo structure\nvar certificationRequestInfoValidator = {\n name: 'CertificationRequestInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'certificationRequestInfo',\n value: [{\n name: 'CertificationRequestInfo.integer',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'certificationRequestInfoVersion'\n }, {\n // Name (subject) (RDNSequence)\n name: 'CertificationRequestInfo.subject',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'certificationRequestInfoSubject'\n },\n // SubjectPublicKeyInfo\n publicKeyValidator,\n {\n name: 'CertificationRequestInfo.attributes',\n tagClass: asn1.Class.CONTEXT_SPECIFIC,\n type: 0,\n constructed: true,\n optional: true,\n capture: 'certificationRequestInfoAttributes',\n value: [{\n name: 'CertificationRequestInfo.attributes',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'CertificationRequestInfo.attributes.type',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false\n }, {\n name: 'CertificationRequestInfo.attributes.value',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SET,\n constructed: true\n }]\n }]\n }]\n};\n\n// validator for a CertificationRequest structure\nvar certificationRequestValidator = {\n name: 'CertificationRequest',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'csr',\n value: [\n certificationRequestInfoValidator, {\n // AlgorithmIdentifier (signature algorithm)\n name: 'CertificationRequest.signatureAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n // algorithm\n name: 'CertificationRequest.signatureAlgorithm.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'csrSignatureOid'\n }, {\n name: 'CertificationRequest.signatureAlgorithm.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n optional: true,\n captureAsn1: 'csrSignatureParams'\n }]\n }, {\n // signature\n name: 'CertificationRequest.signature',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.BITSTRING,\n constructed: false,\n captureBitStringValue: 'csrSignature'\n }\n ]\n};\n\n/**\n * Converts an RDNSequence of ASN.1 DER-encoded RelativeDistinguishedName\n * sets into an array with objects that have type and value properties.\n *\n * @param rdn the RDNSequence to convert.\n * @param md a message digest to append type and value to if provided.\n */\npki.RDNAttributesAsArray = function(rdn, md) {\n var rval = [];\n\n // each value in 'rdn' in is a SET of RelativeDistinguishedName\n var set, attr, obj;\n for(var si = 0; si < rdn.value.length; ++si) {\n // get the RelativeDistinguishedName set\n set = rdn.value[si];\n\n // each value in the SET is an AttributeTypeAndValue sequence\n // containing first a type (an OID) and second a value (defined by\n // the OID)\n for(var i = 0; i < set.value.length; ++i) {\n obj = {};\n attr = set.value[i];\n obj.type = asn1.derToOid(attr.value[0].value);\n obj.value = attr.value[1].value;\n obj.valueTagClass = attr.value[1].type;\n // if the OID is known, get its name and short name\n if(obj.type in oids) {\n obj.name = oids[obj.type];\n if(obj.name in _shortNames) {\n obj.shortName = _shortNames[obj.name];\n }\n }\n if(md) {\n md.update(obj.type);\n md.update(obj.value);\n }\n rval.push(obj);\n }\n }\n\n return rval;\n};\n\n/**\n * Converts ASN.1 CRIAttributes into an array with objects that have type and\n * value properties.\n *\n * @param attributes the CRIAttributes to convert.\n */\npki.CRIAttributesAsArray = function(attributes) {\n var rval = [];\n\n // each value in 'attributes' in is a SEQUENCE with an OID and a SET\n for(var si = 0; si < attributes.length; ++si) {\n // get the attribute sequence\n var seq = attributes[si];\n\n // each value in the SEQUENCE containing first a type (an OID) and\n // second a set of values (defined by the OID)\n var type = asn1.derToOid(seq.value[0].value);\n var values = seq.value[1].value;\n for(var vi = 0; vi < values.length; ++vi) {\n var obj = {};\n obj.type = type;\n obj.value = values[vi].value;\n obj.valueTagClass = values[vi].type;\n // if the OID is known, get its name and short name\n if(obj.type in oids) {\n obj.name = oids[obj.type];\n if(obj.name in _shortNames) {\n obj.shortName = _shortNames[obj.name];\n }\n }\n // parse extensions\n if(obj.type === oids.extensionRequest) {\n obj.extensions = [];\n for(var ei = 0; ei < obj.value.length; ++ei) {\n obj.extensions.push(pki.certificateExtensionFromAsn1(obj.value[ei]));\n }\n }\n rval.push(obj);\n }\n }\n\n return rval;\n};\n\n/**\n * Gets an issuer or subject attribute from its name, type, or short name.\n *\n * @param obj the issuer or subject object.\n * @param options a short name string or an object with:\n * shortName the short name for the attribute.\n * name the name for the attribute.\n * type the type for the attribute.\n *\n * @return the attribute.\n */\nfunction _getAttribute(obj, options) {\n if(typeof options === 'string') {\n options = {shortName: options};\n }\n\n var rval = null;\n var attr;\n for(var i = 0; rval === null && i < obj.attributes.length; ++i) {\n attr = obj.attributes[i];\n if(options.type && options.type === attr.type) {\n rval = attr;\n } else if(options.name && options.name === attr.name) {\n rval = attr;\n } else if(options.shortName && options.shortName === attr.shortName) {\n rval = attr;\n }\n }\n return rval;\n}\n\n/**\n * Converts signature parameters from ASN.1 structure.\n *\n * Currently only RSASSA-PSS supported. The PKCS#1 v1.5 signature scheme had\n * no parameters.\n *\n * RSASSA-PSS-params ::= SEQUENCE {\n * hashAlgorithm [0] HashAlgorithm DEFAULT\n * sha1Identifier,\n * maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT\n * mgf1SHA1Identifier,\n * saltLength [2] INTEGER DEFAULT 20,\n * trailerField [3] INTEGER DEFAULT 1\n * }\n *\n * HashAlgorithm ::= AlgorithmIdentifier\n *\n * MaskGenAlgorithm ::= AlgorithmIdentifier\n *\n * AlgorithmIdentifer ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER,\n * parameters ANY DEFINED BY algorithm OPTIONAL\n * }\n *\n * @param oid The OID specifying the signature algorithm\n * @param obj The ASN.1 structure holding the parameters\n * @param fillDefaults Whether to use return default values where omitted\n * @return signature parameter object\n */\nvar _readSignatureParameters = function(oid, obj, fillDefaults) {\n var params = {};\n\n if(oid !== oids['RSASSA-PSS']) {\n return params;\n }\n\n if(fillDefaults) {\n params = {\n hash: {\n algorithmOid: oids['sha1']\n },\n mgf: {\n algorithmOid: oids['mgf1'],\n hash: {\n algorithmOid: oids['sha1']\n }\n },\n saltLength: 20\n };\n }\n\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, rsassaPssParameterValidator, capture, errors)) {\n var error = new Error('Cannot read RSASSA-PSS parameter block.');\n error.errors = errors;\n throw error;\n }\n\n if(capture.hashOid !== undefined) {\n params.hash = params.hash || {};\n params.hash.algorithmOid = asn1.derToOid(capture.hashOid);\n }\n\n if(capture.maskGenOid !== undefined) {\n params.mgf = params.mgf || {};\n params.mgf.algorithmOid = asn1.derToOid(capture.maskGenOid);\n params.mgf.hash = params.mgf.hash || {};\n params.mgf.hash.algorithmOid = asn1.derToOid(capture.maskGenHashOid);\n }\n\n if(capture.saltLength !== undefined) {\n params.saltLength = capture.saltLength.charCodeAt(0);\n }\n\n return params;\n};\n\n/**\n * Converts an X.509 certificate from PEM format.\n *\n * Note: If the certificate is to be verified then compute hash should\n * be set to true. This will scan the TBSCertificate part of the ASN.1\n * object while it is converted so it doesn't need to be converted back\n * to ASN.1-DER-encoding later.\n *\n * @param pem the PEM-formatted certificate.\n * @param computeHash true to compute the hash for verification.\n * @param strict true to be strict when checking ASN.1 value lengths, false to\n * allow truncated values (default: true).\n *\n * @return the certificate.\n */\npki.certificateFromPem = function(pem, computeHash, strict) {\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'CERTIFICATE' &&\n msg.type !== 'X509 CERTIFICATE' &&\n msg.type !== 'TRUSTED CERTIFICATE') {\n var error = new Error(\n 'Could not convert certificate from PEM; PEM header type ' +\n 'is not \"CERTIFICATE\", \"X509 CERTIFICATE\", or \"TRUSTED CERTIFICATE\".');\n error.headerType = msg.type;\n throw error;\n }\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n throw new Error(\n 'Could not convert certificate from PEM; PEM is encrypted.');\n }\n\n // convert DER to ASN.1 object\n var obj = asn1.fromDer(msg.body, strict);\n\n return pki.certificateFromAsn1(obj, computeHash);\n};\n\n/**\n * Converts an X.509 certificate to PEM format.\n *\n * @param cert the certificate.\n * @param maxline the maximum characters per line, defaults to 64.\n *\n * @return the PEM-formatted certificate.\n */\npki.certificateToPem = function(cert, maxline) {\n // convert to ASN.1, then DER, then PEM-encode\n var msg = {\n type: 'CERTIFICATE',\n body: asn1.toDer(pki.certificateToAsn1(cert)).getBytes()\n };\n return forge.pem.encode(msg, {maxline: maxline});\n};\n\n/**\n * Converts an RSA public key from PEM format.\n *\n * @param pem the PEM-formatted public key.\n *\n * @return the public key.\n */\npki.publicKeyFromPem = function(pem) {\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'PUBLIC KEY' && msg.type !== 'RSA PUBLIC KEY') {\n var error = new Error('Could not convert public key from PEM; PEM header ' +\n 'type is not \"PUBLIC KEY\" or \"RSA PUBLIC KEY\".');\n error.headerType = msg.type;\n throw error;\n }\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n throw new Error('Could not convert public key from PEM; PEM is encrypted.');\n }\n\n // convert DER to ASN.1 object\n var obj = asn1.fromDer(msg.body);\n\n return pki.publicKeyFromAsn1(obj);\n};\n\n/**\n * Converts an RSA public key to PEM format (using a SubjectPublicKeyInfo).\n *\n * @param key the public key.\n * @param maxline the maximum characters per line, defaults to 64.\n *\n * @return the PEM-formatted public key.\n */\npki.publicKeyToPem = function(key, maxline) {\n // convert to ASN.1, then DER, then PEM-encode\n var msg = {\n type: 'PUBLIC KEY',\n body: asn1.toDer(pki.publicKeyToAsn1(key)).getBytes()\n };\n return forge.pem.encode(msg, {maxline: maxline});\n};\n\n/**\n * Converts an RSA public key to PEM format (using an RSAPublicKey).\n *\n * @param key the public key.\n * @param maxline the maximum characters per line, defaults to 64.\n *\n * @return the PEM-formatted public key.\n */\npki.publicKeyToRSAPublicKeyPem = function(key, maxline) {\n // convert to ASN.1, then DER, then PEM-encode\n var msg = {\n type: 'RSA PUBLIC KEY',\n body: asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes()\n };\n return forge.pem.encode(msg, {maxline: maxline});\n};\n\n/**\n * Gets a fingerprint for the given public key.\n *\n * @param options the options to use.\n * [md] the message digest object to use (defaults to forge.md.sha1).\n * [type] the type of fingerprint, such as 'RSAPublicKey',\n * 'SubjectPublicKeyInfo' (defaults to 'RSAPublicKey').\n * [encoding] an alternative output encoding, such as 'hex'\n * (defaults to none, outputs a byte buffer).\n * [delimiter] the delimiter to use between bytes for 'hex' encoded\n * output, eg: ':' (defaults to none).\n *\n * @return the fingerprint as a byte buffer or other encoding based on options.\n */\npki.getPublicKeyFingerprint = function(key, options) {\n options = options || {};\n var md = options.md || forge.md.sha1.create();\n var type = options.type || 'RSAPublicKey';\n\n var bytes;\n switch(type) {\n case 'RSAPublicKey':\n bytes = asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes();\n break;\n case 'SubjectPublicKeyInfo':\n bytes = asn1.toDer(pki.publicKeyToAsn1(key)).getBytes();\n break;\n default:\n throw new Error('Unknown fingerprint type \"' + options.type + '\".');\n }\n\n // hash public key bytes\n md.start();\n md.update(bytes);\n var digest = md.digest();\n if(options.encoding === 'hex') {\n var hex = digest.toHex();\n if(options.delimiter) {\n return hex.match(/.{2}/g).join(options.delimiter);\n }\n return hex;\n } else if(options.encoding === 'binary') {\n return digest.getBytes();\n } else if(options.encoding) {\n throw new Error('Unknown encoding \"' + options.encoding + '\".');\n }\n return digest;\n};\n\n/**\n * Converts a PKCS#10 certification request (CSR) from PEM format.\n *\n * Note: If the certification request is to be verified then compute hash\n * should be set to true. This will scan the CertificationRequestInfo part of\n * the ASN.1 object while it is converted so it doesn't need to be converted\n * back to ASN.1-DER-encoding later.\n *\n * @param pem the PEM-formatted certificate.\n * @param computeHash true to compute the hash for verification.\n * @param strict true to be strict when checking ASN.1 value lengths, false to\n * allow truncated values (default: true).\n *\n * @return the certification request (CSR).\n */\npki.certificationRequestFromPem = function(pem, computeHash, strict) {\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'CERTIFICATE REQUEST') {\n var error = new Error('Could not convert certification request from PEM; ' +\n 'PEM header type is not \"CERTIFICATE REQUEST\".');\n error.headerType = msg.type;\n throw error;\n }\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n throw new Error('Could not convert certification request from PEM; ' +\n 'PEM is encrypted.');\n }\n\n // convert DER to ASN.1 object\n var obj = asn1.fromDer(msg.body, strict);\n\n return pki.certificationRequestFromAsn1(obj, computeHash);\n};\n\n/**\n * Converts a PKCS#10 certification request (CSR) to PEM format.\n *\n * @param csr the certification request.\n * @param maxline the maximum characters per line, defaults to 64.\n *\n * @return the PEM-formatted certification request.\n */\npki.certificationRequestToPem = function(csr, maxline) {\n // convert to ASN.1, then DER, then PEM-encode\n var msg = {\n type: 'CERTIFICATE REQUEST',\n body: asn1.toDer(pki.certificationRequestToAsn1(csr)).getBytes()\n };\n return forge.pem.encode(msg, {maxline: maxline});\n};\n\n/**\n * Creates an empty X.509v3 RSA certificate.\n *\n * @return the certificate.\n */\npki.createCertificate = function() {\n var cert = {};\n cert.version = 0x02;\n cert.serialNumber = '00';\n cert.signatureOid = null;\n cert.signature = null;\n cert.siginfo = {};\n cert.siginfo.algorithmOid = null;\n cert.validity = {};\n cert.validity.notBefore = new Date();\n cert.validity.notAfter = new Date();\n\n cert.issuer = {};\n cert.issuer.getField = function(sn) {\n return _getAttribute(cert.issuer, sn);\n };\n cert.issuer.addField = function(attr) {\n _fillMissingFields([attr]);\n cert.issuer.attributes.push(attr);\n };\n cert.issuer.attributes = [];\n cert.issuer.hash = null;\n\n cert.subject = {};\n cert.subject.getField = function(sn) {\n return _getAttribute(cert.subject, sn);\n };\n cert.subject.addField = function(attr) {\n _fillMissingFields([attr]);\n cert.subject.attributes.push(attr);\n };\n cert.subject.attributes = [];\n cert.subject.hash = null;\n\n cert.extensions = [];\n cert.publicKey = null;\n cert.md = null;\n\n /**\n * Sets the subject of this certificate.\n *\n * @param attrs the array of subject attributes to use.\n * @param uniqueId an optional a unique ID to use.\n */\n cert.setSubject = function(attrs, uniqueId) {\n // set new attributes, clear hash\n _fillMissingFields(attrs);\n cert.subject.attributes = attrs;\n delete cert.subject.uniqueId;\n if(uniqueId) {\n // TODO: support arbitrary bit length ids\n cert.subject.uniqueId = uniqueId;\n }\n cert.subject.hash = null;\n };\n\n /**\n * Sets the issuer of this certificate.\n *\n * @param attrs the array of issuer attributes to use.\n * @param uniqueId an optional a unique ID to use.\n */\n cert.setIssuer = function(attrs, uniqueId) {\n // set new attributes, clear hash\n _fillMissingFields(attrs);\n cert.issuer.attributes = attrs;\n delete cert.issuer.uniqueId;\n if(uniqueId) {\n // TODO: support arbitrary bit length ids\n cert.issuer.uniqueId = uniqueId;\n }\n cert.issuer.hash = null;\n };\n\n /**\n * Sets the extensions of this certificate.\n *\n * @param exts the array of extensions to use.\n */\n cert.setExtensions = function(exts) {\n for(var i = 0; i < exts.length; ++i) {\n _fillMissingExtensionFields(exts[i], {cert: cert});\n }\n // set new extensions\n cert.extensions = exts;\n };\n\n /**\n * Gets an extension by its name or id.\n *\n * @param options the name to use or an object with:\n * name the name to use.\n * id the id to use.\n *\n * @return the extension or null if not found.\n */\n cert.getExtension = function(options) {\n if(typeof options === 'string') {\n options = {name: options};\n }\n\n var rval = null;\n var ext;\n for(var i = 0; rval === null && i < cert.extensions.length; ++i) {\n ext = cert.extensions[i];\n if(options.id && ext.id === options.id) {\n rval = ext;\n } else if(options.name && ext.name === options.name) {\n rval = ext;\n }\n }\n return rval;\n };\n\n /**\n * Signs this certificate using the given private key.\n *\n * @param key the private key to sign with.\n * @param md the message digest object to use (defaults to forge.md.sha1).\n */\n cert.sign = function(key, md) {\n // TODO: get signature OID from private key\n cert.md = md || forge.md.sha1.create();\n var algorithmOid = oids[cert.md.algorithm + 'WithRSAEncryption'];\n if(!algorithmOid) {\n var error = new Error('Could not compute certificate digest. ' +\n 'Unknown message digest algorithm OID.');\n error.algorithm = cert.md.algorithm;\n throw error;\n }\n cert.signatureOid = cert.siginfo.algorithmOid = algorithmOid;\n\n // get TBSCertificate, convert to DER\n cert.tbsCertificate = pki.getTBSCertificate(cert);\n var bytes = asn1.toDer(cert.tbsCertificate);\n\n // digest and sign\n cert.md.update(bytes.getBytes());\n cert.signature = key.sign(cert.md);\n };\n\n /**\n * Attempts verify the signature on the passed certificate using this\n * certificate's public key.\n *\n * @param child the certificate to verify.\n *\n * @return true if verified, false if not.\n */\n cert.verify = function(child) {\n var rval = false;\n\n if(!cert.issued(child)) {\n var issuer = child.issuer;\n var subject = cert.subject;\n var error = new Error(\n 'The parent certificate did not issue the given child ' +\n 'certificate; the child certificate\\'s issuer does not match the ' +\n 'parent\\'s subject.');\n error.expectedIssuer = issuer.attributes;\n error.actualIssuer = subject.attributes;\n throw error;\n }\n\n var md = child.md;\n if(md === null) {\n // check signature OID for supported signature types\n if(child.signatureOid in oids) {\n var oid = oids[child.signatureOid];\n switch(oid) {\n case 'sha1WithRSAEncryption':\n md = forge.md.sha1.create();\n break;\n case 'md5WithRSAEncryption':\n md = forge.md.md5.create();\n break;\n case 'sha256WithRSAEncryption':\n md = forge.md.sha256.create();\n break;\n case 'sha384WithRSAEncryption':\n md = forge.md.sha384.create();\n break;\n case 'sha512WithRSAEncryption':\n md = forge.md.sha512.create();\n break;\n case 'RSASSA-PSS':\n md = forge.md.sha256.create();\n break;\n }\n }\n if(md === null) {\n var error = new Error('Could not compute certificate digest. ' +\n 'Unknown signature OID.');\n error.signatureOid = child.signatureOid;\n throw error;\n }\n\n // produce DER formatted TBSCertificate and digest it\n var tbsCertificate = child.tbsCertificate || pki.getTBSCertificate(child);\n var bytes = asn1.toDer(tbsCertificate);\n md.update(bytes.getBytes());\n }\n\n if(md !== null) {\n var scheme;\n\n switch(child.signatureOid) {\n case oids.sha1WithRSAEncryption:\n scheme = undefined; /* use PKCS#1 v1.5 padding scheme */\n break;\n case oids['RSASSA-PSS']:\n var hash, mgf;\n\n /* initialize mgf */\n hash = oids[child.signatureParameters.mgf.hash.algorithmOid];\n if(hash === undefined || forge.md[hash] === undefined) {\n var error = new Error('Unsupported MGF hash function.');\n error.oid = child.signatureParameters.mgf.hash.algorithmOid;\n error.name = hash;\n throw error;\n }\n\n mgf = oids[child.signatureParameters.mgf.algorithmOid];\n if(mgf === undefined || forge.mgf[mgf] === undefined) {\n var error = new Error('Unsupported MGF function.');\n error.oid = child.signatureParameters.mgf.algorithmOid;\n error.name = mgf;\n throw error;\n }\n\n mgf = forge.mgf[mgf].create(forge.md[hash].create());\n\n /* initialize hash function */\n hash = oids[child.signatureParameters.hash.algorithmOid];\n if(hash === undefined || forge.md[hash] === undefined) {\n throw {\n message: 'Unsupported RSASSA-PSS hash function.',\n oid: child.signatureParameters.hash.algorithmOid,\n name: hash\n };\n }\n\n scheme = forge.pss.create(forge.md[hash].create(), mgf,\n child.signatureParameters.saltLength);\n break;\n }\n\n // verify signature on cert using public key\n rval = cert.publicKey.verify(\n md.digest().getBytes(), child.signature, scheme);\n }\n\n return rval;\n };\n\n /**\n * Returns true if this certificate's issuer matches the passed\n * certificate's subject. Note that no signature check is performed.\n *\n * @param parent the certificate to check.\n *\n * @return true if this certificate's issuer matches the passed certificate's\n * subject.\n */\n cert.isIssuer = function(parent) {\n var rval = false;\n\n var i = cert.issuer;\n var s = parent.subject;\n\n // compare hashes if present\n if(i.hash && s.hash) {\n rval = (i.hash === s.hash);\n } else if(i.attributes.length === s.attributes.length) {\n // all attributes are the same so issuer matches subject\n rval = true;\n var iattr, sattr;\n for(var n = 0; rval && n < i.attributes.length; ++n) {\n iattr = i.attributes[n];\n sattr = s.attributes[n];\n if(iattr.type !== sattr.type || iattr.value !== sattr.value) {\n // attribute mismatch\n rval = false;\n }\n }\n }\n\n return rval;\n };\n\n /**\n * Returns true if this certificate's subject matches the issuer of the\n * given certificate). Note that not signature check is performed.\n *\n * @param child the certificate to check.\n *\n * @return true if this certificate's subject matches the passed\n * certificate's issuer.\n */\n cert.issued = function(child) {\n return child.isIssuer(cert);\n };\n\n /**\n * Generates the subjectKeyIdentifier for this certificate as byte buffer.\n *\n * @return the subjectKeyIdentifier for this certificate as byte buffer.\n */\n cert.generateSubjectKeyIdentifier = function() {\n /* See: 4.2.1.2 section of the the RFC3280, keyIdentifier is either:\n\n (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the\n value of the BIT STRING subjectPublicKey (excluding the tag,\n length, and number of unused bits).\n\n (2) The keyIdentifier is composed of a four bit type field with\n the value 0100 followed by the least significant 60 bits of the\n SHA-1 hash of the value of the BIT STRING subjectPublicKey\n (excluding the tag, length, and number of unused bit string bits).\n */\n\n // skipping the tag, length, and number of unused bits is the same\n // as just using the RSAPublicKey (for RSA keys, which are the\n // only ones supported)\n return pki.getPublicKeyFingerprint(cert.publicKey, {type: 'RSAPublicKey'});\n };\n\n /**\n * Verifies the subjectKeyIdentifier extension value for this certificate\n * against its public key. If no extension is found, false will be\n * returned.\n *\n * @return true if verified, false if not.\n */\n cert.verifySubjectKeyIdentifier = function() {\n var oid = oids['subjectKeyIdentifier'];\n for(var i = 0; i < cert.extensions.length; ++i) {\n var ext = cert.extensions[i];\n if(ext.id === oid) {\n var ski = cert.generateSubjectKeyIdentifier().getBytes();\n return (forge.util.hexToBytes(ext.subjectKeyIdentifier) === ski);\n }\n }\n return false;\n };\n\n return cert;\n};\n\n/**\n * Converts an X.509v3 RSA certificate from an ASN.1 object.\n *\n * Note: If the certificate is to be verified then compute hash should\n * be set to true. There is currently no implementation for converting\n * a certificate back to ASN.1 so the TBSCertificate part of the ASN.1\n * object needs to be scanned before the cert object is created.\n *\n * @param obj the asn1 representation of an X.509v3 RSA certificate.\n * @param computeHash true to compute the hash for verification.\n *\n * @return the certificate.\n */\npki.certificateFromAsn1 = function(obj, computeHash) {\n // validate certificate and capture data\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, x509CertificateValidator, capture, errors)) {\n var error = new Error('Cannot read X.509 certificate. ' +\n 'ASN.1 object is not an X509v3 Certificate.');\n error.errors = errors;\n throw error;\n }\n\n // get oid\n var oid = asn1.derToOid(capture.publicKeyOid);\n if(oid !== pki.oids.rsaEncryption) {\n throw new Error('Cannot read public key. OID is not RSA.');\n }\n\n // create certificate\n var cert = pki.createCertificate();\n cert.version = capture.certVersion ?\n capture.certVersion.charCodeAt(0) : 0;\n var serial = forge.util.createBuffer(capture.certSerialNumber);\n cert.serialNumber = serial.toHex();\n cert.signatureOid = forge.asn1.derToOid(capture.certSignatureOid);\n cert.signatureParameters = _readSignatureParameters(\n cert.signatureOid, capture.certSignatureParams, true);\n cert.siginfo.algorithmOid = forge.asn1.derToOid(capture.certinfoSignatureOid);\n cert.siginfo.parameters = _readSignatureParameters(cert.siginfo.algorithmOid,\n capture.certinfoSignatureParams, false);\n cert.signature = capture.certSignature;\n\n var validity = [];\n if(capture.certValidity1UTCTime !== undefined) {\n validity.push(asn1.utcTimeToDate(capture.certValidity1UTCTime));\n }\n if(capture.certValidity2GeneralizedTime !== undefined) {\n validity.push(asn1.generalizedTimeToDate(\n capture.certValidity2GeneralizedTime));\n }\n if(capture.certValidity3UTCTime !== undefined) {\n validity.push(asn1.utcTimeToDate(capture.certValidity3UTCTime));\n }\n if(capture.certValidity4GeneralizedTime !== undefined) {\n validity.push(asn1.generalizedTimeToDate(\n capture.certValidity4GeneralizedTime));\n }\n if(validity.length > 2) {\n throw new Error('Cannot read notBefore/notAfter validity times; more ' +\n 'than two times were provided in the certificate.');\n }\n if(validity.length < 2) {\n throw new Error('Cannot read notBefore/notAfter validity times; they ' +\n 'were not provided as either UTCTime or GeneralizedTime.');\n }\n cert.validity.notBefore = validity[0];\n cert.validity.notAfter = validity[1];\n\n // keep TBSCertificate to preserve signature when exporting\n cert.tbsCertificate = capture.tbsCertificate;\n\n if(computeHash) {\n // check signature OID for supported signature types\n cert.md = null;\n if(cert.signatureOid in oids) {\n var oid = oids[cert.signatureOid];\n switch(oid) {\n case 'sha1WithRSAEncryption':\n cert.md = forge.md.sha1.create();\n break;\n case 'md5WithRSAEncryption':\n cert.md = forge.md.md5.create();\n break;\n case 'sha256WithRSAEncryption':\n cert.md = forge.md.sha256.create();\n break;\n case 'sha384WithRSAEncryption':\n cert.md = forge.md.sha384.create();\n break;\n case 'sha512WithRSAEncryption':\n cert.md = forge.md.sha512.create();\n break;\n case 'RSASSA-PSS':\n cert.md = forge.md.sha256.create();\n break;\n }\n }\n if(cert.md === null) {\n var error = new Error('Could not compute certificate digest. ' +\n 'Unknown signature OID.');\n error.signatureOid = cert.signatureOid;\n throw error;\n }\n\n // produce DER formatted TBSCertificate and digest it\n var bytes = asn1.toDer(cert.tbsCertificate);\n cert.md.update(bytes.getBytes());\n }\n\n // handle issuer, build issuer message digest\n var imd = forge.md.sha1.create();\n cert.issuer.getField = function(sn) {\n return _getAttribute(cert.issuer, sn);\n };\n cert.issuer.addField = function(attr) {\n _fillMissingFields([attr]);\n cert.issuer.attributes.push(attr);\n };\n cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer, imd);\n if(capture.certIssuerUniqueId) {\n cert.issuer.uniqueId = capture.certIssuerUniqueId;\n }\n cert.issuer.hash = imd.digest().toHex();\n\n // handle subject, build subject message digest\n var smd = forge.md.sha1.create();\n cert.subject.getField = function(sn) {\n return _getAttribute(cert.subject, sn);\n };\n cert.subject.addField = function(attr) {\n _fillMissingFields([attr]);\n cert.subject.attributes.push(attr);\n };\n cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject, smd);\n if(capture.certSubjectUniqueId) {\n cert.subject.uniqueId = capture.certSubjectUniqueId;\n }\n cert.subject.hash = smd.digest().toHex();\n\n // handle extensions\n if(capture.certExtensions) {\n cert.extensions = pki.certificateExtensionsFromAsn1(capture.certExtensions);\n } else {\n cert.extensions = [];\n }\n\n // convert RSA public key from ASN.1\n cert.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo);\n\n return cert;\n};\n\n/**\n * Converts an ASN.1 extensions object (with extension sequences as its\n * values) into an array of extension objects with types and values.\n *\n * Supported extensions:\n *\n * id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 }\n * KeyUsage ::= BIT STRING {\n * digitalSignature (0),\n * nonRepudiation (1),\n * keyEncipherment (2),\n * dataEncipherment (3),\n * keyAgreement (4),\n * keyCertSign (5),\n * cRLSign (6),\n * encipherOnly (7),\n * decipherOnly (8)\n * }\n *\n * id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 }\n * BasicConstraints ::= SEQUENCE {\n * cA BOOLEAN DEFAULT FALSE,\n * pathLenConstraint INTEGER (0..MAX) OPTIONAL\n * }\n *\n * subjectAltName EXTENSION ::= {\n * SYNTAX GeneralNames\n * IDENTIFIED BY id-ce-subjectAltName\n * }\n *\n * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName\n *\n * GeneralName ::= CHOICE {\n * otherName [0] INSTANCE OF OTHER-NAME,\n * rfc822Name [1] IA5String,\n * dNSName [2] IA5String,\n * x400Address [3] ORAddress,\n * directoryName [4] Name,\n * ediPartyName [5] EDIPartyName,\n * uniformResourceIdentifier [6] IA5String,\n * IPAddress [7] OCTET STRING,\n * registeredID [8] OBJECT IDENTIFIER\n * }\n *\n * OTHER-NAME ::= TYPE-IDENTIFIER\n *\n * EDIPartyName ::= SEQUENCE {\n * nameAssigner [0] DirectoryString {ub-name} OPTIONAL,\n * partyName [1] DirectoryString {ub-name}\n * }\n *\n * @param exts the extensions ASN.1 with extension sequences to parse.\n *\n * @return the array.\n */\npki.certificateExtensionsFromAsn1 = function(exts) {\n var rval = [];\n for(var i = 0; i < exts.value.length; ++i) {\n // get extension sequence\n var extseq = exts.value[i];\n for(var ei = 0; ei < extseq.value.length; ++ei) {\n rval.push(pki.certificateExtensionFromAsn1(extseq.value[ei]));\n }\n }\n\n return rval;\n};\n\n/**\n * Parses a single certificate extension from ASN.1.\n *\n * @param ext the extension in ASN.1 format.\n *\n * @return the parsed extension as an object.\n */\npki.certificateExtensionFromAsn1 = function(ext) {\n // an extension has:\n // [0] extnID OBJECT IDENTIFIER\n // [1] critical BOOLEAN DEFAULT FALSE\n // [2] extnValue OCTET STRING\n var e = {};\n e.id = asn1.derToOid(ext.value[0].value);\n e.critical = false;\n if(ext.value[1].type === asn1.Type.BOOLEAN) {\n e.critical = (ext.value[1].value.charCodeAt(0) !== 0x00);\n e.value = ext.value[2].value;\n } else {\n e.value = ext.value[1].value;\n }\n // if the oid is known, get its name\n if(e.id in oids) {\n e.name = oids[e.id];\n\n // handle key usage\n if(e.name === 'keyUsage') {\n // get value as BIT STRING\n var ev = asn1.fromDer(e.value);\n var b2 = 0x00;\n var b3 = 0x00;\n if(ev.value.length > 1) {\n // skip first byte, just indicates unused bits which\n // will be padded with 0s anyway\n // get bytes with flag bits\n b2 = ev.value.charCodeAt(1);\n b3 = ev.value.length > 2 ? ev.value.charCodeAt(2) : 0;\n }\n // set flags\n e.digitalSignature = (b2 & 0x80) === 0x80;\n e.nonRepudiation = (b2 & 0x40) === 0x40;\n e.keyEncipherment = (b2 & 0x20) === 0x20;\n e.dataEncipherment = (b2 & 0x10) === 0x10;\n e.keyAgreement = (b2 & 0x08) === 0x08;\n e.keyCertSign = (b2 & 0x04) === 0x04;\n e.cRLSign = (b2 & 0x02) === 0x02;\n e.encipherOnly = (b2 & 0x01) === 0x01;\n e.decipherOnly = (b3 & 0x80) === 0x80;\n } else if(e.name === 'basicConstraints') {\n // handle basic constraints\n // get value as SEQUENCE\n var ev = asn1.fromDer(e.value);\n // get cA BOOLEAN flag (defaults to false)\n if(ev.value.length > 0 && ev.value[0].type === asn1.Type.BOOLEAN) {\n e.cA = (ev.value[0].value.charCodeAt(0) !== 0x00);\n } else {\n e.cA = false;\n }\n // get path length constraint\n var value = null;\n if(ev.value.length > 0 && ev.value[0].type === asn1.Type.INTEGER) {\n value = ev.value[0].value;\n } else if(ev.value.length > 1) {\n value = ev.value[1].value;\n }\n if(value !== null) {\n e.pathLenConstraint = asn1.derToInteger(value);\n }\n } else if(e.name === 'extKeyUsage') {\n // handle extKeyUsage\n // value is a SEQUENCE of OIDs\n var ev = asn1.fromDer(e.value);\n for(var vi = 0; vi < ev.value.length; ++vi) {\n var oid = asn1.derToOid(ev.value[vi].value);\n if(oid in oids) {\n e[oids[oid]] = true;\n } else {\n e[oid] = true;\n }\n }\n } else if(e.name === 'nsCertType') {\n // handle nsCertType\n // get value as BIT STRING\n var ev = asn1.fromDer(e.value);\n var b2 = 0x00;\n if(ev.value.length > 1) {\n // skip first byte, just indicates unused bits which\n // will be padded with 0s anyway\n // get bytes with flag bits\n b2 = ev.value.charCodeAt(1);\n }\n // set flags\n e.client = (b2 & 0x80) === 0x80;\n e.server = (b2 & 0x40) === 0x40;\n e.email = (b2 & 0x20) === 0x20;\n e.objsign = (b2 & 0x10) === 0x10;\n e.reserved = (b2 & 0x08) === 0x08;\n e.sslCA = (b2 & 0x04) === 0x04;\n e.emailCA = (b2 & 0x02) === 0x02;\n e.objCA = (b2 & 0x01) === 0x01;\n } else if(\n e.name === 'subjectAltName' ||\n e.name === 'issuerAltName') {\n // handle subjectAltName/issuerAltName\n e.altNames = [];\n\n // ev is a SYNTAX SEQUENCE\n var gn;\n var ev = asn1.fromDer(e.value);\n for(var n = 0; n < ev.value.length; ++n) {\n // get GeneralName\n gn = ev.value[n];\n\n var altName = {\n type: gn.type,\n value: gn.value\n };\n e.altNames.push(altName);\n\n // Note: Support for types 1,2,6,7,8\n switch(gn.type) {\n // rfc822Name\n case 1:\n // dNSName\n case 2:\n // uniformResourceIdentifier (URI)\n case 6:\n break;\n // IPAddress\n case 7:\n // convert to IPv4/IPv6 string representation\n altName.ip = forge.util.bytesToIP(gn.value);\n break;\n // registeredID\n case 8:\n altName.oid = asn1.derToOid(gn.value);\n break;\n default:\n // unsupported\n }\n }\n } else if(e.name === 'subjectKeyIdentifier') {\n // value is an OCTETSTRING w/the hash of the key-type specific\n // public key structure (eg: RSAPublicKey)\n var ev = asn1.fromDer(e.value);\n e.subjectKeyIdentifier = forge.util.bytesToHex(ev.value);\n }\n }\n return e;\n};\n\n/**\n * Converts a PKCS#10 certification request (CSR) from an ASN.1 object.\n *\n * Note: If the certification request is to be verified then compute hash\n * should be set to true. There is currently no implementation for converting\n * a certificate back to ASN.1 so the CertificationRequestInfo part of the\n * ASN.1 object needs to be scanned before the csr object is created.\n *\n * @param obj the asn1 representation of a PKCS#10 certification request (CSR).\n * @param computeHash true to compute the hash for verification.\n *\n * @return the certification request (CSR).\n */\npki.certificationRequestFromAsn1 = function(obj, computeHash) {\n // validate certification request and capture data\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, certificationRequestValidator, capture, errors)) {\n var error = new Error('Cannot read PKCS#10 certificate request. ' +\n 'ASN.1 object is not a PKCS#10 CertificationRequest.');\n error.errors = errors;\n throw error;\n }\n\n // get oid\n var oid = asn1.derToOid(capture.publicKeyOid);\n if(oid !== pki.oids.rsaEncryption) {\n throw new Error('Cannot read public key. OID is not RSA.');\n }\n\n // create certification request\n var csr = pki.createCertificationRequest();\n csr.version = capture.csrVersion ? capture.csrVersion.charCodeAt(0) : 0;\n csr.signatureOid = forge.asn1.derToOid(capture.csrSignatureOid);\n csr.signatureParameters = _readSignatureParameters(\n csr.signatureOid, capture.csrSignatureParams, true);\n csr.siginfo.algorithmOid = forge.asn1.derToOid(capture.csrSignatureOid);\n csr.siginfo.parameters = _readSignatureParameters(\n csr.siginfo.algorithmOid, capture.csrSignatureParams, false);\n csr.signature = capture.csrSignature;\n\n // keep CertificationRequestInfo to preserve signature when exporting\n csr.certificationRequestInfo = capture.certificationRequestInfo;\n\n if(computeHash) {\n // check signature OID for supported signature types\n csr.md = null;\n if(csr.signatureOid in oids) {\n var oid = oids[csr.signatureOid];\n switch(oid) {\n case 'sha1WithRSAEncryption':\n csr.md = forge.md.sha1.create();\n break;\n case 'md5WithRSAEncryption':\n csr.md = forge.md.md5.create();\n break;\n case 'sha256WithRSAEncryption':\n csr.md = forge.md.sha256.create();\n break;\n case 'sha384WithRSAEncryption':\n csr.md = forge.md.sha384.create();\n break;\n case 'sha512WithRSAEncryption':\n csr.md = forge.md.sha512.create();\n break;\n case 'RSASSA-PSS':\n csr.md = forge.md.sha256.create();\n break;\n }\n }\n if(csr.md === null) {\n var error = new Error('Could not compute certification request digest. ' +\n 'Unknown signature OID.');\n error.signatureOid = csr.signatureOid;\n throw error;\n }\n\n // produce DER formatted CertificationRequestInfo and digest it\n var bytes = asn1.toDer(csr.certificationRequestInfo);\n csr.md.update(bytes.getBytes());\n }\n\n // handle subject, build subject message digest\n var smd = forge.md.sha1.create();\n csr.subject.getField = function(sn) {\n return _getAttribute(csr.subject, sn);\n };\n csr.subject.addField = function(attr) {\n _fillMissingFields([attr]);\n csr.subject.attributes.push(attr);\n };\n csr.subject.attributes = pki.RDNAttributesAsArray(\n capture.certificationRequestInfoSubject, smd);\n csr.subject.hash = smd.digest().toHex();\n\n // convert RSA public key from ASN.1\n csr.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo);\n\n // convert attributes from ASN.1\n csr.getAttribute = function(sn) {\n return _getAttribute(csr, sn);\n };\n csr.addAttribute = function(attr) {\n _fillMissingFields([attr]);\n csr.attributes.push(attr);\n };\n csr.attributes = pki.CRIAttributesAsArray(\n capture.certificationRequestInfoAttributes || []);\n\n return csr;\n};\n\n/**\n * Creates an empty certification request (a CSR or certificate signing\n * request). Once created, its public key and attributes can be set and then\n * it can be signed.\n *\n * @return the empty certification request.\n */\npki.createCertificationRequest = function() {\n var csr = {};\n csr.version = 0x00;\n csr.signatureOid = null;\n csr.signature = null;\n csr.siginfo = {};\n csr.siginfo.algorithmOid = null;\n\n csr.subject = {};\n csr.subject.getField = function(sn) {\n return _getAttribute(csr.subject, sn);\n };\n csr.subject.addField = function(attr) {\n _fillMissingFields([attr]);\n csr.subject.attributes.push(attr);\n };\n csr.subject.attributes = [];\n csr.subject.hash = null;\n\n csr.publicKey = null;\n csr.attributes = [];\n csr.getAttribute = function(sn) {\n return _getAttribute(csr, sn);\n };\n csr.addAttribute = function(attr) {\n _fillMissingFields([attr]);\n csr.attributes.push(attr);\n };\n csr.md = null;\n\n /**\n * Sets the subject of this certification request.\n *\n * @param attrs the array of subject attributes to use.\n */\n csr.setSubject = function(attrs) {\n // set new attributes\n _fillMissingFields(attrs);\n csr.subject.attributes = attrs;\n csr.subject.hash = null;\n };\n\n /**\n * Sets the attributes of this certification request.\n *\n * @param attrs the array of attributes to use.\n */\n csr.setAttributes = function(attrs) {\n // set new attributes\n _fillMissingFields(attrs);\n csr.attributes = attrs;\n };\n\n /**\n * Signs this certification request using the given private key.\n *\n * @param key the private key to sign with.\n * @param md the message digest object to use (defaults to forge.md.sha1).\n */\n csr.sign = function(key, md) {\n // TODO: get signature OID from private key\n csr.md = md || forge.md.sha1.create();\n var algorithmOid = oids[csr.md.algorithm + 'WithRSAEncryption'];\n if(!algorithmOid) {\n var error = new Error('Could not compute certification request digest. ' +\n 'Unknown message digest algorithm OID.');\n error.algorithm = csr.md.algorithm;\n throw error;\n }\n csr.signatureOid = csr.siginfo.algorithmOid = algorithmOid;\n\n // get CertificationRequestInfo, convert to DER\n csr.certificationRequestInfo = pki.getCertificationRequestInfo(csr);\n var bytes = asn1.toDer(csr.certificationRequestInfo);\n\n // digest and sign\n csr.md.update(bytes.getBytes());\n csr.signature = key.sign(csr.md);\n };\n\n /**\n * Attempts verify the signature on the passed certification request using\n * its public key.\n *\n * A CSR that has been exported to a file in PEM format can be verified using\n * OpenSSL using this command:\n *\n * openssl req -in -verify -noout -text\n *\n * @return true if verified, false if not.\n */\n csr.verify = function() {\n var rval = false;\n\n var md = csr.md;\n if(md === null) {\n // check signature OID for supported signature types\n if(csr.signatureOid in oids) {\n // TODO: create DRY `OID to md` function\n var oid = oids[csr.signatureOid];\n switch(oid) {\n case 'sha1WithRSAEncryption':\n md = forge.md.sha1.create();\n break;\n case 'md5WithRSAEncryption':\n md = forge.md.md5.create();\n break;\n case 'sha256WithRSAEncryption':\n md = forge.md.sha256.create();\n break;\n case 'sha384WithRSAEncryption':\n md = forge.md.sha384.create();\n break;\n case 'sha512WithRSAEncryption':\n md = forge.md.sha512.create();\n break;\n case 'RSASSA-PSS':\n md = forge.md.sha256.create();\n break;\n }\n }\n if(md === null) {\n var error = new Error(\n 'Could not compute certification request digest. ' +\n 'Unknown signature OID.');\n error.signatureOid = csr.signatureOid;\n throw error;\n }\n\n // produce DER formatted CertificationRequestInfo and digest it\n var cri = csr.certificationRequestInfo ||\n pki.getCertificationRequestInfo(csr);\n var bytes = asn1.toDer(cri);\n md.update(bytes.getBytes());\n }\n\n if(md !== null) {\n var scheme;\n\n switch(csr.signatureOid) {\n case oids.sha1WithRSAEncryption:\n /* use PKCS#1 v1.5 padding scheme */\n break;\n case oids['RSASSA-PSS']:\n var hash, mgf;\n\n /* initialize mgf */\n hash = oids[csr.signatureParameters.mgf.hash.algorithmOid];\n if(hash === undefined || forge.md[hash] === undefined) {\n var error = new Error('Unsupported MGF hash function.');\n error.oid = csr.signatureParameters.mgf.hash.algorithmOid;\n error.name = hash;\n throw error;\n }\n\n mgf = oids[csr.signatureParameters.mgf.algorithmOid];\n if(mgf === undefined || forge.mgf[mgf] === undefined) {\n var error = new Error('Unsupported MGF function.');\n error.oid = csr.signatureParameters.mgf.algorithmOid;\n error.name = mgf;\n throw error;\n }\n\n mgf = forge.mgf[mgf].create(forge.md[hash].create());\n\n /* initialize hash function */\n hash = oids[csr.signatureParameters.hash.algorithmOid];\n if(hash === undefined || forge.md[hash] === undefined) {\n var error = new Error('Unsupported RSASSA-PSS hash function.');\n error.oid = csr.signatureParameters.hash.algorithmOid;\n error.name = hash;\n throw error;\n }\n\n scheme = forge.pss.create(forge.md[hash].create(), mgf,\n csr.signatureParameters.saltLength);\n break;\n }\n\n // verify signature on csr using its public key\n rval = csr.publicKey.verify(\n md.digest().getBytes(), csr.signature, scheme);\n }\n\n return rval;\n };\n\n return csr;\n};\n\n/**\n * Converts an X.509 subject or issuer to an ASN.1 RDNSequence.\n *\n * @param obj the subject or issuer (distinguished name).\n *\n * @return the ASN.1 RDNSequence.\n */\nfunction _dnToAsn1(obj) {\n // create an empty RDNSequence\n var rval = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n\n // iterate over attributes\n var attr, set;\n var attrs = obj.attributes;\n for(var i = 0; i < attrs.length; ++i) {\n attr = attrs[i];\n var value = attr.value;\n\n // reuse tag class for attribute value if available\n var valueTagClass = asn1.Type.PRINTABLESTRING;\n if('valueTagClass' in attr) {\n valueTagClass = attr.valueTagClass;\n\n if(valueTagClass === asn1.Type.UTF8) {\n value = forge.util.encodeUtf8(value);\n }\n // FIXME: handle more encodings\n }\n\n // create a RelativeDistinguishedName set\n // each value in the set is an AttributeTypeAndValue first\n // containing the type (an OID) and second the value\n set = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // AttributeType\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(attr.type).getBytes()),\n // AttributeValue\n asn1.create(asn1.Class.UNIVERSAL, valueTagClass, false, value)\n ])\n ]);\n rval.value.push(set);\n }\n\n return rval;\n}\n\n/**\n * Gets all printable attributes (typically of an issuer or subject) in a\n * simplified JSON format for display.\n *\n * @param attrs the attributes.\n *\n * @return the JSON for display.\n */\nfunction _getAttributesAsJson(attrs) {\n var rval = {};\n for(var i = 0; i < attrs.length; ++i) {\n var attr = attrs[i];\n if(attr.shortName && (\n attr.valueTagClass === asn1.Type.UTF8 ||\n attr.valueTagClass === asn1.Type.PRINTABLESTRING ||\n attr.valueTagClass === asn1.Type.IA5STRING)) {\n var value = attr.value;\n if(attr.valueTagClass === asn1.Type.UTF8) {\n value = forge.util.encodeUtf8(attr.value);\n }\n if(!(attr.shortName in rval)) {\n rval[attr.shortName] = value;\n } else if(forge.util.isArray(rval[attr.shortName])) {\n rval[attr.shortName].push(value);\n } else {\n rval[attr.shortName] = [rval[attr.shortName], value];\n }\n }\n }\n return rval;\n}\n\n/**\n * Fills in missing fields in attributes.\n *\n * @param attrs the attributes to fill missing fields in.\n */\nfunction _fillMissingFields(attrs) {\n var attr;\n for(var i = 0; i < attrs.length; ++i) {\n attr = attrs[i];\n\n // populate missing name\n if(typeof attr.name === 'undefined') {\n if(attr.type && attr.type in pki.oids) {\n attr.name = pki.oids[attr.type];\n } else if(attr.shortName && attr.shortName in _shortNames) {\n attr.name = pki.oids[_shortNames[attr.shortName]];\n }\n }\n\n // populate missing type (OID)\n if(typeof attr.type === 'undefined') {\n if(attr.name && attr.name in pki.oids) {\n attr.type = pki.oids[attr.name];\n } else {\n var error = new Error('Attribute type not specified.');\n error.attribute = attr;\n throw error;\n }\n }\n\n // populate missing shortname\n if(typeof attr.shortName === 'undefined') {\n if(attr.name && attr.name in _shortNames) {\n attr.shortName = _shortNames[attr.name];\n }\n }\n\n // convert extensions to value\n if(attr.type === oids.extensionRequest) {\n attr.valueConstructed = true;\n attr.valueTagClass = asn1.Type.SEQUENCE;\n if(!attr.value && attr.extensions) {\n attr.value = [];\n for(var ei = 0; ei < attr.extensions.length; ++ei) {\n attr.value.push(pki.certificateExtensionToAsn1(\n _fillMissingExtensionFields(attr.extensions[ei])));\n }\n }\n }\n\n if(typeof attr.value === 'undefined') {\n var error = new Error('Attribute value not specified.');\n error.attribute = attr;\n throw error;\n }\n }\n}\n\n/**\n * Fills in missing fields in certificate extensions.\n *\n * @param e the extension.\n * @param [options] the options to use.\n * [cert] the certificate the extensions are for.\n *\n * @return the extension.\n */\nfunction _fillMissingExtensionFields(e, options) {\n options = options || {};\n\n // populate missing name\n if(typeof e.name === 'undefined') {\n if(e.id && e.id in pki.oids) {\n e.name = pki.oids[e.id];\n }\n }\n\n // populate missing id\n if(typeof e.id === 'undefined') {\n if(e.name && e.name in pki.oids) {\n e.id = pki.oids[e.name];\n } else {\n var error = new Error('Extension ID not specified.');\n error.extension = e;\n throw error;\n }\n }\n\n if(typeof e.value !== 'undefined') {\n return e;\n }\n\n // handle missing value:\n\n // value is a BIT STRING\n if(e.name === 'keyUsage') {\n // build flags\n var unused = 0;\n var b2 = 0x00;\n var b3 = 0x00;\n if(e.digitalSignature) {\n b2 |= 0x80;\n unused = 7;\n }\n if(e.nonRepudiation) {\n b2 |= 0x40;\n unused = 6;\n }\n if(e.keyEncipherment) {\n b2 |= 0x20;\n unused = 5;\n }\n if(e.dataEncipherment) {\n b2 |= 0x10;\n unused = 4;\n }\n if(e.keyAgreement) {\n b2 |= 0x08;\n unused = 3;\n }\n if(e.keyCertSign) {\n b2 |= 0x04;\n unused = 2;\n }\n if(e.cRLSign) {\n b2 |= 0x02;\n unused = 1;\n }\n if(e.encipherOnly) {\n b2 |= 0x01;\n unused = 0;\n }\n if(e.decipherOnly) {\n b3 |= 0x80;\n unused = 7;\n }\n\n // create bit string\n var value = String.fromCharCode(unused);\n if(b3 !== 0) {\n value += String.fromCharCode(b2) + String.fromCharCode(b3);\n } else if(b2 !== 0) {\n value += String.fromCharCode(b2);\n }\n e.value = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value);\n } else if(e.name === 'basicConstraints') {\n // basicConstraints is a SEQUENCE\n e.value = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n // cA BOOLEAN flag defaults to false\n if(e.cA) {\n e.value.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false,\n String.fromCharCode(0xFF)));\n }\n if('pathLenConstraint' in e) {\n e.value.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(e.pathLenConstraint).getBytes()));\n }\n } else if(e.name === 'extKeyUsage') {\n // extKeyUsage is a SEQUENCE of OIDs\n e.value = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n var seq = e.value.value;\n for(var key in e) {\n if(e[key] !== true) {\n continue;\n }\n // key is name in OID map\n if(key in oids) {\n seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID,\n false, asn1.oidToDer(oids[key]).getBytes()));\n } else if(key.indexOf('.') !== -1) {\n // assume key is an OID\n seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID,\n false, asn1.oidToDer(key).getBytes()));\n }\n }\n } else if(e.name === 'nsCertType') {\n // nsCertType is a BIT STRING\n // build flags\n var unused = 0;\n var b2 = 0x00;\n\n if(e.client) {\n b2 |= 0x80;\n unused = 7;\n }\n if(e.server) {\n b2 |= 0x40;\n unused = 6;\n }\n if(e.email) {\n b2 |= 0x20;\n unused = 5;\n }\n if(e.objsign) {\n b2 |= 0x10;\n unused = 4;\n }\n if(e.reserved) {\n b2 |= 0x08;\n unused = 3;\n }\n if(e.sslCA) {\n b2 |= 0x04;\n unused = 2;\n }\n if(e.emailCA) {\n b2 |= 0x02;\n unused = 1;\n }\n if(e.objCA) {\n b2 |= 0x01;\n unused = 0;\n }\n\n // create bit string\n var value = String.fromCharCode(unused);\n if(b2 !== 0) {\n value += String.fromCharCode(b2);\n }\n e.value = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value);\n } else if(e.name === 'subjectAltName' || e.name === 'issuerAltName') {\n // SYNTAX SEQUENCE\n e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n\n var altName;\n for(var n = 0; n < e.altNames.length; ++n) {\n altName = e.altNames[n];\n var value = altName.value;\n // handle IP\n if(altName.type === 7 && altName.ip) {\n value = forge.util.bytesFromIP(altName.ip);\n if(value === null) {\n var error = new Error(\n 'Extension \"ip\" value is not a valid IPv4 or IPv6 address.');\n error.extension = e;\n throw error;\n }\n } else if(altName.type === 8) {\n // handle OID\n if(altName.oid) {\n value = asn1.oidToDer(asn1.oidToDer(altName.oid));\n } else {\n // deprecated ... convert value to OID\n value = asn1.oidToDer(value);\n }\n }\n e.value.value.push(asn1.create(\n asn1.Class.CONTEXT_SPECIFIC, altName.type, false,\n value));\n }\n } else if(e.name === 'nsComment' && options.cert) {\n // sanity check value is ASCII (req'd) and not too big\n if(!(/^[\\x00-\\x7F]*$/.test(e.comment)) ||\n (e.comment.length < 1) || (e.comment.length > 128)) {\n throw new Error('Invalid \"nsComment\" content.');\n }\n // IA5STRING opaque comment\n e.value = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.IA5STRING, false, e.comment);\n } else if(e.name === 'subjectKeyIdentifier' && options.cert) {\n var ski = options.cert.generateSubjectKeyIdentifier();\n e.subjectKeyIdentifier = ski.toHex();\n // OCTETSTRING w/digest\n e.value = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, ski.getBytes());\n } else if(e.name === 'authorityKeyIdentifier' && options.cert) {\n // SYNTAX SEQUENCE\n e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n var seq = e.value.value;\n\n if(e.keyIdentifier) {\n var keyIdentifier = (e.keyIdentifier === true ?\n options.cert.generateSubjectKeyIdentifier().getBytes() :\n e.keyIdentifier);\n seq.push(\n asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, false, keyIdentifier));\n }\n\n if(e.authorityCertIssuer) {\n var authorityCertIssuer = [\n asn1.create(asn1.Class.CONTEXT_SPECIFIC, 4, true, [\n _dnToAsn1(e.authorityCertIssuer === true ?\n options.cert.issuer : e.authorityCertIssuer)\n ])\n ];\n seq.push(\n asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, authorityCertIssuer));\n }\n\n if(e.serialNumber) {\n var serialNumber = forge.util.hexToBytes(e.serialNumber === true ?\n options.cert.serialNumber : e.serialNumber);\n seq.push(\n asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, false, serialNumber));\n }\n } else if(e.name === 'cRLDistributionPoints') {\n e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n var seq = e.value.value;\n\n // Create sub SEQUENCE of DistributionPointName\n var subSeq = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n\n // Create fullName CHOICE\n var fullNameGeneralNames = asn1.create(\n asn1.Class.CONTEXT_SPECIFIC, 0, true, []);\n var altName;\n for(var n = 0; n < e.altNames.length; ++n) {\n altName = e.altNames[n];\n var value = altName.value;\n // handle IP\n if(altName.type === 7 && altName.ip) {\n value = forge.util.bytesFromIP(altName.ip);\n if(value === null) {\n var error = new Error(\n 'Extension \"ip\" value is not a valid IPv4 or IPv6 address.');\n error.extension = e;\n throw error;\n }\n } else if(altName.type === 8) {\n // handle OID\n if(altName.oid) {\n value = asn1.oidToDer(asn1.oidToDer(altName.oid));\n } else {\n // deprecated ... convert value to OID\n value = asn1.oidToDer(value);\n }\n }\n fullNameGeneralNames.value.push(asn1.create(\n asn1.Class.CONTEXT_SPECIFIC, altName.type, false,\n value));\n }\n\n // Add to the parent SEQUENCE\n subSeq.value.push(asn1.create(\n asn1.Class.CONTEXT_SPECIFIC, 0, true, [fullNameGeneralNames]));\n seq.push(subSeq);\n }\n\n // ensure value has been defined by now\n if(typeof e.value === 'undefined') {\n var error = new Error('Extension value not specified.');\n error.extension = e;\n throw error;\n }\n\n return e;\n}\n\n/**\n * Convert signature parameters object to ASN.1\n *\n * @param {String} oid Signature algorithm OID\n * @param params The signature parametrs object\n * @return ASN.1 object representing signature parameters\n */\nfunction _signatureParametersToAsn1(oid, params) {\n switch(oid) {\n case oids['RSASSA-PSS']:\n var parts = [];\n\n if(params.hash.algorithmOid !== undefined) {\n parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(params.hash.algorithmOid).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ])\n ]));\n }\n\n if(params.mgf.algorithmOid !== undefined) {\n parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(params.mgf.algorithmOid).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(params.mgf.hash.algorithmOid).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ])\n ])\n ]));\n }\n\n if(params.saltLength !== undefined) {\n parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(params.saltLength).getBytes())\n ]));\n }\n\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, parts);\n\n default:\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '');\n }\n}\n\n/**\n * Converts a certification request's attributes to an ASN.1 set of\n * CRIAttributes.\n *\n * @param csr certification request.\n *\n * @return the ASN.1 set of CRIAttributes.\n */\nfunction _CRIAttributesToAsn1(csr) {\n // create an empty context-specific container\n var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []);\n\n // no attributes, return empty container\n if(csr.attributes.length === 0) {\n return rval;\n }\n\n // each attribute has a sequence with a type and a set of values\n var attrs = csr.attributes;\n for(var i = 0; i < attrs.length; ++i) {\n var attr = attrs[i];\n var value = attr.value;\n\n // reuse tag class for attribute value if available\n var valueTagClass = asn1.Type.UTF8;\n if('valueTagClass' in attr) {\n valueTagClass = attr.valueTagClass;\n }\n if(valueTagClass === asn1.Type.UTF8) {\n value = forge.util.encodeUtf8(value);\n }\n var valueConstructed = false;\n if('valueConstructed' in attr) {\n valueConstructed = attr.valueConstructed;\n }\n // FIXME: handle more encodings\n\n // create a RelativeDistinguishedName set\n // each value in the set is an AttributeTypeAndValue first\n // containing the type (an OID) and second the value\n var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // AttributeType\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(attr.type).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [\n // AttributeValue\n asn1.create(\n asn1.Class.UNIVERSAL, valueTagClass, valueConstructed, value)\n ])\n ]);\n rval.value.push(seq);\n }\n\n return rval;\n}\n\nvar jan_1_1950 = new Date('1950-01-01T00:00:00Z');\nvar jan_1_2050 = new Date('2050-01-01T00:00:00Z');\n\n/**\n * Converts a Date object to ASN.1\n * Handles the different format before and after 1st January 2050\n *\n * @param date date object.\n *\n * @return the ASN.1 object representing the date.\n */\nfunction _dateToAsn1(date) {\n if(date >= jan_1_1950 && date < jan_1_2050) {\n return asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false,\n asn1.dateToUtcTime(date));\n } else {\n return asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false,\n asn1.dateToGeneralizedTime(date));\n }\n}\n\n/**\n * Gets the ASN.1 TBSCertificate part of an X.509v3 certificate.\n *\n * @param cert the certificate.\n *\n * @return the asn1 TBSCertificate.\n */\npki.getTBSCertificate = function(cert) {\n // TBSCertificate\n var notBefore = _dateToAsn1(cert.validity.notBefore);\n var notAfter = _dateToAsn1(cert.validity.notAfter);\n var tbs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // version\n asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [\n // integer\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(cert.version).getBytes())\n ]),\n // serialNumber\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n forge.util.hexToBytes(cert.serialNumber)),\n // signature\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(cert.siginfo.algorithmOid).getBytes()),\n // parameters\n _signatureParametersToAsn1(\n cert.siginfo.algorithmOid, cert.siginfo.parameters)\n ]),\n // issuer\n _dnToAsn1(cert.issuer),\n // validity\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n notBefore,\n notAfter\n ]),\n // subject\n _dnToAsn1(cert.subject),\n // SubjectPublicKeyInfo\n pki.publicKeyToAsn1(cert.publicKey)\n ]);\n\n if(cert.issuer.uniqueId) {\n // issuerUniqueID (optional)\n tbs.value.push(\n asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false,\n // TODO: support arbitrary bit length ids\n String.fromCharCode(0x00) +\n cert.issuer.uniqueId\n )\n ])\n );\n }\n if(cert.subject.uniqueId) {\n // subjectUniqueID (optional)\n tbs.value.push(\n asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false,\n // TODO: support arbitrary bit length ids\n String.fromCharCode(0x00) +\n cert.subject.uniqueId\n )\n ])\n );\n }\n\n if(cert.extensions.length > 0) {\n // extensions (optional)\n tbs.value.push(pki.certificateExtensionsToAsn1(cert.extensions));\n }\n\n return tbs;\n};\n\n/**\n * Gets the ASN.1 CertificationRequestInfo part of a\n * PKCS#10 CertificationRequest.\n *\n * @param csr the certification request.\n *\n * @return the asn1 CertificationRequestInfo.\n */\npki.getCertificationRequestInfo = function(csr) {\n // CertificationRequestInfo\n var cri = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // version\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n asn1.integerToDer(csr.version).getBytes()),\n // subject\n _dnToAsn1(csr.subject),\n // SubjectPublicKeyInfo\n pki.publicKeyToAsn1(csr.publicKey),\n // attributes\n _CRIAttributesToAsn1(csr)\n ]);\n\n return cri;\n};\n\n/**\n * Converts a DistinguishedName (subject or issuer) to an ASN.1 object.\n *\n * @param dn the DistinguishedName.\n *\n * @return the asn1 representation of a DistinguishedName.\n */\npki.distinguishedNameToAsn1 = function(dn) {\n return _dnToAsn1(dn);\n};\n\n/**\n * Converts an X.509v3 RSA certificate to an ASN.1 object.\n *\n * @param cert the certificate.\n *\n * @return the asn1 representation of an X.509v3 RSA certificate.\n */\npki.certificateToAsn1 = function(cert) {\n // prefer cached TBSCertificate over generating one\n var tbsCertificate = cert.tbsCertificate || pki.getTBSCertificate(cert);\n\n // Certificate\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // TBSCertificate\n tbsCertificate,\n // AlgorithmIdentifier (signature algorithm)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(cert.signatureOid).getBytes()),\n // parameters\n _signatureParametersToAsn1(cert.signatureOid, cert.signatureParameters)\n ]),\n // SignatureValue\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false,\n String.fromCharCode(0x00) + cert.signature)\n ]);\n};\n\n/**\n * Converts X.509v3 certificate extensions to ASN.1.\n *\n * @param exts the extensions to convert.\n *\n * @return the extensions in ASN.1 format.\n */\npki.certificateExtensionsToAsn1 = function(exts) {\n // create top-level extension container\n var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []);\n\n // create extension sequence (stores a sequence for each extension)\n var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n rval.value.push(seq);\n\n for(var i = 0; i < exts.length; ++i) {\n seq.value.push(pki.certificateExtensionToAsn1(exts[i]));\n }\n\n return rval;\n};\n\n/**\n * Converts a single certificate extension to ASN.1.\n *\n * @param ext the extension to convert.\n *\n * @return the extension in ASN.1 format.\n */\npki.certificateExtensionToAsn1 = function(ext) {\n // create a sequence for each extension\n var extseq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []);\n\n // extnID (OID)\n extseq.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(ext.id).getBytes()));\n\n // critical defaults to false\n if(ext.critical) {\n // critical BOOLEAN DEFAULT FALSE\n extseq.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false,\n String.fromCharCode(0xFF)));\n }\n\n var value = ext.value;\n if(typeof ext.value !== 'string') {\n // value is asn.1\n value = asn1.toDer(value).getBytes();\n }\n\n // extnValue (OCTET STRING)\n extseq.value.push(asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, value));\n\n return extseq;\n};\n\n/**\n * Converts a PKCS#10 certification request to an ASN.1 object.\n *\n * @param csr the certification request.\n *\n * @return the asn1 representation of a certification request.\n */\npki.certificationRequestToAsn1 = function(csr) {\n // prefer cached CertificationRequestInfo over generating one\n var cri = csr.certificationRequestInfo ||\n pki.getCertificationRequestInfo(csr);\n\n // Certificate\n return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // CertificationRequestInfo\n cri,\n // AlgorithmIdentifier (signature algorithm)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(csr.signatureOid).getBytes()),\n // parameters\n _signatureParametersToAsn1(csr.signatureOid, csr.signatureParameters)\n ]),\n // signature\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false,\n String.fromCharCode(0x00) + csr.signature)\n ]);\n};\n\n/**\n * Creates a CA store.\n *\n * @param certs an optional array of certificate objects or PEM-formatted\n * certificate strings to add to the CA store.\n *\n * @return the CA store.\n */\npki.createCaStore = function(certs) {\n // create CA store\n var caStore = {\n // stored certificates\n certs: {}\n };\n\n /**\n * Gets the certificate that issued the passed certificate or its\n * 'parent'.\n *\n * @param cert the certificate to get the parent for.\n *\n * @return the parent certificate or null if none was found.\n */\n caStore.getIssuer = function(cert) {\n var rval = getBySubject(cert.issuer);\n\n // see if there are multiple matches\n /*if(forge.util.isArray(rval)) {\n // TODO: resolve multiple matches by checking\n // authorityKey/subjectKey/issuerUniqueID/other identifiers, etc.\n // FIXME: or alternatively do authority key mapping\n // if possible (X.509v1 certs can't work?)\n throw new Error('Resolving multiple issuer matches not implemented yet.');\n }*/\n\n return rval;\n };\n\n /**\n * Adds a trusted certificate to the store.\n *\n * @param cert the certificate to add as a trusted certificate (either a\n * pki.certificate object or a PEM-formatted certificate).\n */\n caStore.addCertificate = function(cert) {\n // convert from pem if necessary\n if(typeof cert === 'string') {\n cert = forge.pki.certificateFromPem(cert);\n }\n\n ensureSubjectHasHash(cert.subject);\n\n if(!caStore.hasCertificate(cert)) { // avoid duplicate certificates in store\n if(cert.subject.hash in caStore.certs) {\n // subject hash already exists, append to array\n var tmp = caStore.certs[cert.subject.hash];\n if(!forge.util.isArray(tmp)) {\n tmp = [tmp];\n }\n tmp.push(cert);\n caStore.certs[cert.subject.hash] = tmp;\n } else {\n caStore.certs[cert.subject.hash] = cert;\n }\n }\n };\n\n /**\n * Checks to see if the given certificate is in the store.\n *\n * @param cert the certificate to check (either a pki.certificate or a\n * PEM-formatted certificate).\n *\n * @return true if the certificate is in the store, false if not.\n */\n caStore.hasCertificate = function(cert) {\n // convert from pem if necessary\n if(typeof cert === 'string') {\n cert = forge.pki.certificateFromPem(cert);\n }\n\n var match = getBySubject(cert.subject);\n if(!match) {\n return false;\n }\n if(!forge.util.isArray(match)) {\n match = [match];\n }\n // compare DER-encoding of certificates\n var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes();\n for(var i = 0; i < match.length; ++i) {\n var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes();\n if(der1 === der2) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Lists all of the certificates kept in the store.\n *\n * @return an array of all of the pki.certificate objects in the store.\n */\n caStore.listAllCertificates = function() {\n var certList = [];\n\n for(var hash in caStore.certs) {\n if(caStore.certs.hasOwnProperty(hash)) {\n var value = caStore.certs[hash];\n if(!forge.util.isArray(value)) {\n certList.push(value);\n } else {\n for(var i = 0; i < value.length; ++i) {\n certList.push(value[i]);\n }\n }\n }\n }\n\n return certList;\n };\n\n /**\n * Removes a certificate from the store.\n *\n * @param cert the certificate to remove (either a pki.certificate or a\n * PEM-formatted certificate).\n *\n * @return the certificate that was removed or null if the certificate\n * wasn't in store.\n */\n caStore.removeCertificate = function(cert) {\n var result;\n\n // convert from pem if necessary\n if(typeof cert === 'string') {\n cert = forge.pki.certificateFromPem(cert);\n }\n ensureSubjectHasHash(cert.subject);\n if(!caStore.hasCertificate(cert)) {\n return null;\n }\n\n var match = getBySubject(cert.subject);\n\n if(!forge.util.isArray(match)) {\n result = caStore.certs[cert.subject.hash];\n delete caStore.certs[cert.subject.hash];\n return result;\n }\n\n // compare DER-encoding of certificates\n var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes();\n for(var i = 0; i < match.length; ++i) {\n var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes();\n if(der1 === der2) {\n result = match[i];\n match.splice(i, 1);\n }\n }\n if(match.length === 0) {\n delete caStore.certs[cert.subject.hash];\n }\n\n return result;\n };\n\n function getBySubject(subject) {\n ensureSubjectHasHash(subject);\n return caStore.certs[subject.hash] || null;\n }\n\n function ensureSubjectHasHash(subject) {\n // produce subject hash if it doesn't exist\n if(!subject.hash) {\n var md = forge.md.sha1.create();\n subject.attributes = pki.RDNAttributesAsArray(_dnToAsn1(subject), md);\n subject.hash = md.digest().toHex();\n }\n }\n\n // auto-add passed in certs\n if(certs) {\n // parse PEM-formatted certificates as necessary\n for(var i = 0; i < certs.length; ++i) {\n var cert = certs[i];\n caStore.addCertificate(cert);\n }\n }\n\n return caStore;\n};\n\n/**\n * Certificate verification errors, based on TLS.\n */\npki.certificateError = {\n bad_certificate: 'forge.pki.BadCertificate',\n unsupported_certificate: 'forge.pki.UnsupportedCertificate',\n certificate_revoked: 'forge.pki.CertificateRevoked',\n certificate_expired: 'forge.pki.CertificateExpired',\n certificate_unknown: 'forge.pki.CertificateUnknown',\n unknown_ca: 'forge.pki.UnknownCertificateAuthority'\n};\n\n/**\n * Verifies a certificate chain against the given Certificate Authority store\n * with an optional custom verify callback.\n *\n * @param caStore a certificate store to verify against.\n * @param chain the certificate chain to verify, with the root or highest\n * authority at the end (an array of certificates).\n * @param options a callback to be called for every certificate in the chain or\n * an object with:\n * verify a callback to be called for every certificate in the\n * chain\n * validityCheckDate the date against which the certificate\n * validity period should be checked. Pass null to not check\n * the validity period. By default, the current date is used.\n *\n * The verify callback has the following signature:\n *\n * verified - Set to true if certificate was verified, otherwise the\n * pki.certificateError for why the certificate failed.\n * depth - The current index in the chain, where 0 is the end point's cert.\n * certs - The certificate chain, *NOTE* an empty chain indicates an anonymous\n * end point.\n *\n * The function returns true on success and on failure either the appropriate\n * pki.certificateError or an object with 'error' set to the appropriate\n * pki.certificateError and 'message' set to a custom error message.\n *\n * @return true if successful, error thrown if not.\n */\npki.verifyCertificateChain = function(caStore, chain, options) {\n /* From: RFC3280 - Internet X.509 Public Key Infrastructure Certificate\n Section 6: Certification Path Validation\n See inline parentheticals related to this particular implementation.\n\n The primary goal of path validation is to verify the binding between\n a subject distinguished name or a subject alternative name and subject\n public key, as represented in the end entity certificate, based on the\n public key of the trust anchor. This requires obtaining a sequence of\n certificates that support that binding. That sequence should be provided\n in the passed 'chain'. The trust anchor should be in the given CA\n store. The 'end entity' certificate is the certificate provided by the\n end point (typically a server) and is the first in the chain.\n\n To meet this goal, the path validation process verifies, among other\n things, that a prospective certification path (a sequence of n\n certificates or a 'chain') satisfies the following conditions:\n\n (a) for all x in {1, ..., n-1}, the subject of certificate x is\n the issuer of certificate x+1;\n\n (b) certificate 1 is issued by the trust anchor;\n\n (c) certificate n is the certificate to be validated; and\n\n (d) for all x in {1, ..., n}, the certificate was valid at the\n time in question.\n\n Note that here 'n' is index 0 in the chain and 1 is the last certificate\n in the chain and it must be signed by a certificate in the connection's\n CA store.\n\n The path validation process also determines the set of certificate\n policies that are valid for this path, based on the certificate policies\n extension, policy mapping extension, policy constraints extension, and\n inhibit any-policy extension.\n\n Note: Policy mapping extension not supported (Not Required).\n\n Note: If the certificate has an unsupported critical extension, then it\n must be rejected.\n\n Note: A certificate is self-issued if the DNs that appear in the subject\n and issuer fields are identical and are not empty.\n\n The path validation algorithm assumes the following seven inputs are\n provided to the path processing logic. What this specific implementation\n will use is provided parenthetically:\n\n (a) a prospective certification path of length n (the 'chain')\n (b) the current date/time: ('now').\n (c) user-initial-policy-set: A set of certificate policy identifiers\n naming the policies that are acceptable to the certificate user.\n The user-initial-policy-set contains the special value any-policy\n if the user is not concerned about certificate policy\n (Not implemented. Any policy is accepted).\n (d) trust anchor information, describing a CA that serves as a trust\n anchor for the certification path. The trust anchor information\n includes:\n\n (1) the trusted issuer name,\n (2) the trusted public key algorithm,\n (3) the trusted public key, and\n (4) optionally, the trusted public key parameters associated\n with the public key.\n\n (Trust anchors are provided via certificates in the CA store).\n\n The trust anchor information may be provided to the path processing\n procedure in the form of a self-signed certificate. The trusted anchor\n information is trusted because it was delivered to the path processing\n procedure by some trustworthy out-of-band procedure. If the trusted\n public key algorithm requires parameters, then the parameters are\n provided along with the trusted public key (No parameters used in this\n implementation).\n\n (e) initial-policy-mapping-inhibit, which indicates if policy mapping is\n allowed in the certification path.\n (Not implemented, no policy checking)\n\n (f) initial-explicit-policy, which indicates if the path must be valid\n for at least one of the certificate policies in the user-initial-\n policy-set.\n (Not implemented, no policy checking)\n\n (g) initial-any-policy-inhibit, which indicates whether the\n anyPolicy OID should be processed if it is included in a\n certificate.\n (Not implemented, so any policy is valid provided that it is\n not marked as critical) */\n\n /* Basic Path Processing:\n\n For each certificate in the 'chain', the following is checked:\n\n 1. The certificate validity period includes the current time.\n 2. The certificate was signed by its parent (where the parent is either\n the next in the chain or from the CA store). Allow processing to\n continue to the next step if no parent is found but the certificate is\n in the CA store.\n 3. TODO: The certificate has not been revoked.\n 4. The certificate issuer name matches the parent's subject name.\n 5. TODO: If the certificate is self-issued and not the final certificate\n in the chain, skip this step, otherwise verify that the subject name\n is within one of the permitted subtrees of X.500 distinguished names\n and that each of the alternative names in the subjectAltName extension\n (critical or non-critical) is within one of the permitted subtrees for\n that name type.\n 6. TODO: If the certificate is self-issued and not the final certificate\n in the chain, skip this step, otherwise verify that the subject name\n is not within one of the excluded subtrees for X.500 distinguished\n names and none of the subjectAltName extension names are excluded for\n that name type.\n 7. The other steps in the algorithm for basic path processing involve\n handling the policy extension which is not presently supported in this\n implementation. Instead, if a critical policy extension is found, the\n certificate is rejected as not supported.\n 8. If the certificate is not the first or if its the only certificate in\n the chain (having no parent from the CA store or is self-signed) and it\n has a critical key usage extension, verify that the keyCertSign bit is\n set. If the key usage extension exists, verify that the basic\n constraints extension exists. If the basic constraints extension exists,\n verify that the cA flag is set. If pathLenConstraint is set, ensure that\n the number of certificates that precede in the chain (come earlier\n in the chain as implemented below), excluding the very first in the\n chain (typically the end-entity one), isn't greater than the\n pathLenConstraint. This constraint limits the number of intermediate\n CAs that may appear below a CA before only end-entity certificates\n may be issued. */\n\n // if a verify callback is passed as the third parameter, package it within\n // the options object. This is to support a legacy function signature that\n // expected the verify callback as the third parameter.\n if(typeof options === 'function') {\n options = {verify: options};\n }\n options = options || {};\n\n // copy cert chain references to another array to protect against changes\n // in verify callback\n chain = chain.slice(0);\n var certs = chain.slice(0);\n\n var validityCheckDate = options.validityCheckDate;\n // if no validityCheckDate is specified, default to the current date. Make\n // sure to maintain the value null because it indicates that the validity\n // period should not be checked.\n if(typeof validityCheckDate === 'undefined') {\n validityCheckDate = new Date();\n }\n\n // verify each cert in the chain using its parent, where the parent\n // is either the next in the chain or from the CA store\n var first = true;\n var error = null;\n var depth = 0;\n do {\n var cert = chain.shift();\n var parent = null;\n var selfSigned = false;\n\n if(validityCheckDate) {\n // 1. check valid time\n if(validityCheckDate < cert.validity.notBefore ||\n validityCheckDate > cert.validity.notAfter) {\n error = {\n message: 'Certificate is not valid yet or has expired.',\n error: pki.certificateError.certificate_expired,\n notBefore: cert.validity.notBefore,\n notAfter: cert.validity.notAfter,\n // TODO: we might want to reconsider renaming 'now' to\n // 'validityCheckDate' should this API be changed in the future.\n now: validityCheckDate\n };\n }\n }\n\n // 2. verify with parent from chain or CA store\n if(error === null) {\n parent = chain[0] || caStore.getIssuer(cert);\n if(parent === null) {\n // check for self-signed cert\n if(cert.isIssuer(cert)) {\n selfSigned = true;\n parent = cert;\n }\n }\n\n if(parent) {\n // FIXME: current CA store implementation might have multiple\n // certificates where the issuer can't be determined from the\n // certificate (happens rarely with, eg: old certificates) so normalize\n // by always putting parents into an array\n // TODO: there's may be an extreme degenerate case currently uncovered\n // where an old intermediate certificate seems to have a matching parent\n // but none of the parents actually verify ... but the intermediate\n // is in the CA and it should pass this check; needs investigation\n var parents = parent;\n if(!forge.util.isArray(parents)) {\n parents = [parents];\n }\n\n // try to verify with each possible parent (typically only one)\n var verified = false;\n while(!verified && parents.length > 0) {\n parent = parents.shift();\n try {\n verified = parent.verify(cert);\n } catch(ex) {\n // failure to verify, don't care why, try next one\n }\n }\n\n if(!verified) {\n error = {\n message: 'Certificate signature is invalid.',\n error: pki.certificateError.bad_certificate\n };\n }\n }\n\n if(error === null && (!parent || selfSigned) &&\n !caStore.hasCertificate(cert)) {\n // no parent issuer and certificate itself is not trusted\n error = {\n message: 'Certificate is not trusted.',\n error: pki.certificateError.unknown_ca\n };\n }\n }\n\n // TODO: 3. check revoked\n\n // 4. check for matching issuer/subject\n if(error === null && parent && !cert.isIssuer(parent)) {\n // parent is not issuer\n error = {\n message: 'Certificate issuer is invalid.',\n error: pki.certificateError.bad_certificate\n };\n }\n\n // 5. TODO: check names with permitted names tree\n\n // 6. TODO: check names against excluded names tree\n\n // 7. check for unsupported critical extensions\n if(error === null) {\n // supported extensions\n var se = {\n keyUsage: true,\n basicConstraints: true\n };\n for(var i = 0; error === null && i < cert.extensions.length; ++i) {\n var ext = cert.extensions[i];\n if(ext.critical && !(ext.name in se)) {\n error = {\n message:\n 'Certificate has an unsupported critical extension.',\n error: pki.certificateError.unsupported_certificate\n };\n }\n }\n }\n\n // 8. check for CA if cert is not first or is the only certificate\n // remaining in chain with no parent or is self-signed\n if(error === null &&\n (!first || (chain.length === 0 && (!parent || selfSigned)))) {\n // first check keyUsage extension and then basic constraints\n var bcExt = cert.getExtension('basicConstraints');\n var keyUsageExt = cert.getExtension('keyUsage');\n if(keyUsageExt !== null) {\n // keyCertSign must be true and there must be a basic\n // constraints extension\n if(!keyUsageExt.keyCertSign || bcExt === null) {\n // bad certificate\n error = {\n message:\n 'Certificate keyUsage or basicConstraints conflict ' +\n 'or indicate that the certificate is not a CA. ' +\n 'If the certificate is the only one in the chain or ' +\n 'isn\\'t the first then the certificate must be a ' +\n 'valid CA.',\n error: pki.certificateError.bad_certificate\n };\n }\n }\n // basic constraints cA flag must be set\n if(error === null && bcExt !== null && !bcExt.cA) {\n // bad certificate\n error = {\n message:\n 'Certificate basicConstraints indicates the certificate ' +\n 'is not a CA.',\n error: pki.certificateError.bad_certificate\n };\n }\n // if error is not null and keyUsage is available, then we know it\n // has keyCertSign and there is a basic constraints extension too,\n // which means we can check pathLenConstraint (if it exists)\n if(error === null && keyUsageExt !== null &&\n 'pathLenConstraint' in bcExt) {\n // pathLen is the maximum # of intermediate CA certs that can be\n // found between the current certificate and the end-entity (depth 0)\n // certificate; this number does not include the end-entity (depth 0,\n // last in the chain) even if it happens to be a CA certificate itself\n var pathLen = depth - 1;\n if(pathLen > bcExt.pathLenConstraint) {\n // pathLenConstraint violated, bad certificate\n error = {\n message:\n 'Certificate basicConstraints pathLenConstraint violated.',\n error: pki.certificateError.bad_certificate\n };\n }\n }\n }\n\n // call application callback\n var vfd = (error === null) ? true : error.error;\n var ret = options.verify ? options.verify(vfd, depth, certs) : vfd;\n if(ret === true) {\n // clear any set error\n error = null;\n } else {\n // if passed basic tests, set default message and alert\n if(vfd === true) {\n error = {\n message: 'The application rejected the certificate.',\n error: pki.certificateError.bad_certificate\n };\n }\n\n // check for custom error info\n if(ret || ret === 0) {\n // set custom message and error\n if(typeof ret === 'object' && !forge.util.isArray(ret)) {\n if(ret.message) {\n error.message = ret.message;\n }\n if(ret.error) {\n error.error = ret.error;\n }\n } else if(typeof ret === 'string') {\n // set custom error\n error.error = ret;\n }\n }\n\n // throw error\n throw error;\n }\n\n // no longer first cert in chain\n first = false;\n ++depth;\n } while(chain.length > 0);\n\n return true;\n};\n","var noop = function () {}\n\nfunction abortAll(ary, abort, cb) {\n var n = ary.length\n if(!n) return cb(abort)\n ary.forEach(function (f) {\n if(f) f(abort, next)\n else next()\n })\n\n function next() {\n if(--n) return\n cb(abort)\n }\n if(!n) next()\n}\n\nmodule.exports = function (streams) {\n return function (abort, cb) {\n ;(function next () {\n if(abort)\n abortAll(streams, abort, cb)\n else if(!streams.length)\n cb(true)\n else if(!streams[0])\n streams.shift(), next()\n else\n streams[0](null, function (err, data) {\n if(err) {\n streams.shift() //drop the first, has already ended.\n if(err === true) next()\n else abortAll(streams, err, cb)\n }\n else\n cb(null, data)\n })\n })()\n }\n}\n\n\n","'use strict'\n\nclass Base {\n constructor (name, code, implementation, alphabet) {\n this.name = name\n this.code = code\n this.alphabet = alphabet\n if (implementation && alphabet) {\n this.engine = implementation(alphabet)\n }\n }\n\n encode (stringOrBuffer) {\n return this.engine.encode(stringOrBuffer)\n }\n\n decode (stringOrBuffer) {\n return this.engine.decode(stringOrBuffer)\n }\n\n isImplemented () {\n return this.engine\n }\n}\n\nmodule.exports = Base\n","'use strict'\n\nconst setImmediate = require('async/setImmediate')\n\nconst EE = require('events').EventEmitter\nconst Connection = require('interface-connection').Connection\nconst utilsFactory = require('./utils')\nconst PeerInfo = require('peer-info')\nconst proto = require('../protocol').CircuitRelay\nconst series = require('async/series')\n\nconst debug = require('debug')\n\nconst log = debug('libp2p:circuit:stop')\nlog.err = debug('libp2p:circuit:error:stop')\n\nclass Stop extends EE {\n constructor (swarm) {\n super()\n this.swarm = swarm\n this.utils = utilsFactory(swarm)\n }\n\n /**\n * Handle the incoming STOP message\n *\n * @param {{}} msg - the parsed protobuf message\n * @param {StreamHandler} sh - the stream handler wrapped connection\n * @param {Function} callback - callback\n * @returns {undefined}\n */\n handle (msg, sh, callback) {\n callback = callback || (() => {})\n\n series([\n (cb) => this.utils.validateAddrs(msg, sh, proto.Type.STOP, cb),\n (cb) => this.utils.writeResponse(sh, proto.Status.Success, cb)\n ], (err) => {\n if (err) {\n // we don't return the error here,\n // since multistream select don't expect one\n callback()\n return log(err)\n }\n\n const peerInfo = new PeerInfo(this.utils.peerIdFromId(msg.srcPeer.id))\n msg.srcPeer.addrs.forEach((addr) => peerInfo.multiaddrs.add(addr))\n const newConn = new Connection(sh.rest())\n newConn.setPeerInfo(peerInfo)\n setImmediate(() => this.emit('connection', newConn))\n callback(newConn)\n })\n }\n}\n\nmodule.exports = Stop\n","'use strict'\n\nvar defined = require('./utils').defined\nvar varint = require('varint')\n\nfunction compileEncodingLength (m, enc, oneofs) {\n var oneofsKeys = Object.keys(oneofs)\n var encLength = enc.length\n\n var hls = new Array(encLength)\n\n for (var i = 0; i < m.fields.length; i++) {\n hls[i] = varint.encodingLength(m.fields[i].tag << 3 | enc[i].type)\n\n var field = m.fields[i]\n m.fields[i].packed = field.repeated && field.options && field.options.packed && field.options.packed !== 'false'\n }\n\n return function encodingLength (obj) {\n var length = 0\n var i = 0\n var j = 0\n\n for (i = 0; i < oneofsKeys.length; i++) {\n var name = oneofsKeys[i]\n var props = oneofs[name]\n\n var match = false\n for (j = 0; j < props.length; j++) {\n if (defined(obj[props[j]])) {\n if (match) {\n throw new Error('only one of the properties defined in oneof ' + name + ' can be set')\n }\n match = true\n }\n }\n }\n\n for (i = 0; i < encLength; i++) {\n var e = enc[i]\n var field = m.fields[i]\n var val = obj[field.name]\n var hl = hls[i]\n var len\n\n if (!defined(val)) {\n if (field.required) {\n throw new Error(field.name + ' is required')\n }\n\n continue\n }\n\n if (field.map) {\n var tmp = Object.keys(val)\n for (j = 0; j < tmp.length; j++) {\n tmp[j] = {\n key: tmp[j],\n value: val[tmp[j]]\n }\n }\n\n val = tmp\n }\n\n if (field.packed) {\n var packedLen = 0\n for (j = 0; j < val.length; j++) {\n if (!defined(val[j])) {\n continue\n }\n len = e.encodingLength(val[j])\n packedLen += len\n\n if (e.message) {\n packedLen += varint.encodingLength(len)\n }\n }\n\n if (packedLen) {\n length += hl + packedLen + varint.encodingLength(packedLen)\n }\n } else if (field.repeated) {\n for (j = 0; j < val.length; j++) {\n if (!defined(val[j])) {\n continue\n }\n\n len = e.encodingLength(val[j])\n length += hl + len + (e.message ? varint.encodingLength(len) : 0)\n }\n } else {\n len = e.encodingLength(val)\n length += hl + len + (e.message ? varint.encodingLength(len) : 0)\n }\n }\n\n return length\n }\n}\n\nmodule.exports = compileEncodingLength\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction shuffled(array) {\n array = array.slice();\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n return array;\n}\nexports.shuffled = shuffled;\n","'use strict'\n\nconst exporter = require('ipfs-unixfs-exporter')\nconst log = require('debug')('ipfs:mfs:utils:to-trail')\n\nconst toTrail = async (context, path) => {\n log(`Creating trail for path ${path}`)\n\n const output = []\n\n for await (const fsEntry of exporter.path(path, context.ipld)) {\n output.push({\n name: fsEntry.name,\n cid: fsEntry.cid,\n size: fsEntry.node.size,\n type: fsEntry.unixfs ? fsEntry.unixfs.type : undefined\n })\n }\n\n return output\n}\n\nmodule.exports = toTrail\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util = require(\"util\");\nconst toString = Object.prototype.toString;\nconst isOfType = (type) => (value) => typeof value === type; // tslint:disable-line:strict-type-predicates\nconst getObjectType = (value) => {\n const objectName = toString.call(value).slice(8, -1);\n if (objectName) {\n return objectName;\n }\n return null;\n};\nconst isObjectOfType = (typeName) => (value) => {\n return getObjectType(value) === typeName;\n};\nfunction is(value) {\n if (value === null) {\n return \"null\" /* null */;\n }\n if (value === true || value === false) {\n return \"boolean\" /* boolean */;\n }\n const type = typeof value;\n if (type === 'undefined') {\n return \"undefined\" /* undefined */;\n }\n if (type === 'string') {\n return \"string\" /* string */;\n }\n if (type === 'number') {\n return \"number\" /* number */;\n }\n if (type === 'symbol') {\n return \"symbol\" /* symbol */;\n }\n if (is.function_(value)) {\n return \"Function\" /* Function */;\n }\n if (Array.isArray(value)) {\n return \"Array\" /* Array */;\n }\n if (Buffer.isBuffer(value)) {\n return \"Buffer\" /* Buffer */;\n }\n const tagType = getObjectType(value);\n if (tagType) {\n return tagType;\n }\n if (value instanceof String || value instanceof Boolean || value instanceof Number) {\n throw new TypeError('Please don\\'t use object wrappers for primitive types');\n }\n return \"Object\" /* Object */;\n}\n(function (is) {\n const isObject = (value) => typeof value === 'object';\n // tslint:disable:variable-name\n is.undefined = isOfType('undefined');\n is.string = isOfType('string');\n is.number = isOfType('number');\n is.function_ = isOfType('function');\n is.null_ = (value) => value === null;\n is.class_ = (value) => is.function_(value) && value.toString().startsWith('class ');\n is.boolean = (value) => value === true || value === false;\n // tslint:enable:variable-name\n is.symbol = isOfType('symbol');\n is.array = Array.isArray;\n is.buffer = Buffer.isBuffer;\n is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value);\n is.object = (value) => !is.nullOrUndefined(value) && (is.function_(value) || isObject(value));\n is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]);\n is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw);\n is.nativePromise = isObjectOfType(\"Promise\" /* Promise */);\n const hasPromiseAPI = (value) => !is.null_(value) &&\n isObject(value) &&\n is.function_(value.then) &&\n is.function_(value.catch);\n is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value);\n // TODO: Change to use `isObjectOfType` once Node.js 6 or higher is targeted\n const isFunctionOfType = (type) => (value) => is.function_(value) && is.function_(value.constructor) && value.constructor.name === type;\n is.generatorFunction = isFunctionOfType('GeneratorFunction');\n is.asyncFunction = isFunctionOfType('AsyncFunction');\n is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype');\n is.regExp = isObjectOfType(\"RegExp\" /* RegExp */);\n is.date = isObjectOfType(\"Date\" /* Date */);\n is.error = isObjectOfType(\"Error\" /* Error */);\n is.map = isObjectOfType(\"Map\" /* Map */);\n is.set = isObjectOfType(\"Set\" /* Set */);\n is.weakMap = isObjectOfType(\"WeakMap\" /* WeakMap */);\n is.weakSet = isObjectOfType(\"WeakSet\" /* WeakSet */);\n is.int8Array = isObjectOfType(\"Int8Array\" /* Int8Array */);\n is.uint8Array = isObjectOfType(\"Uint8Array\" /* Uint8Array */);\n is.uint8ClampedArray = isObjectOfType(\"Uint8ClampedArray\" /* Uint8ClampedArray */);\n is.int16Array = isObjectOfType(\"Int16Array\" /* Int16Array */);\n is.uint16Array = isObjectOfType(\"Uint16Array\" /* Uint16Array */);\n is.int32Array = isObjectOfType(\"Int32Array\" /* Int32Array */);\n is.uint32Array = isObjectOfType(\"Uint32Array\" /* Uint32Array */);\n is.float32Array = isObjectOfType(\"Float32Array\" /* Float32Array */);\n is.float64Array = isObjectOfType(\"Float64Array\" /* Float64Array */);\n is.arrayBuffer = isObjectOfType(\"ArrayBuffer\" /* ArrayBuffer */);\n is.sharedArrayBuffer = isObjectOfType(\"SharedArrayBuffer\" /* SharedArrayBuffer */);\n is.dataView = isObjectOfType(\"DataView\" /* DataView */);\n // TODO: Remove `object` checks when targeting ES2015 or higher\n // See `Notes`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf\n is.directInstanceOf = (instance, klass) => is.object(instance) && is.object(klass) && Object.getPrototypeOf(instance) === klass.prototype;\n is.truthy = (value) => Boolean(value);\n is.falsy = (value) => !value;\n is.nan = (value) => Number.isNaN(value);\n const primitiveTypes = new Set([\n 'undefined',\n 'string',\n 'number',\n 'boolean',\n 'symbol'\n ]);\n is.primitive = (value) => is.null_(value) || primitiveTypes.has(typeof value);\n is.integer = (value) => Number.isInteger(value);\n is.safeInteger = (value) => Number.isSafeInteger(value);\n is.plainObject = (value) => {\n // From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js\n let prototype;\n return getObjectType(value) === \"Object\" /* Object */ &&\n (prototype = Object.getPrototypeOf(value), prototype === null || // tslint:disable-line:ban-comma-operator\n prototype === Object.getPrototypeOf({}));\n };\n const typedArrayTypes = new Set([\n \"Int8Array\" /* Int8Array */,\n \"Uint8Array\" /* Uint8Array */,\n \"Uint8ClampedArray\" /* Uint8ClampedArray */,\n \"Int16Array\" /* Int16Array */,\n \"Uint16Array\" /* Uint16Array */,\n \"Int32Array\" /* Int32Array */,\n \"Uint32Array\" /* Uint32Array */,\n \"Float32Array\" /* Float32Array */,\n \"Float64Array\" /* Float64Array */\n ]);\n is.typedArray = (value) => {\n const objectType = getObjectType(value);\n if (objectType === null) {\n return false;\n }\n return typedArrayTypes.has(objectType);\n };\n const isValidLength = (value) => is.safeInteger(value) && value > -1;\n is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length);\n is.inRange = (value, range) => {\n if (is.number(range)) {\n return value >= Math.min(0, range) && value <= Math.max(range, 0);\n }\n if (is.array(range) && range.length === 2) {\n // TODO: Use spread operator here when targeting Node.js 6 or higher\n return value >= Math.min.apply(null, range) && value <= Math.max.apply(null, range);\n }\n throw new TypeError(`Invalid range: ${util.inspect(range)}`);\n };\n const NODE_TYPE_ELEMENT = 1;\n const DOM_PROPERTIES_TO_CHECK = [\n 'innerHTML',\n 'ownerDocument',\n 'style',\n 'attributes',\n 'nodeValue'\n ];\n is.domElement = (value) => is.object(value) && value.nodeType === NODE_TYPE_ELEMENT && is.string(value.nodeName) &&\n !is.plainObject(value) && DOM_PROPERTIES_TO_CHECK.every(property => property in value);\n is.nodeStream = (value) => !is.nullOrUndefined(value) && isObject(value) && is.function_(value.pipe);\n is.infinite = (value) => value === Infinity || value === -Infinity;\n const isAbsoluteMod2 = (value) => (rem) => is.integer(rem) && Math.abs(rem % 2) === value;\n is.even = isAbsoluteMod2(0);\n is.odd = isAbsoluteMod2(1);\n const isWhiteSpaceString = (value) => is.string(value) && /\\S/.test(value) === false;\n const isEmptyStringOrArray = (value) => (is.string(value) || is.array(value)) && value.length === 0;\n const isEmptyObject = (value) => !is.map(value) && !is.set(value) && is.object(value) && Object.keys(value).length === 0;\n const isEmptyMapOrSet = (value) => (is.map(value) || is.set(value)) && value.size === 0;\n is.empty = (value) => is.falsy(value) || isEmptyStringOrArray(value) || isEmptyObject(value) || isEmptyMapOrSet(value);\n is.emptyOrWhitespace = (value) => is.empty(value) || isWhiteSpaceString(value);\n const predicateOnArray = (method, predicate, args) => {\n // `args` is the calling function's \"arguments object\".\n // We have to do it this way to keep node v4 support.\n // So here we convert it to an array and slice off the first item.\n const values = Array.prototype.slice.call(args, 1);\n if (is.function_(predicate) === false) {\n throw new TypeError(`Invalid predicate: ${util.inspect(predicate)}`);\n }\n if (values.length === 0) {\n throw new TypeError('Invalid number of values');\n }\n return method.call(values, predicate);\n };\n function any(predicate) {\n return predicateOnArray(Array.prototype.some, predicate, arguments);\n }\n is.any = any;\n function all(predicate) {\n return predicateOnArray(Array.prototype.every, predicate, arguments);\n }\n is.all = all;\n // tslint:enable:only-arrow-functions no-function-expression\n})(is || (is = {}));\n// Some few keywords are reserved, but we'll populate them for Node.js users\n// See https://github.com/Microsoft/TypeScript/issues/2536\nObject.defineProperties(is, {\n class: {\n value: is.class_\n },\n function: {\n value: is.function_\n },\n null: {\n value: is.null_\n }\n});\nexports.default = is;\n// For CommonJS default export support\nmodule.exports = is;\nmodule.exports.default = is;\n","'use strict'\n\nconst utils = require('../../utils')\n\nmodule.exports = (dht) => {\n const log = utils.logger(dht.peerInfo.id, 'rpc:ping')\n\n /**\n * Process `Ping` DHT messages.\n *\n * @param {PeerInfo} peer\n * @param {Message} msg\n * @param {function(Error, Message)} callback\n * @returns {undefined}\n */\n return function ping (peer, msg, callback) {\n log('from %s', peer.id.toB58String())\n callback(null, msg)\n }\n}\n","'use strict'\n\nconst blake = require('blakejs')\n\nconst toCallback = require('./utils').toCallback\n\nconst minB = 0xb201\nconst minS = 0xb241\n\nconst blake2b = {\n init: blake.blake2bInit,\n update: blake.blake2bUpdate,\n digest: blake.blake2bFinal\n}\n\nconst blake2s = {\n init: blake.blake2sInit,\n update: blake.blake2sUpdate,\n digest: blake.blake2sFinal\n}\n\nconst makeB2Hash = (size, hf) => toCallback((buf) => {\n const ctx = hf.init(size, null)\n hf.update(ctx, buf)\n return Buffer.from(hf.digest(ctx))\n})\n\nmodule.exports = (table) => {\n for (let i = 0; i < 64; i++) {\n table[minB + i] = makeB2Hash(i + 1, blake2b)\n }\n for (let i = 0; i < 32; i++) {\n table[minS + i] = makeB2Hash(i + 1, blake2s)\n }\n}\n","'use strict'\n\nconst first = async (iterator) => {\n for await (const entry of iterator) {\n return entry\n }\n}\n\nmodule.exports = first\n","/* @flow */\n'use strict'\n\nconst uuid = require('uuid/v4')\nconst withIs = require('class-is')\n\nconst pathSepS = '/'\nconst pathSepB = Buffer.from(pathSepS)\nconst pathSep = pathSepB[0]\n\n/**\n * A Key represents the unique identifier of an object.\n * Our Key scheme is inspired by file systems and Google App Engine key model.\n * Keys are meant to be unique across a system. Keys are hierarchical,\n * incorporating more and more specific namespaces. Thus keys can be deemed\n * 'children' or 'ancestors' of other keys:\n * - `new Key('/Comedy')`\n * - `new Key('/Comedy/MontyPython')`\n * Also, every namespace can be parametrized to embed relevant object\n * information. For example, the Key `name` (most specific namespace) could\n * include the object type:\n * - `new Key('/Comedy/MontyPython/Actor:JohnCleese')`\n * - `new Key('/Comedy/MontyPython/Sketch:CheeseShop')`\n * - `new Key('/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender')`\n *\n */\nclass Key {\n /* :: _buf: Buffer */\n\n constructor (s /* : string|Buffer */, clean /* : ?bool */) {\n if (typeof s === 'string') {\n this._buf = Buffer.from(s)\n } else if (Buffer.isBuffer(s)) {\n this._buf = s\n }\n\n if (clean == null) {\n clean = true\n }\n\n if (clean) {\n this.clean()\n }\n\n if (this._buf.length === 0 || this._buf[0] !== pathSep) {\n throw new Error(`Invalid key: ${this.toString()}`)\n }\n }\n\n /**\n * Convert to the string representation\n *\n * @param {string} [encoding='utf8']\n * @returns {string}\n */\n toString (encoding/* : ?buffer$Encoding */)/* : string */ {\n return this._buf.toString(encoding || 'utf8')\n }\n\n /**\n * Return the buffer representation of the key\n *\n * @returns {Buffer}\n */\n toBuffer () /* : Buffer */ {\n return this._buf\n }\n\n // waiting on https://github.com/facebook/flow/issues/2286\n // $FlowFixMe\n get [Symbol.toStringTag] () /* : string */ {\n return `[Key ${this.toString()}]`\n }\n\n /**\n * Constructs a key out of a namespace array.\n *\n * @param {Array} list\n * @returns {Key}\n *\n * @example\n * Key.withNamespaces(['one', 'two'])\n * // => Key('/one/two')\n *\n */\n static withNamespaces (list /* : Array */) /* : Key */ {\n return new _Key(list.join(pathSepS))\n }\n\n /**\n * Returns a randomly (uuid) generated key.\n *\n * @returns {Key}\n *\n * @example\n * Key.random()\n * // => Key('/f98719ea086343f7b71f32ea9d9d521d')\n *\n */\n static random () /* : Key */ {\n return new _Key(uuid().replace(/-/g, ''))\n }\n\n /**\n * Cleanup the current key\n *\n * @returns {void}\n */\n clean () {\n if (!this._buf || this._buf.length === 0) {\n this._buf = Buffer.from(pathSepS)\n }\n\n if (this._buf[0] !== pathSep) {\n this._buf = Buffer.concat([pathSepB, this._buf])\n }\n\n // normalize does not remove trailing slashes\n while (this._buf.length > 1 && this._buf[this._buf.length - 1] === pathSep) {\n this._buf = this._buf.slice(0, -1)\n }\n }\n\n /**\n * Check if the given key is sorted lower than ourself.\n *\n * @param {Key} key\n * @returns {bool}\n */\n less (key /* : Key */) /* : bool */ {\n const list1 = this.list()\n const list2 = key.list()\n\n for (let i = 0; i < list1.length; i++) {\n if (list2.length < i + 1) {\n return false\n }\n\n const c1 = list1[i]\n const c2 = list2[i]\n\n if (c1 < c2) {\n return true\n } else if (c1 > c2) {\n return false\n }\n }\n\n return list1.length < list2.length\n }\n\n /**\n * Returns the key with all parts in reversed order.\n *\n * @returns {Key}\n *\n * @example\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').reverse()\n * // => Key('/Actor:JohnCleese/MontyPython/Comedy')\n */\n reverse () /* : Key */ {\n return Key.withNamespaces(this.list().slice().reverse())\n }\n\n /**\n * Returns the `namespaces` making up this Key.\n *\n * @returns {Array}\n */\n namespaces () /* : Array */ {\n return this.list()\n }\n\n /** Returns the \"base\" namespace of this key.\n *\n * @returns {string}\n *\n * @example\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').baseNamespace()\n * // => 'Actor:JohnCleese'\n *\n */\n baseNamespace () /* : string */ {\n const ns = this.namespaces()\n return ns[ns.length - 1]\n }\n\n /**\n * Returns the `list` representation of this key.\n *\n * @returns {Array}\n *\n * @example\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').list()\n * // => ['Comedy', 'MontyPythong', 'Actor:JohnCleese']\n *\n */\n list () /* : Array */ {\n return this.toString().split(pathSepS).slice(1)\n }\n\n /**\n * Returns the \"type\" of this key (value of last namespace).\n *\n * @returns {string}\n *\n * @example\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').type()\n * // => 'Actor'\n *\n */\n type () /* : string */ {\n return namespaceType(this.baseNamespace())\n }\n\n /**\n * Returns the \"name\" of this key (field of last namespace).\n *\n * @returns {string}\n *\n * @example\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').name()\n * // => 'JohnCleese'\n */\n name () /* : string */ {\n return namespaceValue(this.baseNamespace())\n }\n\n /**\n * Returns an \"instance\" of this type key (appends value to namespace).\n *\n * @param {string} s\n * @returns {Key}\n *\n * @example\n * new Key('/Comedy/MontyPython/Actor').instance('JohnClesse')\n * // => Key('/Comedy/MontyPython/Actor:JohnCleese')\n */\n instance (s /* : string */) /* : Key */ {\n return new _Key(this.toString() + ':' + s)\n }\n\n /**\n * Returns the \"path\" of this key (parent + type).\n *\n * @returns {Key}\n *\n * @example\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').path()\n * // => Key('/Comedy/MontyPython/Actor')\n *\n */\n path () /* : Key */ {\n let p = this.parent().toString()\n if (!p.endsWith(pathSepS)) {\n p += pathSepS\n }\n p += this.type()\n return new _Key(p)\n }\n\n /**\n * Returns the `parent` Key of this Key.\n *\n * @returns {Key}\n *\n * @example\n * new Key(\"/Comedy/MontyPython/Actor:JohnCleese\").parent()\n * // => Key(\"/Comedy/MontyPython\")\n *\n */\n parent () /* : Key */ {\n const list = this.list()\n if (list.length === 1) {\n return new _Key(pathSepS)\n }\n\n return new _Key(list.slice(0, -1).join(pathSepS))\n }\n\n /**\n * Returns the `child` Key of this Key.\n *\n * @param {Key} key\n * @returns {Key}\n *\n * @example\n * new Key('/Comedy/MontyPython').child(new Key('Actor:JohnCleese'))\n * // => Key('/Comedy/MontyPython/Actor:JohnCleese')\n *\n */\n child (key /* : Key */) /* : Key */ {\n if (this.toString() === pathSepS) {\n return key\n } else if (key.toString() === pathSepS) {\n return this\n }\n\n return new _Key(this.toString() + key.toString(), false)\n }\n\n /**\n * Returns whether this key is a prefix of `other`\n *\n * @param {Key} other\n * @returns {bool}\n *\n * @example\n * new Key('/Comedy').isAncestorOf('/Comedy/MontyPython')\n * // => true\n *\n */\n isAncestorOf (other /* : Key */) /* : bool */ {\n if (other.toString() === this.toString()) {\n return false\n }\n\n return other.toString().startsWith(this.toString())\n }\n\n /**\n * Returns whether this key is a contains another as prefix.\n *\n * @param {Key} other\n * @returns {bool}\n *\n * @example\n * new Key('/Comedy/MontyPython').isDecendantOf('/Comedy')\n * // => true\n *\n */\n isDecendantOf (other /* : Key */) /* : bool */ {\n if (other.toString() === this.toString()) {\n return false\n }\n\n return this.toString().startsWith(other.toString())\n }\n\n /**\n * Returns wether this key has only one namespace.\n *\n * @returns {bool}\n *\n */\n isTopLevel () /* : bool */ {\n return this.list().length === 1\n }\n}\n\n/**\n * The first component of a namespace. `foo` in `foo:bar`\n *\n * @param {string} ns\n * @returns {string}\n */\nfunction namespaceType (ns /* : string */) /* : string */ {\n const parts = ns.split(':')\n if (parts.length < 2) {\n return ''\n }\n return parts.slice(0, -1).join(':')\n}\n\n/**\n * The last component of a namespace, `baz` in `foo:bar:baz`.\n *\n * @param {string} ns\n * @returns {string}\n */\nfunction namespaceValue (ns /* : string */) /* : string */ {\n const parts = ns.split(':')\n return parts[parts.length - 1]\n}\n\nconst _Key = withIs(Key, { className: 'Key', symbolName: '@ipfs/interface-datastore/key' })\n\nmodule.exports = _Key\n","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar defaults = {\n allowDots: false,\n allowPrototypes: false,\n arrayLimit: 20,\n charset: 'utf-8',\n charsetSentinel: false,\n comma: false,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n ignoreQueryPrefix: false,\n interpretNumericEntities: false,\n parameterLimit: 1000,\n parseArrays: true,\n plainObjects: false,\n strictNullHandling: false\n};\n\nvar interpretNumericEntities = function (str) {\n return str.replace(/&#(\\d+);/g, function ($0, numberStr) {\n return String.fromCharCode(parseInt(numberStr, 10));\n });\n};\n\n// This is what browsers will submit when the ✓ character occurs in an\n// application/x-www-form-urlencoded body and the encoding of the page containing\n// the form is iso-8859-1, or when the submitted form has an accept-charset\n// attribute of iso-8859-1. Presumably also with other charsets that do not contain\n// the ✓ character, such as us-ascii.\nvar isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')\n\n// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.\nvar charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = {};\n var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\\?/, '') : str;\n var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;\n var parts = cleanStr.split(options.delimiter, limit);\n var skipIndex = -1; // Keep track of where the utf8 sentinel was found\n var i;\n\n var charset = options.charset;\n if (options.charsetSentinel) {\n for (i = 0; i < parts.length; ++i) {\n if (parts[i].indexOf('utf8=') === 0) {\n if (parts[i] === charsetSentinel) {\n charset = 'utf-8';\n } else if (parts[i] === isoSentinel) {\n charset = 'iso-8859-1';\n }\n skipIndex = i;\n i = parts.length; // The eslint settings do not allow break;\n }\n }\n }\n\n for (i = 0; i < parts.length; ++i) {\n if (i === skipIndex) {\n continue;\n }\n var part = parts[i];\n\n var bracketEqualsPos = part.indexOf(']=');\n var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part, defaults.decoder, charset, 'key');\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');\n val = options.decoder(part.slice(pos + 1), defaults.decoder, charset, 'value');\n }\n\n if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {\n val = interpretNumericEntities(val);\n }\n\n if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {\n val = val.split(',');\n }\n\n if (part.indexOf('[]=') > -1) {\n val = isArray(val) ? [val] : val;\n }\n\n if (has.call(obj, key)) {\n obj[key] = utils.combine(obj[key], val);\n } else {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function (chain, val, options) {\n var leaf = val;\n\n for (var i = chain.length - 1; i >= 0; --i) {\n var obj;\n var root = chain[i];\n\n if (root === '[]' && options.parseArrays) {\n obj = [].concat(leaf);\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var index = parseInt(cleanRoot, 10);\n if (!options.parseArrays && cleanRoot === '') {\n obj = { 0: leaf };\n } else if (\n !isNaN(index)\n && root !== cleanRoot\n && String(index) === cleanRoot\n && index >= 0\n && (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = leaf;\n } else {\n obj[cleanRoot] = leaf;\n }\n }\n\n leaf = obj;\n }\n\n return leaf;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = options.depth > 0 && brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options);\n};\n\nvar normalizeParseOptions = function normalizeParseOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;\n\n return {\n allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,\n allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,\n arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,\n decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,\n delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,\n // eslint-disable-next-line no-implicit-coercion, no-extra-parens\n depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,\n ignoreQueryPrefix: opts.ignoreQueryPrefix === true,\n interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,\n parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,\n parseArrays: opts.parseArrays !== false,\n plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (str, opts) {\n var options = normalizeParseOptions(opts);\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options);\n obj = utils.merge(obj, newObj, options);\n }\n\n return utils.compact(obj);\n};\n","/**\n * Node.js module for Forge mask generation functions.\n *\n * @author Stefan Siegl\n *\n * Copyright 2012 Stefan Siegl \n */\nvar forge = require('./forge');\nrequire('./mgf1');\n\nmodule.exports = forge.mgf = forge.mgf || {};\nforge.mgf.mgf1 = forge.mgf1;\n","/* eslint-env browser */\n'use strict'\n\nconst TLRU = require('../../utils/tlru')\nconst { default: PQueue } = require('p-queue')\nconst { default: ky } = require('ky-universal')\n\n// Avoid sending multiple queries for the same hostname by caching results\nconst cache = new TLRU(1000)\n// TODO: /api/v0/dns does not return TTL yet: https://github.com/ipfs/go-ipfs/issues/5884\n// However we know browsers themselves cache DNS records for at least 1 minute,\n// which acts a provisional default ttl: https://stackoverflow.com/a/36917902/11518426\nconst ttl = 60 * 1000\n\n// browsers limit concurrent connections per host,\n// we don't want preload calls to exhaust the limit (~6)\nconst httpQueue = new PQueue({ concurrency: 4 })\n\n// Delegated HTTP resolver sending DNSLink queries to ipfs.io\n// TODO: replace hardcoded host with configurable DNS over HTTPS: https://github.com/ipfs/js-ipfs/issues/2212\nconst api = ky.create({\n prefixUrl: 'https://ipfs.io/api/v0/',\n hooks: {\n afterResponse: [\n async (input, options, response) => {\n const query = new URL(response.url).search.slice(1)\n const json = await response.json()\n cache.set(query, json, ttl)\n }\n ]\n }\n})\n\nconst ipfsPath = (response) => {\n if (response.Path) return response.Path\n throw new Error(response.Message)\n}\n\nmodule.exports = async (fqdn, opts) => { // eslint-disable-line require-await\n const resolveDnslink = async (fqdn, opts) => {\n opts = opts || {}\n\n const searchParams = new URLSearchParams(opts)\n searchParams.set('arg', fqdn)\n\n // try cache first\n const query = searchParams.toString()\n if (!opts.nocache && cache.has(query)) {\n const response = cache.get(query)\n return ipfsPath(response)\n }\n\n // fallback to delegated DNS resolver\n const response = await httpQueue.add(() => api.get('dns', { searchParams }).json())\n return ipfsPath(response)\n }\n\n return resolveDnslink(fqdn, opts)\n}\n","'use strict';\nmodule.exports = (promise, onFinally) => {\n\tonFinally = onFinally || (() => {});\n\n\treturn promise.then(\n\t\tval => new Promise(resolve => {\n\t\t\tresolve(onFinally());\n\t\t}).then(() => val),\n\t\terr => new Promise(resolve => {\n\t\t\tresolve(onFinally());\n\t\t}).then(() => {\n\t\t\tthrow err;\n\t\t})\n\t);\n};\n","/**\n * Supported cipher modes.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2014 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nrequire('./util');\n\nforge.cipher = forge.cipher || {};\n\n// supported cipher modes\nvar modes = module.exports = forge.cipher.modes = forge.cipher.modes || {};\n\n/** Electronic codebook (ECB) (Don't use this; it's not secure) **/\n\nmodes.ecb = function(options) {\n options = options || {};\n this.name = 'ECB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n};\n\nmodes.ecb.prototype.start = function(options) {};\n\nmodes.ecb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // write output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n};\n\nmodes.ecb.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // decrypt block\n this.cipher.decrypt(this._inBlock, this._outBlock);\n\n // write output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n};\n\nmodes.ecb.prototype.pad = function(input, options) {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (input.length() === this.blockSize ?\n this.blockSize : (this.blockSize - input.length()));\n input.fillWithByte(padding, padding);\n return true;\n};\n\nmodes.ecb.prototype.unpad = function(output, options) {\n // check for error: input data not a multiple of blockSize\n if(options.overflow > 0) {\n return false;\n }\n\n // ensure padding byte count is valid\n var len = output.length();\n var count = output.at(len - 1);\n if(count > (this.blockSize << 2)) {\n return false;\n }\n\n // trim off padding bytes\n output.truncate(count);\n return true;\n};\n\n/** Cipher-block Chaining (CBC) **/\n\nmodes.cbc = function(options) {\n options = options || {};\n this.name = 'CBC';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n};\n\nmodes.cbc.prototype.start = function(options) {\n // Note: legacy support for using IV residue (has security flaws)\n // if IV is null, reuse block from previous processing\n if(options.iv === null) {\n // must have a previous block\n if(!this._prev) {\n throw new Error('Invalid IV parameter.');\n }\n this._iv = this._prev.slice(0);\n } else if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n } else {\n // save IV as \"previous\" block\n this._iv = transformIV(options.iv, this.blockSize);\n this._prev = this._iv.slice(0);\n }\n};\n\nmodes.cbc.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n // CBC XOR's IV (or previous block) with plaintext\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._prev[i] ^ input.getInt32();\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // write output, save previous block\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i]);\n }\n this._prev = this._outBlock;\n};\n\nmodes.cbc.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n if(input.length() < this.blockSize && !(finish && input.length() > 0)) {\n return true;\n }\n\n // get next block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n }\n\n // decrypt block\n this.cipher.decrypt(this._inBlock, this._outBlock);\n\n // write output, save previous ciphered block\n // CBC XOR's IV (or previous block) with ciphertext\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._prev[i] ^ this._outBlock[i]);\n }\n this._prev = this._inBlock.slice(0);\n};\n\nmodes.cbc.prototype.pad = function(input, options) {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (input.length() === this.blockSize ?\n this.blockSize : (this.blockSize - input.length()));\n input.fillWithByte(padding, padding);\n return true;\n};\n\nmodes.cbc.prototype.unpad = function(output, options) {\n // check for error: input data not a multiple of blockSize\n if(options.overflow > 0) {\n return false;\n }\n\n // ensure padding byte count is valid\n var len = output.length();\n var count = output.at(len - 1);\n if(count > (this.blockSize << 2)) {\n return false;\n }\n\n // trim off padding bytes\n output.truncate(count);\n return true;\n};\n\n/** Cipher feedback (CFB) **/\n\nmodes.cfb = function(options) {\n options = options || {};\n this.name = 'CFB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output, write input as output\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32() ^ this._outBlock[i];\n output.putInt32(this._inBlock[i]);\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output, write input as partial output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialBlock[i] = input.getInt32() ^ this._outBlock[i];\n this._partialOutput.putInt32(this._partialBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._partialBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\nmodes.cfb.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block (CFB always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output, write input as output\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = input.getInt32();\n output.putInt32(this._inBlock[i] ^ this._outBlock[i]);\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output, write input as partial output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialBlock[i] = input.getInt32();\n this._partialOutput.putInt32(this._partialBlock[i] ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._partialBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\n/** Output feedback (OFB) **/\n\nmodes.ofb = function(options) {\n options = options || {};\n this.name = 'OFB';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(input.length() === 0) {\n return true;\n }\n\n // encrypt block (OFB always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output and update next input\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(input.getInt32() ^ this._outBlock[i]);\n this._inBlock[i] = this._outBlock[i];\n }\n return;\n }\n\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n } else {\n // block complete, update input block\n for(var i = 0; i < this._ints; ++i) {\n this._inBlock[i] = this._outBlock[i];\n }\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n};\n\nmodes.ofb.prototype.decrypt = modes.ofb.prototype.encrypt;\n\n/** Counter (CTR) **/\n\nmodes.ctr = function(options) {\n options = options || {};\n this.name = 'CTR';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = null;\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n};\n\nmodes.ctr.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // use IV as first input\n this._iv = transformIV(options.iv, this.blockSize);\n this._inBlock = this._iv.slice(0);\n this._partialBytes = 0;\n};\n\nmodes.ctr.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block (CTR always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n } else {\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes > 0) {\n // block still incomplete, restore input buffer\n input.read -= this.blockSize;\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n }\n\n // block complete, increment counter (input block)\n inc32(this._inBlock);\n};\n\nmodes.ctr.prototype.decrypt = modes.ctr.prototype.encrypt;\n\n/** Galois/Counter Mode (GCM) **/\n\nmodes.gcm = function(options) {\n options = options || {};\n this.name = 'GCM';\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._ints = this.blockSize / 4;\n this._inBlock = new Array(this._ints);\n this._outBlock = new Array(this._ints);\n this._partialOutput = forge.util.createBuffer();\n this._partialBytes = 0;\n\n // R is actually this value concatenated with 120 more zero bits, but\n // we only XOR against R so the other zeros have no effect -- we just\n // apply this value to the first integer in a block\n this._R = 0xE1000000;\n};\n\nmodes.gcm.prototype.start = function(options) {\n if(!('iv' in options)) {\n throw new Error('Invalid IV parameter.');\n }\n // ensure IV is a byte buffer\n var iv = forge.util.createBuffer(options.iv);\n\n // no ciphered data processed yet\n this._cipherLength = 0;\n\n // default additional data is none\n var additionalData;\n if('additionalData' in options) {\n additionalData = forge.util.createBuffer(options.additionalData);\n } else {\n additionalData = forge.util.createBuffer();\n }\n\n // default tag length is 128 bits\n if('tagLength' in options) {\n this._tagLength = options.tagLength;\n } else {\n this._tagLength = 128;\n }\n\n // if tag is given, ensure tag matches tag length\n this._tag = null;\n if(options.decrypt) {\n // save tag to check later\n this._tag = forge.util.createBuffer(options.tag).getBytes();\n if(this._tag.length !== (this._tagLength / 8)) {\n throw new Error('Authentication tag does not match tag length.');\n }\n }\n\n // create tmp storage for hash calculation\n this._hashBlock = new Array(this._ints);\n\n // no tag generated yet\n this.tag = null;\n\n // generate hash subkey\n // (apply block cipher to \"zero\" block)\n this._hashSubkey = new Array(this._ints);\n this.cipher.encrypt([0, 0, 0, 0], this._hashSubkey);\n\n // generate table M\n // use 4-bit tables (32 component decomposition of a 16 byte value)\n // 8-bit tables take more space and are known to have security\n // vulnerabilities (in native implementations)\n this.componentBits = 4;\n this._m = this.generateHashTable(this._hashSubkey, this.componentBits);\n\n // Note: support IV length different from 96 bits? (only supporting\n // 96 bits is recommended by NIST SP-800-38D)\n // generate J_0\n var ivLength = iv.length();\n if(ivLength === 12) {\n // 96-bit IV\n this._j0 = [iv.getInt32(), iv.getInt32(), iv.getInt32(), 1];\n } else {\n // IV is NOT 96-bits\n this._j0 = [0, 0, 0, 0];\n while(iv.length() > 0) {\n this._j0 = this.ghash(\n this._hashSubkey, this._j0,\n [iv.getInt32(), iv.getInt32(), iv.getInt32(), iv.getInt32()]);\n }\n this._j0 = this.ghash(\n this._hashSubkey, this._j0, [0, 0].concat(from64To32(ivLength * 8)));\n }\n\n // generate ICB (initial counter block)\n this._inBlock = this._j0.slice(0);\n inc32(this._inBlock);\n this._partialBytes = 0;\n\n // consume authentication data\n additionalData = forge.util.createBuffer(additionalData);\n // save additional data length as a BE 64-bit number\n this._aDataLength = from64To32(additionalData.length() * 8);\n // pad additional data to 128 bit (16 byte) block size\n var overflow = additionalData.length() % this.blockSize;\n if(overflow) {\n additionalData.fillWithByte(0, this.blockSize - overflow);\n }\n this._s = [0, 0, 0, 0];\n while(additionalData.length() > 0) {\n this._s = this.ghash(this._hashSubkey, this._s, [\n additionalData.getInt32(),\n additionalData.getInt32(),\n additionalData.getInt32(),\n additionalData.getInt32()\n ]);\n }\n};\n\nmodes.gcm.prototype.encrypt = function(input, output, finish) {\n // not enough input to encrypt\n var inputLength = input.length();\n if(inputLength === 0) {\n return true;\n }\n\n // encrypt block\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // handle full block\n if(this._partialBytes === 0 && inputLength >= this.blockSize) {\n // XOR input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i] ^= input.getInt32());\n }\n this._cipherLength += this.blockSize;\n } else {\n // handle partial block\n var partialBytes = (this.blockSize - inputLength) % this.blockSize;\n if(partialBytes > 0) {\n partialBytes = this.blockSize - partialBytes;\n }\n\n // XOR input with output\n this._partialOutput.clear();\n for(var i = 0; i < this._ints; ++i) {\n this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);\n }\n\n if(partialBytes <= 0 || finish) {\n // handle overflow prior to hashing\n if(finish) {\n // get block overflow\n var overflow = inputLength % this.blockSize;\n this._cipherLength += overflow;\n // truncate for hash function\n this._partialOutput.truncate(this.blockSize - overflow);\n } else {\n this._cipherLength += this.blockSize;\n }\n\n // get output block for hashing\n for(var i = 0; i < this._ints; ++i) {\n this._outBlock[i] = this._partialOutput.getInt32();\n }\n this._partialOutput.read -= this.blockSize;\n }\n\n // skip any previous partial bytes\n if(this._partialBytes > 0) {\n this._partialOutput.getBytes(this._partialBytes);\n }\n\n if(partialBytes > 0 && !finish) {\n // block still incomplete, restore input buffer, get partial output,\n // and return early\n input.read -= this.blockSize;\n output.putBytes(this._partialOutput.getBytes(\n partialBytes - this._partialBytes));\n this._partialBytes = partialBytes;\n return true;\n }\n\n output.putBytes(this._partialOutput.getBytes(\n inputLength - this._partialBytes));\n this._partialBytes = 0;\n }\n\n // update hash block S\n this._s = this.ghash(this._hashSubkey, this._s, this._outBlock);\n\n // increment counter (input block)\n inc32(this._inBlock);\n};\n\nmodes.gcm.prototype.decrypt = function(input, output, finish) {\n // not enough input to decrypt\n var inputLength = input.length();\n if(inputLength < this.blockSize && !(finish && inputLength > 0)) {\n return true;\n }\n\n // encrypt block (GCM always uses encryption mode)\n this.cipher.encrypt(this._inBlock, this._outBlock);\n\n // increment counter (input block)\n inc32(this._inBlock);\n\n // update hash block S\n this._hashBlock[0] = input.getInt32();\n this._hashBlock[1] = input.getInt32();\n this._hashBlock[2] = input.getInt32();\n this._hashBlock[3] = input.getInt32();\n this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock);\n\n // XOR hash input with output\n for(var i = 0; i < this._ints; ++i) {\n output.putInt32(this._outBlock[i] ^ this._hashBlock[i]);\n }\n\n // increment cipher data length\n if(inputLength < this.blockSize) {\n this._cipherLength += inputLength % this.blockSize;\n } else {\n this._cipherLength += this.blockSize;\n }\n};\n\nmodes.gcm.prototype.afterFinish = function(output, options) {\n var rval = true;\n\n // handle overflow\n if(options.decrypt && options.overflow) {\n output.truncate(this.blockSize - options.overflow);\n }\n\n // handle authentication tag\n this.tag = forge.util.createBuffer();\n\n // concatenate additional data length with cipher length\n var lengths = this._aDataLength.concat(from64To32(this._cipherLength * 8));\n\n // include lengths in hash\n this._s = this.ghash(this._hashSubkey, this._s, lengths);\n\n // do GCTR(J_0, S)\n var tag = [];\n this.cipher.encrypt(this._j0, tag);\n for(var i = 0; i < this._ints; ++i) {\n this.tag.putInt32(this._s[i] ^ tag[i]);\n }\n\n // trim tag to length\n this.tag.truncate(this.tag.length() % (this._tagLength / 8));\n\n // check authentication tag\n if(options.decrypt && this.tag.bytes() !== this._tag) {\n rval = false;\n }\n\n return rval;\n};\n\n/**\n * See NIST SP-800-38D 6.3 (Algorithm 1). This function performs Galois\n * field multiplication. The field, GF(2^128), is defined by the polynomial:\n *\n * x^128 + x^7 + x^2 + x + 1\n *\n * Which is represented in little-endian binary form as: 11100001 (0xe1). When\n * the value of a coefficient is 1, a bit is set. The value R, is the\n * concatenation of this value and 120 zero bits, yielding a 128-bit value\n * which matches the block size.\n *\n * This function will multiply two elements (vectors of bytes), X and Y, in\n * the field GF(2^128). The result is initialized to zero. For each bit of\n * X (out of 128), x_i, if x_i is set, then the result is multiplied (XOR'd)\n * by the current value of Y. For each bit, the value of Y will be raised by\n * a power of x (multiplied by the polynomial x). This can be achieved by\n * shifting Y once to the right. If the current value of Y, prior to being\n * multiplied by x, has 0 as its LSB, then it is a 127th degree polynomial.\n * Otherwise, we must divide by R after shifting to find the remainder.\n *\n * @param x the first block to multiply by the second.\n * @param y the second block to multiply by the first.\n *\n * @return the block result of the multiplication.\n */\nmodes.gcm.prototype.multiply = function(x, y) {\n var z_i = [0, 0, 0, 0];\n var v_i = y.slice(0);\n\n // calculate Z_128 (block has 128 bits)\n for(var i = 0; i < 128; ++i) {\n // if x_i is 0, Z_{i+1} = Z_i (unchanged)\n // else Z_{i+1} = Z_i ^ V_i\n // get x_i by finding 32-bit int position, then left shift 1 by remainder\n var x_i = x[(i / 32) | 0] & (1 << (31 - i % 32));\n if(x_i) {\n z_i[0] ^= v_i[0];\n z_i[1] ^= v_i[1];\n z_i[2] ^= v_i[2];\n z_i[3] ^= v_i[3];\n }\n\n // if LSB(V_i) is 1, V_i = V_i >> 1\n // else V_i = (V_i >> 1) ^ R\n this.pow(v_i, v_i);\n }\n\n return z_i;\n};\n\nmodes.gcm.prototype.pow = function(x, out) {\n // if LSB(x) is 1, x = x >>> 1\n // else x = (x >>> 1) ^ R\n var lsb = x[3] & 1;\n\n // always do x >>> 1:\n // starting with the rightmost integer, shift each integer to the right\n // one bit, pulling in the bit from the integer to the left as its top\n // most bit (do this for the last 3 integers)\n for(var i = 3; i > 0; --i) {\n out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31);\n }\n // shift the first integer normally\n out[0] = x[0] >>> 1;\n\n // if lsb was not set, then polynomial had a degree of 127 and doesn't\n // need to divided; otherwise, XOR with R to find the remainder; we only\n // need to XOR the first integer since R technically ends w/120 zero bits\n if(lsb) {\n out[0] ^= this._R;\n }\n};\n\nmodes.gcm.prototype.tableMultiply = function(x) {\n // assumes 4-bit tables are used\n var z = [0, 0, 0, 0];\n for(var i = 0; i < 32; ++i) {\n var idx = (i / 8) | 0;\n var x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF;\n var ah = this._m[i][x_i];\n z[0] ^= ah[0];\n z[1] ^= ah[1];\n z[2] ^= ah[2];\n z[3] ^= ah[3];\n }\n return z;\n};\n\n/**\n * A continuing version of the GHASH algorithm that operates on a single\n * block. The hash block, last hash value (Ym) and the new block to hash\n * are given.\n *\n * @param h the hash block.\n * @param y the previous value for Ym, use [0, 0, 0, 0] for a new hash.\n * @param x the block to hash.\n *\n * @return the hashed value (Ym).\n */\nmodes.gcm.prototype.ghash = function(h, y, x) {\n y[0] ^= x[0];\n y[1] ^= x[1];\n y[2] ^= x[2];\n y[3] ^= x[3];\n return this.tableMultiply(y);\n //return this.multiply(y, h);\n};\n\n/**\n * Precomputes a table for multiplying against the hash subkey. This\n * mechanism provides a substantial speed increase over multiplication\n * performed without a table. The table-based multiplication this table is\n * for solves X * H by multiplying each component of X by H and then\n * composing the results together using XOR.\n *\n * This function can be used to generate tables with different bit sizes\n * for the components, however, this implementation assumes there are\n * 32 components of X (which is a 16 byte vector), therefore each component\n * takes 4-bits (so the table is constructed with bits=4).\n *\n * @param h the hash subkey.\n * @param bits the bit size for a component.\n */\nmodes.gcm.prototype.generateHashTable = function(h, bits) {\n // TODO: There are further optimizations that would use only the\n // first table M_0 (or some variant) along with a remainder table;\n // this can be explored in the future\n var multiplier = 8 / bits;\n var perInt = 4 * multiplier;\n var size = 16 * multiplier;\n var m = new Array(size);\n for(var i = 0; i < size; ++i) {\n var tmp = [0, 0, 0, 0];\n var idx = (i / perInt) | 0;\n var shft = ((perInt - 1 - (i % perInt)) * bits);\n tmp[idx] = (1 << (bits - 1)) << shft;\n m[i] = this.generateSubHashTable(this.multiply(tmp, h), bits);\n }\n return m;\n};\n\n/**\n * Generates a table for multiplying against the hash subkey for one\n * particular component (out of all possible component values).\n *\n * @param mid the pre-multiplied value for the middle key of the table.\n * @param bits the bit size for a component.\n */\nmodes.gcm.prototype.generateSubHashTable = function(mid, bits) {\n // compute the table quickly by minimizing the number of\n // POW operations -- they only need to be performed for powers of 2,\n // all other entries can be composed from those powers using XOR\n var size = 1 << bits;\n var half = size >>> 1;\n var m = new Array(size);\n m[half] = mid.slice(0);\n var i = half >>> 1;\n while(i > 0) {\n // raise m0[2 * i] and store in m0[i]\n this.pow(m[2 * i], m[i] = []);\n i >>= 1;\n }\n i = 2;\n while(i < half) {\n for(var j = 1; j < i; ++j) {\n var m_i = m[i];\n var m_j = m[j];\n m[i + j] = [\n m_i[0] ^ m_j[0],\n m_i[1] ^ m_j[1],\n m_i[2] ^ m_j[2],\n m_i[3] ^ m_j[3]\n ];\n }\n i *= 2;\n }\n m[0] = [0, 0, 0, 0];\n /* Note: We could avoid storing these by doing composition during multiply\n calculate top half using composition by speed is preferred. */\n for(i = half + 1; i < size; ++i) {\n var c = m[i ^ half];\n m[i] = [mid[0] ^ c[0], mid[1] ^ c[1], mid[2] ^ c[2], mid[3] ^ c[3]];\n }\n return m;\n};\n\n/** Utility functions */\n\nfunction transformIV(iv, blockSize) {\n if(typeof iv === 'string') {\n // convert iv string into byte buffer\n iv = forge.util.createBuffer(iv);\n }\n\n if(forge.util.isArray(iv) && iv.length > 4) {\n // convert iv byte array into byte buffer\n var tmp = iv;\n iv = forge.util.createBuffer();\n for(var i = 0; i < tmp.length; ++i) {\n iv.putByte(tmp[i]);\n }\n }\n\n if(iv.length() < blockSize) {\n throw new Error(\n 'Invalid IV length; got ' + iv.length() +\n ' bytes and expected ' + blockSize + ' bytes.');\n }\n\n if(!forge.util.isArray(iv)) {\n // convert iv byte buffer into 32-bit integer array\n var ints = [];\n var blocks = blockSize / 4;\n for(var i = 0; i < blocks; ++i) {\n ints.push(iv.getInt32());\n }\n iv = ints;\n }\n\n return iv;\n}\n\nfunction inc32(block) {\n // increment last 32 bits of block only\n block[block.length - 1] = (block[block.length - 1] + 1) & 0xFFFFFFFF;\n}\n\nfunction from64To32(num) {\n // convert 64-bit number to two BE Int32s\n return [(num / 0x100000000) | 0, num & 0xFFFFFFFF];\n}\n","var modeModules = {\n ECB: require('./ecb'),\n CBC: require('./cbc'),\n CFB: require('./cfb'),\n CFB8: require('./cfb8'),\n CFB1: require('./cfb1'),\n OFB: require('./ofb'),\n CTR: require('./ctr'),\n GCM: require('./ctr')\n}\n\nvar modes = require('./list.json')\n\nfor (var key in modes) {\n modes[key].module = modeModules[modes[key].mode]\n}\n\nmodule.exports = modes\n","'use strict'\n\nconst table = require('./base-table.json')\n\n// map for codecConstant -> code\nconst constants = {}\n\nfor (const [name, code] of Object.entries(table)) {\n constants[name.toUpperCase().replace(/-/g, '_')] = code\n}\n\nmodule.exports = Object.freeze(constants)\n","/**\n * Password-Based Key-Derivation Function #2 implementation.\n *\n * See RFC 2898 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nrequire('./hmac');\nrequire('./md');\nrequire('./util');\n\nvar pkcs5 = forge.pkcs5 = forge.pkcs5 || {};\n\nvar crypto;\nif(forge.util.isNodejs && !forge.options.usePureJavaScript) {\n crypto = require('crypto');\n}\n\n/**\n * Derives a key from a password.\n *\n * @param p the password as a binary-encoded string of bytes.\n * @param s the salt as a binary-encoded string of bytes.\n * @param c the iteration count, a positive integer.\n * @param dkLen the intended length, in bytes, of the derived key,\n * (max: 2^32 - 1) * hash length of the PRF.\n * @param [md] the message digest (or algorithm identifier as a string) to use\n * in the PRF, defaults to SHA-1.\n * @param [callback(err, key)] presence triggers asynchronous version, called\n * once the operation completes.\n *\n * @return the derived key, as a binary-encoded string of bytes, for the\n * synchronous version (if no callback is specified).\n */\nmodule.exports = forge.pbkdf2 = pkcs5.pbkdf2 = function(\n p, s, c, dkLen, md, callback) {\n if(typeof md === 'function') {\n callback = md;\n md = null;\n }\n\n // use native implementation if possible and not disabled, note that\n // some node versions only support SHA-1, others allow digest to be changed\n if(forge.util.isNodejs && !forge.options.usePureJavaScript &&\n crypto.pbkdf2 && (md === null || typeof md !== 'object') &&\n (crypto.pbkdf2Sync.length > 4 || (!md || md === 'sha1'))) {\n if(typeof md !== 'string') {\n // default prf to SHA-1\n md = 'sha1';\n }\n p = Buffer.from(p, 'binary');\n s = Buffer.from(s, 'binary');\n if(!callback) {\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2Sync(p, s, c, dkLen).toString('binary');\n }\n return crypto.pbkdf2Sync(p, s, c, dkLen, md).toString('binary');\n }\n if(crypto.pbkdf2Sync.length === 4) {\n return crypto.pbkdf2(p, s, c, dkLen, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n return crypto.pbkdf2(p, s, c, dkLen, md, function(err, key) {\n if(err) {\n return callback(err);\n }\n callback(null, key.toString('binary'));\n });\n }\n\n if(typeof md === 'undefined' || md === null) {\n // default prf to SHA-1\n md = 'sha1';\n }\n if(typeof md === 'string') {\n if(!(md in forge.md.algorithms)) {\n throw new Error('Unknown hash algorithm: ' + md);\n }\n md = forge.md[md].create();\n }\n\n var hLen = md.digestLength;\n\n /* 1. If dkLen > (2^32 - 1) * hLen, output \"derived key too long\" and\n stop. */\n if(dkLen > (0xFFFFFFFF * hLen)) {\n var err = new Error('Derived key is too long.');\n if(callback) {\n return callback(err);\n }\n throw err;\n }\n\n /* 2. Let len be the number of hLen-octet blocks in the derived key,\n rounding up, and let r be the number of octets in the last\n block:\n\n len = CEIL(dkLen / hLen),\n r = dkLen - (len - 1) * hLen. */\n var len = Math.ceil(dkLen / hLen);\n var r = dkLen - (len - 1) * hLen;\n\n /* 3. For each block of the derived key apply the function F defined\n below to the password P, the salt S, the iteration count c, and\n the block index to compute the block:\n\n T_1 = F(P, S, c, 1),\n T_2 = F(P, S, c, 2),\n ...\n T_len = F(P, S, c, len),\n\n where the function F is defined as the exclusive-or sum of the\n first c iterates of the underlying pseudorandom function PRF\n applied to the password P and the concatenation of the salt S\n and the block index i:\n\n F(P, S, c, i) = u_1 XOR u_2 XOR ... XOR u_c\n\n where\n\n u_1 = PRF(P, S || INT(i)),\n u_2 = PRF(P, u_1),\n ...\n u_c = PRF(P, u_{c-1}).\n\n Here, INT(i) is a four-octet encoding of the integer i, most\n significant octet first. */\n var prf = forge.hmac.create();\n prf.start(md, p);\n var dk = '';\n var xor, u_c, u_c1;\n\n // sync version\n if(!callback) {\n for(var i = 1; i <= len; ++i) {\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n for(var j = 2; j <= c; ++j) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n }\n /* 5. Output the derived key DK. */\n return dk;\n }\n\n // async version\n var i = 1, j;\n function outer() {\n if(i > len) {\n // done\n return callback(null, dk);\n }\n\n // PRF(P, S || INT(i)) (first iteration)\n prf.start(null, null);\n prf.update(s);\n prf.update(forge.util.int32ToBytes(i));\n xor = u_c1 = prf.digest().getBytes();\n\n // PRF(P, u_{c-1}) (other iterations)\n j = 2;\n inner();\n }\n\n function inner() {\n if(j <= c) {\n prf.start(null, null);\n prf.update(u_c1);\n u_c = prf.digest().getBytes();\n // F(p, s, c, i)\n xor = forge.util.xorBytes(xor, u_c, hLen);\n u_c1 = u_c;\n ++j;\n return forge.util.setImmediate(inner);\n }\n\n /* 4. Concatenate the blocks and extract the first dkLen octets to\n produce a derived key DK:\n\n DK = T_1 || T_2 || ... || T_len<0..r-1> */\n dk += (i < len) ? xor : xor.substr(0, r);\n\n ++i;\n outer();\n }\n\n outer();\n};\n","/**\n * Password-based encryption functions.\n *\n * @author Dave Longley\n * @author Stefan Siegl \n *\n * Copyright (c) 2010-2013 Digital Bazaar, Inc.\n * Copyright (c) 2012 Stefan Siegl \n *\n * An EncryptedPrivateKeyInfo:\n *\n * EncryptedPrivateKeyInfo ::= SEQUENCE {\n * encryptionAlgorithm EncryptionAlgorithmIdentifier,\n * encryptedData EncryptedData }\n *\n * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier\n *\n * EncryptedData ::= OCTET STRING\n */\nvar forge = require('./forge');\nrequire('./aes');\nrequire('./asn1');\nrequire('./des');\nrequire('./md');\nrequire('./oids');\nrequire('./pbkdf2');\nrequire('./pem');\nrequire('./random');\nrequire('./rc2');\nrequire('./rsa');\nrequire('./util');\n\nif(typeof BigInteger === 'undefined') {\n var BigInteger = forge.jsbn.BigInteger;\n}\n\n// shortcut for asn.1 API\nvar asn1 = forge.asn1;\n\n/* Password-based encryption implementation. */\nvar pki = forge.pki = forge.pki || {};\nmodule.exports = pki.pbe = forge.pbe = forge.pbe || {};\nvar oids = pki.oids;\n\n// validator for an EncryptedPrivateKeyInfo structure\n// Note: Currently only works w/algorithm params\nvar encryptedPrivateKeyValidator = {\n name: 'EncryptedPrivateKeyInfo',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'EncryptedPrivateKeyInfo.encryptionAlgorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'AlgorithmIdentifier.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'encryptionOid'\n }, {\n name: 'AlgorithmIdentifier.parameters',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n captureAsn1: 'encryptionParams'\n }]\n }, {\n // encryptedData\n name: 'EncryptedPrivateKeyInfo.encryptedData',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'encryptedData'\n }]\n};\n\n// validator for a PBES2Algorithms structure\n// Note: Currently only works w/PBKDF2 + AES encryption schemes\nvar PBES2AlgorithmsValidator = {\n name: 'PBES2Algorithms',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.keyDerivationFunc',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.keyDerivationFunc.oid',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'kdfOid'\n }, {\n name: 'PBES2Algorithms.params',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.params.salt',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'kdfSalt'\n }, {\n name: 'PBES2Algorithms.params.iterationCount',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'kdfIterationCount'\n }, {\n name: 'PBES2Algorithms.params.keyLength',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n optional: true,\n capture: 'keyLength'\n }, {\n // prf\n name: 'PBES2Algorithms.params.prf',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n optional: true,\n value: [{\n name: 'PBES2Algorithms.params.prf.algorithm',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'prfOid'\n }]\n }]\n }]\n }, {\n name: 'PBES2Algorithms.encryptionScheme',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'PBES2Algorithms.encryptionScheme.oid',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OID,\n constructed: false,\n capture: 'encOid'\n }, {\n name: 'PBES2Algorithms.encryptionScheme.iv',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'encIv'\n }]\n }]\n};\n\nvar pkcs12PbeParamsValidator = {\n name: 'pkcs-12PbeParams',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.SEQUENCE,\n constructed: true,\n value: [{\n name: 'pkcs-12PbeParams.salt',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.OCTETSTRING,\n constructed: false,\n capture: 'salt'\n }, {\n name: 'pkcs-12PbeParams.iterations',\n tagClass: asn1.Class.UNIVERSAL,\n type: asn1.Type.INTEGER,\n constructed: false,\n capture: 'iterations'\n }]\n};\n\n/**\n * Encrypts a ASN.1 PrivateKeyInfo object, producing an EncryptedPrivateKeyInfo.\n *\n * PBES2Algorithms ALGORITHM-IDENTIFIER ::=\n * { {PBES2-params IDENTIFIED BY id-PBES2}, ...}\n *\n * id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13}\n *\n * PBES2-params ::= SEQUENCE {\n * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},\n * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}}\n * }\n *\n * PBES2-KDFs ALGORITHM-IDENTIFIER ::=\n * { {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ... }\n *\n * PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... }\n *\n * PBKDF2-params ::= SEQUENCE {\n * salt CHOICE {\n * specified OCTET STRING,\n * otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}\n * },\n * iterationCount INTEGER (1..MAX),\n * keyLength INTEGER (1..MAX) OPTIONAL,\n * prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1\n * }\n *\n * @param obj the ASN.1 PrivateKeyInfo object.\n * @param password the password to encrypt with.\n * @param options:\n * algorithm the encryption algorithm to use\n * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'.\n * count the iteration count to use.\n * saltSize the salt size to use.\n * prfAlgorithm the PRF message digest algorithm to use\n * ('sha1', 'sha224', 'sha256', 'sha384', 'sha512')\n *\n * @return the ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptPrivateKeyInfo = function(obj, password, options) {\n // set default options\n options = options || {};\n options.saltSize = options.saltSize || 8;\n options.count = options.count || 2048;\n options.algorithm = options.algorithm || 'aes128';\n options.prfAlgorithm = options.prfAlgorithm || 'sha1';\n\n // generate PBE params\n var salt = forge.random.getBytesSync(options.saltSize);\n var count = options.count;\n var countBytes = asn1.integerToDer(count);\n var dkLen;\n var encryptionAlgorithm;\n var encryptedData;\n if(options.algorithm.indexOf('aes') === 0 || options.algorithm === 'des') {\n // do PBES2\n var ivLen, encOid, cipherFn;\n switch(options.algorithm) {\n case 'aes128':\n dkLen = 16;\n ivLen = 16;\n encOid = oids['aes128-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes192':\n dkLen = 24;\n ivLen = 16;\n encOid = oids['aes192-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes256':\n dkLen = 32;\n ivLen = 16;\n encOid = oids['aes256-CBC'];\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'des':\n dkLen = 8;\n ivLen = 8;\n encOid = oids['desCBC'];\n cipherFn = forge.des.createEncryptionCipher;\n break;\n default:\n var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // get PRF message digest\n var prfAlgorithm = 'hmacWith' + options.prfAlgorithm.toUpperCase();\n var md = prfAlgorithmToMessageDigest(prfAlgorithm);\n\n // encrypt private key using pbe SHA-1 and AES/DES\n var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md);\n var iv = forge.random.getBytesSync(ivLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(obj));\n cipher.finish();\n encryptedData = cipher.output.getBytes();\n\n // get PBKDF2-params\n var params = createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm);\n\n encryptionAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pkcs5PBES2']).getBytes()),\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // keyDerivationFunc\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pkcs5PBKDF2']).getBytes()),\n // PBKDF2-params\n params\n ]),\n // encryptionScheme\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(encOid).getBytes()),\n // iv\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, iv)\n ])\n ])\n ]);\n } else if(options.algorithm === '3des') {\n // Do PKCS12 PBE\n dkLen = 24;\n\n var saltBytes = new forge.util.ByteBuffer(salt);\n var dk = pki.pbe.generatePkcs12Key(password, saltBytes, 1, count, dkLen);\n var iv = pki.pbe.generatePkcs12Key(password, saltBytes, 2, count, dkLen);\n var cipher = forge.des.createEncryptionCipher(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(obj));\n cipher.finish();\n encryptedData = cipher.output.getBytes();\n\n encryptionAlgorithm = asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(oids['pbeWithSHAAnd3-KeyTripleDES-CBC']).getBytes()),\n // pkcs-12PbeParams\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // salt\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt),\n // iteration count\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n countBytes.getBytes())\n ])\n ]);\n } else {\n var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // EncryptedPrivateKeyInfo\n var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // encryptionAlgorithm\n encryptionAlgorithm,\n // encryptedData\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, encryptedData)\n ]);\n return rval;\n};\n\n/**\n * Decrypts a ASN.1 PrivateKeyInfo object.\n *\n * @param obj the ASN.1 EncryptedPrivateKeyInfo object.\n * @param password the password to decrypt with.\n *\n * @return the ASN.1 PrivateKeyInfo on success, null on failure.\n */\npki.decryptPrivateKeyInfo = function(obj, password) {\n var rval = null;\n\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(obj, encryptedPrivateKeyValidator, capture, errors)) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n // get cipher\n var oid = asn1.derToOid(capture.encryptionOid);\n var cipher = pki.pbe.getCipher(oid, capture.encryptionParams, password);\n\n // get encrypted data\n var encrypted = forge.util.createBuffer(capture.encryptedData);\n\n cipher.update(encrypted);\n if(cipher.finish()) {\n rval = asn1.fromDer(cipher.output);\n }\n\n return rval;\n};\n\n/**\n * Converts a EncryptedPrivateKeyInfo to PEM format.\n *\n * @param epki the EncryptedPrivateKeyInfo.\n * @param maxline the maximum characters per line, defaults to 64.\n *\n * @return the PEM-formatted encrypted private key.\n */\npki.encryptedPrivateKeyToPem = function(epki, maxline) {\n // convert to DER, then PEM-encode\n var msg = {\n type: 'ENCRYPTED PRIVATE KEY',\n body: asn1.toDer(epki).getBytes()\n };\n return forge.pem.encode(msg, {maxline: maxline});\n};\n\n/**\n * Converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format. Decryption\n * is not performed.\n *\n * @param pem the EncryptedPrivateKeyInfo in PEM-format.\n *\n * @return the ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptedPrivateKeyFromPem = function(pem) {\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'ENCRYPTED PRIVATE KEY') {\n var error = new Error('Could not convert encrypted private key from PEM; ' +\n 'PEM header type is \"ENCRYPTED PRIVATE KEY\".');\n error.headerType = msg.type;\n throw error;\n }\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n throw new Error('Could not convert encrypted private key from PEM; ' +\n 'PEM is encrypted.');\n }\n\n // convert DER to ASN.1 object\n return asn1.fromDer(msg.body);\n};\n\n/**\n * Encrypts an RSA private key. By default, the key will be wrapped in\n * a PrivateKeyInfo and encrypted to produce a PKCS#8 EncryptedPrivateKeyInfo.\n * This is the standard, preferred way to encrypt a private key.\n *\n * To produce a non-standard PEM-encrypted private key that uses encapsulated\n * headers to indicate the encryption algorithm (old-style non-PKCS#8 OpenSSL\n * private key encryption), set the 'legacy' option to true. Note: Using this\n * option will cause the iteration count to be forced to 1.\n *\n * Note: The 'des' algorithm is supported, but it is not considered to be\n * secure because it only uses a single 56-bit key. If possible, it is highly\n * recommended that a different algorithm be used.\n *\n * @param rsaKey the RSA key to encrypt.\n * @param password the password to use.\n * @param options:\n * algorithm: the encryption algorithm to use\n * ('aes128', 'aes192', 'aes256', '3des', 'des').\n * count: the iteration count to use.\n * saltSize: the salt size to use.\n * legacy: output an old non-PKCS#8 PEM-encrypted+encapsulated\n * headers (DEK-Info) private key.\n *\n * @return the PEM-encoded ASN.1 EncryptedPrivateKeyInfo.\n */\npki.encryptRsaPrivateKey = function(rsaKey, password, options) {\n // standard PKCS#8\n options = options || {};\n if(!options.legacy) {\n // encrypt PrivateKeyInfo\n var rval = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(rsaKey));\n rval = pki.encryptPrivateKeyInfo(rval, password, options);\n return pki.encryptedPrivateKeyToPem(rval);\n }\n\n // legacy non-PKCS#8\n var algorithm;\n var iv;\n var dkLen;\n var cipherFn;\n switch(options.algorithm) {\n case 'aes128':\n algorithm = 'AES-128-CBC';\n dkLen = 16;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes192':\n algorithm = 'AES-192-CBC';\n dkLen = 24;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case 'aes256':\n algorithm = 'AES-256-CBC';\n dkLen = 32;\n iv = forge.random.getBytesSync(16);\n cipherFn = forge.aes.createEncryptionCipher;\n break;\n case '3des':\n algorithm = 'DES-EDE3-CBC';\n dkLen = 24;\n iv = forge.random.getBytesSync(8);\n cipherFn = forge.des.createEncryptionCipher;\n break;\n case 'des':\n algorithm = 'DES-CBC';\n dkLen = 8;\n iv = forge.random.getBytesSync(8);\n cipherFn = forge.des.createEncryptionCipher;\n break;\n default:\n var error = new Error('Could not encrypt RSA private key; unsupported ' +\n 'encryption algorithm \"' + options.algorithm + '\".');\n error.algorithm = options.algorithm;\n throw error;\n }\n\n // encrypt private key using OpenSSL legacy key derivation\n var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(asn1.toDer(pki.privateKeyToAsn1(rsaKey)));\n cipher.finish();\n\n var msg = {\n type: 'RSA PRIVATE KEY',\n procType: {\n version: '4',\n type: 'ENCRYPTED'\n },\n dekInfo: {\n algorithm: algorithm,\n parameters: forge.util.bytesToHex(iv).toUpperCase()\n },\n body: cipher.output.getBytes()\n };\n return forge.pem.encode(msg);\n};\n\n/**\n * Decrypts an RSA private key.\n *\n * @param pem the PEM-formatted EncryptedPrivateKeyInfo to decrypt.\n * @param password the password to use.\n *\n * @return the RSA key on success, null on failure.\n */\npki.decryptRsaPrivateKey = function(pem, password) {\n var rval = null;\n\n var msg = forge.pem.decode(pem)[0];\n\n if(msg.type !== 'ENCRYPTED PRIVATE KEY' &&\n msg.type !== 'PRIVATE KEY' &&\n msg.type !== 'RSA PRIVATE KEY') {\n var error = new Error('Could not convert private key from PEM; PEM header type ' +\n 'is not \"ENCRYPTED PRIVATE KEY\", \"PRIVATE KEY\", or \"RSA PRIVATE KEY\".');\n error.headerType = error;\n throw error;\n }\n\n if(msg.procType && msg.procType.type === 'ENCRYPTED') {\n var dkLen;\n var cipherFn;\n switch(msg.dekInfo.algorithm) {\n case 'DES-CBC':\n dkLen = 8;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'DES-EDE3-CBC':\n dkLen = 24;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'AES-128-CBC':\n dkLen = 16;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'AES-192-CBC':\n dkLen = 24;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'AES-256-CBC':\n dkLen = 32;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'RC2-40-CBC':\n dkLen = 5;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 40);\n };\n break;\n case 'RC2-64-CBC':\n dkLen = 8;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 64);\n };\n break;\n case 'RC2-128-CBC':\n dkLen = 16;\n cipherFn = function(key) {\n return forge.rc2.createDecryptionCipher(key, 128);\n };\n break;\n default:\n var error = new Error('Could not decrypt private key; unsupported ' +\n 'encryption algorithm \"' + msg.dekInfo.algorithm + '\".');\n error.algorithm = msg.dekInfo.algorithm;\n throw error;\n }\n\n // use OpenSSL legacy key derivation\n var iv = forge.util.hexToBytes(msg.dekInfo.parameters);\n var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen);\n var cipher = cipherFn(dk);\n cipher.start(iv);\n cipher.update(forge.util.createBuffer(msg.body));\n if(cipher.finish()) {\n rval = cipher.output.getBytes();\n } else {\n return rval;\n }\n } else {\n rval = msg.body;\n }\n\n if(msg.type === 'ENCRYPTED PRIVATE KEY') {\n rval = pki.decryptPrivateKeyInfo(asn1.fromDer(rval), password);\n } else {\n // decryption already performed above\n rval = asn1.fromDer(rval);\n }\n\n if(rval !== null) {\n rval = pki.privateKeyFromAsn1(rval);\n }\n\n return rval;\n};\n\n/**\n * Derives a PKCS#12 key.\n *\n * @param password the password to derive the key material from, null or\n * undefined for none.\n * @param salt the salt, as a ByteBuffer, to use.\n * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC).\n * @param iter the iteration count.\n * @param n the number of bytes to derive from the password.\n * @param md the message digest to use, defaults to SHA-1.\n *\n * @return a ByteBuffer with the bytes derived from the password.\n */\npki.pbe.generatePkcs12Key = function(password, salt, id, iter, n, md) {\n var j, l;\n\n if(typeof md === 'undefined' || md === null) {\n if(!('sha1' in forge.md)) {\n throw new Error('\"sha1\" hash algorithm unavailable.');\n }\n md = forge.md.sha1.create();\n }\n\n var u = md.digestLength;\n var v = md.blockLength;\n var result = new forge.util.ByteBuffer();\n\n /* Convert password to Unicode byte buffer + trailing 0-byte. */\n var passBuf = new forge.util.ByteBuffer();\n if(password !== null && password !== undefined) {\n for(l = 0; l < password.length; l++) {\n passBuf.putInt16(password.charCodeAt(l));\n }\n passBuf.putInt16(0);\n }\n\n /* Length of salt and password in BYTES. */\n var p = passBuf.length();\n var s = salt.length();\n\n /* 1. Construct a string, D (the \"diversifier\"), by concatenating\n v copies of ID. */\n var D = new forge.util.ByteBuffer();\n D.fillWithByte(id, v);\n\n /* 2. Concatenate copies of the salt together to create a string S of length\n v * ceil(s / v) bytes (the final copy of the salt may be trunacted\n to create S).\n Note that if the salt is the empty string, then so is S. */\n var Slen = v * Math.ceil(s / v);\n var S = new forge.util.ByteBuffer();\n for(l = 0; l < Slen; l++) {\n S.putByte(salt.at(l % s));\n }\n\n /* 3. Concatenate copies of the password together to create a string P of\n length v * ceil(p / v) bytes (the final copy of the password may be\n truncated to create P).\n Note that if the password is the empty string, then so is P. */\n var Plen = v * Math.ceil(p / v);\n var P = new forge.util.ByteBuffer();\n for(l = 0; l < Plen; l++) {\n P.putByte(passBuf.at(l % p));\n }\n\n /* 4. Set I=S||P to be the concatenation of S and P. */\n var I = S;\n I.putBuffer(P);\n\n /* 5. Set c=ceil(n / u). */\n var c = Math.ceil(n / u);\n\n /* 6. For i=1, 2, ..., c, do the following: */\n for(var i = 1; i <= c; i++) {\n /* a) Set Ai=H^r(D||I). (l.e. the rth hash of D||I, H(H(H(...H(D||I)))) */\n var buf = new forge.util.ByteBuffer();\n buf.putBytes(D.bytes());\n buf.putBytes(I.bytes());\n for(var round = 0; round < iter; round++) {\n md.start();\n md.update(buf.getBytes());\n buf = md.digest();\n }\n\n /* b) Concatenate copies of Ai to create a string B of length v bytes (the\n final copy of Ai may be truncated to create B). */\n var B = new forge.util.ByteBuffer();\n for(l = 0; l < v; l++) {\n B.putByte(buf.at(l % u));\n }\n\n /* c) Treating I as a concatenation I0, I1, ..., Ik-1 of v-byte blocks,\n where k=ceil(s / v) + ceil(p / v), modify I by setting\n Ij=(Ij+B+1) mod 2v for each j. */\n var k = Math.ceil(s / v) + Math.ceil(p / v);\n var Inew = new forge.util.ByteBuffer();\n for(j = 0; j < k; j++) {\n var chunk = new forge.util.ByteBuffer(I.getBytes(v));\n var x = 0x1ff;\n for(l = B.length() - 1; l >= 0; l--) {\n x = x >> 8;\n x += B.at(l) + chunk.at(l);\n chunk.setAt(l, x & 0xff);\n }\n Inew.putBuffer(chunk);\n }\n I = Inew;\n\n /* Add Ai to A. */\n result.putBuffer(buf);\n }\n\n result.truncate(result.length() - n);\n return result;\n};\n\n/**\n * Get new Forge cipher object instance.\n *\n * @param oid the OID (in string notation).\n * @param params the ASN.1 params object.\n * @param password the password to decrypt with.\n *\n * @return new cipher object instance.\n */\npki.pbe.getCipher = function(oid, params, password) {\n switch(oid) {\n case pki.oids['pkcs5PBES2']:\n return pki.pbe.getCipherForPBES2(oid, params, password);\n\n case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']:\n case pki.oids['pbewithSHAAnd40BitRC2-CBC']:\n return pki.pbe.getCipherForPKCS12PBE(oid, params, password);\n\n default:\n var error = new Error('Cannot read encrypted PBE data block. Unsupported OID.');\n error.oid = oid;\n error.supportedOids = [\n 'pkcs5PBES2',\n 'pbeWithSHAAnd3-KeyTripleDES-CBC',\n 'pbewithSHAAnd40BitRC2-CBC'\n ];\n throw error;\n }\n};\n\n/**\n * Get new Forge cipher object instance according to PBES2 params block.\n *\n * The returned cipher instance is already started using the IV\n * from PBES2 parameter block.\n *\n * @param oid the PKCS#5 PBKDF2 OID (in string notation).\n * @param params the ASN.1 PBES2-params object.\n * @param password the password to decrypt with.\n *\n * @return new cipher object instance.\n */\npki.pbe.getCipherForPBES2 = function(oid, params, password) {\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(params, PBES2AlgorithmsValidator, capture, errors)) {\n var error = new Error('Cannot read password-based-encryption algorithm ' +\n 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n // check oids\n oid = asn1.derToOid(capture.kdfOid);\n if(oid !== pki.oids['pkcs5PBKDF2']) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'Unsupported key derivation function OID.');\n error.oid = oid;\n error.supportedOids = ['pkcs5PBKDF2'];\n throw error;\n }\n oid = asn1.derToOid(capture.encOid);\n if(oid !== pki.oids['aes128-CBC'] &&\n oid !== pki.oids['aes192-CBC'] &&\n oid !== pki.oids['aes256-CBC'] &&\n oid !== pki.oids['des-EDE3-CBC'] &&\n oid !== pki.oids['desCBC']) {\n var error = new Error('Cannot read encrypted private key. ' +\n 'Unsupported encryption scheme OID.');\n error.oid = oid;\n error.supportedOids = [\n 'aes128-CBC', 'aes192-CBC', 'aes256-CBC', 'des-EDE3-CBC', 'desCBC'];\n throw error;\n }\n\n // set PBE params\n var salt = capture.kdfSalt;\n var count = forge.util.createBuffer(capture.kdfIterationCount);\n count = count.getInt(count.length() << 3);\n var dkLen;\n var cipherFn;\n switch(pki.oids[oid]) {\n case 'aes128-CBC':\n dkLen = 16;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'aes192-CBC':\n dkLen = 24;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'aes256-CBC':\n dkLen = 32;\n cipherFn = forge.aes.createDecryptionCipher;\n break;\n case 'des-EDE3-CBC':\n dkLen = 24;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n case 'desCBC':\n dkLen = 8;\n cipherFn = forge.des.createDecryptionCipher;\n break;\n }\n\n // get PRF message digest\n var md = prfOidToMessageDigest(capture.prfOid);\n\n // decrypt private key using pbe with chosen PRF and AES/DES\n var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md);\n var iv = capture.encIv;\n var cipher = cipherFn(dk);\n cipher.start(iv);\n\n return cipher;\n};\n\n/**\n * Get new Forge cipher object instance for PKCS#12 PBE.\n *\n * The returned cipher instance is already started using the key & IV\n * derived from the provided password and PKCS#12 PBE salt.\n *\n * @param oid The PKCS#12 PBE OID (in string notation).\n * @param params The ASN.1 PKCS#12 PBE-params object.\n * @param password The password to decrypt with.\n *\n * @return the new cipher object instance.\n */\npki.pbe.getCipherForPKCS12PBE = function(oid, params, password) {\n // get PBE params\n var capture = {};\n var errors = [];\n if(!asn1.validate(params, pkcs12PbeParamsValidator, capture, errors)) {\n var error = new Error('Cannot read password-based-encryption algorithm ' +\n 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.');\n error.errors = errors;\n throw error;\n }\n\n var salt = forge.util.createBuffer(capture.salt);\n var count = forge.util.createBuffer(capture.iterations);\n count = count.getInt(count.length() << 3);\n\n var dkLen, dIvLen, cipherFn;\n switch(oid) {\n case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']:\n dkLen = 24;\n dIvLen = 8;\n cipherFn = forge.des.startDecrypting;\n break;\n\n case pki.oids['pbewithSHAAnd40BitRC2-CBC']:\n dkLen = 5;\n dIvLen = 8;\n cipherFn = function(key, iv) {\n var cipher = forge.rc2.createDecryptionCipher(key, 40);\n cipher.start(iv, null);\n return cipher;\n };\n break;\n\n default:\n var error = new Error('Cannot read PKCS #12 PBE data block. Unsupported OID.');\n error.oid = oid;\n throw error;\n }\n\n // get PRF message digest\n var md = prfOidToMessageDigest(capture.prfOid);\n var key = pki.pbe.generatePkcs12Key(password, salt, 1, count, dkLen, md);\n md.start();\n var iv = pki.pbe.generatePkcs12Key(password, salt, 2, count, dIvLen, md);\n\n return cipherFn(key, iv);\n};\n\n/**\n * OpenSSL's legacy key derivation function.\n *\n * See: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html\n *\n * @param password the password to derive the key from.\n * @param salt the salt to use, null for none.\n * @param dkLen the number of bytes needed for the derived key.\n * @param [options] the options to use:\n * [md] an optional message digest object to use.\n */\npki.pbe.opensslDeriveBytes = function(password, salt, dkLen, md) {\n if(typeof md === 'undefined' || md === null) {\n if(!('md5' in forge.md)) {\n throw new Error('\"md5\" hash algorithm unavailable.');\n }\n md = forge.md.md5.create();\n }\n if(salt === null) {\n salt = '';\n }\n var digests = [hash(md, password + salt)];\n for(var length = 16, i = 1; length < dkLen; ++i, length += 16) {\n digests.push(hash(md, digests[i - 1] + password + salt));\n }\n return digests.join('').substr(0, dkLen);\n};\n\nfunction hash(md, bytes) {\n return md.start().update(bytes).digest().getBytes();\n}\n\nfunction prfOidToMessageDigest(prfOid) {\n // get PRF algorithm, default to SHA-1\n var prfAlgorithm;\n if(!prfOid) {\n prfAlgorithm = 'hmacWithSHA1';\n } else {\n prfAlgorithm = pki.oids[asn1.derToOid(prfOid)];\n if(!prfAlgorithm) {\n var error = new Error('Unsupported PRF OID.');\n error.oid = prfOid;\n error.supported = [\n 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384',\n 'hmacWithSHA512'];\n throw error;\n }\n }\n return prfAlgorithmToMessageDigest(prfAlgorithm);\n}\n\nfunction prfAlgorithmToMessageDigest(prfAlgorithm) {\n var factory = forge.md;\n switch(prfAlgorithm) {\n case 'hmacWithSHA224':\n factory = forge.md.sha512;\n case 'hmacWithSHA1':\n case 'hmacWithSHA256':\n case 'hmacWithSHA384':\n case 'hmacWithSHA512':\n prfAlgorithm = prfAlgorithm.substr(8).toLowerCase();\n break;\n default:\n var error = new Error('Unsupported PRF algorithm.');\n error.algorithm = prfAlgorithm;\n error.supported = [\n 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384',\n 'hmacWithSHA512'];\n throw error;\n }\n if(!factory || !(prfAlgorithm in factory)) {\n throw new Error('Unknown hash algorithm: ' + prfAlgorithm);\n }\n return factory[prfAlgorithm].create();\n}\n\nfunction createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm) {\n var params = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // salt\n asn1.create(\n asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt),\n // iteration count\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n countBytes.getBytes())\n ]);\n // when PRF algorithm is not SHA-1 default, add key length and PRF algorithm\n if(prfAlgorithm !== 'hmacWithSHA1') {\n params.value.push(\n // key length\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false,\n forge.util.hexToBytes(dkLen.toString(16))),\n // AlgorithmIdentifier\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [\n // algorithm\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false,\n asn1.oidToDer(pki.oids[prfAlgorithm]).getBytes()),\n // parameters (null)\n asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')\n ]));\n }\n return params;\n}\n","/**\n * RC2 implementation.\n *\n * @author Stefan Siegl\n *\n * Copyright (c) 2012 Stefan Siegl \n *\n * Information on the RC2 cipher is available from RFC #2268,\n * http://www.ietf.org/rfc/rfc2268.txt\n */\nvar forge = require('./forge');\nrequire('./util');\n\nvar piTable = [\n 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,\n 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,\n 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,\n 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,\n 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,\n 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,\n 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,\n 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,\n 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,\n 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,\n 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,\n 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,\n 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,\n 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,\n 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,\n 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad\n];\n\nvar s = [1, 2, 3, 5];\n\n/**\n * Rotate a word left by given number of bits.\n *\n * Bits that are shifted out on the left are put back in on the right\n * hand side.\n *\n * @param word The word to shift left.\n * @param bits The number of bits to shift by.\n * @return The rotated word.\n */\nvar rol = function(word, bits) {\n return ((word << bits) & 0xffff) | ((word & 0xffff) >> (16 - bits));\n};\n\n/**\n * Rotate a word right by given number of bits.\n *\n * Bits that are shifted out on the right are put back in on the left\n * hand side.\n *\n * @param word The word to shift right.\n * @param bits The number of bits to shift by.\n * @return The rotated word.\n */\nvar ror = function(word, bits) {\n return ((word & 0xffff) >> bits) | ((word << (16 - bits)) & 0xffff);\n};\n\n/* RC2 API */\nmodule.exports = forge.rc2 = forge.rc2 || {};\n\n/**\n * Perform RC2 key expansion as per RFC #2268, section 2.\n *\n * @param key variable-length user key (between 1 and 128 bytes)\n * @param effKeyBits number of effective key bits (default: 128)\n * @return the expanded RC2 key (ByteBuffer of 128 bytes)\n */\nforge.rc2.expandKey = function(key, effKeyBits) {\n if(typeof key === 'string') {\n key = forge.util.createBuffer(key);\n }\n effKeyBits = effKeyBits || 128;\n\n /* introduce variables that match the names used in RFC #2268 */\n var L = key;\n var T = key.length();\n var T1 = effKeyBits;\n var T8 = Math.ceil(T1 / 8);\n var TM = 0xff >> (T1 & 0x07);\n var i;\n\n for(i = T; i < 128; i++) {\n L.putByte(piTable[(L.at(i - 1) + L.at(i - T)) & 0xff]);\n }\n\n L.setAt(128 - T8, piTable[L.at(128 - T8) & TM]);\n\n for(i = 127 - T8; i >= 0; i--) {\n L.setAt(i, piTable[L.at(i + 1) ^ L.at(i + T8)]);\n }\n\n return L;\n};\n\n/**\n * Creates a RC2 cipher object.\n *\n * @param key the symmetric key to use (as base for key generation).\n * @param bits the number of effective key bits.\n * @param encrypt false for decryption, true for encryption.\n *\n * @return the cipher.\n */\nvar createCipher = function(key, bits, encrypt) {\n var _finish = false, _input = null, _output = null, _iv = null;\n var mixRound, mashRound;\n var i, j, K = [];\n\n /* Expand key and fill into K[] Array */\n key = forge.rc2.expandKey(key, bits);\n for(i = 0; i < 64; i++) {\n K.push(key.getInt16Le());\n }\n\n if(encrypt) {\n /**\n * Perform one mixing round \"in place\".\n *\n * @param R Array of four words to perform mixing on.\n */\n mixRound = function(R) {\n for(i = 0; i < 4; i++) {\n R[i] += K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) +\n ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);\n R[i] = rol(R[i], s[i]);\n j++;\n }\n };\n\n /**\n * Perform one mashing round \"in place\".\n *\n * @param R Array of four words to perform mashing on.\n */\n mashRound = function(R) {\n for(i = 0; i < 4; i++) {\n R[i] += K[R[(i + 3) % 4] & 63];\n }\n };\n } else {\n /**\n * Perform one r-mixing round \"in place\".\n *\n * @param R Array of four words to perform mixing on.\n */\n mixRound = function(R) {\n for(i = 3; i >= 0; i--) {\n R[i] = ror(R[i], s[i]);\n R[i] -= K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) +\n ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);\n j--;\n }\n };\n\n /**\n * Perform one r-mashing round \"in place\".\n *\n * @param R Array of four words to perform mashing on.\n */\n mashRound = function(R) {\n for(i = 3; i >= 0; i--) {\n R[i] -= K[R[(i + 3) % 4] & 63];\n }\n };\n }\n\n /**\n * Run the specified cipher execution plan.\n *\n * This function takes four words from the input buffer, applies the IV on\n * it (if requested) and runs the provided execution plan.\n *\n * The plan must be put together in form of a array of arrays. Where the\n * outer one is simply a list of steps to perform and the inner one needs\n * to have two elements: the first one telling how many rounds to perform,\n * the second one telling what to do (i.e. the function to call).\n *\n * @param {Array} plan The plan to execute.\n */\n var runPlan = function(plan) {\n var R = [];\n\n /* Get data from input buffer and fill the four words into R */\n for(i = 0; i < 4; i++) {\n var val = _input.getInt16Le();\n\n if(_iv !== null) {\n if(encrypt) {\n /* We're encrypting, apply the IV first. */\n val ^= _iv.getInt16Le();\n } else {\n /* We're decryption, keep cipher text for next block. */\n _iv.putInt16Le(val);\n }\n }\n\n R.push(val & 0xffff);\n }\n\n /* Reset global \"j\" variable as per spec. */\n j = encrypt ? 0 : 63;\n\n /* Run execution plan. */\n for(var ptr = 0; ptr < plan.length; ptr++) {\n for(var ctr = 0; ctr < plan[ptr][0]; ctr++) {\n plan[ptr][1](R);\n }\n }\n\n /* Write back result to output buffer. */\n for(i = 0; i < 4; i++) {\n if(_iv !== null) {\n if(encrypt) {\n /* We're encrypting in CBC-mode, feed back encrypted bytes into\n IV buffer to carry it forward to next block. */\n _iv.putInt16Le(R[i]);\n } else {\n R[i] ^= _iv.getInt16Le();\n }\n }\n\n _output.putInt16Le(R[i]);\n }\n };\n\n /* Create cipher object */\n var cipher = null;\n cipher = {\n /**\n * Starts or restarts the encryption or decryption process, whichever\n * was previously configured.\n *\n * To use the cipher in CBC mode, iv may be given either as a string\n * of bytes, or as a byte buffer. For ECB mode, give null as iv.\n *\n * @param iv the initialization vector to use, null for ECB mode.\n * @param output the output the buffer to write to, null to create one.\n */\n start: function(iv, output) {\n if(iv) {\n /* CBC mode */\n if(typeof iv === 'string') {\n iv = forge.util.createBuffer(iv);\n }\n }\n\n _finish = false;\n _input = forge.util.createBuffer();\n _output = output || new forge.util.createBuffer();\n _iv = iv;\n\n cipher.output = _output;\n },\n\n /**\n * Updates the next block.\n *\n * @param input the buffer to read from.\n */\n update: function(input) {\n if(!_finish) {\n // not finishing, so fill the input buffer with more input\n _input.putBuffer(input);\n }\n\n while(_input.length() >= 8) {\n runPlan([\n [ 5, mixRound ],\n [ 1, mashRound ],\n [ 6, mixRound ],\n [ 1, mashRound ],\n [ 5, mixRound ]\n ]);\n }\n },\n\n /**\n * Finishes encrypting or decrypting.\n *\n * @param pad a padding function to use, null for PKCS#7 padding,\n * signature(blockSize, buffer, decrypt).\n *\n * @return true if successful, false on error.\n */\n finish: function(pad) {\n var rval = true;\n\n if(encrypt) {\n if(pad) {\n rval = pad(8, _input, !encrypt);\n } else {\n // add PKCS#7 padding to block (each pad byte is the\n // value of the number of pad bytes)\n var padding = (_input.length() === 8) ? 8 : (8 - _input.length());\n _input.fillWithByte(padding, padding);\n }\n }\n\n if(rval) {\n // do final update\n _finish = true;\n cipher.update();\n }\n\n if(!encrypt) {\n // check for error: input data not a multiple of block size\n rval = (_input.length() === 0);\n if(rval) {\n if(pad) {\n rval = pad(8, _output, !encrypt);\n } else {\n // ensure padding byte count is valid\n var len = _output.length();\n var count = _output.at(len - 1);\n\n if(count > len) {\n rval = false;\n } else {\n // trim off padding bytes\n _output.truncate(count);\n }\n }\n }\n }\n\n return rval;\n }\n };\n\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the\n * given symmetric key. The output will be stored in the 'output' member\n * of the returned cipher.\n *\n * The key and iv may be given as a string of bytes or a byte buffer.\n * The cipher is initialized to use 128 effective key bits.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n *\n * @return the cipher.\n */\nforge.rc2.startEncrypting = function(key, iv, output) {\n var cipher = forge.rc2.createEncryptionCipher(key, 128);\n cipher.start(iv, output);\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the\n * given symmetric key.\n *\n * The key may be given as a string of bytes or a byte buffer.\n *\n * To start encrypting call start() on the cipher with an iv and optional\n * output buffer.\n *\n * @param key the symmetric key to use.\n *\n * @return the cipher.\n */\nforge.rc2.createEncryptionCipher = function(key, bits) {\n return createCipher(key, bits, true);\n};\n\n/**\n * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the\n * given symmetric key. The output will be stored in the 'output' member\n * of the returned cipher.\n *\n * The key and iv may be given as a string of bytes or a byte buffer.\n * The cipher is initialized to use 128 effective key bits.\n *\n * @param key the symmetric key to use.\n * @param iv the initialization vector to use.\n * @param output the buffer to write to, null to create one.\n *\n * @return the cipher.\n */\nforge.rc2.startDecrypting = function(key, iv, output) {\n var cipher = forge.rc2.createDecryptionCipher(key, 128);\n cipher.start(iv, output);\n return cipher;\n};\n\n/**\n * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the\n * given symmetric key.\n *\n * The key may be given as a string of bytes or a byte buffer.\n *\n * To start decrypting call start() on the cipher with an iv and optional\n * output buffer.\n *\n * @param key the symmetric key to use.\n *\n * @return the cipher.\n */\nforge.rc2.createDecryptionCipher = function(key, bits) {\n return createCipher(key, bits, false);\n};\n","/**\n * Node.js module for Forge message digests.\n *\n * @author Dave Longley\n *\n * Copyright 2011-2017 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\n\nmodule.exports = forge.md = forge.md || {};\nforge.md.algorithms = forge.md.algorithms || {};\n","'use strict'\n\n/**\n * Interface for G-Set CRDT\n *\n * From:\n * \"A comprehensive study of Convergent and Commutative Replicated Data Types\"\n * https://hal.inria.fr/inria-00555588\n */\nclass GSet {\n constructor (values) {} // eslint-disable-line\n append (value) {}\n merge (set) {}\n get (value) {}\n has (value) {}\n get values () {}\n get length () {}\n}\n\nmodule.exports = GSet\n","/**\n * Node.js module for Forge.\n *\n * @author Dave Longley\n *\n * Copyright 2011-2016 Digital Bazaar, Inc.\n */\nmodule.exports = {\n // default options\n options: {\n usePureJavaScript: false\n }\n};\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","'use strict'\n\nconst path = require('path')\nconst os = require('os')\nconst uuid = require('uuid/v4')\n\nexports.filter = (iterable, filterer) => {\n return (async function * () {\n for await (const value of iterable) {\n const keep = await filterer(value)\n if (!keep) continue\n yield value\n }\n })()\n}\n\n// Not just sort, because the sorter is given all the values and should return\n// them all sorted\nexports.sortAll = (iterable, sorter) => {\n return (async function * () {\n let values = []\n for await (const value of iterable) values.push(value)\n values = await sorter(values)\n for (const value of values) yield value\n })()\n}\n\nexports.take = (iterable, n) => {\n return (async function * () {\n if (n <= 0) return\n let i = 0\n for await (const value of iterable) {\n yield value\n i++\n if (i >= n) return\n }\n })()\n}\n\nexports.map = (iterable, mapper) => {\n return (async function * () {\n for await (const value of iterable) {\n yield mapper(value)\n }\n })()\n}\n\nexports.replaceStartWith = function (s, r) {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n\nexports.tmpdir = () => {\n return path.join(os.tmpdir(), uuid())\n}\n","'use strict'\n\n/**\n * Keeps track of all running queries.\n */\nclass QueryManager {\n /**\n * Creates a new QueryManager.\n */\n constructor () {\n this.queries = new Set()\n this.running = false\n }\n\n /**\n * Called when a query is started.\n *\n * @param {Query} query\n */\n queryStarted (query) {\n this.queries.add(query)\n }\n\n /**\n * Called when a query completes.\n *\n * @param {Query} query\n */\n queryCompleted (query) {\n this.queries.delete(query)\n }\n\n /**\n * Starts the query manager.\n */\n start () {\n this.running = true\n }\n\n /**\n * Stops all queries.\n */\n stop () {\n this.running = false\n for (const query of this.queries) {\n query.stop()\n }\n this.queries.clear()\n }\n}\n\nmodule.exports = QueryManager\n","'use strict'\n\nconst { Buffer } = require('buffer')\nconst blake = require('blakejs')\n\nconst minB = 0xb201\nconst minS = 0xb241\n\nconst blake2b = {\n init: blake.blake2bInit,\n update: blake.blake2bUpdate,\n digest: blake.blake2bFinal\n}\n\nconst blake2s = {\n init: blake.blake2sInit,\n update: blake.blake2sUpdate,\n digest: blake.blake2sFinal\n}\n\n// Note that although this function doesn't do any asynchronous work, we mark\n// the function as async because it must return a Promise to match the API\n// for other functions that do perform asynchronous work (see sha.browser.js)\nconst makeB2Hash = (size, hf) => async (data) => {\n const ctx = hf.init(size, null)\n hf.update(ctx, data)\n return Buffer.from(hf.digest(ctx))\n}\n\nmodule.exports = (table) => {\n for (let i = 0; i < 64; i++) {\n table[minB + i] = makeB2Hash(i + 1, blake2b)\n }\n for (let i = 0; i < 32; i++) {\n table[minS + i] = makeB2Hash(i + 1, blake2s)\n }\n}\n","'use strict'\nconst baseTable = require('./base-table.json')\n\n// map for hexString -> codecName\nconst nameTable = new Map()\n\nfor (const encodingName in baseTable) {\n const code = baseTable[encodingName]\n nameTable.set(code, encodingName)\n}\n\nmodule.exports = Object.freeze(nameTable)\n","export const version = \"transactions/5.0.0-beta.134\";\n","\"use strict\";\nimport { getAddress } from \"@ethersproject/address\";\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { arrayify, hexDataSlice, hexlify, hexZeroPad, isBytesLike, splitSignature, stripZeros, } from \"@ethersproject/bytes\";\nimport { Zero } from \"@ethersproject/constants\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { checkProperties } from \"@ethersproject/properties\";\nimport * as RLP from \"@ethersproject/rlp\";\nimport { computePublicKey, recoverPublicKey } from \"@ethersproject/signing-key\";\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n///////////////////////////////\nfunction handleAddress(value) {\n if (value === \"0x\") {\n return null;\n }\n return getAddress(value);\n}\nfunction handleNumber(value) {\n if (value === \"0x\") {\n return Zero;\n }\n return BigNumber.from(value);\n}\nconst transactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"gasPrice\", maxLength: 32, numeric: true },\n { name: \"gasLimit\", maxLength: 32, numeric: true },\n { name: \"to\", length: 20 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n];\nconst allowedTransactionKeys = {\n chainId: true, data: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true\n};\nexport function computeAddress(key) {\n const publicKey = computePublicKey(key);\n return getAddress(hexDataSlice(keccak256(hexDataSlice(publicKey, 1)), 12));\n}\nexport function recoverAddress(digest, signature) {\n return computeAddress(recoverPublicKey(arrayify(digest), signature));\n}\nexport function serialize(transaction, signature) {\n checkProperties(transaction, allowedTransactionKeys);\n const raw = [];\n transactionFields.forEach(function (fieldInfo) {\n let value = transaction[fieldInfo.name] || ([]);\n const options = {};\n if (fieldInfo.numeric) {\n options.hexPad = \"left\";\n }\n value = arrayify(hexlify(value, options));\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value);\n }\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = stripZeros(value);\n if (value.length > fieldInfo.maxLength) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value);\n }\n }\n raw.push(hexlify(value));\n });\n let chainId = 0;\n if (transaction.chainId != null) {\n // A chainId was provided; if non-zero we'll use EIP-155\n chainId = transaction.chainId;\n if (typeof (chainId) !== \"number\") {\n logger.throwArgumentError(\"invalid transaction.chainId\", \"transaction\", transaction);\n }\n }\n else if (signature && !isBytesLike(signature) && signature.v > 28) {\n // No chainId provided, but the signature is signing with EIP-155; derive chainId\n chainId = Math.floor((signature.v - 35) / 2);\n }\n // We have an EIP-155 transaction (chainId was specified and non-zero)\n if (chainId !== 0) {\n raw.push(hexlify(chainId));\n raw.push(\"0x\");\n raw.push(\"0x\");\n }\n // Requesting an unsigned transation\n if (!signature) {\n return RLP.encode(raw);\n }\n // The splitSignature will ensure the transaction has a recoveryParam in the\n // case that the signTransaction function only adds a v.\n const sig = splitSignature(signature);\n // We pushed a chainId and null r, s on for hashing only; remove those\n let v = 27 + sig.recoveryParam;\n if (chainId !== 0) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += chainId * 2 + 8;\n // If an EIP-155 v (directly or indirectly; maybe _vs) was provided, check it!\n if (sig.v > 28 && sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n }\n else if (sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n raw.push(hexlify(v));\n raw.push(stripZeros(arrayify(sig.r)));\n raw.push(stripZeros(arrayify(sig.s)));\n return RLP.encode(raw);\n}\nexport function parse(rawTransaction) {\n const transaction = RLP.decode(rawTransaction);\n if (transaction.length !== 9 && transaction.length !== 6) {\n logger.throwArgumentError(\"invalid raw transaction\", \"rawTransactin\", rawTransaction);\n }\n const tx = {\n nonce: handleNumber(transaction[0]).toNumber(),\n gasPrice: handleNumber(transaction[1]),\n gasLimit: handleNumber(transaction[2]),\n to: handleAddress(transaction[3]),\n value: handleNumber(transaction[4]),\n data: transaction[5],\n chainId: 0\n };\n // Legacy unsigned transaction\n if (transaction.length === 6) {\n return tx;\n }\n try {\n tx.v = BigNumber.from(transaction[6]).toNumber();\n }\n catch (error) {\n console.log(error);\n return tx;\n }\n tx.r = hexZeroPad(transaction[7], 32);\n tx.s = hexZeroPad(transaction[8], 32);\n if (BigNumber.from(tx.r).isZero() && BigNumber.from(tx.s).isZero()) {\n // EIP-155 unsigned transaction\n tx.chainId = tx.v;\n tx.v = 0;\n }\n else {\n // Signed Tranasaction\n tx.chainId = Math.floor((tx.v - 35) / 2);\n if (tx.chainId < 0) {\n tx.chainId = 0;\n }\n let recoveryParam = tx.v - 27;\n const raw = transaction.slice(0, 6);\n if (tx.chainId !== 0) {\n raw.push(hexlify(tx.chainId));\n raw.push(\"0x\");\n raw.push(\"0x\");\n recoveryParam -= tx.chainId * 2 + 8;\n }\n const digest = keccak256(RLP.encode(raw));\n try {\n tx.from = recoverAddress(digest, { r: hexlify(tx.r), s: hexlify(tx.s), recoveryParam: recoveryParam });\n }\n catch (error) {\n console.log(error);\n }\n tx.hash = keccak256(rawTransaction);\n }\n return tx;\n}\n","/* global self */\n\n'use strict'\n\nconst nodeify = require('nodeify')\n\nconst webCrypto = getWebCrypto()\n\nfunction getWebCrypto () {\n if (self.crypto) {\n return self.crypto.subtle || self.crypto.webkitSubtle\n }\n\n if (self.msCrypto) {\n return self.msCrypto.subtle\n }\n}\n\nfunction webCryptoHash (type) {\n if (!webCrypto) {\n throw new Error('Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context')\n }\n\n return (data, callback) => {\n const res = webCrypto.digest({ name: type }, data)\n\n if (typeof res.then !== 'function') { // IE11\n res.onerror = () => {\n callback(new Error(`hashing data using ${type}`))\n }\n res.oncomplete = (e) => {\n callback(null, e.target.result)\n }\n return\n }\n\n nodeify(\n res.then((raw) => Buffer.from(new Uint8Array(raw))),\n callback\n )\n }\n}\n\nfunction sha1 (buf, callback) {\n webCryptoHash('SHA-1')(buf, callback)\n}\n\nfunction sha2256 (buf, callback) {\n webCryptoHash('SHA-256')(buf, callback)\n}\n\nfunction sha2512 (buf, callback) {\n webCryptoHash('SHA-512')(buf, callback)\n}\n\nmodule.exports = {\n sha1: sha1,\n sha2256: sha2256,\n sha2512: sha2512\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* Active `debug` instances.\n\t*/\n\tcreateDebug.instances = [];\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn match;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.enabled = createDebug.enabled(namespace);\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = selectColor(namespace);\n\t\tdebug.destroy = destroy;\n\t\tdebug.extend = extend;\n\t\t// Debug.formatArgs = formatArgs;\n\t\t// debug.rawLog = rawLog;\n\n\t\t// env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\tcreateDebug.instances.push(debug);\n\n\t\treturn debug;\n\t}\n\n\tfunction destroy() {\n\t\tconst index = createDebug.instances.indexOf(this);\n\t\tif (index !== -1) {\n\t\t\tcreateDebug.instances.splice(index, 1);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0; i < createDebug.instances.length; i++) {\n\t\t\tconst instance = createDebug.instances[i];\n\t\t\tinstance.enabled = createDebug.enabled(instance.namespace);\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","'use strict';\n\nconst pDoWhilst = async (action, condition) => {\n\tconst actionResult = await action();\n\n\tif (condition(actionResult)) {\n\t\treturn pDoWhilst(action, condition);\n\t}\n};\n\nmodule.exports = pDoWhilst;\n// TODO: Remove this for the next major release\nmodule.exports.default = pDoWhilst;\n","var Reader = require('pull-reader')\nvar Writer = require('pull-pushable')\nvar cat = require('pull-cat')\nvar pair = require('pull-pair')\n\nfunction once (cb) {\n var called = 0\n return function (a, b, c) {\n if(called++) return\n cb(a, b, c)\n }\n}\n\nfunction isFunction (f) {\n return 'function' === typeof f\n}\n\nmodule.exports = function (opts, _cb) {\n if(isFunction(opts)) _cb = opts, opts = {}\n _cb = once(_cb || function noop () {})\n var reader = Reader(opts && opts.timeout || 5e3)\n var writer = Writer(function (err) {\n if(err) _cb(err)\n })\n\n var p = pair()\n\n return {\n handshake: {\n read: reader.read,\n abort: function (err) {\n writer.end(err)\n reader.abort(err, function (err) {\n })\n _cb(err)\n },\n write: writer.push,\n rest: function () {\n writer.end()\n return {\n source: reader.read(),\n sink: p.sink\n }\n }\n },\n sink: reader,\n source: cat([writer, p.source])\n }\n}\n","'use strict';\n\nfunction createError(msg, code, props) {\n var err = msg instanceof Error ? msg : new Error(msg);\n var key;\n\n if (typeof code === 'object') {\n props = code;\n } else if (code != null) {\n err.code = code;\n }\n\n if (props) {\n for (key in props) {\n err[key] = props[key];\n }\n }\n\n return err;\n}\n\nmodule.exports = createError;\n","'use strict'\n\nvar reduce = require('./reduce')\n\nmodule.exports = function concat (cb) {\n return reduce(function (a, b) {\n return a + b\n }, '', cb)\n}\n","'use strict';\nconst isPlainObject = require('is-plain-obj');\n\nmodule.exports = (object, options = {}) => {\n\tif (!isPlainObject(object)) {\n\t\tthrow new TypeError('Expected a plain object');\n\t}\n\n\tconst {deep} = options;\n\tconst seenInput = [];\n\tconst seenOutput = [];\n\n\tconst sortKeys = object => {\n\t\tconst seenIndex = seenInput.indexOf(object);\n\n\t\tif (seenIndex !== -1) {\n\t\t\treturn seenOutput[seenIndex];\n\t\t}\n\n\t\tconst result = {};\n\t\tconst keys = Object.keys(object).sort(options.compare);\n\n\t\tseenInput.push(object);\n\t\tseenOutput.push(result);\n\n\t\tfor (const key of keys) {\n\t\t\tconst value = object[key];\n\n\t\t\tif (deep && Array.isArray(value)) {\n\t\t\t\tresult[key] = value.map(arrayValue => isPlainObject(arrayValue) ? sortKeys(arrayValue) : arrayValue);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tresult[key] = deep && isPlainObject(value) ? sortKeys(value) : value;\n\t\t}\n\n\t\treturn result;\n\t};\n\n\treturn sortKeys(object);\n};\n","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = doParallel;\n\nvar _eachOf = require('../eachOf');\n\nvar _eachOf2 = _interopRequireDefault(_eachOf);\n\nvar _wrapAsync = require('./wrapAsync');\n\nvar _wrapAsync2 = _interopRequireDefault(_wrapAsync);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction doParallel(fn) {\n return function (obj, iteratee, callback) {\n return fn(_eachOf2.default, obj, (0, _wrapAsync2.default)(iteratee), callback);\n };\n}\nmodule.exports = exports['default'];","/**\n * Javascript implementation of mask generation function MGF1.\n *\n * @author Stefan Siegl\n * @author Dave Longley\n *\n * Copyright (c) 2012 Stefan Siegl \n * Copyright (c) 2014 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nrequire('./util');\n\nforge.mgf = forge.mgf || {};\nvar mgf1 = module.exports = forge.mgf.mgf1 = forge.mgf1 = forge.mgf1 || {};\n\n/**\n * Creates a MGF1 mask generation function object.\n *\n * @param md the message digest API to use (eg: forge.md.sha1.create()).\n *\n * @return a mask generation function object.\n */\nmgf1.create = function(md) {\n var mgf = {\n /**\n * Generate mask of specified length.\n *\n * @param {String} seed The seed for mask generation.\n * @param maskLen Number of bytes to generate.\n * @return {String} The generated mask.\n */\n generate: function(seed, maskLen) {\n /* 2. Let T be the empty octet string. */\n var t = new forge.util.ByteBuffer();\n\n /* 3. For counter from 0 to ceil(maskLen / hLen), do the following: */\n var len = Math.ceil(maskLen / md.digestLength);\n for(var i = 0; i < len; i++) {\n /* a. Convert counter to an octet string C of length 4 octets */\n var c = new forge.util.ByteBuffer();\n c.putInt32(i);\n\n /* b. Concatenate the hash of the seed mgfSeed and C to the octet\n * string T: */\n md.start();\n md.update(seed + c.getBytes());\n t.putBuffer(md.digest());\n }\n\n /* Output the leading maskLen octets of T as the octet string mask. */\n t.truncate(t.length() - maskLen);\n return t.getBytes();\n }\n };\n\n return mgf;\n};\n","'use strict'\n\nconst EventEmitter = require('events')\nconst LatencyMonitor = require('latency-monitor').default\nconst debug = require('debug')('libp2p:connection-manager')\n\nconst defaultOptions = {\n maxPeers: Infinity,\n minPeers: 0,\n maxData: Infinity,\n maxSentData: Infinity,\n maxReceivedData: Infinity,\n maxEventLoopDelay: Infinity,\n pollInterval: 2000,\n movingAverageInterval: 60000,\n defaultPeerValue: 1\n}\n\nclass ConnectionManager extends EventEmitter {\n constructor (libp2p, options) {\n super()\n this._libp2p = libp2p\n this._options = Object.assign({}, defaultOptions, options)\n this._options.maxPeersPerProtocol = fixMaxPeersPerProtocol(this._options.maxPeersPerProtocol)\n\n debug('options: %j', this._options)\n\n this._stats = libp2p.stats\n if (options && !this._stats) {\n throw new Error('No libp2p.stats')\n }\n\n this._peerValues = new Map()\n this._peers = new Map()\n this._peerProtocols = new Map()\n this._peerCountPerProtocol = new Map()\n this._onStatsUpdate = this._onStatsUpdate.bind(this)\n this._onPeerConnect = this._onPeerConnect.bind(this)\n this._onPeerDisconnect = this._onPeerDisconnect.bind(this)\n\n if (this._libp2p.isStarted()) {\n this._onceStarted()\n } else {\n this._libp2p.once('start', this._onceStarted.bind(this))\n }\n }\n\n start () {\n this._stats.on('update', this._onStatsUpdate)\n this._libp2p.on('connection:start', this._onPeerConnect)\n this._libp2p.on('connection:end', this._onPeerDisconnect)\n // latency monitor\n this._latencyMonitor = new LatencyMonitor({\n dataEmitIntervalMs: this._options.pollInterval\n })\n this._onLatencyMeasure = this._onLatencyMeasure.bind(this)\n this._latencyMonitor.on('data', this._onLatencyMeasure)\n }\n\n stop () {\n this._stats.removeListener('update', this._onStatsUpdate)\n this._libp2p.removeListener('connection:start', this._onPeerConnect)\n this._libp2p.removeListener('connection:end', this._onPeerDisconnect)\n this._latencyMonitor.removeListener('data', this._onLatencyMeasure)\n }\n\n setPeerValue (peerId, value) {\n if (value < 0 || value > 1) {\n throw new Error('value should be a number between 0 and 1')\n }\n if (peerId.toB58String) {\n peerId = peerId.toB58String()\n }\n this._peerValues.set(peerId, value)\n }\n\n _onceStarted () {\n this._peerId = this._libp2p.peerInfo.id.toB58String()\n }\n\n _onStatsUpdate () {\n const movingAvgs = this._stats.global.movingAverages\n const received = movingAvgs.dataReceived[this._options.movingAverageInterval].movingAverage()\n this._checkLimit('maxReceivedData', received)\n const sent = movingAvgs.dataSent[this._options.movingAverageInterval].movingAverage()\n this._checkLimit('maxSentData', sent)\n const total = received + sent\n this._checkLimit('maxData', total)\n debug('stats update', total)\n }\n\n _onPeerConnect (peerInfo) {\n const peerId = peerInfo.id.toB58String()\n debug('%s: connected to %s', this._peerId, peerId)\n this._peerValues.set(peerId, this._options.defaultPeerValue)\n this._peers.set(peerId, peerInfo)\n this.emit('connected', peerId)\n this._checkLimit('maxPeers', this._peers.size)\n\n protocolsFromPeerInfo(peerInfo).forEach((protocolTag) => {\n const protocol = this._peerCountPerProtocol[protocolTag]\n if (!protocol) {\n this._peerCountPerProtocol[protocolTag] = 0\n }\n this._peerCountPerProtocol[protocolTag]++\n\n let peerProtocols = this._peerProtocols[peerId]\n if (!peerProtocols) {\n peerProtocols = this._peerProtocols[peerId] = new Set()\n }\n peerProtocols.add(protocolTag)\n this._checkProtocolMaxPeersLimit(protocolTag, this._peerCountPerProtocol[protocolTag])\n })\n }\n\n _onPeerDisconnect (peerInfo) {\n const peerId = peerInfo.id.toB58String()\n debug('%s: disconnected from %s', this._peerId, peerId)\n this._peerValues.delete(peerId)\n this._peers.delete(peerId)\n\n const peerProtocols = this._peerProtocols[peerId]\n if (peerProtocols) {\n Array.from(peerProtocols).forEach((protocolTag) => {\n const peerCountForProtocol = this._peerCountPerProtocol[protocolTag]\n if (peerCountForProtocol) {\n this._peerCountPerProtocol[protocolTag]--\n }\n })\n }\n\n this.emit('disconnected', peerId)\n }\n\n _onLatencyMeasure (summary) {\n this._checkLimit('maxEventLoopDelay', summary.avgMs)\n }\n\n _checkLimit (name, value) {\n const limit = this._options[name]\n debug('checking limit of %s. current value: %d of %d', name, value, limit)\n if (value > limit) {\n debug('%s: limit exceeded: %s, %d', this._peerId, name, value)\n this.emit('limit:exceeded', name, value)\n this._maybeDisconnectOne()\n }\n }\n\n _checkProtocolMaxPeersLimit (protocolTag, value) {\n debug('checking protocol limit. current value of %s is %d', protocolTag, value)\n const limit = this._options.maxPeersPerProtocol[protocolTag]\n if (value > limit) {\n debug('%s: protocol max peers limit exceeded: %s, %d', this._peerId, protocolTag, value)\n this.emit('limit:exceeded', protocolTag, value)\n this._maybeDisconnectOne()\n }\n }\n\n _maybeDisconnectOne () {\n if (this._options.minPeers < this._peerValues.size) {\n const peerValues = Array.from(this._peerValues).sort(byPeerValue)\n debug('%s: sorted peer values: %j', this._peerId, peerValues)\n const disconnectPeer = peerValues[0]\n if (disconnectPeer) {\n const peerId = disconnectPeer[0]\n debug('%s: lowest value peer is %s', this._peerId, peerId)\n debug('%s: forcing disconnection from %j', this._peerId, peerId)\n this._disconnectPeer(peerId)\n }\n }\n }\n\n _disconnectPeer (peerId) {\n debug('preemptively disconnecting peer', peerId)\n this.emit('%s: disconnect:preemptive', this._peerId, peerId)\n const peer = this._peers.get(peerId)\n this._libp2p.hangUp(peer, (err) => {\n if (err) {\n this.emit('error', err)\n }\n })\n }\n}\n\nmodule.exports = ConnectionManager\n\nfunction byPeerValue (peerValueEntryA, peerValueEntryB) {\n return peerValueEntryA[1] - peerValueEntryB[1]\n}\n\nfunction fixMaxPeersPerProtocol (maxPeersPerProtocol) {\n if (!maxPeersPerProtocol) {\n maxPeersPerProtocol = {}\n }\n\n Object.keys(maxPeersPerProtocol).forEach((transportTag) => {\n const max = maxPeersPerProtocol[transportTag]\n delete maxPeersPerProtocol[transportTag]\n maxPeersPerProtocol[transportTag.toLowerCase()] = max\n })\n\n return maxPeersPerProtocol\n}\n\nfunction protocolsFromPeerInfo (peerInfo) {\n const protocolTags = new Set()\n peerInfo.multiaddrs.forEach((multiaddr) => {\n multiaddr.protos().map(protocolToProtocolTag).forEach((protocolTag) => {\n protocolTags.add(protocolTag)\n })\n })\n\n return Array.from(protocolTags)\n}\n\nfunction protocolToProtocolTag (protocol) {\n return protocol.name.toLowerCase()\n}\n","'use strict'\n\nconst Entry = require('./entry')\nconst EntryIO = require('./entry-io')\nconst Sorting = require('./log-sorting')\nconst { LastWriteWins, NoZeroes } = Sorting\nconst LogError = require('./log-errors')\nconst { isDefined, findUniques, difference, io } = require('./utils')\n\nconst IPLD_LINKS = ['heads']\nconst last = (arr, n) => arr.slice(arr.length - Math.min(arr.length, n), arr.length)\n\nclass LogIO {\n //\n /**\n * Get the multihash of a Log.\n * @param {IPFS} ipfs An IPFS instance\n * @param {Log} log Log to get a multihash for\n * @returns {Promise}\n * @deprecated\n */\n static async toMultihash (ipfs, log, { format } = {}) {\n if (!isDefined(ipfs)) throw LogError.IPFSNotDefinedError()\n if (!isDefined(log)) throw LogError.LogNotDefinedError()\n if (!isDefined(format)) format = 'dag-cbor'\n if (log.values.length < 1) throw new Error(`Can't serialize an empty log`)\n\n return io.write(ipfs, format, log.toJSON(), { links: IPLD_LINKS })\n }\n\n /**\n * Create a log from a hashes.\n * @param {IPFS} ipfs An IPFS instance\n * @param {string} hash The hash of the log\n * @param {Object} options\n * @param {number} options.length How many items to include in the log\n * @param {Array} options.exclude Entries to not fetch (cached)\n * @param {function(hash, entry, parent, depth)} options.onProgressCallback\n */\n static async fromMultihash (ipfs, hash,\n { length = -1, exclude = [], timeout, concurrency, sortFn, onProgressCallback }) {\n if (!isDefined(ipfs)) throw LogError.IPFSNotDefinedError()\n if (!isDefined(hash)) throw new Error(`Invalid hash: ${hash}`)\n\n const logData = await io.read(ipfs, hash, { links: IPLD_LINKS })\n\n if (!logData.heads || !logData.id) throw LogError.NotALogError()\n\n // Use user provided sorting function or the default one\n sortFn = sortFn || NoZeroes(LastWriteWins)\n const isHead = e => logData.heads.includes(e.hash)\n\n const all = await EntryIO.fetchAll(ipfs, logData.heads,\n { length, exclude, timeout, concurrency, onProgressCallback })\n\n const logId = logData.id\n const entries = length > -1 ? last(all.sort(sortFn), length) : all\n const heads = entries.filter(isHead)\n return { logId, entries, heads }\n }\n\n /**\n * Create a log from an entry hash.\n * @param {IPFS} ipfs An IPFS instance\n * @param {string} hash The hash of the entry\n * @param {Object} options\n * @param {number} options.length How many items to include in the log\n * @param {Array} options.exclude Entries to not fetch (cached)\n * @param {function(hash, entry, parent, depth)} options.onProgressCallback\n */\n static async fromEntryHash (ipfs, hash,\n { length = -1, exclude = [], timeout, concurrency, sortFn, onProgressCallback }) {\n if (!isDefined(ipfs)) throw LogError.IpfsNotDefinedError()\n if (!isDefined(hash)) throw new Error(\"'hash' must be defined\")\n // Convert input hash(s) to an array\n const hashes = Array.isArray(hash) ? hash : [hash]\n // Fetch given length, return size at least the given input entries\n length = length > -1 ? Math.max(length, 1) : length\n const all = await EntryIO.fetchParallel(ipfs, hashes,\n { length, exclude, timeout, concurrency, onProgressCallback })\n // Cap the result at the right size by taking the last n entries,\n // or if given length is -1, then take all\n sortFn = sortFn || NoZeroes(LastWriteWins)\n const entries = length > -1 ? last(all.sort(sortFn), length) : all\n return { entries }\n }\n\n /**\n * Creates a log data from a JSON object, to be passed to a Log constructor\n *\n * @param {IPFS} ipfs An IPFS instance\n * @param {json} json A json object containing valid log data\n * @param {Object} options\n * @param {number} options.length How many entries to include\n * @param {function(hash, entry, parent, depth)} options.onProgressCallback\n **/\n static async fromJSON (ipfs, json, { length = -1, timeout, concurrency, onProgressCallback }) {\n if (!isDefined(ipfs)) throw LogError.IPFSNotDefinedError()\n const { id, heads } = json\n const headHashes = heads.map(e => e.hash)\n const all = await EntryIO.fetchParallel(ipfs, headHashes,\n { length, timeout, concurrency, onProgressCallback })\n const entries = all.sort(Entry.compare)\n return { logId: id, entries, heads }\n }\n\n /**\n * Create a new log starting from an entry.\n * @param {IPFS} ipfs An IPFS instance\n * @param {Entry|Array} sourceEntries An entry or an array of entries to fetch a log from\n * @param {Object} options\n * @param {number} options.length How many entries to include\n * @param {Array} options.exclude Entries to not fetch (cached)\n * @param {function(hash, entry, parent, depth)} options.onProgressCallback\n */\n static async fromEntry (ipfs, sourceEntries,\n { length = -1, exclude = [], timeout, concurrency, onProgressCallback }) {\n if (!isDefined(ipfs)) throw LogError.IPFSNotDefinedError()\n if (!isDefined(sourceEntries)) throw new Error(\"'sourceEntries' must be defined\")\n\n // Make sure we only have Entry objects as input\n if (!Array.isArray(sourceEntries) && !Entry.isEntry(sourceEntries)) {\n throw new Error(`'sourceEntries' argument must be an array of Entry instances or a single Entry`)\n }\n\n if (!Array.isArray(sourceEntries)) {\n sourceEntries = [sourceEntries]\n }\n\n // Fetch given length, return size at least the given input entries\n length = length > -1 ? Math.max(length, sourceEntries.length) : length\n\n // Make sure we pass hashes instead of objects to the fetcher function\n const hashes = sourceEntries.map(e => e.hash)\n\n // Fetch the entries\n const all = await EntryIO.fetchParallel(ipfs, hashes,\n { length, exclude, timeout, concurrency, onProgressCallback })\n\n // Combine the fetches with the source entries and take only uniques\n const combined = sourceEntries.concat(all).concat(exclude)\n const uniques = findUniques(combined, 'hash').sort(Entry.compare)\n\n // Cap the result at the right size by taking the last n entries\n const sliced = uniques.slice(length > -1 ? -length : -uniques.length)\n\n // Make sure that the given input entries are present in the result\n // in order to not lose references\n const missingSourceEntries = difference(sliced, sourceEntries, 'hash')\n\n const replaceInFront = (a, withEntries) => {\n var sliced = a.slice(withEntries.length, a.length)\n return withEntries.concat(sliced)\n }\n\n // Add the input entries at the beginning of the array and remove\n // as many elements from the array before inserting the original entries\n const entries = replaceInFront(sliced, missingSourceEntries)\n const logId = entries[entries.length - 1].id\n return { logId, entries }\n }\n}\n\nmodule.exports = LogIO\n","const DID_PLACEHOLDER = 'GENESIS'\n\n/**\n * A class for creating ipfs based DID Documents.\n * Based on the DID spec: https://w3c-ccg.github.io/did-spec/\n */\nclass DidDocument {\n /**\n * Create a new DID Document.\n *\n * @param {Object} ipfs An js-ipfs instance\n * @param {String} method The name of the DID Method\n * @return {DidDocument} self\n */\n constructor (ipfs, method) {\n this._ipfs = ipfs\n this._content = {\n id: `did:${method}:${DID_PLACEHOLDER}`\n }\n }\n\n get DID () {\n if (this._content.id.includes(DID_PLACEHOLDER)) {\n throw new Error('DID is not available before commit')\n }\n return this._content.id\n }\n\n /**\n * Load an already existing DID Document.\n *\n * @param {Object} ipfs An js-ipfs instance\n * @param {String} documentCid The CID of the document\n * @return {Promise} self\n */\n static async load (ipfs, documentCid) {\n const doc = new DidDocument(ipfs)\n doc._content = await DidDocument.cidToDocument(ipfs, documentCid)\n doc._content.previousDocument = { '/': documentCid.toString() }\n return doc\n }\n\n /**\n * Add a new public key\n *\n * @param {String} id The id of the key, e.g. \"key1\"\n * @param {String} type The type of the key\n * @param {String} encoding The encoding of the key\n * @param {String} key The encoded public key\n * @param {String} owner The owner of the key (optional)\n */\n addPublicKey (id, type, encoding, key, owner) {\n if (!this._content.publicKey) {\n this._content.publicKey = []\n }\n let entry = {\n id: `${this._content.id}#${id}`,\n type\n }\n entry[encoding] = key\n if (owner) {\n entry.owner = owner\n }\n this._content.publicKey.push(entry)\n }\n\n /**\n * Remove a public key\n *\n * @param {String} id The id of the key, e.g. \"key1\"\n */\n removePublicKey (id) {\n const idx = this._content.publicKey.findIndex(e => e.id.endsWith(id))\n this._content.publicKey.splice(idx, 1)\n if (!this._content.publicKey.length) {\n delete this._content.publicKey\n }\n }\n\n /**\n * Add a new authentication\n *\n * @param {String} type The type of the authentication\n * @param {String} id The id of the key to be used, e.g. \"key1\"\n */\n addAuthentication (type, id) {\n if (!this._content.authentication) {\n this._content.authentication = []\n }\n this._content.authentication.push({\n type,\n publicKey: `${this._content.id}#${id}`\n })\n }\n\n /**\n * Remove an authentication\n *\n * @param {String} id The id of the key, e.g. \"key1\"\n */\n removeAuthentication (id) {\n const idx = this._content.authentication.findIndex(e => e.publicKey.endsWith(id))\n this._content.authentication.splice(idx, 1)\n if (!this._content.authentication.length) {\n delete this._content.authentication\n }\n }\n\n /**\n * Add a new service\n *\n * @param {String} id The id of the key to be used, e.g. \"key1\"\n * @param {String} type The type of the service\n * @param {String} serviceEndpoint The endpoint of the service\n * @param {Object} additionalFields Any additional fields (optional)\n */\n addService (id, type, serviceEndpoint, additionalFields) {\n if (!this._content.service) {\n this._content.service = []\n }\n this._content.service.push(Object.assign({\n id: `${this._content.id};${id}`,\n type,\n serviceEndpoint\n }, additionalFields))\n }\n\n /**\n * Remove a service\n *\n * @param {String} id The id of the key, e.g. \"key1\"\n */\n removeService (id) {\n const idx = this._content.service.findIndex(e => e.id.endsWith(id))\n this._content.service.splice(idx, 1)\n if (!this._content.service.length) {\n delete this._content.service\n }\n }\n\n /**\n * Set the revocationMethod. This can be of any js object\n * and is determined by the implementer of a revocation module.\n *\n * @param {Object} methodDescriptor the object that defines the revocation method\n */\n setRevocationMethod (methodDescriptor) {\n this._content.revocationMethod = methodDescriptor\n }\n\n /**\n * Add a new property\n *\n * @param {String} propName The name of the property\n * @param {Object} propValue The value of the property\n */\n addCustomProperty (propName, propValue) {\n this._content[propName] = propValue\n }\n\n /**\n * Remove a property\n *\n * @param {String} propName The name of the property\n */\n removeCustomProperty (propName) {\n delete this._content[propName]\n }\n\n /**\n * Commit all changes and create a new ipfs dag object.\n *\n * @param {Object} opts Optional parameters\n * @param {Boolean} noTimestamp Don't use timestamps if true\n *\n * @return {Promise} The CID of the object\n */\n async commit (opts = {}) {\n if (!this._content.created) {\n this._content['@context'] = 'https://w3id.org/did/v1'\n if (!opts.noTimestamp) {\n this._content.created = (new Date(Date.now())).toISOString()\n }\n } else if (!opts.noTimestamp) {\n this._content.updated = (new Date(Date.now())).toISOString()\n }\n const cid = await this._ipfs.dag.put(this._content, { format: 'dag-cbor', hashAlg: 'sha2-256' })\n // set up for further changes:\n this._content = await DidDocument.cidToDocument(this._ipfs, cid)\n this._content.previousDocument = { '/': cid.toString() }\n return cid\n }\n\n /**\n * Returns the DID document of a document CID\n *\n * @param {Object} ipfs An js-ipfs instance\n * @param {String} documentCid The CID of the document\n * @return {Promise} The DID document as a js object\n */\n static async cidToDocument (ipfs, documentCid) {\n let doc = (await ipfs.dag.get(documentCid)).value\n // If genesis document replace placeholder identifier with cid\n if (doc.id.includes(DID_PLACEHOLDER)) {\n const re = new RegExp(DID_PLACEHOLDER, 'gi')\n doc.id = doc.id.replace(re, documentCid)\n if (doc.publicKey) {\n doc.publicKey = JSON.parse(JSON.stringify(doc.publicKey).replace(re, documentCid))\n }\n if (doc.authentication) {\n doc.authentication = JSON.parse(JSON.stringify(doc.authentication).replace(re, documentCid))\n }\n if (doc.service) {\n doc.service = JSON.parse(JSON.stringify(doc.service).replace(re, documentCid))\n }\n }\n if (doc.previousDocument) {\n // make CID human readable\n doc.previousDocument = { '/': doc.previousDocument.toString() }\n }\n return doc\n }\n}\n\nmodule.exports = DidDocument\n","'use strict'\n\nconst IPFSRepo = require('ipfs-repo')\n\nmodule.exports = (options) => {\n const repoPath = options.repo || 'ipfs'\n return new IPFSRepo(repoPath, { autoMigrate: options.repoAutoMigrate })\n}\n","'use strict'\n\nconst debounce = require('just-debounce-it')\n\nconst Message = require('../types/message')\nconst logger = require('../utils').logger\n\nmodule.exports = class MsgQueue {\n constructor (selfPeerId, otherPeerId, network) {\n this.peerId = otherPeerId\n this.network = network\n this.refcnt = 1\n\n this._entries = []\n this._log = logger(selfPeerId, 'msgqueue', otherPeerId.toB58String().slice(0, 8))\n this.sendEntries = debounce(this._sendEntries.bind(this), 200)\n }\n\n addMessage (msg) {\n if (msg.empty) {\n return\n }\n\n this.send(msg)\n }\n\n addEntries (entries) {\n this._entries = this._entries.concat(entries)\n this.sendEntries()\n }\n\n _sendEntries () {\n if (!this._entries.length) {\n return\n }\n\n const msg = new Message(false)\n this._entries.forEach((entry) => {\n if (entry.cancel) {\n msg.cancel(entry.cid)\n } else {\n msg.addEntry(entry.cid, entry.priority)\n }\n })\n this._entries = []\n this.addMessage(msg)\n }\n\n async send (msg) {\n try {\n await this.network.connectTo(this.peerId)\n } catch (err) {\n this._log.error('cant connect to peer %s: %s', this.peerId.toB58String(), err.message)\n return\n }\n\n this._log('sending message to peer %s', this.peerId.toB58String())\n\n // Note: Don't wait for sendMessage() to complete\n this.network.sendMessage(this.peerId, msg).catch((err) => {\n this._log.error('send error: %s', err.message)\n })\n }\n}\n","'use strict'\n\nconst path = require('path')\nconst os = require('os')\nconst uuid = require('uuid/v4')\n\nexports.filter = (iterable, filterer) => {\n return (async function * () {\n for await (const value of iterable) {\n const keep = await filterer(value)\n if (!keep) continue\n yield value\n }\n })()\n}\n\n// Not just sort, because the sorter is given all the values and should return\n// them all sorted\nexports.sortAll = (iterable, sorter) => {\n return (async function * () {\n let values = []\n for await (const value of iterable) values.push(value)\n values = await sorter(values)\n for (const value of values) yield value\n })()\n}\n\nexports.take = (iterable, n) => {\n return (async function * () {\n if (n <= 0) return\n let i = 0\n for await (const value of iterable) {\n yield value\n i++\n if (i >= n) return\n }\n })()\n}\n\nexports.map = (iterable, mapper) => {\n return (async function * () {\n for await (const value of iterable) {\n yield mapper(value)\n }\n })()\n}\n\nexports.replaceStartWith = function (s, r) {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n\nexports.tmpdir = () => {\n return path.join(os.tmpdir(), uuid())\n}\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.toSignatureObject = toSignatureObject;\nexports.verifyES256K = verifyES256K;\nexports.verifyRecoverableES256K = verifyRecoverableES256K;\nexports.verifyEd25519 = verifyEd25519;\n\nvar _elliptic = require(\"elliptic\");\n\nvar _Digest = require(\"./Digest\");\n\nvar _base64url = _interopRequireDefault(require(\"base64url\"));\n\nvar _tweetnacl = _interopRequireDefault(require(\"tweetnacl\"));\n\nvar _tweetnaclUtil = _interopRequireDefault(require(\"tweetnacl-util\"));\n\nvar secp256k1 = new _elliptic.ec('secp256k1'); // converts a JOSE signature to it's components\n\nfunction toSignatureObject(signature) {\n var recoverable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var rawsig = _base64url.default.toBuffer(signature);\n\n if (rawsig.length !== (recoverable ? 65 : 64)) throw new Error('wrong signature length');\n var r = rawsig.slice(0, 32).toString('hex');\n var s = rawsig.slice(32, 64).toString('hex');\n var sigObj = {\n r: r,\n s: s\n };\n\n if (recoverable) {\n sigObj.recoveryParam = rawsig[64];\n }\n\n return sigObj;\n}\n\nfunction verifyES256K(data, signature, authenticators) {\n var hash = (0, _Digest.sha256)(data);\n var sigObj = toSignatureObject(signature);\n var signer = authenticators.find(function (_ref) {\n var publicKeyHex = _ref.publicKeyHex;\n return secp256k1.keyFromPublic(publicKeyHex, 'hex').verify(hash, sigObj);\n });\n if (!signer) throw new Error('Signature invalid for JWT');\n return signer;\n}\n\nfunction verifyRecoverableES256K(data, signature, authenticators) {\n var sigObj = toSignatureObject(signature, true);\n var hash = (0, _Digest.sha256)(data);\n var recoveredKey = secp256k1.recoverPubKey(hash, sigObj, sigObj.recoveryParam);\n var recoveredPublicKeyHex = recoveredKey.encode('hex');\n var recoveredCompressedPublicKeyHex = recoveredKey.encode('hex', true);\n var recoveredAddress = (0, _Digest.toEthereumAddress)(recoveredPublicKeyHex);\n var signer = authenticators.find(function (_ref2) {\n var publicKeyHex = _ref2.publicKeyHex,\n ethereumAddress = _ref2.ethereumAddress;\n return publicKeyHex === recoveredPublicKeyHex || publicKeyHex === recoveredCompressedPublicKeyHex || ethereumAddress === recoveredAddress;\n });\n if (!signer) throw new Error('Signature invalid for JWT');\n return signer;\n}\n\nfunction verifyEd25519(data, signature, authenticators) {\n var clear = _tweetnaclUtil.default.decodeUTF8(data);\n\n var sig = _tweetnaclUtil.default.decodeBase64(_base64url.default.toBase64(signature));\n\n var signer = authenticators.find(function (_ref3) {\n var publicKeyBase64 = _ref3.publicKeyBase64;\n return _tweetnacl.default.sign.detached.verify(clear, sig, _tweetnaclUtil.default.decodeBase64(publicKeyBase64));\n });\n if (!signer) throw new Error('Signature invalid for JWT');\n return signer;\n}\n\nvar algorithms = {\n ES256K: verifyES256K,\n 'ES256K-R': verifyRecoverableES256K,\n 'Ed25519': verifyEd25519\n};\n\nfunction VerifierAlgorithm(alg) {\n var impl = algorithms[alg];\n if (!impl) throw new Error(\"Unsupported algorithm \".concat(alg));\n return impl;\n}\n\nVerifierAlgorithm.toSignatureObject = toSignatureObject;\nmodule.exports = VerifierAlgorithm;","// Generated by CoffeeScript 1.8.0\n(function() {\n var Heap, defaultCmp, floor, heapify, heappop, heappush, heappushpop, heapreplace, insort, min, nlargest, nsmallest, updateItem, _siftdown, _siftup;\n\n floor = Math.floor, min = Math.min;\n\n\n /*\n Default comparison function to be used\n */\n\n defaultCmp = function(x, y) {\n if (x < y) {\n return -1;\n }\n if (x > y) {\n return 1;\n }\n return 0;\n };\n\n\n /*\n Insert item x in list a, and keep it sorted assuming a is sorted.\n \n If x is already in a, insert it to the right of the rightmost x.\n \n Optional args lo (default 0) and hi (default a.length) bound the slice\n of a to be searched.\n */\n\n insort = function(a, x, lo, hi, cmp) {\n var mid;\n if (lo == null) {\n lo = 0;\n }\n if (cmp == null) {\n cmp = defaultCmp;\n }\n if (lo < 0) {\n throw new Error('lo must be non-negative');\n }\n if (hi == null) {\n hi = a.length;\n }\n while (lo < hi) {\n mid = floor((lo + hi) / 2);\n if (cmp(x, a[mid]) < 0) {\n hi = mid;\n } else {\n lo = mid + 1;\n }\n }\n return ([].splice.apply(a, [lo, lo - lo].concat(x)), x);\n };\n\n\n /*\n Push item onto heap, maintaining the heap invariant.\n */\n\n heappush = function(array, item, cmp) {\n if (cmp == null) {\n cmp = defaultCmp;\n }\n array.push(item);\n return _siftdown(array, 0, array.length - 1, cmp);\n };\n\n\n /*\n Pop the smallest item off the heap, maintaining the heap invariant.\n */\n\n heappop = function(array, cmp) {\n var lastelt, returnitem;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n lastelt = array.pop();\n if (array.length) {\n returnitem = array[0];\n array[0] = lastelt;\n _siftup(array, 0, cmp);\n } else {\n returnitem = lastelt;\n }\n return returnitem;\n };\n\n\n /*\n Pop and return the current smallest value, and add the new item.\n \n This is more efficient than heappop() followed by heappush(), and can be\n more appropriate when using a fixed size heap. Note that the value\n returned may be larger than item! That constrains reasonable use of\n this routine unless written as part of a conditional replacement:\n if item > array[0]\n item = heapreplace(array, item)\n */\n\n heapreplace = function(array, item, cmp) {\n var returnitem;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n returnitem = array[0];\n array[0] = item;\n _siftup(array, 0, cmp);\n return returnitem;\n };\n\n\n /*\n Fast version of a heappush followed by a heappop.\n */\n\n heappushpop = function(array, item, cmp) {\n var _ref;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n if (array.length && cmp(array[0], item) < 0) {\n _ref = [array[0], item], item = _ref[0], array[0] = _ref[1];\n _siftup(array, 0, cmp);\n }\n return item;\n };\n\n\n /*\n Transform list into a heap, in-place, in O(array.length) time.\n */\n\n heapify = function(array, cmp) {\n var i, _i, _j, _len, _ref, _ref1, _results, _results1;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n _ref1 = (function() {\n _results1 = [];\n for (var _j = 0, _ref = floor(array.length / 2); 0 <= _ref ? _j < _ref : _j > _ref; 0 <= _ref ? _j++ : _j--){ _results1.push(_j); }\n return _results1;\n }).apply(this).reverse();\n _results = [];\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n i = _ref1[_i];\n _results.push(_siftup(array, i, cmp));\n }\n return _results;\n };\n\n\n /*\n Update the position of the given item in the heap.\n This function should be called every time the item is being modified.\n */\n\n updateItem = function(array, item, cmp) {\n var pos;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n pos = array.indexOf(item);\n if (pos === -1) {\n return;\n }\n _siftdown(array, 0, pos, cmp);\n return _siftup(array, pos, cmp);\n };\n\n\n /*\n Find the n largest elements in a dataset.\n */\n\n nlargest = function(array, n, cmp) {\n var elem, result, _i, _len, _ref;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n result = array.slice(0, n);\n if (!result.length) {\n return result;\n }\n heapify(result, cmp);\n _ref = array.slice(n);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n elem = _ref[_i];\n heappushpop(result, elem, cmp);\n }\n return result.sort(cmp).reverse();\n };\n\n\n /*\n Find the n smallest elements in a dataset.\n */\n\n nsmallest = function(array, n, cmp) {\n var elem, i, los, result, _i, _j, _len, _ref, _ref1, _results;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n if (n * 10 <= array.length) {\n result = array.slice(0, n).sort(cmp);\n if (!result.length) {\n return result;\n }\n los = result[result.length - 1];\n _ref = array.slice(n);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n elem = _ref[_i];\n if (cmp(elem, los) < 0) {\n insort(result, elem, 0, null, cmp);\n result.pop();\n los = result[result.length - 1];\n }\n }\n return result;\n }\n heapify(array, cmp);\n _results = [];\n for (i = _j = 0, _ref1 = min(n, array.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {\n _results.push(heappop(array, cmp));\n }\n return _results;\n };\n\n _siftdown = function(array, startpos, pos, cmp) {\n var newitem, parent, parentpos;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n newitem = array[pos];\n while (pos > startpos) {\n parentpos = (pos - 1) >> 1;\n parent = array[parentpos];\n if (cmp(newitem, parent) < 0) {\n array[pos] = parent;\n pos = parentpos;\n continue;\n }\n break;\n }\n return array[pos] = newitem;\n };\n\n _siftup = function(array, pos, cmp) {\n var childpos, endpos, newitem, rightpos, startpos;\n if (cmp == null) {\n cmp = defaultCmp;\n }\n endpos = array.length;\n startpos = pos;\n newitem = array[pos];\n childpos = 2 * pos + 1;\n while (childpos < endpos) {\n rightpos = childpos + 1;\n if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) {\n childpos = rightpos;\n }\n array[pos] = array[childpos];\n pos = childpos;\n childpos = 2 * pos + 1;\n }\n array[pos] = newitem;\n return _siftdown(array, startpos, pos, cmp);\n };\n\n Heap = (function() {\n Heap.push = heappush;\n\n Heap.pop = heappop;\n\n Heap.replace = heapreplace;\n\n Heap.pushpop = heappushpop;\n\n Heap.heapify = heapify;\n\n Heap.updateItem = updateItem;\n\n Heap.nlargest = nlargest;\n\n Heap.nsmallest = nsmallest;\n\n function Heap(cmp) {\n this.cmp = cmp != null ? cmp : defaultCmp;\n this.nodes = [];\n }\n\n Heap.prototype.push = function(x) {\n return heappush(this.nodes, x, this.cmp);\n };\n\n Heap.prototype.pop = function() {\n return heappop(this.nodes, this.cmp);\n };\n\n Heap.prototype.peek = function() {\n return this.nodes[0];\n };\n\n Heap.prototype.contains = function(x) {\n return this.nodes.indexOf(x) !== -1;\n };\n\n Heap.prototype.replace = function(x) {\n return heapreplace(this.nodes, x, this.cmp);\n };\n\n Heap.prototype.pushpop = function(x) {\n return heappushpop(this.nodes, x, this.cmp);\n };\n\n Heap.prototype.heapify = function() {\n return heapify(this.nodes, this.cmp);\n };\n\n Heap.prototype.updateItem = function(x) {\n return updateItem(this.nodes, x, this.cmp);\n };\n\n Heap.prototype.clear = function() {\n return this.nodes = [];\n };\n\n Heap.prototype.empty = function() {\n return this.nodes.length === 0;\n };\n\n Heap.prototype.size = function() {\n return this.nodes.length;\n };\n\n Heap.prototype.clone = function() {\n var heap;\n heap = new Heap();\n heap.nodes = this.nodes.slice(0);\n return heap;\n };\n\n Heap.prototype.toArray = function() {\n return this.nodes.slice(0);\n };\n\n Heap.prototype.insert = Heap.prototype.push;\n\n Heap.prototype.top = Heap.prototype.peek;\n\n Heap.prototype.front = Heap.prototype.peek;\n\n Heap.prototype.has = Heap.prototype.contains;\n\n Heap.prototype.copy = Heap.prototype.clone;\n\n return Heap;\n\n })();\n\n (function(root, factory) {\n if (typeof define === 'function' && define.amd) {\n return define([], factory);\n } else if (typeof exports === 'object') {\n return module.exports = factory();\n } else {\n return root.Heap = factory();\n }\n })(this, function() {\n return Heap;\n });\n\n}).call(this);\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _events = require('events');\n\nvar _events2 = _interopRequireDefault(_events);\n\nvar _get = require('lodash/get');\n\nvar _get2 = _interopRequireDefault(_get);\n\nvar _isFunction = require('lodash/isFunction');\n\nvar _isFunction2 = _interopRequireDefault(_isFunction);\n\nvar _VisibilityChangeEmitter = require('./VisibilityChangeEmitter');\n\nvar _VisibilityChangeEmitter2 = _interopRequireDefault(_VisibilityChangeEmitter);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* global window */\n\n\nvar debug = require('debug')('latency-monitor:LatencyMonitor');\n\n/**\n * @typedef {Object} SummaryObject\n * @property {Number} events How many events were called\n * @property {Number} minMS What was the min time for a cb to be called\n * @property {Number} maxMS What was the max time for a cb to be called\n * @property {Number} avgMs What was the average time for a cb to be called\n * @property {Number} lengthMs How long this interval was in ms\n */\n\n/**\n * A class to monitor latency of any async function which works in a browser or node. This works by periodically calling\n * the asyncTestFn and timing how long it takes the callback to be called. It can also periodically emit stats about this.\n * This can be disabled and stats can be pulled via setting dataEmitIntervalMs = 0.\n *\n * The default implementation is an event loop latency monitor. This works by firing periodic events into the event loop\n * and timing how long it takes to get back.\n *\n * @example\n * const monitor = new LatencyMonitor();\n * monitor.on('data', (summary) => console.log('Event Loop Latency: %O', summary));\n *\n * @example\n * const monitor = new LatencyMonitor({latencyCheckIntervalMs: 1000, dataEmitIntervalMs: 60000, asyncTestFn:ping});\n * monitor.on('data', (summary) => console.log('Ping Pong Latency: %O', summary));\n */\n\nvar LatencyMonitor = function (_EventEmitter) {\n _inherits(LatencyMonitor, _EventEmitter);\n\n /**\n * @param {Number} [latencyCheckIntervalMs=500] How often to add a latency check event (ms)\n * @param {Number} [dataEmitIntervalMs=5000] How often to summarize latency check events. null or 0 disables event firing\n * @param {function} [asyncTestFn] What cb-style async function to use\n * @param {Number} [latencyRandomPercentage=5] What percent (+/-) of latencyCheckIntervalMs should we randomly use? This helps avoid alignment to other events.\n */\n function LatencyMonitor() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n latencyCheckIntervalMs = _ref.latencyCheckIntervalMs,\n dataEmitIntervalMs = _ref.dataEmitIntervalMs,\n asyncTestFn = _ref.asyncTestFn,\n latencyRandomPercentage = _ref.latencyRandomPercentage;\n\n _classCallCheck(this, LatencyMonitor);\n\n var _this = _possibleConstructorReturn(this, (LatencyMonitor.__proto__ || Object.getPrototypeOf(LatencyMonitor)).call(this));\n\n var that = _this;\n\n // 0 isn't valid here, so its ok to use ||\n that.latencyCheckIntervalMs = latencyCheckIntervalMs || 500; // 0.5s\n that.latencyRandomPercentage = latencyRandomPercentage || 10;\n that._latecyCheckMultiply = 2 * (that.latencyRandomPercentage / 100.0) * that.latencyCheckIntervalMs;\n that._latecyCheckSubtract = that._latecyCheckMultiply / 2;\n\n that.dataEmitIntervalMs = dataEmitIntervalMs === null || dataEmitIntervalMs === 0 ? undefined : dataEmitIntervalMs || 5 * 1000; // 5s\n debug('latencyCheckIntervalMs: %s dataEmitIntervalMs: %s', that.latencyCheckIntervalMs, that.dataEmitIntervalMs);\n if (that.dataEmitIntervalMs) {\n debug('Expecting ~%s events per summary', that.latencyCheckIntervalMs / that.dataEmitIntervalMs);\n } else {\n debug('Not emitting summaries');\n }\n\n that.asyncTestFn = asyncTestFn; // If there is no asyncFn, we measure latency\n\n // If process: use high resolution timer\n if (process && process.hrtime) {\n debug('Using process.hrtime for timing');\n that.now = process.hrtime;\n that.getDeltaMS = function (startTime) {\n var hrtime = that.now(startTime);\n return hrtime[0] * 1000 + hrtime[1] / 1000000;\n };\n // Let's try for a timer that only monotonically increases\n } else if (typeof window !== 'undefined' && (0, _get2.default)(window, 'performance.now')) {\n debug('Using performance.now for timing');\n that.now = window.performance.now.bind(window.performance);\n that.getDeltaMS = function (startTime) {\n return Math.round(that.now() - startTime);\n };\n } else {\n debug('Using Date.now for timing');\n that.now = Date.now;\n that.getDeltaMS = function (startTime) {\n return that.now() - startTime;\n };\n }\n\n that._latencyData = that._initLatencyData();\n\n // We check for isBrowser because of browsers set max rates of timeouts when a page is hidden,\n // so we fall back to another library\n // See: http://stackoverflow.com/questions/6032429/chrome-timeouts-interval-suspended-in-background-tabs\n if (isBrowser()) {\n that._visibilityChangeEmitter = new _VisibilityChangeEmitter2.default();\n that._visibilityChangeEmitter.on('visibilityChange', function (pageInFocus) {\n if (pageInFocus) {\n that._startTimers();\n } else {\n that._emitSummary();\n that._stopTimers();\n }\n });\n }\n\n if (!that._visibilityChangeEmitter || that._visibilityChangeEmitter.isVisible()) {\n that._startTimers();\n }\n return _this;\n }\n\n /**\n * Start internal timers\n * @private\n */\n\n\n _createClass(LatencyMonitor, [{\n key: '_startTimers',\n value: function _startTimers() {\n var _this2 = this;\n\n // Timer already started, ignore this\n if (this._checkLatencyID) {\n return;\n }\n this._checkLatency();\n if (this.dataEmitIntervalMs) {\n this._emitIntervalID = setInterval(function () {\n return _this2._emitSummary();\n }, this.dataEmitIntervalMs);\n if ((0, _isFunction2.default)(this._emitIntervalID.unref)) {\n this._emitIntervalID.unref(); // Doesn't block exit\n }\n }\n }\n\n /**\n * Stop internal timers\n * @private\n */\n\n }, {\n key: '_stopTimers',\n value: function _stopTimers() {\n if (this._checkLatencyID) {\n clearTimeout(this._checkLatencyID);\n this._checkLatencyID = undefined;\n }\n if (this._emitIntervalID) {\n clearInterval(this._emitIntervalID);\n this._emitIntervalID = undefined;\n }\n }\n\n /**\n * Emit summary only if there were events. It might not have any events if it was forced via a page hidden/show\n * @private\n */\n\n }, {\n key: '_emitSummary',\n value: function _emitSummary() {\n var summary = this.getSummary();\n if (summary.events > 0) {\n this.emit('data', summary);\n }\n }\n\n /**\n * Calling this function will end the collection period. If a timing event was already fired and somewhere in the queue,\n * it will not count for this time period\n * @returns {SummaryObject}\n */\n\n }, {\n key: 'getSummary',\n value: function getSummary() {\n // We might want to adjust for the number of expected events\n // Example: first 1 event it comes back, then such a long blocker that the next emit check comes\n // Then this fires - looks like no latency!!\n var latency = {\n events: this._latencyData.events,\n minMs: this._latencyData.minMs,\n maxMs: this._latencyData.maxMs,\n avgMs: this._latencyData.events ? this._latencyData.totalMs / this._latencyData.events : Number.POSITIVE_INFINITY,\n lengthMs: this.getDeltaMS(this._latencyData.startTime)\n };\n this._latencyData = this._initLatencyData(); // Clear\n\n debug('Summary: %O', latency);\n return latency;\n }\n\n /**\n * Randomly calls an async fn every roughly latencyCheckIntervalMs (plus some randomness). If no async fn is found,\n * it will simply report on event loop latency.\n *\n * @private\n */\n\n }, {\n key: '_checkLatency',\n value: function _checkLatency() {\n var _this3 = this;\n\n var that = this;\n // Randomness is needed to avoid alignment by accident to regular things in the event loop\n var randomness = Math.random() * that._latecyCheckMultiply - that._latecyCheckSubtract;\n\n // We use this to ensure that in case some overlap somehow, we don't take the wrong startTime/offset\n var localData = {\n deltaOffset: Math.ceil(that.latencyCheckIntervalMs + randomness),\n startTime: that.now()\n };\n\n var cb = function cb() {\n // We are already stopped, ignore this datapoint\n if (!_this3._checkLatencyID) {\n return;\n }\n var deltaMS = that.getDeltaMS(localData.startTime) - localData.deltaOffset;\n that._checkLatency(); // Start again ASAP\n\n // Add the data point. If this gets complex, refactor it\n that._latencyData.events++;\n that._latencyData.minMs = Math.min(that._latencyData.minMs, deltaMS);\n that._latencyData.maxMs = Math.max(that._latencyData.maxMs, deltaMS);\n that._latencyData.totalMs += deltaMS;\n debug('MS: %s Data: %O', deltaMS, that._latencyData);\n };\n debug('localData: %O', localData);\n\n this._checkLatencyID = setTimeout(function () {\n // This gets rid of including event loop\n if (that.asyncTestFn) {\n // Clear timing related things\n localData.deltaOffset = 0;\n localData.startTime = that.now();\n that.asyncTestFn(cb);\n } else {\n // setTimeout is not more accurate than 1ms, so this will ensure positive numbers. Add 1 to emitted data to remove.\n // This is not the best, but for now it'll be just fine. This isn't meant to be sub ms accurate.\n localData.deltaOffset -= 1;\n // If there is no function to test, we mean check latency which is a special case that is really cb => cb()\n // We avoid that for the few extra function all overheads. Also, we want to keep the timers different\n cb();\n }\n }, localData.deltaOffset);\n\n if ((0, _isFunction2.default)(this._checkLatencyID.unref)) {\n this._checkLatencyID.unref(); // Doesn't block exit\n }\n }\n }, {\n key: '_initLatencyData',\n value: function _initLatencyData() {\n return {\n startTime: this.now(),\n minMs: Number.POSITIVE_INFINITY,\n maxMs: Number.NEGATIVE_INFINITY,\n events: 0,\n totalMs: 0\n };\n }\n }]);\n\n return LatencyMonitor;\n}(_events2.default);\n\nfunction isBrowser() {\n return typeof window !== 'undefined';\n}\n\nexports.default = LatencyMonitor;\n//# sourceMappingURL=LatencyMonitor.js.map\n","'use strict'\n\nconst BN = require('asn1.js').bignum\n\n// Convert a BN.js instance to a base64 encoded string without padding\n// Adapted from https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#appendix-C\nexports.toBase64 = function toBase64 (bn, len) {\n // if len is defined then the bytes are leading-0 padded to the length\n const s = bn.toArrayLike(Buffer, 'be', len).toString('base64')\n\n return s\n .replace(/(=*)$/, '') // Remove any trailing '='s\n .replace(/\\+/g, '-') // 62nd char of encoding\n .replace(/\\//g, '_') // 63rd char of encoding\n}\n\n// Convert a base64 encoded string to a BN.js instance\nexports.toBn = function toBn (str) {\n return new BN(Buffer.from(str, 'base64'))\n}\n","'use strict'\n\nconst Key = require('interface-datastore').Key\n\nconst apiFile = new Key('api')\n\nmodule.exports = (store) => {\n return {\n /**\n * Get the current configuration from the repo.\n *\n * @returns {Promise}\n */\n async get () {\n const value = await store.get(apiFile)\n return value && value.toString()\n },\n /**\n * Set the current configuration for this repo.\n *\n * @param {Object} value - the api address to be written\n * @returns {Promise}\n */\n async set (value) { // eslint-disable-line require-await\n return store.put(apiFile, Buffer.from(value.toString()))\n },\n /**\n * Deletes api file\n *\n * @returns {Promise}\n */\n async delete () { // eslint-disable-line require-await\n return store.delete(apiFile)\n }\n }\n}\n","'use strict'\n\nconst ipns = require('ipns')\nconst crypto = require('libp2p-crypto')\nconst PeerId = require('peer-id')\nconst errcode = require('err-code')\nconst CID = require('cids')\n\nconst debug = require('debug')\nconst log = debug('ipfs:ipns:resolver')\nlog.error = debug('ipfs:ipns:resolver:error')\n\nconst { Errors } = require('interface-datastore')\nconst ERR_NOT_FOUND = Errors.notFoundError().code\n\nconst defaultMaximumRecursiveDepth = 32\n\nclass IpnsResolver {\n constructor (routing) {\n this._routing = routing\n }\n\n async resolve (name, options) {\n options = options || {}\n\n if (typeof name !== 'string') {\n throw errcode(new Error('invalid name'), 'ERR_INVALID_NAME')\n }\n\n options = options || {}\n const recursive = options.recursive && options.recursive.toString() === 'true'\n\n const nameSegments = name.split('/')\n\n if (nameSegments.length !== 3 || nameSegments[0] !== '') {\n throw errcode(new Error('invalid name'), 'ERR_INVALID_NAME')\n }\n\n const key = nameSegments[2]\n\n // Define a maximum depth if recursive option enabled\n let depth\n\n if (recursive) {\n depth = defaultMaximumRecursiveDepth\n }\n\n const res = await this.resolver(key, depth)\n\n log(`${name} was locally resolved correctly`)\n return res\n }\n\n // Recursive resolver according to the specified depth\n async resolver (name, depth) {\n // Exceeded recursive maximum depth\n if (depth === 0) {\n const errMsg = `could not resolve name (recursion limit of ${defaultMaximumRecursiveDepth} exceeded)`\n log.error(errMsg)\n\n throw errcode(new Error(errMsg), 'ERR_RESOLVE_RECURSION_LIMIT')\n }\n\n const res = await this._resolveName(name)\n const nameSegments = res.split('/')\n\n // If obtained a ipfs cid or recursive option is disabled\n if (nameSegments[1] === 'ipfs' || !depth) {\n return res\n }\n\n // continue recursively until depth equals 0\n return this.resolver(nameSegments[2], depth - 1)\n }\n\n // resolve ipns entries from the provided routing\n async _resolveName (name) {\n const peerId = PeerId.createFromBytes(new CID(name).multihash) // TODO: change to `PeerId.createFromCID` when https://github.com/libp2p/js-peer-id/pull/105 lands and js-ipfs switched to async peer-id lib\n const { routingKey } = ipns.getIdKeys(peerId.toBytes())\n let record\n\n try {\n record = await this._routing.get(routingKey.toBuffer())\n } catch (err) {\n log.error(err)\n\n if (err.code === ERR_NOT_FOUND) {\n throw errcode(new Error(`record requested for ${name} was not found in the network`), 'ERR_NO_RECORD_FOUND')\n }\n\n throw errcode(new Error(`unexpected error getting the ipns record ${peerId.id}`), 'ERR_UNEXPECTED_ERROR_GETTING_RECORD')\n }\n\n // IPNS entry\n let ipnsEntry\n try {\n ipnsEntry = ipns.unmarshal(record)\n } catch (err) {\n log.error(err)\n\n throw errcode(new Error('found ipns record that we couldn\\'t convert to a value'), 'ERR_INVALID_RECORD_RECEIVED')\n }\n\n // if the record has a public key validate it\n if (ipnsEntry.pubKey) {\n return this._validateRecord(peerId, ipnsEntry)\n }\n\n // Otherwise, try to get the public key from routing\n let pubKey\n try {\n pubKey = await this._routing.get(routingKey.toBuffer())\n } catch (err) {\n log.error(err)\n\n if (err.code === ERR_NOT_FOUND) {\n throw errcode(new Error(`public key requested for ${name} was not found in the network`), 'ERR_NO_RECORD_FOUND')\n }\n\n throw errcode(new Error(`unexpected error getting the public key for the ipns record ${peerId.id}`), 'ERR_UNEXPECTED_ERROR_GETTING_PUB_KEY')\n }\n\n try {\n // Insert it into the peer id, in order to be validated by IPNS validator\n peerId.pubKey = crypto.keys.unmarshalPublicKey(pubKey)\n } catch (err) {\n log.error(err)\n\n throw errcode(new Error('found public key record that we couldn\\'t convert to a value'), 'ERR_INVALID_PUB_KEY_RECEIVED')\n }\n\n return this._validateRecord(peerId, ipnsEntry)\n }\n\n // validate a resolved record\n async _validateRecord (peerId, ipnsEntry) {\n const pubKey = await ipns.extractPublicKey(peerId, ipnsEntry)\n\n // IPNS entry validation\n await ipns.validate(pubKey, ipnsEntry)\n\n return ipnsEntry.value.toString()\n }\n}\n\nexports = module.exports = IpnsResolver\n","var $ = require('../internals/export');\nvar isObject = require('../internals/is-object');\nvar anObject = require('../internals/an-object');\nvar has = require('../internals/has');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\n\n// `Reflect.get` method\n// https://tc39.github.io/ecma262/#sec-reflect.get\nfunction get(target, propertyKey /* , receiver */) {\n var receiver = arguments.length < 3 ? target : arguments[2];\n var descriptor, prototype;\n if (anObject(target) === receiver) return target[propertyKey];\n if (descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey)) return has(descriptor, 'value')\n ? descriptor.value\n : descriptor.get === undefined\n ? undefined\n : descriptor.get.call(receiver);\n if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver);\n}\n\n$({ target: 'Reflect', stat: true }, {\n get: get\n});\n","/**\n * Secure Hash Algorithm with 256-bit digest (SHA-256) implementation.\n *\n * See FIPS 180-2 for details.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2015 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nrequire('./md');\nrequire('./util');\n\nvar sha256 = module.exports = forge.sha256 = forge.sha256 || {};\nforge.md.sha256 = forge.md.algorithms.sha256 = sha256;\n\n/**\n * Creates a SHA-256 message digest object.\n *\n * @return a message digest object.\n */\nsha256.create = function() {\n // do initialization as necessary\n if(!_initialized) {\n _init();\n }\n\n // SHA-256 state contains eight 32-bit integers\n var _state = null;\n\n // input buffer\n var _input = forge.util.createBuffer();\n\n // used for word storage\n var _w = new Array(64);\n\n // message digest object\n var md = {\n algorithm: 'sha256',\n blockLength: 64,\n digestLength: 32,\n // 56-bit length of message so far (does not including padding)\n messageLength: 0,\n // true message length\n fullMessageLength: null,\n // size of message length in bytes\n messageLengthSize: 8\n };\n\n /**\n * Starts the digest.\n *\n * @return this digest object.\n */\n md.start = function() {\n // up to 56-bit message length for convenience\n md.messageLength = 0;\n\n // full message length (set md.messageLength64 for backwards-compatibility)\n md.fullMessageLength = md.messageLength64 = [];\n var int32s = md.messageLengthSize / 4;\n for(var i = 0; i < int32s; ++i) {\n md.fullMessageLength.push(0);\n }\n _input = forge.util.createBuffer();\n _state = {\n h0: 0x6A09E667,\n h1: 0xBB67AE85,\n h2: 0x3C6EF372,\n h3: 0xA54FF53A,\n h4: 0x510E527F,\n h5: 0x9B05688C,\n h6: 0x1F83D9AB,\n h7: 0x5BE0CD19\n };\n return md;\n };\n // start digest automatically for first time\n md.start();\n\n /**\n * Updates the digest with the given message input. The given input can\n * treated as raw input (no encoding will be applied) or an encoding of\n * 'utf8' maybe given to encode the input using UTF-8.\n *\n * @param msg the message input to update with.\n * @param encoding the encoding to use (default: 'raw', other: 'utf8').\n *\n * @return this digest object.\n */\n md.update = function(msg, encoding) {\n if(encoding === 'utf8') {\n msg = forge.util.encodeUtf8(msg);\n }\n\n // update message length\n var len = msg.length;\n md.messageLength += len;\n len = [(len / 0x100000000) >>> 0, len >>> 0];\n for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {\n md.fullMessageLength[i] += len[1];\n len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);\n md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;\n len[0] = ((len[1] / 0x100000000) >>> 0);\n }\n\n // add bytes to input buffer\n _input.putBytes(msg);\n\n // process bytes\n _update(_state, _w, _input);\n\n // compact input buffer every 2K or if empty\n if(_input.read > 2048 || _input.length() === 0) {\n _input.compact();\n }\n\n return md;\n };\n\n /**\n * Produces the digest.\n *\n * @return a byte buffer containing the digest value.\n */\n md.digest = function() {\n /* Note: Here we copy the remaining bytes in the input buffer and\n add the appropriate SHA-256 padding. Then we do the final update\n on a copy of the state so that if the user wants to get\n intermediate digests they can do so. */\n\n /* Determine the number of bytes that must be added to the message\n to ensure its length is congruent to 448 mod 512. In other words,\n the data to be digested must be a multiple of 512 bits (or 128 bytes).\n This data includes the message, some padding, and the length of the\n message. Since the length of the message will be encoded as 8 bytes (64\n bits), that means that the last segment of the data must have 56 bytes\n (448 bits) of message and padding. Therefore, the length of the message\n plus the padding must be congruent to 448 mod 512 because\n 512 - 128 = 448.\n\n In order to fill up the message length it must be filled with\n padding that begins with 1 bit followed by all 0 bits. Padding\n must *always* be present, so if the message length is already\n congruent to 448 mod 512, then 512 padding bits must be added. */\n\n var finalBlock = forge.util.createBuffer();\n finalBlock.putBytes(_input.bytes());\n\n // compute remaining size to be digested (include message length size)\n var remaining = (\n md.fullMessageLength[md.fullMessageLength.length - 1] +\n md.messageLengthSize);\n\n // add padding for overflow blockSize - overflow\n // _padding starts with 1 byte with first bit is set (byte value 128), then\n // there may be up to (blockSize - 1) other pad bytes\n var overflow = remaining & (md.blockLength - 1);\n finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));\n\n // serialize message length in bits in big-endian order; since length\n // is stored in bytes we multiply by 8 and add carry from next int\n var next, carry;\n var bits = md.fullMessageLength[0] * 8;\n for(var i = 0; i < md.fullMessageLength.length - 1; ++i) {\n next = md.fullMessageLength[i + 1] * 8;\n carry = (next / 0x100000000) >>> 0;\n bits += carry;\n finalBlock.putInt32(bits >>> 0);\n bits = next >>> 0;\n }\n finalBlock.putInt32(bits);\n\n var s2 = {\n h0: _state.h0,\n h1: _state.h1,\n h2: _state.h2,\n h3: _state.h3,\n h4: _state.h4,\n h5: _state.h5,\n h6: _state.h6,\n h7: _state.h7\n };\n _update(s2, _w, finalBlock);\n var rval = forge.util.createBuffer();\n rval.putInt32(s2.h0);\n rval.putInt32(s2.h1);\n rval.putInt32(s2.h2);\n rval.putInt32(s2.h3);\n rval.putInt32(s2.h4);\n rval.putInt32(s2.h5);\n rval.putInt32(s2.h6);\n rval.putInt32(s2.h7);\n return rval;\n };\n\n return md;\n};\n\n// sha-256 padding bytes not initialized yet\nvar _padding = null;\nvar _initialized = false;\n\n// table of constants\nvar _k = null;\n\n/**\n * Initializes the constant tables.\n */\nfunction _init() {\n // create padding\n _padding = String.fromCharCode(128);\n _padding += forge.util.fillString(String.fromCharCode(0x00), 64);\n\n // create K table for SHA-256\n _k = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];\n\n // now initialized\n _initialized = true;\n}\n\n/**\n * Updates a SHA-256 state with the given byte buffer.\n *\n * @param s the SHA-256 state to update.\n * @param w the array to use to store words.\n * @param bytes the byte buffer to update with.\n */\nfunction _update(s, w, bytes) {\n // consume 512 bit (64 byte) chunks\n var t1, t2, s0, s1, ch, maj, i, a, b, c, d, e, f, g, h;\n var len = bytes.length();\n while(len >= 64) {\n // the w array will be populated with sixteen 32-bit big-endian words\n // and then extended into 64 32-bit words according to SHA-256\n for(i = 0; i < 16; ++i) {\n w[i] = bytes.getInt32();\n }\n for(; i < 64; ++i) {\n // XOR word 2 words ago rot right 17, rot right 19, shft right 10\n t1 = w[i - 2];\n t1 =\n ((t1 >>> 17) | (t1 << 15)) ^\n ((t1 >>> 19) | (t1 << 13)) ^\n (t1 >>> 10);\n // XOR word 15 words ago rot right 7, rot right 18, shft right 3\n t2 = w[i - 15];\n t2 =\n ((t2 >>> 7) | (t2 << 25)) ^\n ((t2 >>> 18) | (t2 << 14)) ^\n (t2 >>> 3);\n // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^32\n w[i] = (t1 + w[i - 7] + t2 + w[i - 16]) | 0;\n }\n\n // initialize hash value for this chunk\n a = s.h0;\n b = s.h1;\n c = s.h2;\n d = s.h3;\n e = s.h4;\n f = s.h5;\n g = s.h6;\n h = s.h7;\n\n // round function\n for(i = 0; i < 64; ++i) {\n // Sum1(e)\n s1 =\n ((e >>> 6) | (e << 26)) ^\n ((e >>> 11) | (e << 21)) ^\n ((e >>> 25) | (e << 7));\n // Ch(e, f, g) (optimized the same way as SHA-1)\n ch = g ^ (e & (f ^ g));\n // Sum0(a)\n s0 =\n ((a >>> 2) | (a << 30)) ^\n ((a >>> 13) | (a << 19)) ^\n ((a >>> 22) | (a << 10));\n // Maj(a, b, c) (optimized the same way as SHA-1)\n maj = (a & b) | (c & (a ^ b));\n\n // main algorithm\n t1 = h + s1 + ch + _k[i] + w[i];\n t2 = s0 + maj;\n h = g;\n g = f;\n f = e;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n // can't truncate with `| 0`\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug\n // can't truncate with `| 0`\n a = (t1 + t2) >>> 0;\n }\n\n // update hash state\n s.h0 = (s.h0 + a) | 0;\n s.h1 = (s.h1 + b) | 0;\n s.h2 = (s.h2 + c) | 0;\n s.h3 = (s.h3 + d) | 0;\n s.h4 = (s.h4 + e) | 0;\n s.h5 = (s.h5 + f) | 0;\n s.h6 = (s.h6 + g) | 0;\n s.h7 = (s.h7 + h) | 0;\n len -= 64;\n }\n}\n","var __self__ = (function (root) {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = root.DOMException\n}\nF.prototype = root;\nreturn new F();\n})(typeof self !== 'undefined' ? self : this);\n(function(self) {\n\nvar irrelevant = (function (exports) {\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n return exports;\n\n}({}));\n})(__self__);\ndelete __self__.fetch.polyfill\nexports = __self__.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = __self__.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = __self__.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = __self__.Headers\nexports.Request = __self__.Request\nexports.Response = __self__.Response\nmodule.exports = exports\n","/**\n * Implementation of the multicodec specification.\n *\n * @module multicodec\n * @example\n * const multicodec = require('multicodec')\n *\n * const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer)\n * // prefixedProtobuf 0x50...\n *\n */\n'use strict'\n\nconst varint = require('varint')\nconst intTable = require('./int-table')\nconst codecNameToCodeVarint = require('./varint-table')\nconst util = require('./util')\n\nexports = module.exports\n\n/**\n * Prefix a buffer with a multicodec-packed.\n *\n * @param {string|number} multicodecStrOrCode\n * @param {Buffer} data\n * @returns {Buffer}\n */\nexports.addPrefix = (multicodecStrOrCode, data) => {\n let prefix\n\n if (Buffer.isBuffer(multicodecStrOrCode)) {\n prefix = util.varintBufferEncode(multicodecStrOrCode)\n } else {\n if (codecNameToCodeVarint[multicodecStrOrCode]) {\n prefix = codecNameToCodeVarint[multicodecStrOrCode]\n } else {\n throw new Error('multicodec not recognized')\n }\n }\n return Buffer.concat([prefix, data])\n}\n\n/**\n * Decapsulate the multicodec-packed prefix from the data.\n *\n * @param {Buffer} data\n * @returns {Buffer}\n */\nexports.rmPrefix = (data) => {\n varint.decode(data)\n return data.slice(varint.decode.bytes)\n}\n\n/**\n * Get the codec of the prefixed data.\n * @param {Buffer} prefixedData\n * @returns {string}\n */\nexports.getCodec = (prefixedData) => {\n const code = varint.decode(prefixedData)\n const codecName = intTable.get(code)\n if (codecName === undefined) {\n throw new Error(`Code ${code} not found`)\n }\n return codecName\n}\n\n/**\n * Get the name of the codec.\n * @param {number} codec\n * @returns {string}\n */\nexports.getName = (codec) => {\n return intTable.get(codec)\n}\n\n/**\n * Get the code of the codec\n * @param {string} name\n * @returns {number}\n */\nexports.getNumber = (name) => {\n const code = codecNameToCodeVarint[name]\n if (code === undefined) {\n throw new Error('Codec `' + name + '` not found')\n }\n return util.varintBufferDecode(code)[0]\n}\n\n/**\n * Get the code of the prefixed data.\n * @param {Buffer} prefixedData\n * @returns {number}\n */\nexports.getCode = (prefixedData) => {\n return varint.decode(prefixedData)\n}\n\n/**\n * Get the code as varint of a codec name.\n * @param {string} codecName\n * @returns {Buffer}\n */\nexports.getCodeVarint = (codecName) => {\n const code = codecNameToCodeVarint[codecName]\n if (code === undefined) {\n throw new Error('Codec `' + codecName + '` not found')\n }\n return code\n}\n\n/**\n * Get the varint of a code.\n * @param {Number} code\n * @returns {Array.}\n */\nexports.getVarint = (code) => {\n return varint.encode(code)\n}\n\n// Make the constants top-level constants\nconst constants = require('./constants')\nObject.assign(exports, constants)\n\n// Human friendly names for printing, e.g. in error messages\nexports.print = require('./print')\n","'use strict'\n\nconst errCode = require('err-code')\n\n// make sure the content only emits buffer-a-likes\nasync function * validateChunks (source) {\n for await (const content of source) {\n if (content.length === undefined) {\n throw errCode(new Error('Content was invalid'), 'ERR_INVALID_CONTENT')\n }\n\n if (typeof content === 'string' || content instanceof String) {\n yield Buffer.from(content, 'utf8')\n } else if (Array.isArray(content)) {\n yield Buffer.from(content)\n } else {\n yield content\n }\n }\n}\n\nmodule.exports = validateChunks\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\nrequire('inherits')(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","'use strict'\n\nconst path = require('path')\nconst os = require('os')\nconst uuid = require('uuid/v4')\n\nexports.filter = (iterable, filterer) => {\n return (async function * () {\n for await (const value of iterable) {\n const keep = await filterer(value)\n if (!keep) continue\n yield value\n }\n })()\n}\n\n// Not just sort, because the sorter is given all the values and should return\n// them all sorted\nexports.sortAll = (iterable, sorter) => {\n return (async function * () {\n let values = []\n for await (const value of iterable) values.push(value)\n values = await sorter(values)\n for (const value of values) yield value\n })()\n}\n\nexports.take = (iterable, n) => {\n return (async function * () {\n if (n <= 0) return\n let i = 0\n for await (const value of iterable) {\n yield value\n i++\n if (i >= n) return\n }\n })()\n}\n\nexports.map = (iterable, mapper) => {\n return (async function * () {\n for await (const value of iterable) {\n yield mapper(value)\n }\n })()\n}\n\nexports.replaceStartWith = function (s, r) {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n\nexports.tmpdir = () => {\n return path.join(os.tmpdir(), uuid())\n}\n","'use strict';\n\nfunction createError(err, code, props) {\n var key;\n\n if (!(err instanceof Error)) {\n throw new TypeError('Please pass an Error to err-code');\n }\n\n if (typeof code === 'object') {\n props = code;\n } else if (code != null) {\n err.code = code;\n }\n\n if (props) {\n for (key in props) {\n err[key] = props[key];\n }\n }\n\n return err;\n}\n\nmodule.exports = createError;\n","var inherits = require('inherits')\nvar Readable = require('readable-stream').Readable\nvar extend = require('xtend')\n\nmodule.exports = ReadStream\ninherits(ReadStream, Readable)\n\nfunction ReadStream (iterator, options) {\n if (!(this instanceof ReadStream)) return new ReadStream(iterator, options)\n options = options || {}\n Readable.call(this, extend(options, {\n objectMode: true\n }))\n this._iterator = iterator\n this._options = options\n this.on('end', this.destroy.bind(this, null, null))\n}\n\nReadStream.prototype._read = function () {\n var self = this\n var options = this._options\n if (this.destroyed) return\n\n this._iterator.next(function (err, key, value) {\n if (self.destroyed) return\n if (err) return self.destroy(err)\n\n if (key === undefined && value === undefined) {\n self.push(null)\n } else if (options.keys !== false && options.values === false) {\n self.push(key)\n } else if (options.keys === false && options.values !== false) {\n self.push(value)\n } else {\n self.push({ key: key, value: value })\n }\n })\n}\n\nReadStream.prototype._destroy = function (err, callback) {\n this._iterator.end(function (err2) {\n callback(err || err2)\n })\n}\n","'use strict'\nvar abortCb = require('../util/abort-cb')\n\nmodule.exports = function values (array, onAbort) {\n if(!array)\n return function (abort, cb) {\n if(abort) return abortCb(cb, abort, onAbort)\n return cb(true)\n }\n if(!Array.isArray(array))\n array = Object.keys(array).map(function (k) {\n return array[k]\n })\n var i = 0\n return function (abort, cb) {\n if(abort)\n return abortCb(cb, abort, onAbort)\n if(i >= array.length)\n cb(true)\n else\n cb(null, array[i++])\n }\n}\n","'use strict'\n\nconst nacl = require('tweetnacl')\nconst nextTick = require('async/nextTick')\n\nexports.publicKeyLength = nacl.sign.publicKeyLength\nexports.privateKeyLength = nacl.sign.secretKeyLength\n\nexports.generateKey = function (callback) {\n nextTick(() => {\n let result\n try {\n result = nacl.sign.keyPair()\n } catch (err) {\n return callback(err)\n }\n callback(null, result)\n })\n}\n\n// seed should be a 32 byte uint8array\nexports.generateKeyFromSeed = function (seed, callback) {\n nextTick(() => {\n let result\n try {\n result = nacl.sign.keyPair.fromSeed(seed)\n } catch (err) {\n return callback(err)\n }\n callback(null, result)\n })\n}\n\nexports.hashAndSign = function (key, msg, callback) {\n nextTick(() => {\n callback(null, Buffer.from(nacl.sign.detached(msg, key)))\n })\n}\n\nexports.hashAndVerify = function (key, sig, msg, callback) {\n nextTick(() => {\n let result\n try {\n result = nacl.sign.detached.verify(msg, sig, key)\n } catch (err) {\n return callback(err)\n }\n\n callback(null, result)\n })\n}\n","'use strict'\n\nconst DEFAULTS = require('./defaults')\nconst isFunction = require('./util').isFunction\nconst isBoolean = require('./util').isBoolean\nconst isObject = require('./util').isObject\nconst isArray = require('./util').isArray\nconst isRegex = require('./util').isRegex\nconst assign = require('./util').assign\nconst keys = require('./util').keys\n\nfunction serialize (obj) {\n if (obj === null || obj === undefined) return obj\n if (isRegex(obj)) return obj.toString()\n return obj.toJSON ? obj.toJSON() : obj\n}\n\nfunction stringifyDeterministic (obj, opts) {\n opts = opts || assign({}, DEFAULTS)\n\n if (isFunction(opts)) opts = { compare: opts }\n\n const space = opts.space || DEFAULTS.space\n const cycles = isBoolean(opts.cycles) ? opts.cycles : DEFAULTS.cycles\n const replacer = opts.replacer || DEFAULTS.replacer\n const stringify = opts.stringify || DEFAULTS.stringify\n\n const compare = opts.compare && (function (f) {\n return function (node) {\n return function (a, b) {\n const aobj = {key: a, value: node[a]}\n const bobj = {key: b, value: node[b]}\n return f(aobj, bobj)\n }\n }\n })(opts.compare)\n\n // Detect circular structure in obj and raise error efficiently.\n if (!cycles) stringify(obj)\n\n const seen = []\n\n return (function _deterministic (parent, key, node, level) {\n const indent = space ? ('\\n' + new Array(level + 1).join(space)) : ''\n const colonSeparator = space ? ': ' : ':'\n\n node = serialize(node)\n node = replacer.call(parent, key, node)\n\n if (node === undefined) return\n\n if (!isObject(node) || node === null) return stringify(node)\n\n if (isArray(node)) {\n const out = []\n for (let i = 0; i < node.length; i++) {\n const item = _deterministic(node, i, node[i], level + 1) || stringify(null)\n out.push(indent + space + item)\n }\n return '[' + out.join(',') + indent + ']'\n } else {\n if (cycles) {\n if (seen.indexOf(node) !== -1) {\n return stringify('[Circular]')\n } else {\n seen.push(node)\n }\n }\n\n const nodeKeys = keys(node).sort(compare && compare(node))\n const out = []\n for (let i = 0; i < nodeKeys.length; i++) {\n const key = nodeKeys[i]\n const value = _deterministic(node, key, node[key], level + 1)\n\n if (!value) continue\n\n const keyValue = stringify(key) + colonSeparator + value\n out.push(indent + space + keyValue)\n }\n seen.splice(seen.indexOf(node), 1)\n return '{' + out.join(',') + indent + '}'\n }\n })({ '': obj }, '', obj, 0)\n}\n\nmodule.exports = stringifyDeterministic\n","/**\n * Utility functions for web applications.\n *\n * @author Dave Longley\n *\n * Copyright (c) 2010-2018 Digital Bazaar, Inc.\n */\nvar forge = require('./forge');\nvar baseN = require('./baseN');\n\n/* Utilities API */\nvar util = module.exports = forge.util = forge.util || {};\n\n// define setImmediate and nextTick\n(function() {\n // use native nextTick (unless we're in webpack)\n // webpack (or better node-libs-browser polyfill) sets process.browser.\n // this way we can detect webpack properly\n if(typeof process !== 'undefined' && process.nextTick && !process.browser) {\n util.nextTick = process.nextTick;\n if(typeof setImmediate === 'function') {\n util.setImmediate = setImmediate;\n } else {\n // polyfill setImmediate with nextTick, older versions of node\n // (those w/o setImmediate) won't totally starve IO\n util.setImmediate = util.nextTick;\n }\n return;\n }\n\n // polyfill nextTick with native setImmediate\n if(typeof setImmediate === 'function') {\n util.setImmediate = function() { return setImmediate.apply(undefined, arguments); };\n util.nextTick = function(callback) {\n return setImmediate(callback);\n };\n return;\n }\n\n /* Note: A polyfill upgrade pattern is used here to allow combining\n polyfills. For example, MutationObserver is fast, but blocks UI updates,\n so it needs to allow UI updates periodically, so it falls back on\n postMessage or setTimeout. */\n\n // polyfill with setTimeout\n util.setImmediate = function(callback) {\n setTimeout(callback, 0);\n };\n\n // upgrade polyfill to use postMessage\n if(typeof window !== 'undefined' &&\n typeof window.postMessage === 'function') {\n var msg = 'forge.setImmediate';\n var callbacks = [];\n util.setImmediate = function(callback) {\n callbacks.push(callback);\n // only send message when one hasn't been sent in\n // the current turn of the event loop\n if(callbacks.length === 1) {\n window.postMessage(msg, '*');\n }\n };\n function handler(event) {\n if(event.source === window && event.data === msg) {\n event.stopPropagation();\n var copy = callbacks.slice();\n callbacks.length = 0;\n copy.forEach(function(callback) {\n callback();\n });\n }\n }\n window.addEventListener('message', handler, true);\n }\n\n // upgrade polyfill to use MutationObserver\n if(typeof MutationObserver !== 'undefined') {\n // polyfill with MutationObserver\n var now = Date.now();\n var attr = true;\n var div = document.createElement('div');\n var callbacks = [];\n new MutationObserver(function() {\n var copy = callbacks.slice();\n callbacks.length = 0;\n copy.forEach(function(callback) {\n callback();\n });\n }).observe(div, {attributes: true});\n var oldSetImmediate = util.setImmediate;\n util.setImmediate = function(callback) {\n if(Date.now() - now > 15) {\n now = Date.now();\n oldSetImmediate(callback);\n } else {\n callbacks.push(callback);\n // only trigger observer when it hasn't been triggered in\n // the current turn of the event loop\n if(callbacks.length === 1) {\n div.setAttribute('a', attr = !attr);\n }\n }\n };\n }\n\n util.nextTick = util.setImmediate;\n})();\n\n// check if running under Node.js\nutil.isNodejs =\n typeof process !== 'undefined' && process.versions && process.versions.node;\n\n\n// 'self' will also work in Web Workers (instance of WorkerGlobalScope) while\n// it will point to `window` in the main thread.\n// To remain compatible with older browsers, we fall back to 'window' if 'self'\n// is not available.\nutil.globalScope = (function() {\n if(util.isNodejs) {\n return global;\n }\n\n return typeof self === 'undefined' ? window : self;\n})();\n\n// define isArray\nutil.isArray = Array.isArray || function(x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n};\n\n// define isArrayBuffer\nutil.isArrayBuffer = function(x) {\n return typeof ArrayBuffer !== 'undefined' && x instanceof ArrayBuffer;\n};\n\n// define isArrayBufferView\nutil.isArrayBufferView = function(x) {\n return x && util.isArrayBuffer(x.buffer) && x.byteLength !== undefined;\n};\n\n/**\n * Ensure a bits param is 8, 16, 24, or 32. Used to validate input for\n * algorithms where bit manipulation, JavaScript limitations, and/or algorithm\n * design only allow for byte operations of a limited size.\n *\n * @param n number of bits.\n *\n * Throw Error if n invalid.\n */\nfunction _checkBitsParam(n) {\n if(!(n === 8 || n === 16 || n === 24 || n === 32)) {\n throw new Error('Only 8, 16, 24, or 32 bits supported: ' + n);\n }\n}\n\n// TODO: set ByteBuffer to best available backing\nutil.ByteBuffer = ByteStringBuffer;\n\n/** Buffer w/BinaryString backing */\n\n/**\n * Constructor for a binary string backed byte buffer.\n *\n * @param [b] the bytes to wrap (either encoded as string, one byte per\n * character, or as an ArrayBuffer or Typed Array).\n */\nfunction ByteStringBuffer(b) {\n // TODO: update to match DataBuffer API\n\n // the data in this buffer\n this.data = '';\n // the pointer for reading from this buffer\n this.read = 0;\n\n if(typeof b === 'string') {\n this.data = b;\n } else if(util.isArrayBuffer(b) || util.isArrayBufferView(b)) {\n if(typeof Buffer !== 'undefined' && b instanceof Buffer) {\n this.data = b.toString('binary');\n } else {\n // convert native buffer to forge buffer\n // FIXME: support native buffers internally instead\n var arr = new Uint8Array(b);\n try {\n this.data = String.fromCharCode.apply(null, arr);\n } catch(e) {\n for(var i = 0; i < arr.length; ++i) {\n this.putByte(arr[i]);\n }\n }\n }\n } else if(b instanceof ByteStringBuffer ||\n (typeof b === 'object' && typeof b.data === 'string' &&\n typeof b.read === 'number')) {\n // copy existing buffer\n this.data = b.data;\n this.read = b.read;\n }\n\n // used for v8 optimization\n this._constructedStringLength = 0;\n}\nutil.ByteStringBuffer = ByteStringBuffer;\n\n/* Note: This is an optimization for V8-based browsers. When V8 concatenates\n a string, the strings are only joined logically using a \"cons string\" or\n \"constructed/concatenated string\". These containers keep references to one\n another and can result in very large memory usage. For example, if a 2MB\n string is constructed by concatenating 4 bytes together at a time, the\n memory usage will be ~44MB; so ~22x increase. The strings are only joined\n together when an operation requiring their joining takes place, such as\n substr(). This function is called when adding data to this buffer to ensure\n these types of strings are periodically joined to reduce the memory\n footprint. */\nvar _MAX_CONSTRUCTED_STRING_LENGTH = 4096;\nutil.ByteStringBuffer.prototype._optimizeConstructedString = function(x) {\n this._constructedStringLength += x;\n if(this._constructedStringLength > _MAX_CONSTRUCTED_STRING_LENGTH) {\n // this substr() should cause the constructed string to join\n this.data.substr(0, 1);\n this._constructedStringLength = 0;\n }\n};\n\n/**\n * Gets the number of bytes in this buffer.\n *\n * @return the number of bytes in this buffer.\n */\nutil.ByteStringBuffer.prototype.length = function() {\n return this.data.length - this.read;\n};\n\n/**\n * Gets whether or not this buffer is empty.\n *\n * @return true if this buffer is empty, false if not.\n */\nutil.ByteStringBuffer.prototype.isEmpty = function() {\n return this.length() <= 0;\n};\n\n/**\n * Puts a byte in this buffer.\n *\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putByte = function(b) {\n return this.putBytes(String.fromCharCode(b));\n};\n\n/**\n * Puts a byte in this buffer N times.\n *\n * @param b the byte to put.\n * @param n the number of bytes of value b to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.fillWithByte = function(b, n) {\n b = String.fromCharCode(b);\n var d = this.data;\n while(n > 0) {\n if(n & 1) {\n d += b;\n }\n n >>>= 1;\n if(n > 0) {\n b += b;\n }\n }\n this.data = d;\n this._optimizeConstructedString(n);\n return this;\n};\n\n/**\n * Puts bytes in this buffer.\n *\n * @param bytes the bytes (as a binary encoded string) to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putBytes = function(bytes) {\n this.data += bytes;\n this._optimizeConstructedString(bytes.length);\n return this;\n};\n\n/**\n * Puts a UTF-16 encoded string into this buffer.\n *\n * @param str the string to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putString = function(str) {\n return this.putBytes(util.encodeUtf8(str));\n};\n\n/**\n * Puts a 16-bit integer in this buffer in big-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt16 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 24-bit integer in this buffer in big-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt24 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 32-bit integer in this buffer in big-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt32 = function(i) {\n return this.putBytes(\n String.fromCharCode(i >> 24 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n/**\n * Puts a 16-bit integer in this buffer in little-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt16Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF));\n};\n\n/**\n * Puts a 24-bit integer in this buffer in little-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt24Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF));\n};\n\n/**\n * Puts a 32-bit integer in this buffer in little-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt32Le = function(i) {\n return this.putBytes(\n String.fromCharCode(i & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 24 & 0xFF));\n};\n\n/**\n * Puts an n-bit integer in this buffer in big-endian order.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putInt = function(i, n) {\n _checkBitsParam(n);\n var bytes = '';\n do {\n n -= 8;\n bytes += String.fromCharCode((i >> n) & 0xFF);\n } while(n > 0);\n return this.putBytes(bytes);\n};\n\n/**\n * Puts a signed n-bit integer in this buffer in big-endian order. Two's\n * complement representation is used.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putSignedInt = function(i, n) {\n // putInt checks n\n if(i < 0) {\n i += 2 << (n - 1);\n }\n return this.putInt(i, n);\n};\n\n/**\n * Puts the given buffer into this buffer.\n *\n * @param buffer the buffer to put into this one.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.putBuffer = function(buffer) {\n return this.putBytes(buffer.getBytes());\n};\n\n/**\n * Gets a byte from this buffer and advances the read pointer by 1.\n *\n * @return the byte.\n */\nutil.ByteStringBuffer.prototype.getByte = function() {\n return this.data.charCodeAt(this.read++);\n};\n\n/**\n * Gets a uint16 from this buffer in big-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.ByteStringBuffer.prototype.getInt16 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 8 ^\n this.data.charCodeAt(this.read + 1));\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in big-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.ByteStringBuffer.prototype.getInt24 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 16 ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2));\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in big-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.ByteStringBuffer.prototype.getInt32 = function() {\n var rval = (\n this.data.charCodeAt(this.read) << 24 ^\n this.data.charCodeAt(this.read + 1) << 16 ^\n this.data.charCodeAt(this.read + 2) << 8 ^\n this.data.charCodeAt(this.read + 3));\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets a uint16 from this buffer in little-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.ByteStringBuffer.prototype.getInt16Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in little-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.ByteStringBuffer.prototype.getInt24Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2) << 16);\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in little-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.ByteStringBuffer.prototype.getInt32Le = function() {\n var rval = (\n this.data.charCodeAt(this.read) ^\n this.data.charCodeAt(this.read + 1) << 8 ^\n this.data.charCodeAt(this.read + 2) << 16 ^\n this.data.charCodeAt(this.read + 3) << 24);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets an n-bit integer from this buffer in big-endian order and advances the\n * read pointer by ceil(n/8).\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.ByteStringBuffer.prototype.getInt = function(n) {\n _checkBitsParam(n);\n var rval = 0;\n do {\n // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits.\n rval = (rval << 8) + this.data.charCodeAt(this.read++);\n n -= 8;\n } while(n > 0);\n return rval;\n};\n\n/**\n * Gets a signed n-bit integer from this buffer in big-endian order, using\n * two's complement, and advances the read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.ByteStringBuffer.prototype.getSignedInt = function(n) {\n // getInt checks n\n var x = this.getInt(n);\n var max = 2 << (n - 2);\n if(x >= max) {\n x -= max << 1;\n }\n return x;\n};\n\n/**\n * Reads bytes out as a binary encoded string and clears them from the\n * buffer. Note that the resulting string is binary encoded (in node.js this\n * encoding is referred to as `binary`, it is *not* `utf8`).\n *\n * @param count the number of bytes to read, undefined or null for all.\n *\n * @return a binary encoded string of bytes.\n */\nutil.ByteStringBuffer.prototype.getBytes = function(count) {\n var rval;\n if(count) {\n // read count bytes\n count = Math.min(this.length(), count);\n rval = this.data.slice(this.read, this.read + count);\n this.read += count;\n } else if(count === 0) {\n rval = '';\n } else {\n // read all bytes, optimize to only copy when needed\n rval = (this.read === 0) ? this.data : this.data.slice(this.read);\n this.clear();\n }\n return rval;\n};\n\n/**\n * Gets a binary encoded string of the bytes from this buffer without\n * modifying the read pointer.\n *\n * @param count the number of bytes to get, omit to get all.\n *\n * @return a string full of binary encoded characters.\n */\nutil.ByteStringBuffer.prototype.bytes = function(count) {\n return (typeof(count) === 'undefined' ?\n this.data.slice(this.read) :\n this.data.slice(this.read, this.read + count));\n};\n\n/**\n * Gets a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n *\n * @return the byte.\n */\nutil.ByteStringBuffer.prototype.at = function(i) {\n return this.data.charCodeAt(this.read + i);\n};\n\n/**\n * Puts a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.setAt = function(i, b) {\n this.data = this.data.substr(0, this.read + i) +\n String.fromCharCode(b) +\n this.data.substr(this.read + i + 1);\n return this;\n};\n\n/**\n * Gets the last byte without modifying the read pointer.\n *\n * @return the last byte.\n */\nutil.ByteStringBuffer.prototype.last = function() {\n return this.data.charCodeAt(this.data.length - 1);\n};\n\n/**\n * Creates a copy of this buffer.\n *\n * @return the copy.\n */\nutil.ByteStringBuffer.prototype.copy = function() {\n var c = util.createBuffer(this.data);\n c.read = this.read;\n return c;\n};\n\n/**\n * Compacts this buffer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.compact = function() {\n if(this.read > 0) {\n this.data = this.data.slice(this.read);\n this.read = 0;\n }\n return this;\n};\n\n/**\n * Clears this buffer.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.clear = function() {\n this.data = '';\n this.read = 0;\n return this;\n};\n\n/**\n * Shortens this buffer by triming bytes off of the end of this buffer.\n *\n * @param count the number of bytes to trim off.\n *\n * @return this buffer.\n */\nutil.ByteStringBuffer.prototype.truncate = function(count) {\n var len = Math.max(0, this.length() - count);\n this.data = this.data.substr(this.read, len);\n this.read = 0;\n return this;\n};\n\n/**\n * Converts this buffer to a hexadecimal string.\n *\n * @return a hexadecimal string.\n */\nutil.ByteStringBuffer.prototype.toHex = function() {\n var rval = '';\n for(var i = this.read; i < this.data.length; ++i) {\n var b = this.data.charCodeAt(i);\n if(b < 16) {\n rval += '0';\n }\n rval += b.toString(16);\n }\n return rval;\n};\n\n/**\n * Converts this buffer to a UTF-16 string (standard JavaScript string).\n *\n * @return a UTF-16 string.\n */\nutil.ByteStringBuffer.prototype.toString = function() {\n return util.decodeUtf8(this.bytes());\n};\n\n/** End Buffer w/BinaryString backing */\n\n/** Buffer w/UInt8Array backing */\n\n/**\n * FIXME: Experimental. Do not use yet.\n *\n * Constructor for an ArrayBuffer-backed byte buffer.\n *\n * The buffer may be constructed from a string, an ArrayBuffer, DataView, or a\n * TypedArray.\n *\n * If a string is given, its encoding should be provided as an option,\n * otherwise it will default to 'binary'. A 'binary' string is encoded such\n * that each character is one byte in length and size.\n *\n * If an ArrayBuffer, DataView, or TypedArray is given, it will be used\n * *directly* without any copying. Note that, if a write to the buffer requires\n * more space, the buffer will allocate a new backing ArrayBuffer to\n * accommodate. The starting read and write offsets for the buffer may be\n * given as options.\n *\n * @param [b] the initial bytes for this buffer.\n * @param options the options to use:\n * [readOffset] the starting read offset to use (default: 0).\n * [writeOffset] the starting write offset to use (default: the\n * length of the first parameter).\n * [growSize] the minimum amount, in bytes, to grow the buffer by to\n * accommodate writes (default: 1024).\n * [encoding] the encoding ('binary', 'utf8', 'utf16', 'hex') for the\n * first parameter, if it is a string (default: 'binary').\n */\nfunction DataBuffer(b, options) {\n // default options\n options = options || {};\n\n // pointers for read from/write to buffer\n this.read = options.readOffset || 0;\n this.growSize = options.growSize || 1024;\n\n var isArrayBuffer = util.isArrayBuffer(b);\n var isArrayBufferView = util.isArrayBufferView(b);\n if(isArrayBuffer || isArrayBufferView) {\n // use ArrayBuffer directly\n if(isArrayBuffer) {\n this.data = new DataView(b);\n } else {\n // TODO: adjust read/write offset based on the type of view\n // or specify that this must be done in the options ... that the\n // offsets are byte-based\n this.data = new DataView(b.buffer, b.byteOffset, b.byteLength);\n }\n this.write = ('writeOffset' in options ?\n options.writeOffset : this.data.byteLength);\n return;\n }\n\n // initialize to empty array buffer and add any given bytes using putBytes\n this.data = new DataView(new ArrayBuffer(0));\n this.write = 0;\n\n if(b !== null && b !== undefined) {\n this.putBytes(b);\n }\n\n if('writeOffset' in options) {\n this.write = options.writeOffset;\n }\n}\nutil.DataBuffer = DataBuffer;\n\n/**\n * Gets the number of bytes in this buffer.\n *\n * @return the number of bytes in this buffer.\n */\nutil.DataBuffer.prototype.length = function() {\n return this.write - this.read;\n};\n\n/**\n * Gets whether or not this buffer is empty.\n *\n * @return true if this buffer is empty, false if not.\n */\nutil.DataBuffer.prototype.isEmpty = function() {\n return this.length() <= 0;\n};\n\n/**\n * Ensures this buffer has enough empty space to accommodate the given number\n * of bytes. An optional parameter may be given that indicates a minimum\n * amount to grow the buffer if necessary. If the parameter is not given,\n * the buffer will be grown by some previously-specified default amount\n * or heuristic.\n *\n * @param amount the number of bytes to accommodate.\n * @param [growSize] the minimum amount, in bytes, to grow the buffer by if\n * necessary.\n */\nutil.DataBuffer.prototype.accommodate = function(amount, growSize) {\n if(this.length() >= amount) {\n return this;\n }\n growSize = Math.max(growSize || this.growSize, amount);\n\n // grow buffer\n var src = new Uint8Array(\n this.data.buffer, this.data.byteOffset, this.data.byteLength);\n var dst = new Uint8Array(this.length() + growSize);\n dst.set(src);\n this.data = new DataView(dst.buffer);\n\n return this;\n};\n\n/**\n * Puts a byte in this buffer.\n *\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putByte = function(b) {\n this.accommodate(1);\n this.data.setUint8(this.write++, b);\n return this;\n};\n\n/**\n * Puts a byte in this buffer N times.\n *\n * @param b the byte to put.\n * @param n the number of bytes of value b to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.fillWithByte = function(b, n) {\n this.accommodate(n);\n for(var i = 0; i < n; ++i) {\n this.data.setUint8(b);\n }\n return this;\n};\n\n/**\n * Puts bytes in this buffer. The bytes may be given as a string, an\n * ArrayBuffer, a DataView, or a TypedArray.\n *\n * @param bytes the bytes to put.\n * @param [encoding] the encoding for the first parameter ('binary', 'utf8',\n * 'utf16', 'hex'), if it is a string (default: 'binary').\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putBytes = function(bytes, encoding) {\n if(util.isArrayBufferView(bytes)) {\n var src = new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n var len = src.byteLength - src.byteOffset;\n this.accommodate(len);\n var dst = new Uint8Array(this.data.buffer, this.write);\n dst.set(src);\n this.write += len;\n return this;\n }\n\n if(util.isArrayBuffer(bytes)) {\n var src = new Uint8Array(bytes);\n this.accommodate(src.byteLength);\n var dst = new Uint8Array(this.data.buffer);\n dst.set(src, this.write);\n this.write += src.byteLength;\n return this;\n }\n\n // bytes is a util.DataBuffer or equivalent\n if(bytes instanceof util.DataBuffer ||\n (typeof bytes === 'object' &&\n typeof bytes.read === 'number' && typeof bytes.write === 'number' &&\n util.isArrayBufferView(bytes.data))) {\n var src = new Uint8Array(bytes.data.byteLength, bytes.read, bytes.length());\n this.accommodate(src.byteLength);\n var dst = new Uint8Array(bytes.data.byteLength, this.write);\n dst.set(src);\n this.write += src.byteLength;\n return this;\n }\n\n if(bytes instanceof util.ByteStringBuffer) {\n // copy binary string and process as the same as a string parameter below\n bytes = bytes.data;\n encoding = 'binary';\n }\n\n // string conversion\n encoding = encoding || 'binary';\n if(typeof bytes === 'string') {\n var view;\n\n // decode from string\n if(encoding === 'hex') {\n this.accommodate(Math.ceil(bytes.length / 2));\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.hex.decode(bytes, view, this.write);\n return this;\n }\n if(encoding === 'base64') {\n this.accommodate(Math.ceil(bytes.length / 4) * 3);\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.base64.decode(bytes, view, this.write);\n return this;\n }\n\n // encode text as UTF-8 bytes\n if(encoding === 'utf8') {\n // encode as UTF-8 then decode string as raw binary\n bytes = util.encodeUtf8(bytes);\n encoding = 'binary';\n }\n\n // decode string as raw binary\n if(encoding === 'binary' || encoding === 'raw') {\n // one byte per character\n this.accommodate(bytes.length);\n view = new Uint8Array(this.data.buffer, this.write);\n this.write += util.binary.raw.decode(view);\n return this;\n }\n\n // encode text as UTF-16 bytes\n if(encoding === 'utf16') {\n // two bytes per character\n this.accommodate(bytes.length * 2);\n view = new Uint16Array(this.data.buffer, this.write);\n this.write += util.text.utf16.encode(view);\n return this;\n }\n\n throw new Error('Invalid encoding: ' + encoding);\n }\n\n throw Error('Invalid parameter: ' + bytes);\n};\n\n/**\n * Puts the given buffer into this buffer.\n *\n * @param buffer the buffer to put into this one.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putBuffer = function(buffer) {\n this.putBytes(buffer);\n buffer.clear();\n return this;\n};\n\n/**\n * Puts a string into this buffer.\n *\n * @param str the string to put.\n * @param [encoding] the encoding for the string (default: 'utf16').\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putString = function(str) {\n return this.putBytes(str, 'utf16');\n};\n\n/**\n * Puts a 16-bit integer in this buffer in big-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt16 = function(i) {\n this.accommodate(2);\n this.data.setInt16(this.write, i);\n this.write += 2;\n return this;\n};\n\n/**\n * Puts a 24-bit integer in this buffer in big-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt24 = function(i) {\n this.accommodate(3);\n this.data.setInt16(this.write, i >> 8 & 0xFFFF);\n this.data.setInt8(this.write, i >> 16 & 0xFF);\n this.write += 3;\n return this;\n};\n\n/**\n * Puts a 32-bit integer in this buffer in big-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt32 = function(i) {\n this.accommodate(4);\n this.data.setInt32(this.write, i);\n this.write += 4;\n return this;\n};\n\n/**\n * Puts a 16-bit integer in this buffer in little-endian order.\n *\n * @param i the 16-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt16Le = function(i) {\n this.accommodate(2);\n this.data.setInt16(this.write, i, true);\n this.write += 2;\n return this;\n};\n\n/**\n * Puts a 24-bit integer in this buffer in little-endian order.\n *\n * @param i the 24-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt24Le = function(i) {\n this.accommodate(3);\n this.data.setInt8(this.write, i >> 16 & 0xFF);\n this.data.setInt16(this.write, i >> 8 & 0xFFFF, true);\n this.write += 3;\n return this;\n};\n\n/**\n * Puts a 32-bit integer in this buffer in little-endian order.\n *\n * @param i the 32-bit integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt32Le = function(i) {\n this.accommodate(4);\n this.data.setInt32(this.write, i, true);\n this.write += 4;\n return this;\n};\n\n/**\n * Puts an n-bit integer in this buffer in big-endian order.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putInt = function(i, n) {\n _checkBitsParam(n);\n this.accommodate(n / 8);\n do {\n n -= 8;\n this.data.setInt8(this.write++, (i >> n) & 0xFF);\n } while(n > 0);\n return this;\n};\n\n/**\n * Puts a signed n-bit integer in this buffer in big-endian order. Two's\n * complement representation is used.\n *\n * @param i the n-bit integer.\n * @param n the number of bits in the integer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.putSignedInt = function(i, n) {\n _checkBitsParam(n);\n this.accommodate(n / 8);\n if(i < 0) {\n i += 2 << (n - 1);\n }\n return this.putInt(i, n);\n};\n\n/**\n * Gets a byte from this buffer and advances the read pointer by 1.\n *\n * @return the byte.\n */\nutil.DataBuffer.prototype.getByte = function() {\n return this.data.getInt8(this.read++);\n};\n\n/**\n * Gets a uint16 from this buffer in big-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.DataBuffer.prototype.getInt16 = function() {\n var rval = this.data.getInt16(this.read);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in big-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.DataBuffer.prototype.getInt24 = function() {\n var rval = (\n this.data.getInt16(this.read) << 8 ^\n this.data.getInt8(this.read + 2));\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in big-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.DataBuffer.prototype.getInt32 = function() {\n var rval = this.data.getInt32(this.read);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets a uint16 from this buffer in little-endian order and advances the read\n * pointer by 2.\n *\n * @return the uint16.\n */\nutil.DataBuffer.prototype.getInt16Le = function() {\n var rval = this.data.getInt16(this.read, true);\n this.read += 2;\n return rval;\n};\n\n/**\n * Gets a uint24 from this buffer in little-endian order and advances the read\n * pointer by 3.\n *\n * @return the uint24.\n */\nutil.DataBuffer.prototype.getInt24Le = function() {\n var rval = (\n this.data.getInt8(this.read) ^\n this.data.getInt16(this.read + 1, true) << 8);\n this.read += 3;\n return rval;\n};\n\n/**\n * Gets a uint32 from this buffer in little-endian order and advances the read\n * pointer by 4.\n *\n * @return the word.\n */\nutil.DataBuffer.prototype.getInt32Le = function() {\n var rval = this.data.getInt32(this.read, true);\n this.read += 4;\n return rval;\n};\n\n/**\n * Gets an n-bit integer from this buffer in big-endian order and advances the\n * read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.DataBuffer.prototype.getInt = function(n) {\n _checkBitsParam(n);\n var rval = 0;\n do {\n // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits.\n rval = (rval << 8) + this.data.getInt8(this.read++);\n n -= 8;\n } while(n > 0);\n return rval;\n};\n\n/**\n * Gets a signed n-bit integer from this buffer in big-endian order, using\n * two's complement, and advances the read pointer by n/8.\n *\n * @param n the number of bits in the integer (8, 16, 24, or 32).\n *\n * @return the integer.\n */\nutil.DataBuffer.prototype.getSignedInt = function(n) {\n // getInt checks n\n var x = this.getInt(n);\n var max = 2 << (n - 2);\n if(x >= max) {\n x -= max << 1;\n }\n return x;\n};\n\n/**\n * Reads bytes out as a binary encoded string and clears them from the\n * buffer.\n *\n * @param count the number of bytes to read, undefined or null for all.\n *\n * @return a binary encoded string of bytes.\n */\nutil.DataBuffer.prototype.getBytes = function(count) {\n // TODO: deprecate this method, it is poorly named and\n // this.toString('binary') replaces it\n // add a toTypedArray()/toArrayBuffer() function\n var rval;\n if(count) {\n // read count bytes\n count = Math.min(this.length(), count);\n rval = this.data.slice(this.read, this.read + count);\n this.read += count;\n } else if(count === 0) {\n rval = '';\n } else {\n // read all bytes, optimize to only copy when needed\n rval = (this.read === 0) ? this.data : this.data.slice(this.read);\n this.clear();\n }\n return rval;\n};\n\n/**\n * Gets a binary encoded string of the bytes from this buffer without\n * modifying the read pointer.\n *\n * @param count the number of bytes to get, omit to get all.\n *\n * @return a string full of binary encoded characters.\n */\nutil.DataBuffer.prototype.bytes = function(count) {\n // TODO: deprecate this method, it is poorly named, add \"getString()\"\n return (typeof(count) === 'undefined' ?\n this.data.slice(this.read) :\n this.data.slice(this.read, this.read + count));\n};\n\n/**\n * Gets a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n *\n * @return the byte.\n */\nutil.DataBuffer.prototype.at = function(i) {\n return this.data.getUint8(this.read + i);\n};\n\n/**\n * Puts a byte at the given index without modifying the read pointer.\n *\n * @param i the byte index.\n * @param b the byte to put.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.setAt = function(i, b) {\n this.data.setUint8(i, b);\n return this;\n};\n\n/**\n * Gets the last byte without modifying the read pointer.\n *\n * @return the last byte.\n */\nutil.DataBuffer.prototype.last = function() {\n return this.data.getUint8(this.write - 1);\n};\n\n/**\n * Creates a copy of this buffer.\n *\n * @return the copy.\n */\nutil.DataBuffer.prototype.copy = function() {\n return new util.DataBuffer(this);\n};\n\n/**\n * Compacts this buffer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.compact = function() {\n if(this.read > 0) {\n var src = new Uint8Array(this.data.buffer, this.read);\n var dst = new Uint8Array(src.byteLength);\n dst.set(src);\n this.data = new DataView(dst);\n this.write -= this.read;\n this.read = 0;\n }\n return this;\n};\n\n/**\n * Clears this buffer.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.clear = function() {\n this.data = new DataView(new ArrayBuffer(0));\n this.read = this.write = 0;\n return this;\n};\n\n/**\n * Shortens this buffer by triming bytes off of the end of this buffer.\n *\n * @param count the number of bytes to trim off.\n *\n * @return this buffer.\n */\nutil.DataBuffer.prototype.truncate = function(count) {\n this.write = Math.max(0, this.length() - count);\n this.read = Math.min(this.read, this.write);\n return this;\n};\n\n/**\n * Converts this buffer to a hexadecimal string.\n *\n * @return a hexadecimal string.\n */\nutil.DataBuffer.prototype.toHex = function() {\n var rval = '';\n for(var i = this.read; i < this.data.byteLength; ++i) {\n var b = this.data.getUint8(i);\n if(b < 16) {\n rval += '0';\n }\n rval += b.toString(16);\n }\n return rval;\n};\n\n/**\n * Converts this buffer to a string, using the given encoding. If no\n * encoding is given, 'utf8' (UTF-8) is used.\n *\n * @param [encoding] the encoding to use: 'binary', 'utf8', 'utf16', 'hex',\n * 'base64' (default: 'utf8').\n *\n * @return a string representation of the bytes in this buffer.\n */\nutil.DataBuffer.prototype.toString = function(encoding) {\n var view = new Uint8Array(this.data, this.read, this.length());\n encoding = encoding || 'utf8';\n\n // encode to string\n if(encoding === 'binary' || encoding === 'raw') {\n return util.binary.raw.encode(view);\n }\n if(encoding === 'hex') {\n return util.binary.hex.encode(view);\n }\n if(encoding === 'base64') {\n return util.binary.base64.encode(view);\n }\n\n // decode to text\n if(encoding === 'utf8') {\n return util.text.utf8.decode(view);\n }\n if(encoding === 'utf16') {\n return util.text.utf16.decode(view);\n }\n\n throw new Error('Invalid encoding: ' + encoding);\n};\n\n/** End Buffer w/UInt8Array backing */\n\n/**\n * Creates a buffer that stores bytes. A value may be given to populate the\n * buffer with data. This value can either be string of encoded bytes or a\n * regular string of characters. When passing a string of binary encoded\n * bytes, the encoding `raw` should be given. This is also the default. When\n * passing a string of characters, the encoding `utf8` should be given.\n *\n * @param [input] a string with encoded bytes to store in the buffer.\n * @param [encoding] (default: 'raw', other: 'utf8').\n */\nutil.createBuffer = function(input, encoding) {\n // TODO: deprecate, use new ByteBuffer() instead\n encoding = encoding || 'raw';\n if(input !== undefined && encoding === 'utf8') {\n input = util.encodeUtf8(input);\n }\n return new util.ByteBuffer(input);\n};\n\n/**\n * Fills a string with a particular value. If you want the string to be a byte\n * string, pass in String.fromCharCode(theByte).\n *\n * @param c the character to fill the string with, use String.fromCharCode\n * to fill the string with a byte value.\n * @param n the number of characters of value c to fill with.\n *\n * @return the filled string.\n */\nutil.fillString = function(c, n) {\n var s = '';\n while(n > 0) {\n if(n & 1) {\n s += c;\n }\n n >>>= 1;\n if(n > 0) {\n c += c;\n }\n }\n return s;\n};\n\n/**\n * Performs a per byte XOR between two byte strings and returns the result as a\n * string of bytes.\n *\n * @param s1 first string of bytes.\n * @param s2 second string of bytes.\n * @param n the number of bytes to XOR.\n *\n * @return the XOR'd result.\n */\nutil.xorBytes = function(s1, s2, n) {\n var s3 = '';\n var b = '';\n var t = '';\n var i = 0;\n var c = 0;\n for(; n > 0; --n, ++i) {\n b = s1.charCodeAt(i) ^ s2.charCodeAt(i);\n if(c >= 10) {\n s3 += t;\n t = '';\n c = 0;\n }\n t += String.fromCharCode(b);\n ++c;\n }\n s3 += t;\n return s3;\n};\n\n/**\n * Converts a hex string into a 'binary' encoded string of bytes.\n *\n * @param hex the hexadecimal string to convert.\n *\n * @return the binary-encoded string of bytes.\n */\nutil.hexToBytes = function(hex) {\n // TODO: deprecate: \"Deprecated. Use util.binary.hex.decode instead.\"\n var rval = '';\n var i = 0;\n if(hex.length & 1 == 1) {\n // odd number of characters, convert first character alone\n i = 1;\n rval += String.fromCharCode(parseInt(hex[0], 16));\n }\n // convert 2 characters (1 byte) at a time\n for(; i < hex.length; i += 2) {\n rval += String.fromCharCode(parseInt(hex.substr(i, 2), 16));\n }\n return rval;\n};\n\n/**\n * Converts a 'binary' encoded string of bytes to hex.\n *\n * @param bytes the byte string to convert.\n *\n * @return the string of hexadecimal characters.\n */\nutil.bytesToHex = function(bytes) {\n // TODO: deprecate: \"Deprecated. Use util.binary.hex.encode instead.\"\n return util.createBuffer(bytes).toHex();\n};\n\n/**\n * Converts an 32-bit integer to 4-big-endian byte string.\n *\n * @param i the integer.\n *\n * @return the byte string.\n */\nutil.int32ToBytes = function(i) {\n return (\n String.fromCharCode(i >> 24 & 0xFF) +\n String.fromCharCode(i >> 16 & 0xFF) +\n String.fromCharCode(i >> 8 & 0xFF) +\n String.fromCharCode(i & 0xFF));\n};\n\n// base64 characters, reverse mapping\nvar _base64 =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\nvar _base64Idx = [\n/*43 -43 = 0*/\n/*'+', 1, 2, 3,'/' */\n 62, -1, -1, -1, 63,\n\n/*'0','1','2','3','4','5','6','7','8','9' */\n 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,\n\n/*15, 16, 17,'=', 19, 20, 21 */\n -1, -1, -1, 64, -1, -1, -1,\n\n/*65 - 43 = 22*/\n/*'A','B','C','D','E','F','G','H','I','J','K','L','M', */\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,\n\n/*'N','O','P','Q','R','S','T','U','V','W','X','Y','Z' */\n 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,\n\n/*91 - 43 = 48 */\n/*48, 49, 50, 51, 52, 53 */\n -1, -1, -1, -1, -1, -1,\n\n/*97 - 43 = 54*/\n/*'a','b','c','d','e','f','g','h','i','j','k','l','m' */\n 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,\n\n/*'n','o','p','q','r','s','t','u','v','w','x','y','z' */\n 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51\n];\n\n// base58 characters (Bitcoin alphabet)\nvar _base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n\n/**\n * Base64 encodes a 'binary' encoded string of bytes.\n *\n * @param input the binary encoded string of bytes to base64-encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the base64-encoded output.\n */\nutil.encode64 = function(input, maxline) {\n // TODO: deprecate: \"Deprecated. Use util.binary.base64.encode instead.\"\n var line = '';\n var output = '';\n var chr1, chr2, chr3;\n var i = 0;\n while(i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n\n // encode 4 character group\n line += _base64.charAt(chr1 >> 2);\n line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4));\n if(isNaN(chr2)) {\n line += '==';\n } else {\n line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6));\n line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63);\n }\n\n if(maxline && line.length > maxline) {\n output += line.substr(0, maxline) + '\\r\\n';\n line = line.substr(maxline);\n }\n }\n output += line;\n return output;\n};\n\n/**\n * Base64 decodes a string into a 'binary' encoded string of bytes.\n *\n * @param input the base64-encoded input.\n *\n * @return the binary encoded string.\n */\nutil.decode64 = function(input) {\n // TODO: deprecate: \"Deprecated. Use util.binary.base64.decode instead.\"\n\n // remove all non-base64 characters\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, '');\n\n var output = '';\n var enc1, enc2, enc3, enc4;\n var i = 0;\n\n while(i < input.length) {\n enc1 = _base64Idx[input.charCodeAt(i++) - 43];\n enc2 = _base64Idx[input.charCodeAt(i++) - 43];\n enc3 = _base64Idx[input.charCodeAt(i++) - 43];\n enc4 = _base64Idx[input.charCodeAt(i++) - 43];\n\n output += String.fromCharCode((enc1 << 2) | (enc2 >> 4));\n if(enc3 !== 64) {\n // decoded at least 2 bytes\n output += String.fromCharCode(((enc2 & 15) << 4) | (enc3 >> 2));\n if(enc4 !== 64) {\n // decoded 3 bytes\n output += String.fromCharCode(((enc3 & 3) << 6) | enc4);\n }\n }\n }\n\n return output;\n};\n\n/**\n * Encodes the given string of characters (a standard JavaScript\n * string) as a binary encoded string where the bytes represent\n * a UTF-8 encoded string of characters. Non-ASCII characters will be\n * encoded as multiple bytes according to UTF-8.\n *\n * @param str a standard string of characters to encode.\n *\n * @return the binary encoded string.\n */\nutil.encodeUtf8 = function(str) {\n return unescape(encodeURIComponent(str));\n};\n\n/**\n * Decodes a binary encoded string that contains bytes that\n * represent a UTF-8 encoded string of characters -- into a\n * string of characters (a standard JavaScript string).\n *\n * @param str the binary encoded string to decode.\n *\n * @return the resulting standard string of characters.\n */\nutil.decodeUtf8 = function(str) {\n return decodeURIComponent(escape(str));\n};\n\n// binary encoding/decoding tools\n// FIXME: Experimental. Do not use yet.\nutil.binary = {\n raw: {},\n hex: {},\n base64: {},\n base58: {},\n baseN : {\n encode: baseN.encode,\n decode: baseN.decode\n }\n};\n\n/**\n * Encodes a Uint8Array as a binary-encoded string. This encoding uses\n * a value between 0 and 255 for each character.\n *\n * @param bytes the Uint8Array to encode.\n *\n * @return the binary-encoded string.\n */\nutil.binary.raw.encode = function(bytes) {\n return String.fromCharCode.apply(null, bytes);\n};\n\n/**\n * Decodes a binary-encoded string to a Uint8Array. This encoding uses\n * a value between 0 and 255 for each character.\n *\n * @param str the binary-encoded string to decode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.raw.decode = function(str, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length);\n }\n offset = offset || 0;\n var j = offset;\n for(var i = 0; i < str.length; ++i) {\n out[j++] = str.charCodeAt(i);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Encodes a 'binary' string, ArrayBuffer, DataView, TypedArray, or\n * ByteBuffer as a string of hexadecimal characters.\n *\n * @param bytes the bytes to convert.\n *\n * @return the string of hexadecimal characters.\n */\nutil.binary.hex.encode = util.bytesToHex;\n\n/**\n * Decodes a hex-encoded string to a Uint8Array.\n *\n * @param hex the hexadecimal string to convert.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.hex.decode = function(hex, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(Math.ceil(hex.length / 2));\n }\n offset = offset || 0;\n var i = 0, j = offset;\n if(hex.length & 1) {\n // odd number of characters, convert first character alone\n i = 1;\n out[j++] = parseInt(hex[0], 16);\n }\n // convert 2 characters (1 byte) at a time\n for(; i < hex.length; i += 2) {\n out[j++] = parseInt(hex.substr(i, 2), 16);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Base64-encodes a Uint8Array.\n *\n * @param input the Uint8Array to encode.\n * @param maxline the maximum number of encoded characters per line to use,\n * defaults to none.\n *\n * @return the base64-encoded output string.\n */\nutil.binary.base64.encode = function(input, maxline) {\n var line = '';\n var output = '';\n var chr1, chr2, chr3;\n var i = 0;\n while(i < input.byteLength) {\n chr1 = input[i++];\n chr2 = input[i++];\n chr3 = input[i++];\n\n // encode 4 character group\n line += _base64.charAt(chr1 >> 2);\n line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4));\n if(isNaN(chr2)) {\n line += '==';\n } else {\n line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6));\n line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63);\n }\n\n if(maxline && line.length > maxline) {\n output += line.substr(0, maxline) + '\\r\\n';\n line = line.substr(maxline);\n }\n }\n output += line;\n return output;\n};\n\n/**\n * Decodes a base64-encoded string to a Uint8Array.\n *\n * @param input the base64-encoded input string.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.binary.base64.decode = function(input, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(Math.ceil(input.length / 4) * 3);\n }\n\n // remove all non-base64 characters\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, '');\n\n offset = offset || 0;\n var enc1, enc2, enc3, enc4;\n var i = 0, j = offset;\n\n while(i < input.length) {\n enc1 = _base64Idx[input.charCodeAt(i++) - 43];\n enc2 = _base64Idx[input.charCodeAt(i++) - 43];\n enc3 = _base64Idx[input.charCodeAt(i++) - 43];\n enc4 = _base64Idx[input.charCodeAt(i++) - 43];\n\n out[j++] = (enc1 << 2) | (enc2 >> 4);\n if(enc3 !== 64) {\n // decoded at least 2 bytes\n out[j++] = ((enc2 & 15) << 4) | (enc3 >> 2);\n if(enc4 !== 64) {\n // decoded 3 bytes\n out[j++] = ((enc3 & 3) << 6) | enc4;\n }\n }\n }\n\n // make sure result is the exact decoded length\n return output ? (j - offset) : out.subarray(0, j);\n};\n\n// add support for base58 encoding/decoding with Bitcoin alphabet\nutil.binary.base58.encode = function(input, maxline) {\n return util.binary.baseN.encode(input, _base58, maxline);\n};\nutil.binary.base58.decode = function(input, maxline) {\n return util.binary.baseN.decode(input, _base58, maxline);\n};\n\n// text encoding/decoding tools\n// FIXME: Experimental. Do not use yet.\nutil.text = {\n utf8: {},\n utf16: {}\n};\n\n/**\n * Encodes the given string as UTF-8 in a Uint8Array.\n *\n * @param str the string to encode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.text.utf8.encode = function(str, output, offset) {\n str = util.encodeUtf8(str);\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length);\n }\n offset = offset || 0;\n var j = offset;\n for(var i = 0; i < str.length; ++i) {\n out[j++] = str.charCodeAt(i);\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Decodes the UTF-8 contents from a Uint8Array.\n *\n * @param bytes the Uint8Array to decode.\n *\n * @return the resulting string.\n */\nutil.text.utf8.decode = function(bytes) {\n return util.decodeUtf8(String.fromCharCode.apply(null, bytes));\n};\n\n/**\n * Encodes the given string as UTF-16 in a Uint8Array.\n *\n * @param str the string to encode.\n * @param [output] an optional Uint8Array to write the output to; if it\n * is too small, an exception will be thrown.\n * @param [offset] the start offset for writing to the output (default: 0).\n *\n * @return the Uint8Array or the number of bytes written if output was given.\n */\nutil.text.utf16.encode = function(str, output, offset) {\n var out = output;\n if(!out) {\n out = new Uint8Array(str.length * 2);\n }\n var view = new Uint16Array(out.buffer);\n offset = offset || 0;\n var j = offset;\n var k = offset;\n for(var i = 0; i < str.length; ++i) {\n view[k++] = str.charCodeAt(i);\n j += 2;\n }\n return output ? (j - offset) : out;\n};\n\n/**\n * Decodes the UTF-16 contents from a Uint8Array.\n *\n * @param bytes the Uint8Array to decode.\n *\n * @return the resulting string.\n */\nutil.text.utf16.decode = function(bytes) {\n return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer));\n};\n\n/**\n * Deflates the given data using a flash interface.\n *\n * @param api the flash interface.\n * @param bytes the data.\n * @param raw true to return only raw deflate data, false to include zlib\n * header and trailer.\n *\n * @return the deflated data as a string.\n */\nutil.deflate = function(api, bytes, raw) {\n bytes = util.decode64(api.deflate(util.encode64(bytes)).rval);\n\n // strip zlib header and trailer if necessary\n if(raw) {\n // zlib header is 2 bytes (CMF,FLG) where FLG indicates that\n // there is a 4-byte DICT (alder-32) block before the data if\n // its 5th bit is set\n var start = 2;\n var flg = bytes.charCodeAt(1);\n if(flg & 0x20) {\n start = 6;\n }\n // zlib trailer is 4 bytes of adler-32\n bytes = bytes.substring(start, bytes.length - 4);\n }\n\n return bytes;\n};\n\n/**\n * Inflates the given data using a flash interface.\n *\n * @param api the flash interface.\n * @param bytes the data.\n * @param raw true if the incoming data has no zlib header or trailer and is\n * raw DEFLATE data.\n *\n * @return the inflated data as a string, null on error.\n */\nutil.inflate = function(api, bytes, raw) {\n // TODO: add zlib header and trailer if necessary/possible\n var rval = api.inflate(util.encode64(bytes)).rval;\n return (rval === null) ? null : util.decode64(rval);\n};\n\n/**\n * Sets a storage object.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param obj the storage object, null to remove.\n */\nvar _setStorageObject = function(api, id, obj) {\n if(!api) {\n throw new Error('WebStorage not available.');\n }\n\n var rval;\n if(obj === null) {\n rval = api.removeItem(id);\n } else {\n // json-encode and base64-encode object\n obj = util.encode64(JSON.stringify(obj));\n rval = api.setItem(id, obj);\n }\n\n // handle potential flash error\n if(typeof(rval) !== 'undefined' && rval.rval !== true) {\n var error = new Error(rval.error.message);\n error.id = rval.error.id;\n error.name = rval.error.name;\n throw error;\n }\n};\n\n/**\n * Gets a storage object.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n *\n * @return the storage object entry or null if none exists.\n */\nvar _getStorageObject = function(api, id) {\n if(!api) {\n throw new Error('WebStorage not available.');\n }\n\n // get the existing entry\n var rval = api.getItem(id);\n\n /* Note: We check api.init because we can't do (api == localStorage)\n on IE because of \"Class doesn't support Automation\" exception. Only\n the flash api has an init method so this works too, but we need a\n better solution in the future. */\n\n // flash returns item wrapped in an object, handle special case\n if(api.init) {\n if(rval.rval === null) {\n if(rval.error) {\n var error = new Error(rval.error.message);\n error.id = rval.error.id;\n error.name = rval.error.name;\n throw error;\n }\n // no error, but also no item\n rval = null;\n } else {\n rval = rval.rval;\n }\n }\n\n // handle decoding\n if(rval !== null) {\n // base64-decode and json-decode data\n rval = JSON.parse(util.decode64(rval));\n }\n\n return rval;\n};\n\n/**\n * Stores an item in local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param data the data for the item (any javascript object/primitive).\n */\nvar _setItem = function(api, id, key, data) {\n // get storage object\n var obj = _getStorageObject(api, id);\n if(obj === null) {\n // create a new storage object\n obj = {};\n }\n // update key\n obj[key] = data;\n\n // set storage object\n _setStorageObject(api, id, obj);\n};\n\n/**\n * Gets an item from local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n *\n * @return the item.\n */\nvar _getItem = function(api, id, key) {\n // get storage object\n var rval = _getStorageObject(api, id);\n if(rval !== null) {\n // return data at key\n rval = (key in rval) ? rval[key] : null;\n }\n\n return rval;\n};\n\n/**\n * Removes an item from local storage.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n */\nvar _removeItem = function(api, id, key) {\n // get storage object\n var obj = _getStorageObject(api, id);\n if(obj !== null && key in obj) {\n // remove key\n delete obj[key];\n\n // see if entry has no keys remaining\n var empty = true;\n for(var prop in obj) {\n empty = false;\n break;\n }\n if(empty) {\n // remove entry entirely if no keys are left\n obj = null;\n }\n\n // set storage object\n _setStorageObject(api, id, obj);\n }\n};\n\n/**\n * Clears the local disk storage identified by the given ID.\n *\n * @param api the storage interface.\n * @param id the storage ID to use.\n */\nvar _clearItems = function(api, id) {\n _setStorageObject(api, id, null);\n};\n\n/**\n * Calls a storage function.\n *\n * @param func the function to call.\n * @param args the arguments for the function.\n * @param location the location argument.\n *\n * @return the return value from the function.\n */\nvar _callStorageFunction = function(func, args, location) {\n var rval = null;\n\n // default storage types\n if(typeof(location) === 'undefined') {\n location = ['web', 'flash'];\n }\n\n // apply storage types in order of preference\n var type;\n var done = false;\n var exception = null;\n for(var idx in location) {\n type = location[idx];\n try {\n if(type === 'flash' || type === 'both') {\n if(args[0] === null) {\n throw new Error('Flash local storage not available.');\n }\n rval = func.apply(this, args);\n done = (type === 'flash');\n }\n if(type === 'web' || type === 'both') {\n args[0] = localStorage;\n rval = func.apply(this, args);\n done = true;\n }\n } catch(ex) {\n exception = ex;\n }\n if(done) {\n break;\n }\n }\n\n if(!done) {\n throw exception;\n }\n\n return rval;\n};\n\n/**\n * Stores an item on local disk.\n *\n * The available types of local storage include 'flash', 'web', and 'both'.\n *\n * The type 'flash' refers to flash local storage (SharedObject). In order\n * to use flash local storage, the 'api' parameter must be valid. The type\n * 'web' refers to WebStorage, if supported by the browser. The type 'both'\n * refers to storing using both 'flash' and 'web', not just one or the\n * other.\n *\n * The location array should list the storage types to use in order of\n * preference:\n *\n * ['flash']: flash only storage\n * ['web']: web only storage\n * ['both']: try to store in both\n * ['flash','web']: store in flash first, but if not available, 'web'\n * ['web','flash']: store in web first, but if not available, 'flash'\n *\n * The location array defaults to: ['web', 'flash']\n *\n * @param api the flash interface, null to use only WebStorage.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param data the data for the item (any javascript object/primitive).\n * @param location an array with the preferred types of storage to use.\n */\nutil.setItem = function(api, id, key, data, location) {\n _callStorageFunction(_setItem, arguments, location);\n};\n\n/**\n * Gets an item on local disk.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface, null to use only WebStorage.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param location an array with the preferred types of storage to use.\n *\n * @return the item.\n */\nutil.getItem = function(api, id, key, location) {\n return _callStorageFunction(_getItem, arguments, location);\n};\n\n/**\n * Removes an item on local disk.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface.\n * @param id the storage ID to use.\n * @param key the key for the item.\n * @param location an array with the preferred types of storage to use.\n */\nutil.removeItem = function(api, id, key, location) {\n _callStorageFunction(_removeItem, arguments, location);\n};\n\n/**\n * Clears the local disk storage identified by the given ID.\n *\n * Set setItem() for details on storage types.\n *\n * @param api the flash interface if flash is available.\n * @param id the storage ID to use.\n * @param location an array with the preferred types of storage to use.\n */\nutil.clearItems = function(api, id, location) {\n _callStorageFunction(_clearItems, arguments, location);\n};\n\n/**\n * Parses the scheme, host, and port from an http(s) url.\n *\n * @param str the url string.\n *\n * @return the parsed url object or null if the url is invalid.\n */\nutil.parseUrl = function(str) {\n // FIXME: this regex looks a bit broken\n var regex = /^(https?):\\/\\/([^:&^\\/]*):?(\\d*)(.*)$/g;\n regex.lastIndex = 0;\n var m = regex.exec(str);\n var url = (m === null) ? null : {\n full: str,\n scheme: m[1],\n host: m[2],\n port: m[3],\n path: m[4]\n };\n if(url) {\n url.fullHost = url.host;\n if(url.port) {\n if(url.port !== 80 && url.scheme === 'http') {\n url.fullHost += ':' + url.port;\n } else if(url.port !== 443 && url.scheme === 'https') {\n url.fullHost += ':' + url.port;\n }\n } else if(url.scheme === 'http') {\n url.port = 80;\n } else if(url.scheme === 'https') {\n url.port = 443;\n }\n url.full = url.scheme + '://' + url.fullHost;\n }\n return url;\n};\n\n/* Storage for query variables */\nvar _queryVariables = null;\n\n/**\n * Returns the window location query variables. Query is parsed on the first\n * call and the same object is returned on subsequent calls. The mapping\n * is from keys to an array of values. Parameters without values will have\n * an object key set but no value added to the value array. Values are\n * unescaped.\n *\n * ...?k1=v1&k2=v2:\n * {\n * \"k1\": [\"v1\"],\n * \"k2\": [\"v2\"]\n * }\n *\n * ...?k1=v1&k1=v2:\n * {\n * \"k1\": [\"v1\", \"v2\"]\n * }\n *\n * ...?k1=v1&k2:\n * {\n * \"k1\": [\"v1\"],\n * \"k2\": []\n * }\n *\n * ...?k1=v1&k1:\n * {\n * \"k1\": [\"v1\"]\n * }\n *\n * ...?k1&k1:\n * {\n * \"k1\": []\n * }\n *\n * @param query the query string to parse (optional, default to cached\n * results from parsing window location search query).\n *\n * @return object mapping keys to variables.\n */\nutil.getQueryVariables = function(query) {\n var parse = function(q) {\n var rval = {};\n var kvpairs = q.split('&');\n for(var i = 0; i < kvpairs.length; i++) {\n var pos = kvpairs[i].indexOf('=');\n var key;\n var val;\n if(pos > 0) {\n key = kvpairs[i].substring(0, pos);\n val = kvpairs[i].substring(pos + 1);\n } else {\n key = kvpairs[i];\n val = null;\n }\n if(!(key in rval)) {\n rval[key] = [];\n }\n // disallow overriding object prototype keys\n if(!(key in Object.prototype) && val !== null) {\n rval[key].push(unescape(val));\n }\n }\n return rval;\n };\n\n var rval;\n if(typeof(query) === 'undefined') {\n // set cached variables if needed\n if(_queryVariables === null) {\n if(typeof(window) !== 'undefined' && window.location && window.location.search) {\n // parse window search query\n _queryVariables = parse(window.location.search.substring(1));\n } else {\n // no query variables available\n _queryVariables = {};\n }\n }\n rval = _queryVariables;\n } else {\n // parse given query\n rval = parse(query);\n }\n return rval;\n};\n\n/**\n * Parses a fragment into a path and query. This method will take a URI\n * fragment and break it up as if it were the main URI. For example:\n * /bar/baz?a=1&b=2\n * results in:\n * {\n * path: [\"bar\", \"baz\"],\n * query: {\"k1\": [\"v1\"], \"k2\": [\"v2\"]}\n * }\n *\n * @return object with a path array and query object.\n */\nutil.parseFragment = function(fragment) {\n // default to whole fragment\n var fp = fragment;\n var fq = '';\n // split into path and query if possible at the first '?'\n var pos = fragment.indexOf('?');\n if(pos > 0) {\n fp = fragment.substring(0, pos);\n fq = fragment.substring(pos + 1);\n }\n // split path based on '/' and ignore first element if empty\n var path = fp.split('/');\n if(path.length > 0 && path[0] === '') {\n path.shift();\n }\n // convert query into object\n var query = (fq === '') ? {} : util.getQueryVariables(fq);\n\n return {\n pathString: fp,\n queryString: fq,\n path: path,\n query: query\n };\n};\n\n/**\n * Makes a request out of a URI-like request string. This is intended to\n * be used where a fragment id (after a URI '#') is parsed as a URI with\n * path and query parts. The string should have a path beginning and\n * delimited by '/' and optional query parameters following a '?'. The\n * query should be a standard URL set of key value pairs delimited by\n * '&'. For backwards compatibility the initial '/' on the path is not\n * required. The request object has the following API, (fully described\n * in the method code):\n * {\n * path: .\n * query: ,\n * getPath(i): get part or all of the split path array,\n * getQuery(k, i): get part or all of a query key array,\n * getQueryLast(k, _default): get last element of a query key array.\n * }\n *\n * @return object with request parameters.\n */\nutil.makeRequest = function(reqString) {\n var frag = util.parseFragment(reqString);\n var req = {\n // full path string\n path: frag.pathString,\n // full query string\n query: frag.queryString,\n /**\n * Get path or element in path.\n *\n * @param i optional path index.\n *\n * @return path or part of path if i provided.\n */\n getPath: function(i) {\n return (typeof(i) === 'undefined') ? frag.path : frag.path[i];\n },\n /**\n * Get query, values for a key, or value for a key index.\n *\n * @param k optional query key.\n * @param i optional query key index.\n *\n * @return query, values for a key, or value for a key index.\n */\n getQuery: function(k, i) {\n var rval;\n if(typeof(k) === 'undefined') {\n rval = frag.query;\n } else {\n rval = frag.query[k];\n if(rval && typeof(i) !== 'undefined') {\n rval = rval[i];\n }\n }\n return rval;\n },\n getQueryLast: function(k, _default) {\n var rval;\n var vals = req.getQuery(k);\n if(vals) {\n rval = vals[vals.length - 1];\n } else {\n rval = _default;\n }\n return rval;\n }\n };\n return req;\n};\n\n/**\n * Makes a URI out of a path, an object with query parameters, and a\n * fragment. Uses jQuery.param() internally for query string creation.\n * If the path is an array, it will be joined with '/'.\n *\n * @param path string path or array of strings.\n * @param query object with query parameters. (optional)\n * @param fragment fragment string. (optional)\n *\n * @return string object with request parameters.\n */\nutil.makeLink = function(path, query, fragment) {\n // join path parts if needed\n path = jQuery.isArray(path) ? path.join('/') : path;\n\n var qstr = jQuery.param(query || {});\n fragment = fragment || '';\n return path +\n ((qstr.length > 0) ? ('?' + qstr) : '') +\n ((fragment.length > 0) ? ('#' + fragment) : '');\n};\n\n/**\n * Follows a path of keys deep into an object hierarchy and set a value.\n * If a key does not exist or it's value is not an object, create an\n * object in it's place. This can be destructive to a object tree if\n * leaf nodes are given as non-final path keys.\n * Used to avoid exceptions from missing parts of the path.\n *\n * @param object the starting object.\n * @param keys an array of string keys.\n * @param value the value to set.\n */\nutil.setPath = function(object, keys, value) {\n // need to start at an object\n if(typeof(object) === 'object' && object !== null) {\n var i = 0;\n var len = keys.length;\n while(i < len) {\n var next = keys[i++];\n if(i == len) {\n // last\n object[next] = value;\n } else {\n // more\n var hasNext = (next in object);\n if(!hasNext ||\n (hasNext && typeof(object[next]) !== 'object') ||\n (hasNext && object[next] === null)) {\n object[next] = {};\n }\n object = object[next];\n }\n }\n }\n};\n\n/**\n * Follows a path of keys deep into an object hierarchy and return a value.\n * If a key does not exist, create an object in it's place.\n * Used to avoid exceptions from missing parts of the path.\n *\n * @param object the starting object.\n * @param keys an array of string keys.\n * @param _default value to return if path not found.\n *\n * @return the value at the path if found, else default if given, else\n * undefined.\n */\nutil.getPath = function(object, keys, _default) {\n var i = 0;\n var len = keys.length;\n var hasNext = true;\n while(hasNext && i < len &&\n typeof(object) === 'object' && object !== null) {\n var next = keys[i++];\n hasNext = next in object;\n if(hasNext) {\n object = object[next];\n }\n }\n return (hasNext ? object : _default);\n};\n\n/**\n * Follow a path of keys deep into an object hierarchy and delete the\n * last one. If a key does not exist, do nothing.\n * Used to avoid exceptions from missing parts of the path.\n *\n * @param object the starting object.\n * @param keys an array of string keys.\n */\nutil.deletePath = function(object, keys) {\n // need to start at an object\n if(typeof(object) === 'object' && object !== null) {\n var i = 0;\n var len = keys.length;\n while(i < len) {\n var next = keys[i++];\n if(i == len) {\n // last\n delete object[next];\n } else {\n // more\n if(!(next in object) ||\n (typeof(object[next]) !== 'object') ||\n (object[next] === null)) {\n break;\n }\n object = object[next];\n }\n }\n }\n};\n\n/**\n * Check if an object is empty.\n *\n * Taken from:\n * http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object-from-json/679937#679937\n *\n * @param object the object to check.\n */\nutil.isEmpty = function(obj) {\n for(var prop in obj) {\n if(obj.hasOwnProperty(prop)) {\n return false;\n }\n }\n return true;\n};\n\n/**\n * Format with simple printf-style interpolation.\n *\n * %%: literal '%'\n * %s,%o: convert next argument into a string.\n *\n * @param format the string to format.\n * @param ... arguments to interpolate into the format string.\n */\nutil.format = function(format) {\n var re = /%./g;\n // current match\n var match;\n // current part\n var part;\n // current arg index\n var argi = 0;\n // collected parts to recombine later\n var parts = [];\n // last index found\n var last = 0;\n // loop while matches remain\n while((match = re.exec(format))) {\n part = format.substring(last, re.lastIndex - 2);\n // don't add empty strings (ie, parts between %s%s)\n if(part.length > 0) {\n parts.push(part);\n }\n last = re.lastIndex;\n // switch on % code\n var code = match[0][1];\n switch(code) {\n case 's':\n case 'o':\n // check if enough arguments were given\n if(argi < arguments.length) {\n parts.push(arguments[argi++ + 1]);\n } else {\n parts.push('');\n }\n break;\n // FIXME: do proper formating for numbers, etc\n //case 'f':\n //case 'd':\n case '%':\n parts.push('%');\n break;\n default:\n parts.push('<%' + code + '?>');\n }\n }\n // add trailing part of format string\n parts.push(format.substring(last));\n return parts.join('');\n};\n\n/**\n * Formats a number.\n *\n * http://snipplr.com/view/5945/javascript-numberformat--ported-from-php/\n */\nutil.formatNumber = function(number, decimals, dec_point, thousands_sep) {\n // http://kevin.vanzonneveld.net\n // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)\n // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)\n // + bugfix by: Michael White (http://crestidg.com)\n // + bugfix by: Benjamin Lupton\n // + bugfix by: Allan Jensen (http://www.winternet.no)\n // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)\n // * example 1: number_format(1234.5678, 2, '.', '');\n // * returns 1: 1234.57\n\n var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;\n var d = dec_point === undefined ? ',' : dec_point;\n var t = thousands_sep === undefined ?\n '.' : thousands_sep, s = n < 0 ? '-' : '';\n var i = parseInt((n = Math.abs(+n || 0).toFixed(c)), 10) + '';\n var j = (i.length > 3) ? i.length % 3 : 0;\n return s + (j ? i.substr(0, j) + t : '') +\n i.substr(j).replace(/(\\d{3})(?=\\d)/g, '$1' + t) +\n (c ? d + Math.abs(n - i).toFixed(c).slice(2) : '');\n};\n\n/**\n * Formats a byte size.\n *\n * http://snipplr.com/view/5949/format-humanize-file-byte-size-presentation-in-javascript/\n */\nutil.formatSize = function(size) {\n if(size >= 1073741824) {\n size = util.formatNumber(size / 1073741824, 2, '.', '') + ' GiB';\n } else if(size >= 1048576) {\n size = util.formatNumber(size / 1048576, 2, '.', '') + ' MiB';\n } else if(size >= 1024) {\n size = util.formatNumber(size / 1024, 0) + ' KiB';\n } else {\n size = util.formatNumber(size, 0) + ' bytes';\n }\n return size;\n};\n\n/**\n * Converts an IPv4 or IPv6 string representation into bytes (in network order).\n *\n * @param ip the IPv4 or IPv6 address to convert.\n *\n * @return the 4-byte IPv6 or 16-byte IPv6 address or null if the address can't\n * be parsed.\n */\nutil.bytesFromIP = function(ip) {\n if(ip.indexOf('.') !== -1) {\n return util.bytesFromIPv4(ip);\n }\n if(ip.indexOf(':') !== -1) {\n return util.bytesFromIPv6(ip);\n }\n return null;\n};\n\n/**\n * Converts an IPv4 string representation into bytes (in network order).\n *\n * @param ip the IPv4 address to convert.\n *\n * @return the 4-byte address or null if the address can't be parsed.\n */\nutil.bytesFromIPv4 = function(ip) {\n ip = ip.split('.');\n if(ip.length !== 4) {\n return null;\n }\n var b = util.createBuffer();\n for(var i = 0; i < ip.length; ++i) {\n var num = parseInt(ip[i], 10);\n if(isNaN(num)) {\n return null;\n }\n b.putByte(num);\n }\n return b.getBytes();\n};\n\n/**\n * Converts an IPv6 string representation into bytes (in network order).\n *\n * @param ip the IPv6 address to convert.\n *\n * @return the 16-byte address or null if the address can't be parsed.\n */\nutil.bytesFromIPv6 = function(ip) {\n var blanks = 0;\n ip = ip.split(':').filter(function(e) {\n if(e.length === 0) ++blanks;\n return true;\n });\n var zeros = (8 - ip.length + blanks) * 2;\n var b = util.createBuffer();\n for(var i = 0; i < 8; ++i) {\n if(!ip[i] || ip[i].length === 0) {\n b.fillWithByte(0, zeros);\n zeros = 0;\n continue;\n }\n var bytes = util.hexToBytes(ip[i]);\n if(bytes.length < 2) {\n b.putByte(0);\n }\n b.putBytes(bytes);\n }\n return b.getBytes();\n};\n\n/**\n * Converts 4-bytes into an IPv4 string representation or 16-bytes into\n * an IPv6 string representation. The bytes must be in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv4 or IPv6 string representation if 4 or 16 bytes,\n * respectively, are given, otherwise null.\n */\nutil.bytesToIP = function(bytes) {\n if(bytes.length === 4) {\n return util.bytesToIPv4(bytes);\n }\n if(bytes.length === 16) {\n return util.bytesToIPv6(bytes);\n }\n return null;\n};\n\n/**\n * Converts 4-bytes into an IPv4 string representation. The bytes must be\n * in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv4 string representation or null for an invalid # of bytes.\n */\nutil.bytesToIPv4 = function(bytes) {\n if(bytes.length !== 4) {\n return null;\n }\n var ip = [];\n for(var i = 0; i < bytes.length; ++i) {\n ip.push(bytes.charCodeAt(i));\n }\n return ip.join('.');\n};\n\n/**\n * Converts 16-bytes into an IPv16 string representation. The bytes must be\n * in network order.\n *\n * @param bytes the bytes to convert.\n *\n * @return the IPv16 string representation or null for an invalid # of bytes.\n */\nutil.bytesToIPv6 = function(bytes) {\n if(bytes.length !== 16) {\n return null;\n }\n var ip = [];\n var zeroGroups = [];\n var zeroMaxGroup = 0;\n for(var i = 0; i < bytes.length; i += 2) {\n var hex = util.bytesToHex(bytes[i] + bytes[i + 1]);\n // canonicalize zero representation\n while(hex[0] === '0' && hex !== '0') {\n hex = hex.substr(1);\n }\n if(hex === '0') {\n var last = zeroGroups[zeroGroups.length - 1];\n var idx = ip.length;\n if(!last || idx !== last.end + 1) {\n zeroGroups.push({start: idx, end: idx});\n } else {\n last.end = idx;\n if((last.end - last.start) >\n (zeroGroups[zeroMaxGroup].end - zeroGroups[zeroMaxGroup].start)) {\n zeroMaxGroup = zeroGroups.length - 1;\n }\n }\n }\n ip.push(hex);\n }\n if(zeroGroups.length > 0) {\n var group = zeroGroups[zeroMaxGroup];\n // only shorten group of length > 0\n if(group.end - group.start > 0) {\n ip.splice(group.start, group.end - group.start + 1, '');\n if(group.start === 0) {\n ip.unshift('');\n }\n if(group.end === 7) {\n ip.push('');\n }\n }\n }\n return ip.join(':');\n};\n\n/**\n * Estimates the number of processes that can be run concurrently. If\n * creating Web Workers, keep in mind that the main JavaScript process needs\n * its own core.\n *\n * @param options the options to use:\n * update true to force an update (not use the cached value).\n * @param callback(err, max) called once the operation completes.\n */\nutil.estimateCores = function(options, callback) {\n if(typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n if('cores' in util && !options.update) {\n return callback(null, util.cores);\n }\n if(typeof navigator !== 'undefined' &&\n 'hardwareConcurrency' in navigator &&\n navigator.hardwareConcurrency > 0) {\n util.cores = navigator.hardwareConcurrency;\n return callback(null, util.cores);\n }\n if(typeof Worker === 'undefined') {\n // workers not available\n util.cores = 1;\n return callback(null, util.cores);\n }\n if(typeof Blob === 'undefined') {\n // can't estimate, default to 2\n util.cores = 2;\n return callback(null, util.cores);\n }\n\n // create worker concurrency estimation code as blob\n var blobUrl = URL.createObjectURL(new Blob(['(',\n function() {\n self.addEventListener('message', function(e) {\n // run worker for 4 ms\n var st = Date.now();\n var et = st + 4;\n while(Date.now() < et);\n self.postMessage({st: st, et: et});\n });\n }.toString(),\n ')()'], {type: 'application/javascript'}));\n\n // take 5 samples using 16 workers\n sample([], 5, 16);\n\n function sample(max, samples, numWorkers) {\n if(samples === 0) {\n // get overlap average\n var avg = Math.floor(max.reduce(function(avg, x) {\n return avg + x;\n }, 0) / max.length);\n util.cores = Math.max(1, avg);\n URL.revokeObjectURL(blobUrl);\n return callback(null, util.cores);\n }\n map(numWorkers, function(err, results) {\n max.push(reduce(numWorkers, results));\n sample(max, samples - 1, numWorkers);\n });\n }\n\n function map(numWorkers, callback) {\n var workers = [];\n var results = [];\n for(var i = 0; i < numWorkers; ++i) {\n var worker = new Worker(blobUrl);\n worker.addEventListener('message', function(e) {\n results.push(e.data);\n if(results.length === numWorkers) {\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].terminate();\n }\n callback(null, results);\n }\n });\n workers.push(worker);\n }\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].postMessage(i);\n }\n }\n\n function reduce(numWorkers, results) {\n // find overlapping time windows\n var overlaps = [];\n for(var n = 0; n < numWorkers; ++n) {\n var r1 = results[n];\n var overlap = overlaps[n] = [];\n for(var i = 0; i < numWorkers; ++i) {\n if(n === i) {\n continue;\n }\n var r2 = results[i];\n if((r1.st > r2.st && r1.st < r2.et) ||\n (r2.st > r1.st && r2.st < r1.et)) {\n overlap.push(i);\n }\n }\n }\n // get maximum overlaps ... don't include overlapping worker itself\n // as the main JS process was also being scheduled during the work and\n // would have to be subtracted from the estimate anyway\n return overlaps.reduce(function(max, overlap) {\n return Math.max(max, overlap.length);\n }, 0);\n }\n};\n","'use strict'\n\nconst { Key, Errors, utils } = require('interface-datastore')\nconst { filter, map, take, sortAll } = utils\n\n/**\n * A datastore backed by leveldb.\n */\nclass LevelDatastore {\n constructor (path, opts) {\n let database\n\n if (opts && opts.db) {\n database = opts.db\n delete opts.db\n } else {\n database = require('level')\n }\n\n this.db = this._initDb(database, path, opts)\n }\n\n _initDb (database, path, opts) {\n return database(path, {\n ...opts,\n valueEncoding: 'binary',\n compression: false // same default as go\n })\n }\n\n async open () {\n try {\n await this.db.open()\n } catch (err) {\n throw Errors.dbOpenFailedError(err)\n }\n }\n\n async put (key, value) {\n try {\n await this.db.put(key.toString(), value)\n } catch (err) {\n throw Errors.dbWriteFailedError(err)\n }\n }\n\n async get (key) {\n let data\n try {\n data = await this.db.get(key.toString())\n } catch (err) {\n if (err.notFound) throw Errors.notFoundError(err)\n throw Errors.dbWriteFailedError(err)\n }\n return data\n }\n\n async has (key) {\n try {\n await this.db.get(key.toString())\n } catch (err) {\n if (err.notFound) return false\n throw err\n }\n return true\n }\n\n async delete (key) {\n try {\n await this.db.del(key.toString())\n } catch (err) {\n throw Errors.dbDeleteFailedError(err)\n }\n }\n\n close () {\n return this.db.close()\n }\n\n batch () {\n const ops = []\n return {\n put: (key, value) => {\n ops.push({\n type: 'put',\n key: key.toString(),\n value: value\n })\n },\n delete: (key) => {\n ops.push({\n type: 'del',\n key: key.toString()\n })\n },\n commit: () => {\n return this.db.batch(ops)\n }\n }\n }\n\n query (q) {\n let values = true\n if (q.keysOnly != null) {\n values = !q.keysOnly\n }\n\n const opts = {\n keys: true,\n values: values,\n keyAsBuffer: true\n }\n\n // Let the db do the prefix matching\n if (q.prefix != null) {\n const prefix = q.prefix.toString()\n // Match keys greater than or equal to `prefix` and\n opts.gte = prefix\n // less than `prefix` + \\xFF (hex escape sequence)\n opts.lt = prefix + '\\xFF'\n }\n\n let it = levelIteratorToIterator(\n this.db.iterator(opts)\n )\n\n it = map(it, ({ key, value }) => {\n const res = { key: new Key(key, false) }\n if (values) {\n res.value = Buffer.from(value)\n }\n return res\n })\n\n if (Array.isArray(q.filters)) {\n it = q.filters.reduce((it, f) => filter(it, f), it)\n }\n\n if (Array.isArray(q.orders)) {\n it = q.orders.reduce((it, f) => sortAll(it, f), it)\n }\n\n if (q.offset != null) {\n let i = 0\n it = filter(it, () => i++ >= q.offset)\n }\n\n if (q.limit != null) {\n it = take(it, q.limit)\n }\n\n return it\n }\n}\n\nfunction levelIteratorToIterator (li) {\n return {\n next: () => new Promise((resolve, reject) => {\n li.next((err, key, value) => {\n if (err) return reject(err)\n if (key == null) {\n return li.end(err => {\n if (err) return reject(err)\n resolve({ done: true })\n })\n }\n resolve({ done: false, value: { key, value } })\n })\n }),\n return: () => new Promise((resolve, reject) => {\n li.end(err => {\n if (err) return reject(err)\n resolve({ done: true })\n })\n }),\n [Symbol.asyncIterator] () {\n return this\n }\n }\n}\n\nmodule.exports = LevelDatastore\n","'use strict'\n\nconst errCode = require('err-code')\n\nconst chunkers = {\n fixed: require('../chunker/fixed-size'),\n rabin: require('../chunker/rabin')\n}\n\nmodule.exports = (type, source, options) => {\n const chunker = chunkers[type]\n\n if (!chunker) {\n throw errCode(new Error(`Unknkown chunker named ${type}`), 'ERR_UNKNOWN_CHUNKER')\n }\n\n return chunker(source, options)\n}\n","/*\nindex.js - Kademlia DHT K-bucket implementation as a binary tree.\n\nThe MIT License (MIT)\n\nCopyright (c) 2013-2018 Tristan Slominski\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n*/\n'use strict'\n\nconst randomBytes = require('randombytes')\nconst { EventEmitter } = require('events')\n\n/**\n * @param {Uint8Array} array1\n * @param {Uint8Array} array2\n * @return {Boolean}\n */\nfunction arrayEquals (array1, array2) {\n if (array1 === array2) {\n return true\n }\n if (array1.length !== array2.length) {\n return false\n }\n for (let i = 0, length = array1.length; i < length; ++i) {\n if (array1[i] !== array2[i]) {\n return false\n }\n }\n return true\n}\n\nfunction createNode () {\n return { contacts: [], dontSplit: false, left: null, right: null }\n}\n\nfunction ensureInt8 (name, val) {\n if (!(val instanceof Uint8Array)) {\n throw new TypeError(name + ' is not a Uint8Array')\n }\n}\n\n/**\n * Implementation of a Kademlia DHT k-bucket used for storing\n * contact (peer node) information.\n *\n * @extends EventEmitter\n */\nclass KBucket extends EventEmitter {\n /**\n * `options`:\n * `distance`: _Function_\n * `function (firstId, secondId) { return distance }` An optional\n * `distance` function that gets two `id` Uint8Arrays\n * and return distance (as number) between them.\n * `arbiter`: _Function_ _(Default: vectorClock arbiter)_\n * `function (incumbent, candidate) { return contact; }` An optional\n * `arbiter` function that givent two `contact` objects with the same `id`\n * returns the desired object to be used for updating the k-bucket. For\n * more details, see [arbiter function](#arbiter-function).\n * `localNodeId`: _Uint8Array_ An optional Uint8Array representing the local node id.\n * If not provided, a local node id will be created via `randomBytes(20)`.\n * `metadata`: _Object_ _(Default: {})_ Optional satellite data to include\n * with the k-bucket. `metadata` property is guaranteed not be altered by,\n * it is provided as an explicit container for users of k-bucket to store\n * implementation-specific data.\n * `numberOfNodesPerKBucket`: _Integer_ _(Default: 20)_ The number of nodes\n * that a k-bucket can contain before being full or split.\n * `numberOfNodesToPing`: _Integer_ _(Default: 3)_ The number of nodes to\n * ping when a bucket that should not be split becomes full. KBucket will\n * emit a `ping` event that contains `numberOfNodesToPing` nodes that have\n * not been contacted the longest.\n *\n * @param {Object=} options optional\n */\n constructor (options = {}) {\n super()\n\n this.localNodeId = options.localNodeId || randomBytes(20)\n this.numberOfNodesPerKBucket = options.numberOfNodesPerKBucket || 20\n this.numberOfNodesToPing = options.numberOfNodesToPing || 3\n this.distance = options.distance || KBucket.distance\n // use an arbiter from options or vectorClock arbiter by default\n this.arbiter = options.arbiter || KBucket.arbiter\n this.metadata = Object.assign({}, options.metadata)\n\n ensureInt8('option.localNodeId as parameter 1', this.localNodeId)\n\n this.root = createNode()\n }\n\n /**\n * Default arbiter function for contacts with the same id. Uses\n * contact.vectorClock to select which contact to update the k-bucket with.\n * Contact with larger vectorClock field will be selected. If vectorClock is\n * the same, candidat will be selected.\n *\n * @param {Object} incumbent Contact currently stored in the k-bucket.\n * @param {Object} candidate Contact being added to the k-bucket.\n * @return {Object} Contact to updated the k-bucket with.\n */\n static arbiter (incumbent, candidate) {\n return incumbent.vectorClock > candidate.vectorClock ? incumbent : candidate\n }\n\n /**\n * Default distance function. Finds the XOR\n * distance between firstId and secondId.\n *\n * @param {Uint8Array} firstId Uint8Array containing first id.\n * @param {Uint8Array} secondId Uint8Array containing second id.\n * @return {Number} Integer The XOR distance between firstId\n * and secondId.\n */\n static distance (firstId, secondId) {\n let distance = 0\n let i = 0\n const min = Math.min(firstId.length, secondId.length)\n const max = Math.max(firstId.length, secondId.length)\n for (; i < min; ++i) {\n distance = distance * 256 + (firstId[i] ^ secondId[i])\n }\n for (; i < max; ++i) distance = distance * 256 + 255\n return distance\n }\n\n /**\n * Adds a contact to the k-bucket.\n *\n * @param {Object} contact the contact object to add\n */\n add (contact) {\n ensureInt8('contact.id', (contact || {}).id)\n\n let bitIndex = 0\n let node = this.root\n\n while (node.contacts === null) {\n // this is not a leaf node but an inner node with 'low' and 'high'\n // branches; we will check the appropriate bit of the identifier and\n // delegate to the appropriate node for further processing\n node = this._determineNode(node, contact.id, bitIndex++)\n }\n\n // check if the contact already exists\n const index = this._indexOf(node, contact.id)\n if (index >= 0) {\n this._update(node, index, contact)\n return this\n }\n\n if (node.contacts.length < this.numberOfNodesPerKBucket) {\n node.contacts.push(contact)\n this.emit('added', contact)\n return this\n }\n\n // the bucket is full\n if (node.dontSplit) {\n // we are not allowed to split the bucket\n // we need to ping the first this.numberOfNodesToPing\n // in order to determine if they are alive\n // only if one of the pinged nodes does not respond, can the new contact\n // be added (this prevents DoS flodding with new invalid contacts)\n this.emit('ping', node.contacts.slice(0, this.numberOfNodesToPing), contact)\n return this\n }\n\n this._split(node, bitIndex)\n return this.add(contact)\n }\n\n /**\n * Get the n closest contacts to the provided node id. \"Closest\" here means:\n * closest according to the XOR metric of the contact node id.\n *\n * @param {Uint8Array} id Contact node id\n * @param {Number=} n Integer (Default: Infinity) The maximum number of\n * closest contacts to return\n * @return {Array} Array Maximum of n closest contacts to the node id\n */\n closest (id, n = Infinity) {\n ensureInt8('id', id)\n\n if ((!Number.isInteger(n) && n !== Infinity) || n <= 0) {\n throw new TypeError('n is not positive number')\n }\n\n let contacts = []\n\n for (let nodes = [ this.root ], bitIndex = 0; nodes.length > 0 && contacts.length < n;) {\n const node = nodes.pop()\n if (node.contacts === null) {\n const detNode = this._determineNode(node, id, bitIndex++)\n nodes.push(node.left === detNode ? node.right : node.left)\n nodes.push(detNode)\n } else {\n contacts = contacts.concat(node.contacts)\n }\n }\n\n return contacts\n .map(a => [this.distance(a.id, id), a])\n .sort((a, b) => a[0] - b[0])\n .slice(0, n)\n .map(a => a[1])\n }\n\n /**\n * Counts the total number of contacts in the tree.\n *\n * @return {Number} The number of contacts held in the tree\n */\n count () {\n // return this.toArray().length\n let count = 0\n for (const nodes = [ this.root ]; nodes.length > 0;) {\n const node = nodes.pop()\n if (node.contacts === null) nodes.push(node.right, node.left)\n else count += node.contacts.length\n }\n return count\n }\n\n /**\n * Determines whether the id at the bitIndex is 0 or 1.\n * Return left leaf if `id` at `bitIndex` is 0, right leaf otherwise\n *\n * @param {Object} node internal object that has 2 leafs: left and right\n * @param {Uint8Array} id Id to compare localNodeId with.\n * @param {Number} bitIndex Integer (Default: 0) The bit index to which bit\n * to check in the id Uint8Array.\n * @return {Object} left leaf if id at bitIndex is 0, right leaf otherwise.\n */\n _determineNode (node, id, bitIndex) {\n // **NOTE** remember that id is a Uint8Array and has granularity of\n // bytes (8 bits), whereas the bitIndex is the _bit_ index (not byte)\n\n // id's that are too short are put in low bucket (1 byte = 8 bits)\n // (bitIndex >> 3) finds how many bytes the bitIndex describes\n // bitIndex % 8 checks if we have extra bits beyond byte multiples\n // if number of bytes is <= no. of bytes described by bitIndex and there\n // are extra bits to consider, this means id has less bits than what\n // bitIndex describes, id therefore is too short, and will be put in low\n // bucket\n const bytesDescribedByBitIndex = bitIndex >> 3\n const bitIndexWithinByte = bitIndex % 8\n if ((id.length <= bytesDescribedByBitIndex) && (bitIndexWithinByte !== 0)) {\n return node.left\n }\n\n const byteUnderConsideration = id[bytesDescribedByBitIndex]\n\n // byteUnderConsideration is an integer from 0 to 255 represented by 8 bits\n // where 255 is 11111111 and 0 is 00000000\n // in order to find out whether the bit at bitIndexWithinByte is set\n // we construct (1 << (7 - bitIndexWithinByte)) which will consist\n // of all bits being 0, with only one bit set to 1\n // for example, if bitIndexWithinByte is 3, we will construct 00010000 by\n // (1 << (7 - 3)) -> (1 << 4) -> 16\n if (byteUnderConsideration & (1 << (7 - bitIndexWithinByte))) {\n return node.right\n }\n\n return node.left\n }\n\n /**\n * Get a contact by its exact ID.\n * If this is a leaf, loop through the bucket contents and return the correct\n * contact if we have it or null if not. If this is an inner node, determine\n * which branch of the tree to traverse and repeat.\n *\n * @param {Uint8Array} id The ID of the contact to fetch.\n * @return {Object|Null} The contact if available, otherwise null\n */\n get (id) {\n ensureInt8('id', id)\n\n let bitIndex = 0\n\n let node = this.root\n while (node.contacts === null) {\n node = this._determineNode(node, id, bitIndex++)\n }\n\n // index of uses contact id for matching\n const index = this._indexOf(node, id)\n return index >= 0 ? node.contacts[index] : null\n }\n\n /**\n * Returns the index of the contact with provided\n * id if it exists, returns -1 otherwise.\n *\n * @param {Object} node internal object that has 2 leafs: left and right\n * @param {Uint8Array} id Contact node id.\n * @return {Number} Integer Index of contact with provided id if it\n * exists, -1 otherwise.\n */\n _indexOf (node, id) {\n for (let i = 0; i < node.contacts.length; ++i) {\n if (arrayEquals(node.contacts[i].id, id)) return i\n }\n\n return -1\n }\n\n /**\n * Removes contact with the provided id.\n *\n * @param {Uint8Array} id The ID of the contact to remove.\n * @return {Object} The k-bucket itself.\n */\n remove (id) {\n ensureInt8('the id as parameter 1', id)\n\n let bitIndex = 0\n let node = this.root\n\n while (node.contacts === null) {\n node = this._determineNode(node, id, bitIndex++)\n }\n\n const index = this._indexOf(node, id)\n if (index >= 0) {\n const contact = node.contacts.splice(index, 1)[0]\n this.emit('removed', contact)\n }\n\n return this\n }\n\n /**\n * Splits the node, redistributes contacts to the new nodes, and marks the\n * node that was split as an inner node of the binary tree of nodes by\n * setting this.root.contacts = null\n *\n * @param {Object} node node for splitting\n * @param {Number} bitIndex the bitIndex to which byte to check in the\n * Uint8Array for navigating the binary tree\n */\n _split (node, bitIndex) {\n node.left = createNode()\n node.right = createNode()\n\n // redistribute existing contacts amongst the two newly created nodes\n for (const contact of node.contacts) {\n this._determineNode(node, contact.id, bitIndex).contacts.push(contact)\n }\n\n node.contacts = null // mark as inner tree node\n\n // don't split the \"far away\" node\n // we check where the local node would end up and mark the other one as\n // \"dontSplit\" (i.e. \"far away\")\n const detNode = this._determineNode(node, this.localNodeId, bitIndex)\n const otherNode = node.left === detNode ? node.right : node.left\n otherNode.dontSplit = true\n }\n\n /**\n * Returns all the contacts contained in the tree as an array.\n * If this is a leaf, return a copy of the bucket. `slice` is used so that we\n * don't accidentally leak an internal reference out that might be\n * accidentally misused. If this is not a leaf, return the union of the low\n * and high branches (themselves also as arrays).\n *\n * @return {Array} All of the contacts in the tree, as an array\n */\n toArray () {\n let result = []\n for (const nodes = [ this.root ]; nodes.length > 0;) {\n const node = nodes.pop()\n if (node.contacts === null) nodes.push(node.right, node.left)\n else result = result.concat(node.contacts)\n }\n return result\n }\n\n /**\n * Updates the contact selected by the arbiter.\n * If the selection is our old contact and the candidate is some new contact\n * then the new contact is abandoned (not added).\n * If the selection is our old contact and the candidate is our old contact\n * then we are refreshing the contact and it is marked as most recently\n * contacted (by being moved to the right/end of the bucket array).\n * If the selection is our new contact, the old contact is removed and the new\n * contact is marked as most recently contacted.\n *\n * @param {Object} node internal object that has 2 leafs: left and right\n * @param {Number} index the index in the bucket where contact exists\n * (index has already been computed in a previous\n * calculation)\n * @param {Object} contact The contact object to update.\n */\n _update (node, index, contact) {\n // sanity check\n if (!arrayEquals(node.contacts[index].id, contact.id)) {\n throw new Error('wrong index for _update')\n }\n\n const incumbent = node.contacts[index]\n const selection = this.arbiter(incumbent, contact)\n // if the selection is our old contact and the candidate is some new\n // contact, then there is nothing to do\n if (selection === incumbent && incumbent !== contact) return\n\n node.contacts.splice(index, 1) // remove old contact\n node.contacts.push(selection) // add more recent contact version\n this.emit('updated', incumbent, selection)\n }\n}\n\nmodule.exports = KBucket\n","var debug = require('debug')('simple-peer')\nvar getBrowserRTC = require('get-browser-rtc')\nvar randombytes = require('randombytes')\nvar stream = require('readable-stream')\nvar queueMicrotask = require('queue-microtask') // TODO: remove when Node 10 is not supported\n\nvar MAX_BUFFERED_AMOUNT = 64 * 1024\nvar ICECOMPLETE_TIMEOUT = 5 * 1000\nvar CHANNEL_CLOSING_TIMEOUT = 5 * 1000\n\n// HACK: Filter trickle lines when trickle is disabled #354\nfunction filterTrickle (sdp) {\n return sdp.replace(/a=ice-options:trickle\\s\\n/g, '')\n}\n\nfunction makeError (message, code) {\n var err = new Error(message)\n err.code = code\n return err\n}\n\nfunction warn (message) {\n console.warn(message)\n}\n\n/**\n * WebRTC peer connection. Same API as node core `net.Socket`, plus a few extra methods.\n * Duplex stream.\n * @param {Object} opts\n */\nclass Peer extends stream.Duplex {\n constructor (opts) {\n opts = Object.assign({\n allowHalfOpen: false\n }, opts)\n\n super(opts)\n\n this._id = randombytes(4).toString('hex').slice(0, 7)\n this._debug('new peer %o', opts)\n\n this.channelName = opts.initiator\n ? opts.channelName || randombytes(20).toString('hex')\n : null\n\n this.initiator = opts.initiator || false\n this.channelConfig = opts.channelConfig || Peer.channelConfig\n this.config = Object.assign({}, Peer.config, opts.config)\n this.offerOptions = opts.offerOptions || {}\n this.answerOptions = opts.answerOptions || {}\n this.sdpTransform = opts.sdpTransform || (sdp => sdp)\n this.streams = opts.streams || (opts.stream ? [opts.stream] : []) // support old \"stream\" option\n this.trickle = opts.trickle !== undefined ? opts.trickle : true\n this.allowHalfTrickle = opts.allowHalfTrickle !== undefined ? opts.allowHalfTrickle : false\n this.iceCompleteTimeout = opts.iceCompleteTimeout || ICECOMPLETE_TIMEOUT\n\n this.destroyed = false\n this._connected = false\n\n this.remoteAddress = undefined\n this.remoteFamily = undefined\n this.remotePort = undefined\n this.localAddress = undefined\n this.localFamily = undefined\n this.localPort = undefined\n\n this._wrtc = (opts.wrtc && typeof opts.wrtc === 'object')\n ? opts.wrtc\n : getBrowserRTC()\n\n if (!this._wrtc) {\n if (typeof window === 'undefined') {\n throw makeError('No WebRTC support: Specify `opts.wrtc` option in this environment', 'ERR_WEBRTC_SUPPORT')\n } else {\n throw makeError('No WebRTC support: Not a supported browser', 'ERR_WEBRTC_SUPPORT')\n }\n }\n\n this._pcReady = false\n this._channelReady = false\n this._iceComplete = false // ice candidate trickle done (got null candidate)\n this._iceCompleteTimer = null // send an offer/answer anyway after some timeout\n this._channel = null\n this._pendingCandidates = []\n\n this._isNegotiating = !this.initiator // is this peer waiting for negotiation to complete?\n this._batchedNegotiation = false // batch synchronous negotiations\n this._queuedNegotiation = false // is there a queued negotiation request?\n this._sendersAwaitingStable = []\n this._senderMap = new Map()\n this._firstStable = true\n this._closingInterval = null\n\n this._remoteTracks = []\n this._remoteStreams = []\n\n this._chunk = null\n this._cb = null\n this._interval = null\n\n try {\n this._pc = new (this._wrtc.RTCPeerConnection)(this.config)\n } catch (err) {\n queueMicrotask(() => this.destroy(makeError(err, 'ERR_PC_CONSTRUCTOR')))\n return\n }\n\n // We prefer feature detection whenever possible, but sometimes that's not\n // possible for certain implementations.\n this._isReactNativeWebrtc = typeof this._pc._peerConnectionId === 'number'\n\n this._pc.oniceconnectionstatechange = () => {\n this._onIceStateChange()\n }\n this._pc.onicegatheringstatechange = () => {\n this._onIceStateChange()\n }\n this._pc.onconnectionstatechange = () => {\n this._onConnectionStateChange()\n }\n this._pc.onsignalingstatechange = () => {\n this._onSignalingStateChange()\n }\n this._pc.onicecandidate = event => {\n this._onIceCandidate(event)\n }\n\n // Other spec events, unused by this implementation:\n // - onconnectionstatechange\n // - onicecandidateerror\n // - onfingerprintfailure\n // - onnegotiationneeded\n\n if (this.initiator) {\n this._setupData({\n channel: this._pc.createDataChannel(this.channelName, this.channelConfig)\n })\n } else {\n this._pc.ondatachannel = event => {\n this._setupData(event)\n }\n }\n\n if (this.streams) {\n this.streams.forEach(stream => {\n this.addStream(stream)\n })\n }\n this._pc.ontrack = event => {\n this._onTrack(event)\n }\n\n if (this.initiator) {\n this._needsNegotiation()\n }\n\n this._onFinishBound = () => {\n this._onFinish()\n }\n this.once('finish', this._onFinishBound)\n }\n\n get bufferSize () {\n return (this._channel && this._channel.bufferedAmount) || 0\n }\n\n // HACK: it's possible channel.readyState is \"closing\" before peer.destroy() fires\n // https://bugs.chromium.org/p/chromium/issues/detail?id=882743\n get connected () {\n return (this._connected && this._channel.readyState === 'open')\n }\n\n address () {\n return { port: this.localPort, family: this.localFamily, address: this.localAddress }\n }\n\n signal (data) {\n if (this.destroyed) throw makeError('cannot signal after peer is destroyed', 'ERR_SIGNALING')\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data)\n } catch (err) {\n data = {}\n }\n }\n this._debug('signal()')\n\n if (data.renegotiate && this.initiator) {\n this._debug('got request to renegotiate')\n this._needsNegotiation()\n }\n if (data.transceiverRequest && this.initiator) {\n this._debug('got request for transceiver')\n this.addTransceiver(data.transceiverRequest.kind, data.transceiverRequest.init)\n }\n if (data.candidate) {\n if (this._pc.remoteDescription && this._pc.remoteDescription.type) {\n this._addIceCandidate(data.candidate)\n } else {\n this._pendingCandidates.push(data.candidate)\n }\n }\n if (data.sdp) {\n this._pc.setRemoteDescription(new (this._wrtc.RTCSessionDescription)(data))\n .then(() => {\n if (this.destroyed) return\n\n this._pendingCandidates.forEach(candidate => {\n this._addIceCandidate(candidate)\n })\n this._pendingCandidates = []\n\n if (this._pc.remoteDescription.type === 'offer') this._createAnswer()\n })\n .catch(err => {\n this.destroy(makeError(err, 'ERR_SET_REMOTE_DESCRIPTION'))\n })\n }\n if (!data.sdp && !data.candidate && !data.renegotiate && !data.transceiverRequest) {\n this.destroy(makeError('signal() called with invalid signal data', 'ERR_SIGNALING'))\n }\n }\n\n _addIceCandidate (candidate) {\n var iceCandidateObj = new this._wrtc.RTCIceCandidate(candidate)\n this._pc.addIceCandidate(iceCandidateObj)\n .catch(err => {\n if (!iceCandidateObj.address || iceCandidateObj.address.endsWith('.local')) {\n warn('Ignoring unsupported ICE candidate.')\n } else {\n this.destroy(makeError(err, 'ERR_ADD_ICE_CANDIDATE'))\n }\n })\n }\n\n /**\n * Send text/binary data to the remote peer.\n * @param {ArrayBufferView|ArrayBuffer|Buffer|string|Blob} chunk\n */\n send (chunk) {\n this._channel.send(chunk)\n }\n\n /**\n * Add a Transceiver to the connection.\n * @param {String} kind\n * @param {Object} init\n */\n addTransceiver (kind, init) {\n this._debug('addTransceiver()')\n\n if (this.initiator) {\n try {\n this._pc.addTransceiver(kind, init)\n this._needsNegotiation()\n } catch (err) {\n this.destroy(makeError(err, 'ERR_ADD_TRANSCEIVER'))\n }\n } else {\n this.emit('signal', { // request initiator to renegotiate\n transceiverRequest: { kind, init }\n })\n }\n }\n\n /**\n * Add a MediaStream to the connection.\n * @param {MediaStream} stream\n */\n addStream (stream) {\n this._debug('addStream()')\n\n stream.getTracks().forEach(track => {\n this.addTrack(track, stream)\n })\n }\n\n /**\n * Add a MediaStreamTrack to the connection.\n * @param {MediaStreamTrack} track\n * @param {MediaStream} stream\n */\n addTrack (track, stream) {\n this._debug('addTrack()')\n\n var submap = this._senderMap.get(track) || new Map() // nested Maps map [track, stream] to sender\n var sender = submap.get(stream)\n if (!sender) {\n sender = this._pc.addTrack(track, stream)\n submap.set(stream, sender)\n this._senderMap.set(track, submap)\n this._needsNegotiation()\n } else if (sender.removed) {\n throw makeError('Track has been removed. You should enable/disable tracks that you want to re-add.', 'ERR_SENDER_REMOVED')\n } else {\n throw makeError('Track has already been added to that stream.', 'ERR_SENDER_ALREADY_ADDED')\n }\n }\n\n /**\n * Replace a MediaStreamTrack by another in the connection.\n * @param {MediaStreamTrack} oldTrack\n * @param {MediaStreamTrack} newTrack\n * @param {MediaStream} stream\n */\n replaceTrack (oldTrack, newTrack, stream) {\n this._debug('replaceTrack()')\n\n var submap = this._senderMap.get(oldTrack)\n var sender = submap ? submap.get(stream) : null\n if (!sender) {\n throw makeError('Cannot replace track that was never added.', 'ERR_TRACK_NOT_ADDED')\n }\n if (newTrack) this._senderMap.set(newTrack, submap)\n\n if (sender.replaceTrack != null) {\n sender.replaceTrack(newTrack)\n } else {\n this.destroy(makeError('replaceTrack is not supported in this browser', 'ERR_UNSUPPORTED_REPLACETRACK'))\n }\n }\n\n /**\n * Remove a MediaStreamTrack from the connection.\n * @param {MediaStreamTrack} track\n * @param {MediaStream} stream\n */\n removeTrack (track, stream) {\n this._debug('removeSender()')\n\n var submap = this._senderMap.get(track)\n var sender = submap ? submap.get(stream) : null\n if (!sender) {\n throw makeError('Cannot remove track that was never added.', 'ERR_TRACK_NOT_ADDED')\n }\n try {\n sender.removed = true\n this._pc.removeTrack(sender)\n } catch (err) {\n if (err.name === 'NS_ERROR_UNEXPECTED') {\n this._sendersAwaitingStable.push(sender) // HACK: Firefox must wait until (signalingState === stable) https://bugzilla.mozilla.org/show_bug.cgi?id=1133874\n } else {\n this.destroy(makeError(err, 'ERR_REMOVE_TRACK'))\n }\n }\n this._needsNegotiation()\n }\n\n /**\n * Remove a MediaStream from the connection.\n * @param {MediaStream} stream\n */\n removeStream (stream) {\n this._debug('removeSenders()')\n\n stream.getTracks().forEach(track => {\n this.removeTrack(track, stream)\n })\n }\n\n _needsNegotiation () {\n this._debug('_needsNegotiation')\n if (this._batchedNegotiation) return // batch synchronous renegotiations\n this._batchedNegotiation = true\n queueMicrotask(() => {\n this._batchedNegotiation = false\n this._debug('starting batched negotiation')\n this.negotiate()\n })\n }\n\n negotiate () {\n if (this.initiator) {\n if (this._isNegotiating) {\n this._queuedNegotiation = true\n this._debug('already negotiating, queueing')\n } else {\n this._debug('start negotiation')\n setTimeout(() => { // HACK: Chrome crashes if we immediately call createOffer\n this._createOffer()\n }, 0)\n }\n } else {\n if (!this._isNegotiating) {\n this._debug('requesting negotiation from initiator')\n this.emit('signal', { // request initiator to renegotiate\n renegotiate: true\n })\n }\n }\n this._isNegotiating = true\n }\n\n // TODO: Delete this method once readable-stream is updated to contain a default\n // implementation of destroy() that automatically calls _destroy()\n // See: https://github.com/nodejs/readable-stream/issues/283\n destroy (err) {\n this._destroy(err, () => {})\n }\n\n _destroy (err, cb) {\n if (this.destroyed) return\n\n this._debug('destroy (error: %s)', err && (err.message || err))\n\n this.readable = this.writable = false\n\n if (!this._readableState.ended) this.push(null)\n if (!this._writableState.finished) this.end()\n\n this.destroyed = true\n this._connected = false\n this._pcReady = false\n this._channelReady = false\n this._remoteTracks = null\n this._remoteStreams = null\n this._senderMap = null\n\n clearInterval(this._closingInterval)\n this._closingInterval = null\n\n clearInterval(this._interval)\n this._interval = null\n this._chunk = null\n this._cb = null\n\n if (this._onFinishBound) this.removeListener('finish', this._onFinishBound)\n this._onFinishBound = null\n\n if (this._channel) {\n try {\n this._channel.close()\n } catch (err) {}\n\n this._channel.onmessage = null\n this._channel.onopen = null\n this._channel.onclose = null\n this._channel.onerror = null\n }\n if (this._pc) {\n try {\n this._pc.close()\n } catch (err) {}\n\n this._pc.oniceconnectionstatechange = null\n this._pc.onicegatheringstatechange = null\n this._pc.onsignalingstatechange = null\n this._pc.onicecandidate = null\n this._pc.ontrack = null\n this._pc.ondatachannel = null\n }\n this._pc = null\n this._channel = null\n\n if (err) this.emit('error', err)\n this.emit('close')\n cb()\n }\n\n _setupData (event) {\n if (!event.channel) {\n // In some situations `pc.createDataChannel()` returns `undefined` (in wrtc),\n // which is invalid behavior. Handle it gracefully.\n // See: https://github.com/feross/simple-peer/issues/163\n return this.destroy(makeError('Data channel event is missing `channel` property', 'ERR_DATA_CHANNEL'))\n }\n\n this._channel = event.channel\n this._channel.binaryType = 'arraybuffer'\n\n if (typeof this._channel.bufferedAmountLowThreshold === 'number') {\n this._channel.bufferedAmountLowThreshold = MAX_BUFFERED_AMOUNT\n }\n\n this.channelName = this._channel.label\n\n this._channel.onmessage = event => {\n this._onChannelMessage(event)\n }\n this._channel.onbufferedamountlow = () => {\n this._onChannelBufferedAmountLow()\n }\n this._channel.onopen = () => {\n this._onChannelOpen()\n }\n this._channel.onclose = () => {\n this._onChannelClose()\n }\n this._channel.onerror = err => {\n this.destroy(makeError(err, 'ERR_DATA_CHANNEL'))\n }\n\n // HACK: Chrome will sometimes get stuck in readyState \"closing\", let's check for this condition\n // https://bugs.chromium.org/p/chromium/issues/detail?id=882743\n var isClosing = false\n this._closingInterval = setInterval(() => { // No \"onclosing\" event\n if (this._channel && this._channel.readyState === 'closing') {\n if (isClosing) this._onChannelClose() // closing timed out: equivalent to onclose firing\n isClosing = true\n } else {\n isClosing = false\n }\n }, CHANNEL_CLOSING_TIMEOUT)\n }\n\n _read () {}\n\n _write (chunk, encoding, cb) {\n if (this.destroyed) return cb(makeError('cannot write after peer is destroyed', 'ERR_DATA_CHANNEL'))\n\n if (this._connected) {\n try {\n this.send(chunk)\n } catch (err) {\n return this.destroy(makeError(err, 'ERR_DATA_CHANNEL'))\n }\n if (this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT) {\n this._debug('start backpressure: bufferedAmount %d', this._channel.bufferedAmount)\n this._cb = cb\n } else {\n cb(null)\n }\n } else {\n this._debug('write before connect')\n this._chunk = chunk\n this._cb = cb\n }\n }\n\n // When stream finishes writing, close socket. Half open connections are not\n // supported.\n _onFinish () {\n if (this.destroyed) return\n\n // Wait a bit before destroying so the socket flushes.\n // TODO: is there a more reliable way to accomplish this?\n const destroySoon = () => {\n setTimeout(() => this.destroy(), 1000)\n }\n\n if (this._connected) {\n destroySoon()\n } else {\n this.once('connect', destroySoon)\n }\n }\n\n _startIceCompleteTimeout () {\n if (this.destroyed) return\n if (this._iceCompleteTimer) return\n this._debug('started iceComplete timeout')\n this._iceCompleteTimer = setTimeout(() => {\n if (!this._iceComplete) {\n this._iceComplete = true\n this._debug('iceComplete timeout completed')\n this.emit('iceTimeout')\n this.emit('_iceComplete')\n }\n }, this.iceCompleteTimeout)\n }\n\n _createOffer () {\n if (this.destroyed) return\n\n this._pc.createOffer(this.offerOptions)\n .then(offer => {\n if (this.destroyed) return\n if (!this.trickle && !this.allowHalfTrickle) offer.sdp = filterTrickle(offer.sdp)\n offer.sdp = this.sdpTransform(offer.sdp)\n\n const sendOffer = () => {\n if (this.destroyed) return\n var signal = this._pc.localDescription || offer\n this._debug('signal')\n this.emit('signal', {\n type: signal.type,\n sdp: signal.sdp\n })\n }\n\n const onSuccess = () => {\n this._debug('createOffer success')\n if (this.destroyed) return\n if (this.trickle || this._iceComplete) sendOffer()\n else this.once('_iceComplete', sendOffer) // wait for candidates\n }\n\n const onError = err => {\n this.destroy(makeError(err, 'ERR_SET_LOCAL_DESCRIPTION'))\n }\n\n this._pc.setLocalDescription(offer)\n .then(onSuccess)\n .catch(onError)\n })\n .catch(err => {\n this.destroy(makeError(err, 'ERR_CREATE_OFFER'))\n })\n }\n\n _requestMissingTransceivers () {\n if (this._pc.getTransceivers) {\n this._pc.getTransceivers().forEach(transceiver => {\n if (!transceiver.mid && transceiver.sender.track && !transceiver.requested) {\n transceiver.requested = true // HACK: Safari returns negotiated transceivers with a null mid\n this.addTransceiver(transceiver.sender.track.kind)\n }\n })\n }\n }\n\n _createAnswer () {\n if (this.destroyed) return\n\n this._pc.createAnswer(this.answerOptions)\n .then(answer => {\n if (this.destroyed) return\n if (!this.trickle && !this.allowHalfTrickle) answer.sdp = filterTrickle(answer.sdp)\n answer.sdp = this.sdpTransform(answer.sdp)\n\n const sendAnswer = () => {\n if (this.destroyed) return\n var signal = this._pc.localDescription || answer\n this._debug('signal')\n this.emit('signal', {\n type: signal.type,\n sdp: signal.sdp\n })\n if (!this.initiator) this._requestMissingTransceivers()\n }\n\n const onSuccess = () => {\n if (this.destroyed) return\n if (this.trickle || this._iceComplete) sendAnswer()\n else this.once('_iceComplete', sendAnswer)\n }\n\n const onError = err => {\n this.destroy(makeError(err, 'ERR_SET_LOCAL_DESCRIPTION'))\n }\n\n this._pc.setLocalDescription(answer)\n .then(onSuccess)\n .catch(onError)\n })\n .catch(err => {\n this.destroy(makeError(err, 'ERR_CREATE_ANSWER'))\n })\n }\n\n _onConnectionStateChange () {\n if (this.destroyed) return\n if (this._pc.connectionState === 'failed') {\n this.destroy(makeError('Connection failed.', 'ERR_CONNECTION_FAILURE'))\n }\n }\n\n _onIceStateChange () {\n if (this.destroyed) return\n var iceConnectionState = this._pc.iceConnectionState\n var iceGatheringState = this._pc.iceGatheringState\n\n this._debug(\n 'iceStateChange (connection: %s) (gathering: %s)',\n iceConnectionState,\n iceGatheringState\n )\n this.emit('iceStateChange', iceConnectionState, iceGatheringState)\n\n if (iceConnectionState === 'connected' || iceConnectionState === 'completed') {\n this._pcReady = true\n this._maybeReady()\n }\n if (iceConnectionState === 'failed') {\n this.destroy(makeError('Ice connection failed.', 'ERR_ICE_CONNECTION_FAILURE'))\n }\n if (iceConnectionState === 'closed') {\n this.destroy(makeError('Ice connection closed.', 'ERR_ICE_CONNECTION_CLOSED'))\n }\n }\n\n getStats (cb) {\n // statreports can come with a value array instead of properties\n const flattenValues = report => {\n if (Object.prototype.toString.call(report.values) === '[object Array]') {\n report.values.forEach(value => {\n Object.assign(report, value)\n })\n }\n return report\n }\n\n // Promise-based getStats() (standard)\n if (this._pc.getStats.length === 0 || this._isReactNativeWebrtc) {\n this._pc.getStats()\n .then(res => {\n var reports = []\n res.forEach(report => {\n reports.push(flattenValues(report))\n })\n cb(null, reports)\n }, err => cb(err))\n\n // Single-parameter callback-based getStats() (non-standard)\n } else if (this._pc.getStats.length > 0) {\n this._pc.getStats(res => {\n // If we destroy connection in `connect` callback this code might happen to run when actual connection is already closed\n if (this.destroyed) return\n\n var reports = []\n res.result().forEach(result => {\n var report = {}\n result.names().forEach(name => {\n report[name] = result.stat(name)\n })\n report.id = result.id\n report.type = result.type\n report.timestamp = result.timestamp\n reports.push(flattenValues(report))\n })\n cb(null, reports)\n }, err => cb(err))\n\n // Unknown browser, skip getStats() since it's anyone's guess which style of\n // getStats() they implement.\n } else {\n cb(null, [])\n }\n }\n\n _maybeReady () {\n this._debug('maybeReady pc %s channel %s', this._pcReady, this._channelReady)\n if (this._connected || this._connecting || !this._pcReady || !this._channelReady) return\n\n this._connecting = true\n\n // HACK: We can't rely on order here, for details see https://github.com/js-platform/node-webrtc/issues/339\n const findCandidatePair = () => {\n if (this.destroyed) return\n\n this.getStats((err, items) => {\n if (this.destroyed) return\n\n // Treat getStats error as non-fatal. It's not essential.\n if (err) items = []\n\n var remoteCandidates = {}\n var localCandidates = {}\n var candidatePairs = {}\n var foundSelectedCandidatePair = false\n\n items.forEach(item => {\n // TODO: Once all browsers support the hyphenated stats report types, remove\n // the non-hypenated ones\n if (item.type === 'remotecandidate' || item.type === 'remote-candidate') {\n remoteCandidates[item.id] = item\n }\n if (item.type === 'localcandidate' || item.type === 'local-candidate') {\n localCandidates[item.id] = item\n }\n if (item.type === 'candidatepair' || item.type === 'candidate-pair') {\n candidatePairs[item.id] = item\n }\n })\n\n const setSelectedCandidatePair = selectedCandidatePair => {\n foundSelectedCandidatePair = true\n\n var local = localCandidates[selectedCandidatePair.localCandidateId]\n\n if (local && (local.ip || local.address)) {\n // Spec\n this.localAddress = local.ip || local.address\n this.localPort = Number(local.port)\n } else if (local && local.ipAddress) {\n // Firefox\n this.localAddress = local.ipAddress\n this.localPort = Number(local.portNumber)\n } else if (typeof selectedCandidatePair.googLocalAddress === 'string') {\n // TODO: remove this once Chrome 58 is released\n local = selectedCandidatePair.googLocalAddress.split(':')\n this.localAddress = local[0]\n this.localPort = Number(local[1])\n }\n if (this.localAddress) {\n this.localFamily = this.localAddress.includes(':') ? 'IPv6' : 'IPv4'\n }\n\n var remote = remoteCandidates[selectedCandidatePair.remoteCandidateId]\n\n if (remote && (remote.ip || remote.address)) {\n // Spec\n this.remoteAddress = remote.ip || remote.address\n this.remotePort = Number(remote.port)\n } else if (remote && remote.ipAddress) {\n // Firefox\n this.remoteAddress = remote.ipAddress\n this.remotePort = Number(remote.portNumber)\n } else if (typeof selectedCandidatePair.googRemoteAddress === 'string') {\n // TODO: remove this once Chrome 58 is released\n remote = selectedCandidatePair.googRemoteAddress.split(':')\n this.remoteAddress = remote[0]\n this.remotePort = Number(remote[1])\n }\n if (this.remoteAddress) {\n this.remoteFamily = this.remoteAddress.includes(':') ? 'IPv6' : 'IPv4'\n }\n\n this._debug(\n 'connect local: %s:%s remote: %s:%s',\n this.localAddress, this.localPort, this.remoteAddress, this.remotePort\n )\n }\n\n items.forEach(item => {\n // Spec-compliant\n if (item.type === 'transport' && item.selectedCandidatePairId) {\n setSelectedCandidatePair(candidatePairs[item.selectedCandidatePairId])\n }\n\n // Old implementations\n if (\n (item.type === 'googCandidatePair' && item.googActiveConnection === 'true') ||\n ((item.type === 'candidatepair' || item.type === 'candidate-pair') && item.selected)\n ) {\n setSelectedCandidatePair(item)\n }\n })\n\n // Ignore candidate pair selection in browsers like Safari 11 that do not have any local or remote candidates\n // But wait until at least 1 candidate pair is available\n if (!foundSelectedCandidatePair && (!Object.keys(candidatePairs).length || Object.keys(localCandidates).length)) {\n setTimeout(findCandidatePair, 100)\n return\n } else {\n this._connecting = false\n this._connected = true\n }\n\n if (this._chunk) {\n try {\n this.send(this._chunk)\n } catch (err) {\n return this.destroy(makeError(err, 'ERR_DATA_CHANNEL'))\n }\n this._chunk = null\n this._debug('sent chunk from \"write before connect\"')\n\n var cb = this._cb\n this._cb = null\n cb(null)\n }\n\n // If `bufferedAmountLowThreshold` and 'onbufferedamountlow' are unsupported,\n // fallback to using setInterval to implement backpressure.\n if (typeof this._channel.bufferedAmountLowThreshold !== 'number') {\n this._interval = setInterval(() => this._onInterval(), 150)\n if (this._interval.unref) this._interval.unref()\n }\n\n this._debug('connect')\n this.emit('connect')\n })\n }\n findCandidatePair()\n }\n\n _onInterval () {\n if (!this._cb || !this._channel || this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT) {\n return\n }\n this._onChannelBufferedAmountLow()\n }\n\n _onSignalingStateChange () {\n if (this.destroyed) return\n\n if (this._pc.signalingState === 'stable' && !this._firstStable) {\n this._isNegotiating = false\n\n // HACK: Firefox doesn't yet support removing tracks when signalingState !== 'stable'\n this._debug('flushing sender queue', this._sendersAwaitingStable)\n this._sendersAwaitingStable.forEach(sender => {\n this._pc.removeTrack(sender)\n this._queuedNegotiation = true\n })\n this._sendersAwaitingStable = []\n\n if (this._queuedNegotiation) {\n this._debug('flushing negotiation queue')\n this._queuedNegotiation = false\n this._needsNegotiation() // negotiate again\n }\n\n this._debug('negotiate')\n this.emit('negotiate')\n }\n this._firstStable = false\n\n this._debug('signalingStateChange %s', this._pc.signalingState)\n this.emit('signalingStateChange', this._pc.signalingState)\n }\n\n _onIceCandidate (event) {\n if (this.destroyed) return\n if (event.candidate && this.trickle) {\n this.emit('signal', {\n candidate: {\n candidate: event.candidate.candidate,\n sdpMLineIndex: event.candidate.sdpMLineIndex,\n sdpMid: event.candidate.sdpMid\n }\n })\n } else if (!event.candidate && !this._iceComplete) {\n this._iceComplete = true\n this.emit('_iceComplete')\n }\n // as soon as we've received one valid candidate start timeout\n if (event.candidate) {\n this._startIceCompleteTimeout()\n }\n }\n\n _onChannelMessage (event) {\n if (this.destroyed) return\n var data = event.data\n if (data instanceof ArrayBuffer) data = Buffer.from(data)\n this.push(data)\n }\n\n _onChannelBufferedAmountLow () {\n if (this.destroyed || !this._cb) return\n this._debug('ending backpressure: bufferedAmount %d', this._channel.bufferedAmount)\n var cb = this._cb\n this._cb = null\n cb(null)\n }\n\n _onChannelOpen () {\n if (this._connected || this.destroyed) return\n this._debug('on channel open')\n this._channelReady = true\n this._maybeReady()\n }\n\n _onChannelClose () {\n if (this.destroyed) return\n this._debug('on channel close')\n this.destroy()\n }\n\n _onTrack (event) {\n if (this.destroyed) return\n\n event.streams.forEach(eventStream => {\n this._debug('on track')\n this.emit('track', event.track, eventStream)\n\n this._remoteTracks.push({\n track: event.track,\n stream: eventStream\n })\n\n if (this._remoteStreams.some(remoteStream => {\n return remoteStream.id === eventStream.id\n })) return // Only fire one 'stream' event, even though there may be multiple tracks per stream\n\n this._remoteStreams.push(eventStream)\n queueMicrotask(() => {\n this.emit('stream', eventStream) // ensure all tracks have been added\n })\n })\n }\n\n _debug () {\n var args = [].slice.call(arguments)\n args[0] = '[' + this._id + '] ' + args[0]\n debug.apply(null, args)\n }\n}\n\nPeer.WEBRTC_SUPPORT = !!getBrowserRTC()\n\n/**\n * Expose peer and data channel config for overriding all Peer\n * instances. Otherwise, just set opts.config or opts.channelConfig\n * when constructing a Peer.\n */\nPeer.config = {\n iceServers: [\n {\n urls: 'stun:stun.l.google.com:19302'\n },\n {\n urls: 'stun:global.stun.twilio.com:3478?transport=udp'\n }\n ],\n sdpSemantics: 'unified-plan'\n}\n\nPeer.channelConfig = {}\n\nmodule.exports = Peer\n","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _regenerator = _interopRequireDefault(require(\"@babel/runtime/regenerator\"));\n\nvar _asyncToGenerator2 = _interopRequireDefault(require(\"@babel/runtime/helpers/asyncToGenerator\"));\n\nvar _tweetnacl = _interopRequireDefault(require(\"tweetnacl\"));\n\nvar _tweetnaclUtil = _interopRequireDefault(require(\"tweetnacl-util\"));\n\nfunction encodeBase64Url(data) {\n return _tweetnaclUtil.default.encodeBase64(data).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n}\n/**\n* The NaclSigner returns a configured function for signing data using the Ed25519 algorithm. It also defines\n* an interface that you can also implement yourself and use in our other modules.\n*\n* The signing function itself takes the data as a string parameter and returls a base64Url encoded signature\n*\n* @example\n* const signer = NaclSigner(process.env.PRIVATE_KEY)\n* signer(data, (err, signature) => {\n* ...\n* })\n*\n* @param {String} base64PrivateKey a 64 byte base64 encoded private key\n* @return {Function} a configured signer function\n*/\n\n\nfunction NaclSigner(base64PrivateKey) {\n var privateKey = _tweetnaclUtil.default.decodeBase64(base64PrivateKey);\n\n return (\n /*#__PURE__*/\n function () {\n var _ref = (0, _asyncToGenerator2.default)(\n /*#__PURE__*/\n _regenerator.default.mark(function _callee(data) {\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", encodeBase64Url(_tweetnacl.default.sign.detached(_tweetnaclUtil.default.decodeUTF8(data), privateKey)));\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }()\n );\n}\n\nmodule.exports = NaclSigner;","'use strict'\n\nconst applyDefaultOptions = require('./utils/apply-default-options')\nconst toMfsPath = require('./utils/to-mfs-path')\nconst exporter = require('ipfs-unixfs-exporter')\nconst log = require('debug')('ipfs:mfs:stat')\nconst errCode = require('err-code')\n\nconst defaultOptions = {\n withLocal: false\n}\n\nmodule.exports = (context) => {\n return async function mfsStat (path, options) {\n options = applyDefaultOptions(options, defaultOptions)\n\n log(`Fetching stats for ${path}`)\n\n const {\n type,\n cid,\n mfsPath\n } = await toMfsPath(context, path)\n\n const exportPath = type === 'ipfs' && cid ? cid : mfsPath\n let file\n\n try {\n file = await exporter(exportPath, context.ipld)\n } catch (err) {\n if (err.code === 'ERR_NOT_FOUND') {\n throw errCode(new Error(`${path} does not exist`), 'ERR_NOT_FOUND')\n }\n\n throw err\n }\n\n if (!statters[file.cid.codec]) {\n throw new Error(`Cannot stat codec ${file.cid.codec}`)\n }\n\n return statters[file.cid.codec](file, options)\n }\n}\n\nconst statters = {\n raw: (file) => {\n return {\n cid: file.cid,\n size: file.node.length,\n cumulativeSize: file.node.length,\n blocks: 0,\n type: 'file', // for go compatibility\n local: undefined,\n sizeLocal: undefined,\n withLocality: false\n }\n },\n 'dag-pb': (file) => {\n let blocks = file.node.Links.length\n let size = file.node.size\n let cumulativeSize = file.node.size\n let nodeType = null\n\n if (file.unixfs) {\n size = file.unixfs.fileSize()\n nodeType = file.unixfs.type\n\n if (nodeType.includes('directory')) {\n size = 0\n cumulativeSize = file.node.size\n }\n\n if (nodeType === 'file') {\n blocks = file.unixfs.blockSizes.length\n }\n }\n\n return {\n cid: file.cid,\n size: size,\n cumulativeSize: cumulativeSize,\n blocks: blocks,\n type: nodeType,\n local: undefined,\n sizeLocal: undefined,\n withLocality: false\n }\n },\n 'dag-cbor': (file) => {\n return {\n cid: file.cid,\n local: undefined,\n sizeLocal: undefined,\n withLocality: false\n }\n }\n}\n","'use strict'\n\nconst { Buffer } = require('buffer')\nconst blake = require('blakejs')\n\nconst minB = 0xb201\nconst minS = 0xb241\n\nconst blake2b = {\n init: blake.blake2bInit,\n update: blake.blake2bUpdate,\n digest: blake.blake2bFinal\n}\n\nconst blake2s = {\n init: blake.blake2sInit,\n update: blake.blake2sUpdate,\n digest: blake.blake2sFinal\n}\n\n// Note that although this function doesn't do any asynchronous work, we mark\n// the function as async because it must return a Promise to match the API\n// for other functions that do perform asynchronous work (see sha.browser.js)\nconst makeB2Hash = (size, hf) => async (data) => {\n const ctx = hf.init(size, null)\n hf.update(ctx, data)\n return Buffer.from(hf.digest(ctx))\n}\n\nmodule.exports = (table) => {\n for (let i = 0; i < 64; i++) {\n table[minB + i] = makeB2Hash(i + 1, blake2b)\n }\n for (let i = 0; i < 32; i++) {\n table[minS + i] = makeB2Hash(i + 1, blake2s)\n }\n}\n","'use strict'\n\nconst protobuf = require('protons')\nconst keysPBM = protobuf(require('./keys.proto'))\nrequire('node-forge/lib/asn1')\nrequire('node-forge/lib/rsa')\nrequire('node-forge/lib/pbe')\nconst forge = require('node-forge/lib/forge')\n\nexports = module.exports\n\nconst supportedKeys = {\n rsa: require('./rsa-class'),\n ed25519: require('./ed25519-class'),\n secp256k1: require('libp2p-crypto-secp256k1')(keysPBM, require('../random-bytes'))\n}\n\nexports.supportedKeys = supportedKeys\nexports.keysPBM = keysPBM\n\nfunction isValidKeyType (keyType) {\n const key = supportedKeys[keyType.toLowerCase()]\n return key !== undefined\n}\n\nexports.keyStretcher = require('./key-stretcher')\nexports.generateEphemeralKeyPair = require('./ephemeral-keys')\n\n// Generates a keypair of the given type and bitsize\nexports.generateKeyPair = (type, bits, cb) => {\n const key = supportedKeys[type.toLowerCase()]\n\n if (!key) {\n return cb(new Error('invalid or unsupported key type'))\n }\n\n key.generateKeyPair(bits, cb)\n}\n\n// Generates a keypair of the given type and bitsize\n// seed is a 32 byte uint8array\nexports.generateKeyPairFromSeed = (type, seed, bits, cb) => {\n const key = supportedKeys[type.toLowerCase()]\n if (!key) {\n return cb(new Error('invalid or unsupported key type'))\n }\n if (type.toLowerCase() !== 'ed25519') {\n return cb(new Error('Seed key derivation is unimplemented for RSA or secp256k1'))\n }\n key.generateKeyPairFromSeed(seed, bits, cb)\n}\n\n// Converts a protobuf serialized public key into its\n// representative object\nexports.unmarshalPublicKey = (buf) => {\n const decoded = keysPBM.PublicKey.decode(buf)\n const data = decoded.Data\n\n switch (decoded.Type) {\n case keysPBM.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPublicKey(data)\n case keysPBM.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PublicKey(data)\n case keysPBM.KeyType.Secp256k1:\n if (supportedKeys.secp256k1) {\n return supportedKeys.secp256k1.unmarshalSecp256k1PublicKey(data)\n } else {\n throw new Error('secp256k1 support requires libp2p-crypto-secp256k1 package')\n }\n default:\n throw new Error('invalid or unsupported key type')\n }\n}\n\n// Converts a public key object into a protobuf serialized public key\nexports.marshalPublicKey = (key, type) => {\n type = (type || 'rsa').toLowerCase()\n if (!isValidKeyType(type)) {\n throw new Error('invalid or unsupported key type')\n }\n\n return key.bytes\n}\n\n// Converts a protobuf serialized private key into its\n// representative object\nexports.unmarshalPrivateKey = (buf, callback) => {\n let decoded\n try {\n decoded = keysPBM.PrivateKey.decode(buf)\n } catch (err) {\n return callback(err)\n }\n\n const data = decoded.Data\n\n switch (decoded.Type) {\n case keysPBM.KeyType.RSA:\n return supportedKeys.rsa.unmarshalRsaPrivateKey(data, callback)\n case keysPBM.KeyType.Ed25519:\n return supportedKeys.ed25519.unmarshalEd25519PrivateKey(data, callback)\n case keysPBM.KeyType.Secp256k1:\n if (supportedKeys.secp256k1) {\n return supportedKeys.secp256k1.unmarshalSecp256k1PrivateKey(data, callback)\n } else {\n return callback(new Error('secp256k1 support requires libp2p-crypto-secp256k1 package'))\n }\n default:\n callback(new Error('invalid or unsupported key type'))\n }\n}\n\n// Converts a private key object into a protobuf serialized private key\nexports.marshalPrivateKey = (key, type) => {\n type = (type || 'rsa').toLowerCase()\n if (!isValidKeyType(type)) {\n throw new Error('invalid or unsupported key type')\n }\n\n return key.bytes\n}\n\nexports.import = (pem, password, callback) => {\n try {\n const key = forge.pki.decryptRsaPrivateKey(pem, password)\n if (key === null) {\n throw new Error('Cannot read the key, most likely the password is wrong or not a RSA key')\n }\n let der = forge.asn1.toDer(forge.pki.privateKeyToAsn1(key))\n der = Buffer.from(der.getBytes(), 'binary')\n return supportedKeys.rsa.unmarshalRsaPrivateKey(der, callback)\n } catch (err) {\n callback(err)\n }\n}\n","'use strict';\n\nvar generate = require('./generate');\nvar alphabet = require('./alphabet');\n\n// Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness.\n// This number should be updated every year or so to keep the generated id short.\n// To regenerate `new Date() - 0` and bump the version. Always bump the version!\nvar REDUCE_TIME = 1567752802062;\n\n// don't change unless we change the algos or REDUCE_TIME\n// must be an integer and less than 16\nvar version = 7;\n\n// Counter is used when shortid is called multiple times in one second.\nvar counter;\n\n// Remember the last time shortid was called in case counter is needed.\nvar previousSeconds;\n\n/**\n * Generate unique id\n * Returns string id\n */\nfunction build(clusterWorkerId) {\n var str = '';\n\n var seconds = Math.floor((Date.now() - REDUCE_TIME) * 0.001);\n\n if (seconds === previousSeconds) {\n counter++;\n } else {\n counter = 0;\n previousSeconds = seconds;\n }\n\n str = str + generate(version);\n str = str + generate(clusterWorkerId);\n if (counter > 0) {\n str = str + generate(counter);\n }\n str = str + generate(seconds);\n return str;\n}\n\nmodule.exports = build;\n","var Transform = require('readable-stream').Transform\n , inherits = require('util').inherits\n\nfunction DestroyableTransform(opts) {\n Transform.call(this, opts)\n this._destroyed = false\n}\n\ninherits(DestroyableTransform, Transform)\n\nDestroyableTransform.prototype.destroy = function(err) {\n if (this._destroyed) return\n this._destroyed = true\n \n var self = this\n process.nextTick(function() {\n if (err)\n self.emit('error', err)\n self.emit('close')\n })\n}\n\n// a noop _transform function\nfunction noop (chunk, enc, callback) {\n callback(null, chunk)\n}\n\n\n// create a new export function, used by both the main export and\n// the .ctor export, contains common logic for dealing with arguments\nfunction through2 (construct) {\n return function (options, transform, flush) {\n if (typeof options == 'function') {\n flush = transform\n transform = options\n options = {}\n }\n\n if (typeof transform != 'function')\n transform = noop\n\n if (typeof flush != 'function')\n flush = null\n\n return construct(options, transform, flush)\n }\n}\n\n\n// main export, just make me a transform stream!\nmodule.exports = through2(function (options, transform, flush) {\n var t2 = new DestroyableTransform(options)\n\n t2._transform = transform\n\n if (flush)\n t2._flush = flush\n\n return t2\n})\n\n\n// make me a reusable prototype that I can `new`, or implicitly `new`\n// with a constructor call\nmodule.exports.ctor = through2(function (options, transform, flush) {\n function Through2 (override) {\n if (!(this instanceof Through2))\n return new Through2(override)\n\n this.options = Object.assign({}, options, override)\n\n DestroyableTransform.call(this, this.options)\n }\n\n inherits(Through2, DestroyableTransform)\n\n Through2.prototype._transform = transform\n\n if (flush)\n Through2.prototype._flush = flush\n\n return Through2\n})\n\n\nmodule.exports.obj = through2(function (options, transform, flush) {\n var t2 = new DestroyableTransform(Object.assign({ objectMode: true, highWaterMark: 16 }, options))\n\n t2._transform = transform\n\n if (flush)\n t2._flush = flush\n\n return t2\n})\n","'use strict'\n\nconst errCode = require('err-code')\n\nconst validateOffsetAndLength = (size, offset, length) => {\n if (!offset) {\n offset = 0\n }\n\n if (offset < 0) {\n throw errCode(new Error('Offset must be greater than or equal to 0'), 'ERR_INVALID_PARAMS')\n }\n\n if (offset > size) {\n throw errCode(new Error('Offset must be less than the file size'), 'ERR_INVALID_PARAMS')\n }\n\n if (!length && length !== 0) {\n length = size - offset\n }\n\n if (length < 0) {\n throw errCode(new Error('Length must be greater than or equal to 0'), 'ERR_INVALID_PARAMS')\n }\n\n if (offset + length > size) {\n length = size - offset\n }\n\n return {\n offset,\n length\n }\n}\n\nmodule.exports = validateOffsetAndLength\n","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a ","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Tests.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Tests.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Tests.vue?vue&type=template&id=99502d6a&\"\nimport script from \"./Tests.vue?vue&type=script&lang=js&\"\nexport * from \"./Tests.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","import mod from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Navbar.vue?vue&type=style&index=0&lang=scss&\"; export default mod; export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Navbar.vue?vue&type=style&index=0&lang=scss&\"","import Vue from 'vue'\nimport Vuex from 'vuex'\n\nVue.use(Vuex)\n\nexport default new Vuex.Store({\n state: {\n ethPrice: null,\n tokenPriceEth: null,\n user: {\n provider: null,\n // walletAddress: \"0xE0EC61841FCAf59c6650E5F9675345a10F9e31B9\"\n walletAddress: \"Connect Wallet\"\n }\n },\n mutations: {\n setEthPrice(state, price) {\n state.ethPrice = price;\n },\n setTokenPriceEth(state, priceEth) {\n state.tokenPriceEth = priceEth;\n },\n setProvider(state, provider) {\n state.user.provider = provider;\n },\n setUserWalletAddress(state, walletAddress) {\n state.user.walletAddress = walletAddress;\n }\n }\n})\n","module.exports = __webpack_public_path__ + \"img/boundLogo.62253b94.svg\";","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"app\"}},[_c('Navbar'),_c('div',{attrs:{\"id\":\"content\"}},[_c('router-view')],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"navbar\"}},[_c('router-link',{attrs:{\"to\":\"/\"}},[_c('img',{attrs:{\"src\":require(\"../assets/boundLogo.svg\"),\"id\":\"logo\"}})]),_c('Wallet')],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"wallet\"},on:{\"click\":_vm.connectWallet}},[(_vm.address == 'Connect Wallet')?_c('div',{staticClass:\"dot red\"}):_c('div',{staticClass:\"dot green\"}),_c('p',[_vm._v(_vm._s(_vm.trimmedAddress))])])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Wallet.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Wallet.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Wallet.vue?vue&type=template&id=775c479b&\"\nimport script from \"./Wallet.vue?vue&type=script&lang=js&\"\nexport * from \"./Wallet.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Wallet.vue?vue&type=style&index=0&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Navbar.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Navbar.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Navbar.vue?vue&type=template&id=3e656ca5&\"\nimport script from \"./Navbar.vue?vue&type=script&lang=js&\"\nexport * from \"./Navbar.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Navbar.vue?vue&type=style&index=0&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","\n\n\n\n\n","import mod from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./App.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./App.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./App.vue?vue&type=template&id=a2040af2&\"\nimport script from \"./App.vue?vue&type=script&lang=js&\"\nexport * from \"./App.vue?vue&type=script&lang=js&\"\nimport style0 from \"./App.vue?vue&type=style&index=0&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"home\"},[_c('div',{attrs:{\"id\":\"card-grid\"}},[_c('router-link',{attrs:{\"to\":\"/artist\"}},[_c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://factmag-images.s3.amazonaws.com/wp-content/uploads/2016/05/Kaytranada_photoCarysHuws2a-1200x630.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Kaytranada\")])])]),_vm._m(0),_vm._m(1),_vm._m(2),_vm._m(3),_vm._m(4),_vm._m(5),_vm._m(6),_vm._m(7),_vm._m(8),_vm._m(9),_vm._m(10)],1)])}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://ichef.bbci.co.uk/images/ic/960x540/p041b0zn.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Khraungbin\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"http://indietronica.org/wp-content/uploads/2016/11/Joe-Hertz-1024x575.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Joe Hertz\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"http://assets.nydailynews.com/polopoly_fs/1.1109050.1341595620!/img/httpImage/image.jpg_gen/derivatives/article_1200/ocean7f-1-web.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Frank Ocean\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://media.newyorker.com/photos/590973c88b51cf59fc422ca3/16:9/w_1200,h_630,c_limit/160208_r27647.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Madlib\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://spiritualityhealth.com/assets/images/Articles/_articleSummaryImage/PhilipGlass_CreditStevePyke.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Philip Glass\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"http://www.self-titledmag.com/wp-content/uploads/2018/04/Brian-Eno-2-2-1024x684.jpeg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Brian Eno\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://i1.sndcdn.com/avatars-000001254237-bhfhsf-t500x500.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Vanilla\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://images.sxsw.com/kIPuU7_nbeqAXfafzOZFBxG8CSU=/0x823:4912x4332/950x0/images.sxsw.com/3/31fcc915-eb7b-44dd-ad91-032b41e23818/artist-10900\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Sam Gellaitry\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://i.ytimg.com/vi/vS4F8Yoto6A/maxresdefault.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Men I Trust\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://itswide.com/wp-content/uploads/2018/07/descarga.jpeg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"Melo-Zed\")])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"card\"},[_c('img',{attrs:{\"id\":\"artist-img\",\"src\":\"https://lastfm.freetls.fastly.net/i/u/ar0/62d210110f96883a691fd1109b93068d.jpg\"}}),_c('p',{staticClass:\"artist-name\"},[_vm._v(\"HM Surf\")])])}]\n\nexport { render, staticRenderFns }","\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Home.vue?vue&type=template&id=73b6502a&scoped=true&\"\nimport script from \"./Home.vue?vue&type=script&lang=js&\"\nexport * from \"./Home.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Home.vue?vue&type=style&index=0&id=73b6502a&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"73b6502a\",\n null\n \n)\n\nexport default component.exports","import Vue from 'vue'\nimport VueRouter from 'vue-router'\nimport Home from '../views/Home.vue'\n\nVue.use(VueRouter)\n\nconst routes = [\n {\n path: '/',\n name: 'Home',\n component: Home\n },\n {\n path: '/artist',\n name: 'ArtistPage',\n // route level code-splitting\n // this generates a separate chunk (about.[hash].js) for this route\n // which is lazy-loaded when the route is visited.\n component: () => import(/* webpackChunkName: \"ArtistPage\" */ '../views/ArtistPage.vue')\n }\n]\n\nconst router = new VueRouter({\n mode: 'history',\n base: process.env.BASE_URL,\n routes\n})\n\nexport default router\n","import Vue from 'vue'\nimport App from './App.vue'\nimport router from './router'\nimport store from './store'\n\nVue.config.productionTip = false\n\nnew Vue({\n router,\n store,\n render: h => h(App)\n}).$mount('#app')\n","import mod from \"-!../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./App.vue?vue&type=style&index=0&lang=scss&\"; export default mod; export * from \"-!../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./App.vue?vue&type=style&index=0&lang=scss&\"","import Fortmatic from 'fortmatic';\nimport Web3 from \"web3\";\n\nconst customNodeOptions = {\n rpcUrl: 'http://127.0.0.1:7545',//, // your own node url\n chainId: 5777 // chainId of your own node\n}\n\n/** Setting network to localhost blockchain **/\nexport const fm = new Fortmatic('pk_test_F64FF8191AA41844', customNodeOptions);\nlet web3Fortmatic = new Web3(fm.getProvider());\nwindow.web3 = web3Fortmatic;\nexport const web3Provider = web3Fortmatic;\n\n/** production\nexport const fm = new Fortmatic(\"pk_test_F64FF8191AA41844\");\nexport const web3Provider = new Web3(fm.getProvider());\n**/\n","import mod from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=style&index=0&id=73b6502a&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=style&index=0&id=73b6502a&lang=scss&scoped=true&\""],"sourceRoot":""} \ No newline at end of file diff --git a/frontend/dist/js/chunk-vendors.40fd1149.js b/frontend/dist/js/chunk-vendors.40fd1149.js new file mode 100644 index 0000000..420d145 --- /dev/null +++ b/frontend/dist/js/chunk-vendors.40fd1149.js @@ -0,0 +1,63 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-vendors"],{"00dc":function(t,e,r){(function(t){var n=r("58a2"),i=r("c24d"),o=r("561d");function a(e){var r=new t(i[e].prime,"hex"),n=new t(i[e].gen,"hex");return new o(r,n)}var s={binary:!0,hex:!0,base64:!0};function u(e,r,i,a){return t.isBuffer(r)||void 0===s[r]?u(e,"binary",r,i):(r=r||"binary",a=a||"binary",i=i||new t([2]),t.isBuffer(i)||(i=new t(i,a)),"number"===typeof e?new o(n(e,i),i,!0):(t.isBuffer(e)||(e=new t(e,r)),new o(e,i,!0)))}e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=a,e.createDiffieHellman=e.DiffieHellman=u}).call(this,r("b639").Buffer)},"00ee":function(t,e,r){var n=r("b622"),i=n("toStringTag"),o={};o[i]="z",t.exports="[object z]"===String(o)},"0145":function(t,e){e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},"0184":function(t,e,r){"use strict";var n=r("da3e");function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),n=0;n0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;while(e>>27}function f(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(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0;u<16;++u)e[u]=t.readInt32BE(4*u);for(;u<80;++u)e[u]=e[u-3]^e[u-8]^e[u-14]^e[u-16];for(var l=0;l<80;++l){var d=~~(l/20),p=c(r)+h(d,n,i,o)+s+e[l]+a[d]|0;s=o,o=i,i=f(n),n=r,r=p}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},u.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},t.exports=u},"092d":function(t){t.exports=JSON.parse('{"name":"goerli","chainId":5,"networkId":5,"comment":"Cross-client PoA test network","url":"https://github.com/goerli/testnet","genesis":{"hash":"0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a","timestamp":"0x5c51a607","gasLimit":10485760,"difficulty":1,"nonce":"0x0000000000000000","extraData":"0x22466c6578692069732061207468696e6722202d204166726900000000000000e0a2bd4258d2768837baa26a28fe71dc079f84c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","stateRoot":"0x5d6cded585e73c4e322c30c2f782a336316f17dd85a4863b9d838d2d4b8b3008"},"hardforks":[{"name":"chainstart","block":0,"consensus":"poa","finality":null},{"name":"homestead","block":0,"consensus":"poa","finality":null},{"name":"dao","block":0,"consensus":"poa","finality":null},{"name":"tangerineWhistle","block":0,"consensus":"poa","finality":null},{"name":"spuriousDragon","block":0,"consensus":"poa","finality":null},{"name":"byzantium","block":0,"consensus":"poa","finality":null},{"name":"constantinople","block":0,"consensus":"poa","finality":null},{"name":"petersburg","block":0,"consensus":"poa","finality":null},{"name":"istanbul","block":1561651,"consensus":"poa","finality":null}],"bootstrapNodes":[{"ip":"51.141.78.53","port":30303,"id":"011f758e6552d105183b1761c5e2dea0111bc20fd5f6422bc7f91e0fabbec9a6595caf6239b37feb773dddd3f87240d99d859431891e4a642cf2a0a9e6cbb98a","location":"","comment":"Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"},{"ip":"13.93.54.137","port":30303,"id":"176b9417f511d05b6b2cf3e34b756cf0a7096b3094572a8f6ef4cdcb9d1f9d00683bf0f83347eebdf3b81c3521c2332086d9592802230bf528eaf606a1d9677b","location":"","comment":"Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"},{"ip":"94.237.54.114","port":30313,"id":"46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291","location":"","comment":"Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"},{"ip":"52.64.155.147","port":30303,"id":"c1f8b7c2ac4453271fa07d8e9ecf9a2e8285aa0bd0c07df0131f47153306b0736fd3db8924e7a9bf0bed6b1d8d4f87362a71b033dc7c64547728d953e43e59b2","location":"","comment":"Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"},{"ip":"213.186.16.82","port":30303,"id":"f4a9c6ee28586009fb5a96c8af13a58ed6d8315a9eee4772212c1d4d9cebe5a8b8a78ea4434f318726317d04a3f531a1ef0420cf9752605a562cfe858c46e263","location":"","comment":"Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"}]}')},"0960":function(t,e,r){t.exports=r("b19a")},"09f5":function(t,e,r){var n=r("39f5"),i=r("8707").Buffer,o=r("6430"),a=r("3fb5");function s(t,e,r,a){o.call(this),this._cipher=new n.AES(e),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=t}a(s,o),s.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},"0b16":function(t,e,r){"use strict";var n=r("1985"),i=r("35e8");function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=_,e.resolve=E,e.resolveObject=x,e.format=A,e.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["<",">",'"',"`"," ","\r","\n","\t"],f=["{","}","|","\\","^","`"].concat(c),h=["'"].concat(f),l=["%","/","?",";","#"].concat(h),d=["/","?","#"],p=255,m=/^[+a-z0-9A-Z_-]{0,63}$/,y=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=r("b383");function _(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}function A(t){return i.isString(t)&&(t=_(t)),t instanceof o?t.format():o.prototype.format.call(t)}function E(t,e){return _(t,!1,!0).resolve(e)}function x(t,e){return t?_(t,!1,!0).resolveObject(e):e}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o127?N+="x":N+=R[B];if(!N.match(m)){var L=O.slice(0,C),D=O.slice(C+1),F=R.match(y);F&&(L.push(F[1]),D.unshift(F[2])),D.length&&(_="/"+D.join(".")+_),this.hostname=L.join(".");break}}}this.hostname.length>p?this.hostname="":this.hostname=this.hostname.toLowerCase(),U||(this.hostname=n.toASCII(this.hostname));var q=this.port?":"+this.port:"",H=this.hostname||"";this.host=H+q,this.href+=this.host,U&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!v[x])for(C=0,P=h.length;C0)&&r.host.split("@");M&&(r.auth=M.shift(),r.host=r.hostname=M.shift())}return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var k=E.slice(-1)[0],S=(r.host||t.host||E.length>1)&&("."===k||".."===k)||""===k,I=0,C=E.length;C>=0;C--)k=E[C],"."===k?E.splice(C,1):".."===k?(E.splice(C,1),I++):I&&(E.splice(C,1),I--);if(!_&&!A)for(;I--;I)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),S&&"/"!==E.join("/").substr(-1)&&E.push("");var T=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(x){r.hostname=r.host=T?"":E.length?E.shift():"";M=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");M&&(r.auth=M.shift(),r.host=r.hostname=M.shift())}return _=_||r.host&&E.length,_&&!T&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},"0be8":function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},"0c3d":function(t,e,r){(function(e){const n=r("7be5"),i=r("63c1"),o=r("3337"),a=(r("ed14"),new o.ec("secp256k1")),{keccak256:s,keccak256s:u}=r("1ecd"),c=t=>{const e=s(n.concat(n.random(32),t||n.random(32))),r=n.concat(n.concat(n.random(32),e),n.random(32)),i=s(r);return h(i)},f=t=>{const e=u(t.slice(2));let r="0x";for(let n=0;n<40;n++)r+=parseInt(e[n+2],16)>7?t[n+2].toUpperCase():t[n+2];return r},h=t=>{const r=new e(t.slice(2),"hex"),n=a.keyFromPrivate(r),i="0x"+n.getPublic(!1,"hex").slice(2),o=s(i),u=f("0x"+o.slice(-40));return{address:u,privateKey:t}},l=([t,e,r])=>n.flatten([e,r,t]),d=t=>[n.slice(64,n.length(t),t),n.slice(0,32,t),n.slice(32,64,t)],p=t=>(r,o)=>{const s=a.keyFromPrivate(new e(o.slice(2),"hex")).sign(new e(r.slice(2),"hex"),{canonical:!0});return l([i.fromString(n.fromNumber(t+s.recoveryParam)),n.pad(32,n.fromNat("0x"+s.r.toString(16))),n.pad(32,n.fromNat("0x"+s.s.toString(16)))])},m=p(27),y=(t,r)=>{const i=d(r),o={v:n.toNumber(i[0]),r:i[1].slice(2),s:i[2].slice(2)},u=a.recoverPubKey(new e(t.slice(2),"hex"),o,o.v<2?o.v:1-o.v%2),c="0x"+u.encode("hex",!1).slice(2),h=s(c),l=f("0x"+h.slice(-40));return l};t.exports={create:c,toChecksum:f,fromPrivate:h,sign:m,makeSigner:p,recover:y,encodeSignature:l,decodeSignature:d}}).call(this,r("b639").Buffer)},"0cbb":function(t,e,r){"use strict";var n,i=e,o=r("7d92"),a=r("4136"),s=r("f3a3"),u=s.assert;function c(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,u(this.g.validate(),"Invalid curve"),u(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new c(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r("409b")}catch(h){n=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},"0cfb":function(t,e,r){var n=r("83ab"),i=r("d039"),o=r("cc12");t.exports=!n&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},"0da4":function(t,e,r){"use strict";var n=r("da3e"),i=r("3fb5"),o={};function a(t){n.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e=e.length){o++;break}var a=e.slice(2,i-1);if(("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return e.slice(i)}function d(t,e){t=f.from(t),e=f.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;while(++id||new a(e).cmp(u.modulus)>=0)throw new Error("decryption error");o=r?c(new a(e),u):s(e,u);var p=f.alloc(d-o.length);if(o=f.concat([p,o],d),4===i)return h(u,o);if(1===i)return l(u,o,r);if(3===i)return o;throw new Error("unknown padding")}},1037:function(t,e,r){(function(e,r){ +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.5.7 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2016 + * @license MIT + */ +(function(){"use strict";var n="object"===typeof window?window:{},i=!n.JS_SHA3_NO_NODE_JS&&"object"===typeof e&&e.versions&&e.versions.node;i&&(n=r);for(var o=!n.JS_SHA3_NO_COMMON_JS&&"object"===typeof t&&t.exports,a="0123456789abcdef".split(""),s=[31,7936,2031616,520093696],u=[1,256,65536,16777216],c=[6,1536,393216,100663296],f=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],l=[224,256,384,512],d=[128,256],p=["hex","buffer","arrayBuffer","array"],m=function(t,e,r){return function(n){return new S(t,e,t).update(n)[r]()}},y=function(t,e,r){return function(n,i){return new S(t,e,i).update(n)[r]()}},v=function(t,e){var r=m(t,e,"hex");r.create=function(){return new S(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}S.prototype.update=function(t){var e="string"!==typeof t;e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));var r,n,i=t.length,o=this.blocks,a=this.byteCount,s=this.blockCount,u=0,c=this.s;while(u>2]|=t[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(o[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<=a){for(this.start=r-a,this.block=o[s],r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+a[15&t]+a[t>>12&15]+a[t>>8&15]+a[t>>20&15]+a[t>>16&15]+a[t>>28&15]+a[t>>24&15];s%e===0&&(I(r),o=0)}return i&&(t=r[o],i>0&&(u+=a[t>>4&15]+a[15&t]),i>1&&(u+=a[t>>12&15]+a[t>>8&15]),i>2&&(u+=a[t>>20&15]+a[t>>16&15])),u},S.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);var u=new Uint32Array(t);while(a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r===0&&I(n)}return o&&(t=s<<2,e=n[a],o>0&&(u[t]=255&e),o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u};var I=function(t){var e,r,n,i,o,a,s,u,c,f,l,d,p,m,y,v,b,g,w,_,A,E,x,M,k,S,I,C,T,U,O,P,R,N,B,j,L,D,F,q,H,z,K,V,G,$,Y,W,Z,J,X,Q,tt,et,rt,nt,it,ot,at,st,ut,ct,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],d=t[8]^t[18]^t[28]^t[38]^t[48],p=t[9]^t[19]^t[29]^t[39]^t[49],e=d^(a<<1|s>>>31),r=p^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(d<<1|p>>>31),r=c^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],y=t[1],$=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,C=t[20]<<3|t[21]>>>29,T=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,N=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,U=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,j=t[14]<<6|t[15]>>>26,L=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,J=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,I=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=m^~v&g,t[1]=y^~b&w,t[10]=M^~S&C,t[11]=k^~I&T,t[20]=N^~j&D,t[21]=B^~L&F,t[30]=V^~$&W,t[31]=G^~Y&Z,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=v^~g&_,t[3]=b^~w&A,t[12]=S^~C&U,t[13]=I^~T&O,t[22]=j^~D&q,t[23]=L^~F&H,t[32]=$^~W&J,t[33]=Y^~Z&X,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~_&E,t[5]=w^~A&x,t[14]=C^~U&P,t[15]=T^~O&R,t[24]=D^~q&z,t[25]=F^~H&K,t[34]=W^~J&Q,t[35]=Z^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&ft,t[6]=_^~E&m,t[7]=A^~x&y,t[16]=U^~P&M,t[17]=O^~R&k,t[26]=q^~z&N,t[27]=H^~K&B,t[36]=J^~Q&V,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~ft&rt,t[8]=E^~m&v,t[9]=x^~y&b,t[18]=P^~M&S,t[19]=R^~k&I,t[28]=z^~N&j,t[29]=K^~B&L,t[38]=Q^~V&$,t[39]=tt^~G&Y,t[48]=ct^~et&nt,t[49]=ft^~rt&it,t[0]^=h[n],t[1]^=h[n+1]};if(o)t.exports=w;else for(A=0;A<_.length;++A)n[_[A]]=w[_[A]]})()}).call(this,r("4362"),r("c8ba"))},1131:function(t,e,r){var n=r("17fb"),i=r("70c1"),o=r("e870"),a=r("2091"),s=r("11dc"),u=function(t,e,r,i,o){return!n.isObject(t)||t instanceof Error||!t.data||((n.isObject(t.data)||n.isArray(t.data))&&(t.data=JSON.stringify(t.data,null,2)),t=t.message+"\n"+t.data),n.isString(t)&&(t=new Error(t)),n.isFunction(i)&&i(t,o),n.isFunction(r)&&((e&&n.isFunction(e.listeners)&&e.listeners("error").length||n.isFunction(i))&&e.catch((function(){})),setTimeout((function(){r(t)}),1)),e&&n.isFunction(e.emit)&&setTimeout((function(){e.emit("error",t,o),e.removeAllListeners()}),1),e},c=function(t){return n.isObject(t)&&t.name&&-1!==t.name.indexOf("(")?t.name:t.name+"("+f(!1,t.inputs).join(",")+")"},f=function(t,e){var r=[];return e.forEach((function(e){if("object"===typeof e.components){if("tuple"!==e.type.substring(0,5))throw new Error("components found but type is not tuple; report on GitHub");var i="",o=e.type.indexOf("[");o>=0&&(i=e.type.substring(o));var a=f(t,e.components);n.isArray(a)&&t?r.push("tuple("+a.join(",")+")"+i):t?r.push("("+a+")"):r.push("("+a.join(",")+")"+i)}else r.push(e.type)})),r},h=function(t){return"0x"+s(t).toString("hex")},l=function(t){if(!o.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r7?r+=t[n].toUpperCase():r+=t[n];return r};t.exports={_fireError:u,_jsonInterfaceMethodToString:c,_flattenTypes:f,randomHex:h,_:n,BN:o.BN,isBN:o.isBN,isBigNumber:o.isBigNumber,isHex:o.isHex,isHexStrict:o.isHexStrict,sha3:o.sha3,sha3Raw:o.sha3Raw,keccak256:o.sha3,soliditySha3:a.soliditySha3,soliditySha3Raw:a.soliditySha3Raw,isAddress:o.isAddress,checkAddressChecksum:o.checkAddressChecksum,toChecksumAddress:v,toHex:o.toHex,toBN:o.toBN,bytesToHex:o.bytesToHex,hexToBytes:o.hexToBytes,hexToNumberString:o.hexToNumberString,hexToNumber:o.hexToNumber,toDecimal:o.hexToNumber,numberToHex:o.numberToHex,fromDecimal:o.numberToHex,hexToUtf8:o.hexToUtf8,hexToString:o.hexToUtf8,toUtf8:o.hexToUtf8,utf8ToHex:o.utf8ToHex,stringToHex:o.utf8ToHex,fromUtf8:o.utf8ToHex,hexToAscii:l,toAscii:l,asciiToHex:d,fromAscii:d,unitMap:i.unitMap,toWei:y,fromWei:m,padLeft:o.leftPad,leftPad:o.leftPad,padRight:o.rightPad,rightPad:o.rightPad,toTwosComplement:o.toTwosComplement,isBloom:o.isBloom,isUserEthereumAddressInBloom:o.isUserEthereumAddressInBloom,isContractAddressInBloom:o.isContractAddressInBloom,isTopic:o.isTopic,isTopicInBloom:o.isTopicInBloom,isInBloom:o.isInBloom}},"116d":function(t,e,r){t.exports=r("b4e8")},"11dc":function(t,e,r){"use strict";(function(e,n){var i=65536,o=4294967295;function a(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var s=r("8707").Buffer,u=e.crypto||e.msCrypto;function c(t,e){if(t>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(t);if(t>0)if(t>i)for(var a=0;a=48&&t<=57)return t-48;if(t>=65&&t<=70)return t-55;if(t>=97&&t<=102)return t-87;throw new Error("invalid bloom")}function s(t,e){if(!i(t))throw new Error("Invalid bloom given");if(!h(e))throw new Error(`Invalid ethereum address given: "${e}"`);const r=n.padLeft(e,64);return o(t,r)}function u(t,e){if(!i(t))throw new Error("Invalid bloom given");if(!h(e))throw new Error(`Invalid contract address given: "${e}"`);return o(t,e)}function c(t,e){if(!i(t))throw new Error("Invalid bloom given");if(!f(e))throw new Error("Invalid topic");return o(t,e)}function f(t){return"string"===typeof t&&(!!/^(0x)?[0-9a-f]{64}$/i.test(t)&&!(!/^(0x)?[0-9a-f]{64}$/.test(t)&&!/^(0x)?[0-9A-F]{64}$/.test(t)))}function h(t){return"string"===typeof t&&(!!t.match(/^(0x)?[0-9a-fA-F]{40}$/)||!!t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/))}e.isBloom=i,e.isInBloom=o,e.isUserEthereumAddressInBloom=s,e.isContractAddressInBloom=u,e.isTopicInBloom=c,e.isTopic=f,e.isAddress=h},1545:function(t,e,r){"use strict";e.utils=r("5ee7"),e.Cipher=r("0184"),e.DES=r("4e2b"),e.CBC=r("0da4"),e.EDE=r("1fec")},"175f":function(t,e,r){"use strict";var n=r("17fb"),i=r("1131"),o=r("da53"),a=function(t){return t.map(i.numberToHex)},s=function(t){return t.address=i.toChecksumAddress(t.address),t.nonce=i.hexToNumberString(t.nonce),t.balance=i.hexToNumberString(t.balance),t},u=function(t){return i.toBN(t).toString(10)},c=function(t){return"latest"===t||"pending"===t||"earliest"===t},f=function(t){return h(!this||void 0!==t&&null!==t?t:this.defaultBlock)},h=function(t){if(void 0!==t)return c(t)?t:"genesis"===t?"0x0":i.isHexStrict(t)?n.isString(t)?t.toLowerCase():t:i.numberToHex(t)},l=function(t){if(t.to&&(t.to=E(t.to)),t.data&&t.input)throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');if(!t.data&&t.input&&(t.data=t.input,delete t.input),t.data&&!i.isHex(t.data))throw new Error("The data field must be HEX encoded data.");return(t.gas||t.gasLimit)&&(t.gas=t.gas||t.gasLimit),["gasPrice","gas","value","nonce"].filter((function(e){return void 0!==t[e]})).forEach((function(e){t[e]=i.numberToHex(t[e])})),t},d=function(t){t=l(t);var e=t.from||(this?this.defaultAccount:null);return e&&(t.from=E(e)),t},p=function(t){if(t=l(t),!n.isNumber(t.from)&&!n.isObject(t.from)){if(t.from=t.from||(this?this.defaultAccount:null),!t.from&&!n.isNumber(t.from))throw new Error('The send transactions "from" field must be defined!');t.from=E(t.from)}return t},m=function(t){return i.isHexStrict(t)?t:i.utf8ToHex(t)},y=function(t){return null!==t.blockNumber&&(t.blockNumber=i.hexToNumber(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=i.hexToNumber(t.transactionIndex)),t.nonce=i.hexToNumber(t.nonce),t.gas=i.hexToNumber(t.gas),t.gasPrice=u(t.gasPrice),t.value=u(t.value),t.to&&i.isAddress(t.to)?t.to=i.toChecksumAddress(t.to):t.to=null,t.from&&(t.from=i.toChecksumAddress(t.from)),t},v=function(t){if("object"!==typeof t)throw new Error("Received receipt is invalid: "+t);return null!==t.blockNumber&&(t.blockNumber=i.hexToNumber(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=i.hexToNumber(t.transactionIndex)),t.cumulativeGasUsed=i.hexToNumber(t.cumulativeGasUsed),t.gasUsed=i.hexToNumber(t.gasUsed),n.isArray(t.logs)&&(t.logs=t.logs.map(w)),t.contractAddress&&(t.contractAddress=i.toChecksumAddress(t.contractAddress)),"undefined"!==typeof t.status&&null!==t.status&&(t.status=Boolean(parseInt(t.status))),t},b=function(t){return t.gasLimit=i.hexToNumber(t.gasLimit),t.gasUsed=i.hexToNumber(t.gasUsed),t.size=i.hexToNumber(t.size),t.timestamp=i.hexToNumber(t.timestamp),null!==t.number&&(t.number=i.hexToNumber(t.number)),t.difficulty&&(t.difficulty=u(t.difficulty)),t.totalDifficulty&&(t.totalDifficulty=u(t.totalDifficulty)),n.isArray(t.transactions)&&t.transactions.forEach((function(t){if(!n.isString(t))return y(t)})),t.miner&&(t.miner=i.toChecksumAddress(t.miner)),t},g=function(t){var e=function(t){return null===t||"undefined"===typeof t?null:(t=String(t),0===t.indexOf("0x")?t:i.fromUtf8(t))};return(t.fromBlock||0===t.fromBlock)&&(t.fromBlock=h(t.fromBlock)),(t.toBlock||0===t.toBlock)&&(t.toBlock=h(t.toBlock)),t.topics=t.topics||[],t.topics=t.topics.map((function(t){return n.isArray(t)?t.map(e):e(t)})),e=null,t.address&&(t.address=n.isArray(t.address)?t.address.map((function(t){return E(t)})):E(t.address)),t},w=function(t){if("string"===typeof t.blockHash&&"string"===typeof t.transactionHash&&"string"===typeof t.logIndex){var e=i.sha3(t.blockHash.replace("0x","")+t.transactionHash.replace("0x","")+t.logIndex.replace("0x",""));t.id="log_"+e.replace("0x","").substr(0,8)}else t.id||(t.id=null);return null!==t.blockNumber&&(t.blockNumber=i.hexToNumber(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=i.hexToNumber(t.transactionIndex)),null!==t.logIndex&&(t.logIndex=i.hexToNumber(t.logIndex)),t.address&&(t.address=i.toChecksumAddress(t.address)),t},_=function(t){return t.ttl&&(t.ttl=i.numberToHex(t.ttl)),t.workToProve&&(t.workToProve=i.numberToHex(t.workToProve)),t.priority&&(t.priority=i.numberToHex(t.priority)),n.isArray(t.topics)||(t.topics=t.topics?[t.topics]:[]),t.topics=t.topics.map((function(t){return 0===t.indexOf("0x")?t:i.fromUtf8(t)})),t},A=function(t){return t.expiry=i.hexToNumber(t.expiry),t.sent=i.hexToNumber(t.sent),t.ttl=i.hexToNumber(t.ttl),t.workProved=i.hexToNumber(t.workProved),t.topics||(t.topics=[]),t.topics=t.topics.map((function(t){return i.toUtf8(t)})),t},E=function(t){var e=new o(t);if(e.isValid()&&e.isDirect())return e.toAddress().toLowerCase();if(i.isAddress(t))return"0x"+t.toLowerCase().replace("0x","");throw new Error('Provided address "'+t+"\" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.")},x=function(t){return t.startingBlock=i.hexToNumber(t.startingBlock),t.currentBlock=i.hexToNumber(t.currentBlock),t.highestBlock=i.hexToNumber(t.highestBlock),t.knownStates&&(t.knownStates=i.hexToNumber(t.knownStates),t.pulledStates=i.hexToNumber(t.pulledStates)),t};t.exports={inputDefaultBlockNumberFormatter:f,inputBlockNumberFormatter:h,inputCallFormatter:d,inputTransactionFormatter:p,inputAddressFormatter:E,inputPostFormatter:_,inputLogFormatter:g,inputSignFormatter:m,inputStorageKeysFormatter:a,outputProofFormatter:s,outputBigNumberFormatter:u,outputTransactionFormatter:y,outputTransactionReceiptFormatter:v,outputBlockFormatter:b,outputLogFormatter:w,outputPostFormatter:A,outputSyncingFormatter:x}},"176c":function(t,e,r){"use strict";var n=r("17fb"),i=r("39d4").errors,o=r("636c"),a=r("58ab"),s=r("ef84"),u=function t(e){this.provider=null,this.providers=t.providers,this.setProvider(e),this.subscriptions={}};u.givenProvider=s,u.providers={WebsocketProvider:r("3c3c"),HttpProvider:r("8148"),IpcProvider:r("93a0")},u.prototype.setProvider=function(t,e){var r=this;if(t&&"string"===typeof t&&this.providers)if(/^http(s)?:\/\//i.test(t))t=new this.providers.HttpProvider(t);else if(/^ws(s)?:\/\//i.test(t))t=new this.providers.WebsocketProvider(t);else if(t&&"object"===typeof e&&"function"===typeof e.connect)t=new this.providers.IpcProvider(t,e);else if(t)throw new Error("Can't autodetect provider for \""+t+'"');this.provider&&this.provider.connected&&this.clearSubscriptions(),this.provider=t||null,this.provider&&this.provider.on&&this.provider.on("data",(function(t,e){t=t||e,t.method&&r.subscriptions[t.params.subscription]&&r.subscriptions[t.params.subscription].callback&&r.subscriptions[t.params.subscription].callback(null,t.params.result)}))},u.prototype.send=function(t,e){if(e=e||function(){},!this.provider)return e(i.InvalidProvider());var r=o.toPayload(t.method,t.params);this.provider[this.provider.sendAsync?"sendAsync":"send"](r,(function(t,n){return n&&n.id&&r.id!==n.id?e(new Error('Wrong response id "'+n.id+'" (expected: "'+r.id+'") in '+JSON.stringify(r))):t?e(t):n&&n.error?e(i.ErrorResponse(n)):o.isValidResponse(n)?void e(null,n.result):e(i.InvalidResponse(n))}))},u.prototype.sendBatch=function(t,e){if(!this.provider)return e(i.InvalidProvider());var r=o.toBatchPayload(t);this.provider[this.provider.sendAsync?"sendAsync":"send"](r,(function(t,r){return t?e(t):n.isArray(r)?void e(null,r):e(i.InvalidResponse(r))}))},u.prototype.addSubscription=function(t,e,r,n){if(!this.provider.on)throw new Error("The provider doesn't support subscriptions: "+this.provider.constructor.name);this.subscriptions[t]={callback:n,type:r,name:e}},u.prototype.removeSubscription=function(t,e){var r=this;this.subscriptions[t]&&(this.send({method:this.subscriptions[t].type+"_unsubscribe",params:[t]},e),delete r.subscriptions[t])},u.prototype.clearSubscriptions=function(t){var e=this;this.subscriptions&&Object.keys(this.subscriptions).forEach((function(r){t&&"syncing"===e.subscriptions[r].name||e.removeSubscription(r)})),this.provider.reset&&this.provider.reset()},t.exports={Manager:u,BatchManager:a}},"17fb":function(t,e,r){(function(t,r){var n,i;(function(){var o="object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t||this||{},a=o._,s=Array.prototype,u=Object.prototype,c="undefined"!==typeof Symbol?Symbol.prototype:null,f=s.push,h=s.slice,l=u.toString,d=u.hasOwnProperty,p=Array.isArray,m=Object.keys,y=Object.create,v=function(){},b=function(t){return t instanceof b?t:this instanceof b?void(this._wrapped=t):new b(t)};e.nodeType?o._=b:(!r.nodeType&&r.exports&&(e=r.exports=b),e._=b),b.VERSION="1.9.1";var g,w=function(t,e,r){if(void 0===e)return t;switch(null==r?3:r){case 1:return function(r){return t.call(e,r)};case 3:return function(r,n,i){return t.call(e,r,n,i)};case 4:return function(r,n,i,o){return t.call(e,r,n,i,o)}}return function(){return t.apply(e,arguments)}},_=function(t,e,r){return b.iteratee!==g?b.iteratee(t,e):null==t?b.identity:b.isFunction(t)?w(t,e,r):b.isObject(t)&&!b.isArray(t)?b.matcher(t):b.property(t)};b.iteratee=g=function(t,e){return _(t,e,1/0)};var A=function(t,e){return e=null==e?t.length-1:+e,function(){for(var r=Math.max(arguments.length-e,0),n=Array(r),i=0;i=0&&e<=S};b.each=b.forEach=function(t,e,r){var n,i;if(e=w(e,r),C(t))for(n=0,i=t.length;n0?0:a-1;for(i||(n=e[o?o[s]:s],s+=t);s>=0&&s=3;return e(t,w(r,i,4),n,o)}};b.reduce=b.foldl=b.inject=T(1),b.reduceRight=b.foldr=T(-1),b.find=b.detect=function(t,e,r){var n=C(t)?b.findIndex:b.findKey,i=n(t,e,r);if(void 0!==i&&-1!==i)return t[i]},b.filter=b.select=function(t,e,r){var n=[];return e=_(e,r),b.each(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n},b.reject=function(t,e,r){return b.filter(t,b.negate(_(e)),r)},b.every=b.all=function(t,e,r){e=_(e,r);for(var n=!C(t)&&b.keys(t),i=(n||t).length,o=0;o=0},b.invoke=A((function(t,e,r){var n,i;return b.isFunction(e)?i=e:b.isArray(e)&&(n=e.slice(0,-1),e=e[e.length-1]),b.map(t,(function(t){var o=i;if(!o){if(n&&n.length&&(t=k(t,n)),null==t)return;o=t[e]}return null==o?o:o.apply(t,r)}))})),b.pluck=function(t,e){return b.map(t,b.property(e))},b.where=function(t,e){return b.filter(t,b.matcher(e))},b.findWhere=function(t,e){return b.find(t,b.matcher(e))},b.max=function(t,e,r){var n,i,o=-1/0,a=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t){t=C(t)?t:b.values(t);for(var s=0,u=t.length;so&&(o=n)}else e=_(e,r),b.each(t,(function(t,r,n){i=e(t,r,n),(i>a||i===-1/0&&o===-1/0)&&(o=t,a=i)}));return o},b.min=function(t,e,r){var n,i,o=1/0,a=1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t){t=C(t)?t:b.values(t);for(var s=0,u=t.length;sn||void 0===r)return 1;if(r0?0:i-1;o>=0&&o0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(r&&o&&s)return o=r(n,i),n[o]===i?o:-1;if(i!==i)return o=e(h.call(n,a,s),b.isNaN),o>=0?o+a:-1;for(o=t>0?a:s-1;o>=0&&oe?(n&&(clearTimeout(n),n=null),s=c,a=t.apply(i,o),n||(i=o=null)):n||!1===r.trailing||(n=setTimeout(u,f)),a};return c.cancel=function(){clearTimeout(n),s=0,n=i=o=null},c},b.debounce=function(t,e,r){var n,i,o=function(e,r){n=null,r&&(i=t.apply(e,r))},a=A((function(a){if(n&&clearTimeout(n),r){var s=!n;n=setTimeout(o,e),s&&(i=t.apply(this,a))}else n=b.delay(o,e,this,a);return i}));return a.cancel=function(){clearTimeout(n),n=null},a},b.wrap=function(t,e){return b.partial(e,t)},b.negate=function(t){return function(){return!t.apply(this,arguments)}},b.compose=function(){var t=arguments,e=t.length-1;return function(){var r=e,n=t[e].apply(this,arguments);while(r--)n=t[r].call(this,n);return n}},b.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},b.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},b.once=b.partial(b.before,2),b.restArguments=A;var j=!{toString:null}.propertyIsEnumerable("toString"),L=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],D=function(t,e){var r=L.length,n=t.constructor,i=b.isFunction(n)&&n.prototype||u,o="constructor";M(t,o)&&!b.contains(e,o)&&e.push(o);while(r--)o=L[r],o in t&&t[o]!==i[o]&&!b.contains(e,o)&&e.push(o)};b.keys=function(t){if(!b.isObject(t))return[];if(m)return m(t);var e=[];for(var r in t)M(t,r)&&e.push(r);return j&&D(t,e),e},b.allKeys=function(t){if(!b.isObject(t))return[];var e=[];for(var r in t)e.push(r);return j&&D(t,e),e},b.values=function(t){for(var e=b.keys(t),r=e.length,n=Array(r),i=0;i1&&(n=w(n,e[1])),e=b.allKeys(t)):(n=z,e=P(e,!1,!1),t=Object(t));for(var i=0,o=e.length;i1&&(r=e[1])):(e=b.map(P(e,!1,!1),String),n=function(t,r){return!b.contains(e,r)}),b.pick(t,n,r)})),b.defaults=F(b.allKeys,!0),b.create=function(t,e){var r=E(t);return e&&b.extendOwn(r,e),r},b.clone=function(t){return b.isObject(t)?b.isArray(t)?t.slice():b.extend({},t):t},b.tap=function(t,e){return e(t),t},b.isMatch=function(t,e){var r=b.keys(e),n=r.length;if(null==t)return!n;for(var i=Object(t),o=0;o":">",'"':""","'":"'","`":"`"},G=b.invert(V),$=function(t){var e=function(e){return t[e]},r="(?:"+b.keys(t).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(i,e):t}};b.escape=$(V),b.unescape=$(G),b.result=function(t,e,r){b.isArray(e)||(e=[e]);var n=e.length;if(!n)return b.isFunction(r)?r.call(t):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var W=/(.)^/,Z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},J=/\\|'|\r|\n|\u2028|\u2029/g,X=function(t){return"\\"+Z[t]};b.template=function(t,e,r){!e&&r&&(e=r),e=b.defaults({},e,b.templateSettings);var n,i=RegExp([(e.escape||W).source,(e.interpolate||W).source,(e.evaluate||W).source].join("|")+"|$","g"),o=0,a="__p+='";t.replace(i,(function(e,r,n,i,s){return a+=t.slice(o,s).replace(J,X),o=s+e.length,r?a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?a+="'+\n((__t=("+n+"))==null?'':__t)+\n'":i&&(a+="';\n"+i+"\n__p+='"),e})),a+="';\n",e.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{n=new Function(e.variable||"obj","_",a)}catch(c){throw c.source=a,c}var s=function(t){return n.call(this,t,b)},u=e.variable||"obj";return s.source="function("+u+"){\n"+a+"}",s},b.chain=function(t){var e=b(t);return e._chain=!0,e};var Q=function(t,e){return t._chain?b(e).chain():e};b.mixin=function(t){return b.each(b.functions(t),(function(e){var r=b[e]=t[e];b.prototype[e]=function(){var t=[this._wrapped];return f.apply(t,arguments),Q(this,r.apply(b,t))}})),b},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],(function(t){var e=s[t];b.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],Q(this,r)}})),b.each(["concat","join","slice"],(function(t){var e=s[t];b.prototype[t]=function(){return Q(this,e.apply(this._wrapped,arguments))}})),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){return String(this._wrapped)},n=[],i=function(){return b}.apply(e,n),void 0===i||(r.exports=i)})()}).call(this,r("c8ba"),r("62e4")(t))},"18fd":function(t,e,r){"use strict";var n=r("8707").Buffer,i=r("98e6"),o=r("399f"),a=r("3337").ec,s=r("f8c1"),u=new a("secp256k1"),c=u.curve;function f(t,e){var r=new o(e);if(r.cmp(c.p)>=0)return null;r=r.toRed(c.red);var n=r.redSqr().redIMul(r).redIAdd(c.b).redSqrt();return 3===t!==n.isOdd()&&(n=n.redNeg()),u.keyPair({pub:{x:r,y:n}})}function h(t,e,r){var n=new o(e),i=new o(r);if(n.cmp(c.p)>=0||i.cmp(c.p)>=0)return null;if(n=n.toRed(c.red),i=i.toRed(c.red),(6===t||7===t)&&i.isOdd()!==(7===t))return null;var a=n.redSqr().redIMul(n);return i.redSqr().redISub(a.redIAdd(c.b)).isZero()?u.keyPair({pub:{x:n,y:i}}):null}function l(t){var e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:f(e,t.slice(1,33));case 4:case 6:case 7:return 65!==t.length?null:h(e,t.slice(1,33),t.slice(33,65));default:return null}}e.privateKeyVerify=function(t){var e=new o(t);return e.cmp(c.n)<0&&!e.isZero()},e.privateKeyExport=function(t,e){var r=new o(t);if(r.cmp(c.n)>=0||r.isZero())throw new Error(s.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return n.from(u.keyFromPrivate(t).getPublic(e,!0))},e.privateKeyNegate=function(t){var e=new o(t);return e.isZero()?n.alloc(32):c.n.sub(e).umod(c.n).toArrayLike(n,"be",32)},e.privateKeyModInverse=function(t){var e=new o(t);if(e.cmp(c.n)>=0||e.isZero())throw new Error(s.EC_PRIVATE_KEY_RANGE_INVALID);return e.invm(c.n).toArrayLike(n,"be",32)},e.privateKeyTweakAdd=function(t,e){var r=new o(e);if(r.cmp(c.n)>=0)throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(new o(t)),r.cmp(c.n)>=0&&r.isub(c.n),r.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toArrayLike(n,"be",32)},e.privateKeyTweakMul=function(t,e){var r=new o(e);if(r.cmp(c.n)>=0||r.isZero())throw new Error(s.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return r.imul(new o(t)),r.cmp(c.n)&&(r=r.umod(c.n)),r.toArrayLike(n,"be",32)},e.publicKeyCreate=function(t,e){var r=new o(t);if(r.cmp(c.n)>=0||r.isZero())throw new Error(s.EC_PUBLIC_KEY_CREATE_FAIL);return n.from(u.keyFromPrivate(t).getPublic(e,!0))},e.publicKeyConvert=function(t,e){var r=l(t);if(null===r)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return n.from(r.getPublic(e,!0))},e.publicKeyVerify=function(t){return null!==l(t)},e.publicKeyTweakAdd=function(t,e,r){var i=l(t);if(null===i)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(e=new o(e),e.cmp(c.n)>=0)throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var a=c.g.mul(e).add(i.pub);if(a.isInfinity())throw new Error(s.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return n.from(a.encode(!0,r))},e.publicKeyTweakMul=function(t,e,r){var i=l(t);if(null===i)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);if(e=new o(e),e.cmp(c.n)>=0||e.isZero())throw new Error(s.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return n.from(i.pub.mul(e).encode(!0,r))},e.publicKeyCombine=function(t,e){for(var r=new Array(t.length),i=0;i=0||r.cmp(c.n)>=0)throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);var i=n.from(t);return 1===r.cmp(u.nh)&&c.n.sub(r).toArrayLike(n,"be",32).copy(i,32),i},e.signatureExport=function(t){var e=t.slice(0,32),r=t.slice(32,64);if(new o(e).cmp(c.n)>=0||new o(r).cmp(c.n)>=0)throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);return{r:e,s:r}},e.signatureImport=function(t){var e=new o(t.r);e.cmp(c.n)>=0&&(e=new o(0));var r=new o(t.s);return r.cmp(c.n)>=0&&(r=new o(0)),n.concat([e.toArrayLike(n,"be",32),r.toArrayLike(n,"be",32)])},e.sign=function(t,e,r,i){if("function"===typeof r){var a=r;r=function(r){var u=a(t,e,null,i,r);if(!n.isBuffer(u)||32!==u.length)throw new Error(s.ECDSA_SIGN_FAIL);return new o(u)}}var f=new o(e);if(f.cmp(c.n)>=0||f.isZero())throw new Error(s.ECDSA_SIGN_FAIL);var h=u.sign(t,e,{canonical:!0,k:r,pers:i});return{signature:n.concat([h.r.toArrayLike(n,"be",32),h.s.toArrayLike(n,"be",32)]),recovery:h.recoveryParam}},e.verify=function(t,e,r){var n={r:e.slice(0,32),s:e.slice(32,64)},i=new o(n.r),a=new o(n.s);if(i.cmp(c.n)>=0||a.cmp(c.n)>=0)throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);if(1===a.cmp(u.nh)||i.isZero()||a.isZero())return!1;var f=l(r);if(null===f)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);return u.verify(t,n,{x:f.pub.x,y:f.pub.y})},e.recover=function(t,e,r,i){var a={r:e.slice(0,32),s:e.slice(32,64)},f=new o(a.r),h=new o(a.s);if(f.cmp(c.n)>=0||h.cmp(c.n)>=0)throw new Error(s.ECDSA_SIGNATURE_PARSE_FAIL);try{if(f.isZero()||h.isZero())throw new Error;var l=u.recoverPubKey(t,a,r);return n.from(l.encode(!0,i))}catch(d){throw new Error(s.ECDSA_RECOVER_FAIL)}},e.ecdh=function(t,r){var n=e.ecdhUnsafe(t,r,!0);return i("sha256").update(n).digest()},e.ecdhUnsafe=function(t,e,r){var i=l(t);if(null===i)throw new Error(s.EC_PUBLIC_KEY_PARSE_FAIL);var a=new o(e);if(a.cmp(c.n)>=0||a.isZero())throw new Error(s.ECDH_FAIL);return n.from(i.pub.mul(a).encode(!0,r))}},1985:function(t,e,r){(function(t,n){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */(function(o){e&&e.nodeType,t&&t.nodeType;var a="object"==typeof n&&n;a.global!==a&&a.window!==a&&a.self;var s,u=2147483647,c=36,f=1,h=26,l=38,d=700,p=72,m=128,y="-",v=/^xn--/,b=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=c-f,A=Math.floor,E=String.fromCharCode;function x(t){throw new RangeError(w[t])}function M(t,e){var r=t.length,n=[];while(r--)n[r]=e(t[r]);return n}function k(t,e){var r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(g,".");var i=t.split("."),o=M(i,e).join(".");return n+o}function S(t){var e,r,n=[],i=0,o=t.length;while(i=55296&&e<=56319&&i65535&&(t-=65536,e+=E(t>>>10&1023|55296),t=56320|1023&t),e+=E(t),e})).join("")}function C(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:c}function T(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function U(t,e,r){var n=0;for(t=r?A(t/d):t>>1,t+=A(t/e);t>_*h>>1;n+=c)t=A(t/_);return A(n+(_+1)*t/(t+l))}function O(t){var e,r,n,i,o,a,s,l,d,v,b=[],g=t.length,w=0,_=m,E=p;for(r=t.lastIndexOf(y),r<0&&(r=0),n=0;n=128&&x("not-basic"),b.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=g&&x("invalid-input"),l=C(t.charCodeAt(i++)),(l>=c||l>A((u-w)/a))&&x("overflow"),w+=l*a,d=s<=E?f:s>=E+h?h:s-E,lA(u/v)&&x("overflow"),a*=v}e=b.length+1,E=U(w-o,e,0==o),A(w/e)>u-_&&x("overflow"),_+=A(w/e),w%=e,b.splice(w++,0,_)}return I(b)}function P(t){var e,r,n,i,o,a,s,l,d,v,b,g,w,_,M,k=[];for(t=S(t),g=t.length,e=m,r=0,o=p,a=0;a=e&&bA((u-r)/w)&&x("overflow"),r+=(s-e)*w,e=s,a=0;au&&x("overflow"),b==e){for(l=r,d=c;;d+=c){if(v=d<=o?f:d>=o+h?h:d-o,lr){var n="rmd160"===t?new u:c(t);e=n.update(e).digest()}else e.length=8.0.0"},"gitHead":"c20bcf09b04f773406ce3532e88fd105bb04e244","homepage":"https://github.com/ethereum/web3.js#readme","keywords":["Ethereum","JavaScript","API"],"license":"LGPL-3.0","main":"src/index.js","name":"web3","repository":{"type":"git","url":"git+https://github.com/ethereum/web3.js.git"},"scripts":{"dtslint":"dtslint types --onlyTestTsNext","postinstall":"node angular-patch.js"},"types":"types/index.d.ts","version":"1.2.6"}')},"1b54":function(t,e,r){"use strict";var n=r("8707").Buffer,i=r("cd10"),o=n.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),a=n.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);e.privateKeyExport=function(t,e,r){var i=n.from(r?o:a);return t.copy(i,r?8:9),e.copy(i,r?181:214),i},e.privateKeyImport=function(t){var e=t.length,r=0;if(!(e2)&&!(e1?t[r+n-2]<<8:0);if(r+=n,!(e32||e1&&0===e[o]&&!(128&e[o+1]);--r,++o);for(var a=n.concat([n.from([0]),t.s]),s=33,u=0;s>1&&0===a[u]&&!(128&a[u+1]);--s,++u);return i.encode(e.slice(o),a.slice(u))},e.signatureImport=function(t){var e=n.alloc(32,0),r=n.alloc(32,0);try{var o=i.decode(t);if(33===o.r.length&&0===o.r[0]&&(o.r=o.r.slice(1)),o.r.length>32)throw new Error("R length is too long");if(33===o.s.length&&0===o.s[0]&&(o.s=o.s.slice(1)),o.s.length>32)throw new Error("S length is too long")}catch(a){return}return o.r.copy(e,32-o.r.length),o.s.copy(r,32-o.s.length),{r:e,s:r}},e.signatureImportLax=function(t){var e=n.alloc(32,0),r=n.alloc(32,0),i=t.length,o=0;if(48===t[o++]){var a=t[o++];if(!(128&a&&(o+=a-128,o>i))&&2===t[o++]){var s=t[o++];if(128&s){if(a=s-128,o+a>i)return;for(;a>0&&0===t[o];o+=1,a-=1);for(s=0;a>0;o+=1,a-=1)s=(s<<8)+t[o]}if(!(s>i-o)){var u=o;if(o+=s,2===t[o++]){var c=t[o++];if(128&c){if(a=c-128,o+a>i)return;for(;a>0&&0===t[o];o+=1,a-=1);for(c=0;a>0;o+=1,a-=1)c=(c<<8)+t[o]}if(!(c>i-o)){var f=o;for(o+=c;s>0&&0===t[u];s-=1,u+=1);if(!(s>32)){var h=t.slice(u,u+s);for(h.copy(e,32-h.length);c>0&&0===t[f];c-=1,f+=1);if(!(c>32)){var l=t.slice(f,f+c);return l.copy(r,32-l.length),{r:e,s:r}}}}}}}}}},"1be4":function(t,e,r){var n=r("d066");t.exports=n("document","documentElement")},"1c0b":function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},"1c46":function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r("11dc"),e.createHash=e.Hash=r("98e6"),e.createHmac=e.Hmac=r("1a2a");var n=r("116d"),i=Object.keys(n),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var a=r("a099");e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync;var s=r("956a");e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=r("00dc");e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=r("b692");e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=r("e1d3");var f=r("6442");e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var h=r("75cc");e.randomFill=h.randomFill,e.randomFillSync=h.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},"1c55":function(t,e,r){(function(n,i){var o; +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */(function(){"use strict";var a="input is invalid type",s="finalize already called",u="object"===typeof window,c=u?window:{};c.JS_SHA3_NO_WINDOW&&(u=!1);var f=!u&&"object"===typeof self,h=!c.JS_SHA3_NO_NODE_JS&&"object"===typeof n&&n.versions&&n.versions.node;h?c=i:f&&(c=self);var l=!c.JS_SHA3_NO_COMMON_JS&&"object"===typeof t&&t.exports,d=r("3c35"),p=!c.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,m="0123456789abcdef".split(""),y=[31,7936,2031616,520093696],v=[4,1024,262144,67108864],b=[1,256,65536,16777216],g=[6,1536,393216,100663296],w=[0,8,16,24],_=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],A=[224,256,384,512],E=[128,256],x=["hex","buffer","arrayBuffer","array","digest"],M={128:168,256:136};!c.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!p||!c.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"===typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var k=function(t,e,r){return function(n){return new K(t,e,t).update(n)[r]()}},S=function(t,e,r){return function(n,i){return new K(t,e,i).update(n)[r]()}},I=function(t,e,r){return function(e,n,i,o){return B["cshake"+t].update(e,n,i,o)[r]()}},C=function(t,e,r){return function(e,n,i,o){return B["kmac"+t].update(e,n,i,o)[r]()}},T=function(t,e,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function V(t,e,r){K.call(this,t,e,r)}K.prototype.update=function(t){if(this.finalized)throw new Error(s);var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(a);if(null===t)throw new Error(a);if(p&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!p||!ArrayBuffer.isView(t)))throw new Error(a);e=!0}var n,i,o=this.blocks,u=this.byteCount,c=t.length,f=this.blockCount,h=0,l=this.s;while(h>2]|=t[h]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(o[n>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=u){for(this.start=n-u,this.block=o[f],n=0;n>=8,r=255&t;while(r>0)i.unshift(r),t>>=8,r=255&t,++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},K.prototype.encodeString=function(t){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(a);if(null===t)throw new Error(a);if(p&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!p||!ArrayBuffer.isView(t)))throw new Error(a);e=!0}var n=0,i=t.length;if(e)n=i;else for(var o=0;o=57344?n+=3:(s=65536+((1023&s)<<10|1023&t.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(t),n},K.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+m[15&t]+m[t>>12&15]+m[t>>8&15]+m[t>>20&15]+m[t>>16&15]+m[t>>28&15]+m[t>>24&15];a%e===0&&(G(r),o=0)}return i&&(t=r[o],s+=m[t>>4&15]+m[15&t],i>1&&(s+=m[t>>12&15]+m[t>>8&15]),i>2&&(s+=m[t>>20&15]+m[t>>16&15])),s},K.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);var u=new Uint32Array(t);while(a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r===0&&G(n)}return o&&(t=s<<2,e=n[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},V.prototype=new K,V.prototype.finalize=function(){return this.encode(this.outputBits,!0),K.prototype.finalize.call(this)};var G=function(t){var e,r,n,i,o,a,s,u,c,f,h,l,d,p,m,y,v,b,g,w,A,E,x,M,k,S,I,C,T,U,O,P,R,N,B,j,L,D,F,q,H,z,K,V,G,$,Y,W,Z,J,X,Q,tt,et,rt,nt,it,ot,at,st,ut,ct,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],l=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],e=l^(a<<1|s>>>31),r=d^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(f<<1|h>>>31),r=s^(h<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(l<<1|d>>>31),r=c^(d<<1|l>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|o>>>31),r=h^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,p=t[0],m=t[1],$=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,C=t[20]<<3|t[21]>>>29,T=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,N=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,U=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,j=t[14]<<6|t[15]>>>26,L=t[15]<<6|t[14]>>>26,b=t[25]<<11|t[24]>>>21,g=t[24]<<11|t[25]>>>21,J=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,w=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,I=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=p^~y&b,t[1]=m^~v&g,t[10]=M^~S&C,t[11]=k^~I&T,t[20]=N^~j&D,t[21]=B^~L&F,t[30]=V^~$&W,t[31]=G^~Y&Z,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=y^~b&w,t[3]=v^~g&A,t[12]=S^~C&U,t[13]=I^~T&O,t[22]=j^~D&q,t[23]=L^~F&H,t[32]=$^~W&J,t[33]=Y^~Z&X,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=b^~w&E,t[5]=g^~A&x,t[14]=C^~U&P,t[15]=T^~O&R,t[24]=D^~q&z,t[25]=F^~H&K,t[34]=W^~J&Q,t[35]=Z^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&ft,t[6]=w^~E&p,t[7]=A^~x&m,t[16]=U^~P&M,t[17]=O^~R&k,t[26]=q^~z&N,t[27]=H^~K&B,t[36]=J^~Q&V,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~ft&rt,t[8]=E^~p&y,t[9]=x^~m&v,t[18]=P^~M&S,t[19]=R^~k&I,t[28]=z^~N&j,t[29]=K^~B&L,t[38]=Q^~V&$,t[39]=tt^~G&Y,t[48]=ct^~et&nt,t[49]=ft^~rt&it,t[0]^=_[n],t[1]^=_[n+1]};if(l)t.exports=B;else{for(L=0;L{let r=[];for(var n=0;nr(t,()=>e),i=(t,e)=>t.concat(e),o=t=>{let e=[];for(let r=0,n=t.length;r{let r=[];for(let n=0,i=e.length;n({blocks:[],reset:!0,block:0,start:0,blockCount:1600-(t<<1)>>5,outputBlocks:t>>5,s:(t=>[].concat(t,t,t,t,t))([0,0,0,0,0,0,0,0,0,0])}),s=(t,e)=>{var o,a=e.length,s=t.blocks,c=t.blockCount<<2,f=t.blockCount,h=t.outputBlocks,l=t.s,d=0;while(d>2]|=e[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[y>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=c){for(t.start=y-c,t.block=s[f],y=0;y>2]|=n[3&y],t.lastByteIndex===c)for(s[0]=s[f],y=1;y>4&15]+r[15&p]+r[p>>12&15]+r[p>>8&15]+r[p>>20&15]+r[p>>16&15]+r[p>>28&15]+r[p>>24&15];v%f===0&&(u(l),y=0)}return"0x"+m},u=t=>{var e,r,n,i,a,s,u,c,f,h,l,d,p,m,y,v,b,g,w,_,A,E,x,M,k,S,I,C,T,U,O,P,R,N,B,j,L,D,F,q,H,z,K,V,G,$,Y,W,Z,J,X,Q,tt,et,rt,nt,it,ot,at,st,ut,ct,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],a=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],c=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],d=t[8]^t[18]^t[28]^t[38]^t[48],p=t[9]^t[19]^t[29]^t[39]^t[49],e=d^(s<<1|u>>>31),r=p^(u<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(c<<1|f>>>31),r=a^(f<<1|c>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(h<<1|l>>>31),r=u^(l<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=c^(d<<1|p>>>31),r=f^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|a>>>31),r=l^(a<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],y=t[1],$=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,C=t[20]<<3|t[21]>>>29,T=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,N=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,U=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,j=t[14]<<6|t[15]>>>26,L=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,J=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,I=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=m^~v&g,t[1]=y^~b&w,t[10]=M^~S&C,t[11]=k^~I&T,t[20]=N^~j&D,t[21]=B^~L&F,t[30]=V^~$&W,t[31]=G^~Y&Z,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=v^~g&_,t[3]=b^~w&A,t[12]=S^~C&U,t[13]=I^~T&O,t[22]=j^~D&q,t[23]=L^~F&H,t[32]=$^~W&J,t[33]=Y^~Z&X,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~_&E,t[5]=w^~A&x,t[14]=C^~U&P,t[15]=T^~O&R,t[24]=D^~q&z,t[25]=F^~H&K,t[34]=W^~J&Q,t[35]=Z^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&ft,t[6]=_^~E&m,t[7]=A^~x&y,t[16]=U^~P&M,t[17]=O^~R&k,t[26]=q^~z&N,t[27]=H^~K&B,t[36]=J^~Q&V,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~ft&rt,t[8]=E^~m&v,t[9]=x^~y&b,t[18]=P^~M&S,t[19]=R^~k&I,t[28]=z^~N&j,t[29]=K^~B&L,t[38]=Q^~V&$,t[39]=tt^~G&Y,t[48]=ct^~et&nt,t[49]=ft^~rt&it,t[0]^=o[n],t[1]^=o[n+1]},c=t=>e=>{var r;if("0x"===e.slice(0,2)){r=[];for(var n=2,i=e.length;n0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");-1===r&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function f(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n}function h(t,e,r){return 3*(e+r)/4-r}function l(t){var e,r,n=c(t),a=n[0],s=n[1],u=new o(h(t,a,s)),f=0,l=s>0?a-4:a;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;return 2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[f++]=255&e),1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e),u}function d(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function p(t,e,r){for(var n,i=[],o=e;ou?u:s+a));return 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]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},"1fc8":function(t,e,r){"use strict";var n=r("17fb"),i=r("f1ee"),o=r("39d4"),a=r("4923").subscriptions,s=r("6248"),u=r("1131"),c=r("ae52"),f=r("701e"),h=r("b3ce"),l=r("d100"),d=r("da53"),p=r("222f"),m=r("bbaf"),y=r("e199"),v=o.formatters,b=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},g=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},w=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},_=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},A=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},E=function(){var t=this;i.packageInit(this,arguments);var e=this.setProvider;this.setProvider=function(){e.apply(t,arguments),t.net.setProvider.apply(t,arguments),t.personal.setProvider.apply(t,arguments),t.accounts.setProvider.apply(t,arguments),t.Contract.setProvider(t.currentProvider,t.accounts)};var r,o,E,x=!1,M=null,k="latest",S=50,I=24,C=750;Object.defineProperty(this,"handleRevert",{get:function(){return x},set:function(e){x=e,t.Contract.handleRevert=x,O.forEach((function(t){t.handleRevert=x}))},enumerable:!0}),Object.defineProperty(this,"defaultCommon",{get:function(){return E},set:function(e){E=e,t.Contract.defaultCommon=E,O.forEach((function(t){t.defaultCommon=E}))},enumerable:!0}),Object.defineProperty(this,"defaultHardfork",{get:function(){return o},set:function(e){o=e,t.Contract.defaultHardfork=o,O.forEach((function(t){t.defaultHardfork=o}))},enumerable:!0}),Object.defineProperty(this,"defaultChain",{get:function(){return r},set:function(e){r=e,t.Contract.defaultChain=r,O.forEach((function(t){t.defaultChain=r}))},enumerable:!0}),Object.defineProperty(this,"transactionPollingTimeout",{get:function(){return C},set:function(e){C=e,t.Contract.transactionPollingTimeout=C,O.forEach((function(t){t.transactionPollingTimeout=C}))},enumerable:!0}),Object.defineProperty(this,"transactionConfirmationBlocks",{get:function(){return I},set:function(e){I=e,t.Contract.transactionConfirmationBlocks=I,O.forEach((function(t){t.transactionConfirmationBlocks=I}))},enumerable:!0}),Object.defineProperty(this,"transactionBlockTimeout",{get:function(){return S},set:function(e){S=e,t.Contract.transactionBlockTimeout=S,O.forEach((function(t){t.transactionBlockTimeout=S}))},enumerable:!0}),Object.defineProperty(this,"defaultAccount",{get:function(){return M},set:function(e){return e&&(M=u.toChecksumAddress(v.inputAddressFormatter(e))),t.Contract.defaultAccount=M,t.personal.defaultAccount=M,O.forEach((function(t){t.defaultAccount=M})),e},enumerable:!0}),Object.defineProperty(this,"defaultBlock",{get:function(){return k},set:function(e){return k=e,t.Contract.defaultBlock=k,t.personal.defaultBlock=k,O.forEach((function(t){t.defaultBlock=k})),e},enumerable:!0}),this.clearSubscriptions=t._requestManager.clearSubscriptions,this.net=new c(this.currentProvider),this.net.getNetworkType=y.bind(this),this.accounts=new p(this.currentProvider),this.personal=new h(this.currentProvider),this.personal.defaultAccount=this.defaultAccount;var T=this,U=function(){l.apply(this,arguments);var t=this,e=T.setProvider;T.setProvider=function(){e.apply(T,arguments),i.packageInit(t,[T.currentProvider])}};U.setProvider=function(){l.setProvider.apply(this,arguments)},U.prototype=Object.create(l.prototype),U.prototype.constructor=U,this.Contract=U,this.Contract.defaultAccount=this.defaultAccount,this.Contract.defaultBlock=this.defaultBlock,this.Contract.transactionBlockTimeout=this.transactionBlockTimeout,this.Contract.transactionConfirmationBlocks=this.transactionConfirmationBlocks,this.Contract.transactionPollingTimeout=this.transactionPollingTimeout,this.Contract.handleRevert=this.handleRevert,this.Contract.setProvider(this.currentProvider,this.accounts),this.Iban=d,this.abi=m,this.ens=new f(this);var O=[new s({name:"getNodeInfo",call:"web3_clientVersion"}),new s({name:"getProtocolVersion",call:"eth_protocolVersion",params:0}),new s({name:"getCoinbase",call:"eth_coinbase",params:0}),new s({name:"isMining",call:"eth_mining",params:0}),new s({name:"getHashrate",call:"eth_hashrate",params:0,outputFormatter:u.hexToNumber}),new s({name:"isSyncing",call:"eth_syncing",params:0,outputFormatter:v.outputSyncingFormatter}),new s({name:"getGasPrice",call:"eth_gasPrice",params:0,outputFormatter:v.outputBigNumberFormatter}),new s({name:"getAccounts",call:"eth_accounts",params:0,outputFormatter:u.toChecksumAddress}),new s({name:"getBlockNumber",call:"eth_blockNumber",params:0,outputFormatter:u.hexToNumber}),new s({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[v.inputAddressFormatter,v.inputDefaultBlockNumberFormatter],outputFormatter:v.outputBigNumberFormatter}),new s({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[v.inputAddressFormatter,u.numberToHex,v.inputDefaultBlockNumberFormatter]}),new s({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[v.inputAddressFormatter,v.inputDefaultBlockNumberFormatter]}),new s({name:"getBlock",call:b,params:2,inputFormatter:[v.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:v.outputBlockFormatter}),new s({name:"getUncle",call:w,params:2,inputFormatter:[v.inputBlockNumberFormatter,u.numberToHex],outputFormatter:v.outputBlockFormatter}),new s({name:"getBlockTransactionCount",call:_,params:1,inputFormatter:[v.inputBlockNumberFormatter],outputFormatter:u.hexToNumber}),new s({name:"getBlockUncleCount",call:A,params:1,inputFormatter:[v.inputBlockNumberFormatter],outputFormatter:u.hexToNumber}),new s({name:"getTransaction",call:"eth_getTransactionByHash",params:1,inputFormatter:[null],outputFormatter:v.outputTransactionFormatter}),new s({name:"getTransactionFromBlock",call:g,params:2,inputFormatter:[v.inputBlockNumberFormatter,u.numberToHex],outputFormatter:v.outputTransactionFormatter}),new s({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,inputFormatter:[null],outputFormatter:v.outputTransactionReceiptFormatter}),new s({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[v.inputAddressFormatter,v.inputDefaultBlockNumberFormatter],outputFormatter:u.hexToNumber}),new s({name:"sendSignedTransaction",call:"eth_sendRawTransaction",params:1,inputFormatter:[null]}),new s({name:"signTransaction",call:"eth_signTransaction",params:1,inputFormatter:[v.inputTransactionFormatter]}),new s({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[v.inputTransactionFormatter],abiCoder:m}),new s({name:"sign",call:"eth_sign",params:2,inputFormatter:[v.inputSignFormatter,v.inputAddressFormatter],transformPayload:function(t){return t.params.reverse(),t}}),new s({name:"call",call:"eth_call",params:2,inputFormatter:[v.inputCallFormatter,v.inputDefaultBlockNumberFormatter],abiCoder:m}),new s({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[v.inputCallFormatter],outputFormatter:u.hexToNumber}),new s({name:"submitWork",call:"eth_submitWork",params:3}),new s({name:"getWork",call:"eth_getWork",params:0}),new s({name:"getPastLogs",call:"eth_getLogs",params:1,inputFormatter:[v.inputLogFormatter],outputFormatter:v.outputLogFormatter}),new s({name:"getChainId",call:"eth_chainId",params:0,outputFormatter:u.hexToNumber}),new s({name:"requestAccounts",call:"eth_requestAccounts",params:0,outputFormatter:u.toChecksumAddress}),new s({name:"getProof",call:"eth_getProof",params:3,inputFormatter:[v.inputAddressFormatter,v.inputStorageKeysFormatter,v.inputDefaultBlockNumberFormatter],outputFormatter:v.outputProofFormatter}),new s({name:"getPendingTransactions",call:"eth_pendingTransactions",params:0,outputFormatter:v.outputTransactionFormatter}),new a({name:"subscribe",type:"eth",subscriptions:{newBlockHeaders:{subscriptionName:"newHeads",params:0,outputFormatter:v.outputBlockFormatter},pendingTransactions:{subscriptionName:"newPendingTransactions",params:0},logs:{params:1,inputFormatter:[v.inputLogFormatter],outputFormatter:v.outputLogFormatter,subscriptionHandler:function(t){t.removed?this.emit("changed",t):this.emit("data",t),n.isFunction(this.callback)&&this.callback(null,t,this)}},syncing:{params:0,outputFormatter:v.outputSyncingFormatter,subscriptionHandler:function(t){var e=this;!0!==this._isSyncing?(this._isSyncing=!0,this.emit("changed",e._isSyncing),n.isFunction(this.callback)&&this.callback(null,e._isSyncing,this),setTimeout((function(){e.emit("data",t),n.isFunction(e.callback)&&e.callback(null,t,e)}),0)):(this.emit("data",t),n.isFunction(e.callback)&&this.callback(null,t,this),clearTimeout(this._isSyncingTimeout),this._isSyncingTimeout=setTimeout((function(){t.currentBlock>t.highestBlock-200&&(e._isSyncing=!1,e.emit("changed",e._isSyncing),n.isFunction(e.callback)&&e.callback(null,e._isSyncing,e))}),500))}}}})];O.forEach((function(e){e.attachToObject(t),e.setRequestManager(t._requestManager,t.accounts),e.defaultBlock=t.defaultBlock,e.defaultAccount=t.defaultAccount,e.transactionBlockTimeout=t.transactionBlockTimeout,e.transactionConfirmationBlocks=t.transactionConfirmationBlocks,e.transactionPollingTimeout=t.transactionPollingTimeout,e.handleRevert=t.handleRevert}))};i.addProviders(E),t.exports=E},"1fec":function(t,e,r){"use strict";var n=r("da3e"),i=r("3fb5"),o=r("0184"),a=r("4e2b");function s(t,e){n.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:i}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:i}),a.create({type:"decrypt",key:r})]}function u(t){o.call(this,t);var e=new s(this.type,this.options.key);this._edeState=e}i(u,o),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},2044:function(t){t.exports=JSON.parse('{"name":"petersburg","comment":"Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople","eip":{"url":"https://github.com/ethereum/EIPs/pull/1716","status":"Draft"},"gasConfig":{},"gasPrices":{"netSstoreNoopGas":{"v":null,"d":"Removed along EIP-1283"},"netSstoreInitGas":{"v":null,"d":"Removed along EIP-1283"},"netSstoreCleanGas":{"v":null,"d":"Removed along EIP-1283"},"netSstoreDirtyGas":{"v":null,"d":"Removed along EIP-1283"},"netSstoreClearRefund":{"v":null,"d":"Removed along EIP-1283"},"netSstoreResetRefund":{"v":null,"d":"Removed along EIP-1283"},"netSstoreResetClearRefund":{"v":null,"d":"Removed along EIP-1283"}},"vm":{},"pow":{},"casper":{},"sharding":{}}')},"206d":function(t,e,r){(function(e,n){var i,o=r("7d2a"),a=r("9f9d"),s=r("e07b"),u=r("8707").Buffer,c=e.crypto&&e.crypto.subtle,f={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},h=[];function l(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(void 0!==h[t])return h[t];i=i||u.alloc(8);var r=d(i,i,10,128,t).then((function(){return!0})).catch((function(){return!1}));return h[t]=r,r}function d(t,e,r,n,i){return c.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return c.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)})).then((function(t){return u.from(t)}))}function p(t,e){t.then((function(t){n.nextTick((function(){e(null,t)}))}),(function(t){n.nextTick((function(){e(t)}))}))}t.exports=function(t,r,i,c,h,m){"function"===typeof h&&(m=h,h=void 0),h=h||"sha1";var y=f[h.toLowerCase()];if(!y||"function"!==typeof e.Promise)return n.nextTick((function(){var e;try{e=s(t,r,i,c,h)}catch(n){return m(n)}m(null,e)}));if(o(t,r,i,c),"function"!==typeof m)throw new Error("No callback provided to pbkdf2");u.isBuffer(t)||(t=u.from(t,a)),u.isBuffer(r)||(r=u.from(r,a)),p(l(y).then((function(e){return e?d(t,r,i,c,y):s(t,r,i,c,h)})),m)}}).call(this,r("c8ba"),r("4362"))},2091:function(t,e,r){var n=r("17fb"),i=r("399f"),o=r("e870"),a=function(t){return t.startsWith("int[")?"int256"+t.slice(3):"int"===t?"int256":t.startsWith("uint[")?"uint256"+t.slice(4):"uint"===t?"uint256":t.startsWith("fixed[")?"fixed128x128"+t.slice(5):"fixed"===t?"fixed128x128":t.startsWith("ufixed[")?"ufixed128x128"+t.slice(6):"ufixed"===t?"ufixed128x128":t},s=function(t){var e=/^\D+(\d+).*$/.exec(t);return e?parseInt(e[1],10):null},u=function(t){var e=/^\D+\d*\[(\d+)\]$/.exec(t);return e?parseInt(e[1],10):null},c=function(t){var e=typeof t;if("string"===e)return o.isHexStrict(t)?new i(t.replace(/0x/i,""),16):new i(t,10);if("number"===e)return new i(t);if(o.isBigNumber(t))return new i(t.toString(10));if(o.isBN(t))return t;throw new Error(t+" is not a number")},f=function(t,e,r){var n,u;if(t=a(t),"bytes"===t){if(e.replace(/^0x/i,"").length%2!==0)throw new Error("Invalid bytes characters "+e.length);return e}if("string"===t)return o.utf8ToHex(e);if("bool"===t)return e?"01":"00";if(t.startsWith("address")){if(n=r?64:40,!o.isAddress(e))throw new Error(e+" is not a valid address, or the checksum is invalid.");return o.leftPad(e.toLowerCase(),n)}if(n=s(t),t.startsWith("bytes")){if(!n)throw new Error("bytes[] not yet supported in solidity");if(r&&(n=32),n<1||n>32||n256)throw new Error("Invalid uint"+n+" size");if(u=c(e),u.bitLength()>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+u.bitLength());if(u.lt(new i(0)))throw new Error("Supplied uint "+u.toString()+" is negative");return n?o.leftPad(u.toString("hex"),n/8*2):u}if(t.startsWith("int")){if(n%8||n<8||n>256)throw new Error("Invalid int"+n+" size");if(u=c(e),u.bitLength()>n)throw new Error("Supplied int exceeds width: "+n+" vs "+u.bitLength());return u.lt(new i(0))?u.toTwos(n).toString("hex"):n?o.leftPad(u.toString("hex"),n/8*2):u}throw new Error("Unsupported or invalid type: "+t)},h=function(t){if(n.isArray(t))throw new Error("Autodetection of array types is not supported.");var e,r,a,s="";if(n.isObject(t)&&(t.hasOwnProperty("v")||t.hasOwnProperty("t")||t.hasOwnProperty("value")||t.hasOwnProperty("type"))?(e=t.hasOwnProperty("t")?t.t:t.type,s=t.hasOwnProperty("v")?t.v:t.value):(e=o.toHex(t,!0),s=o.toHex(t),e.startsWith("int")||e.startsWith("uint")||(e="bytes")),!e.startsWith("int")&&!e.startsWith("uint")||"string"!==typeof s||/^(-)?0x/i.test(s)||(s=new i(s)),n.isArray(s)){if(a=u(e),a&&s.length!==a)throw new Error(e+" is not matching the given array "+JSON.stringify(s));a=s.length}return n.isArray(s)?(r=s.map((function(t){return f(e,t,a).toString("hex").replace("0x","")})),r.join("")):(r=f(e,s,a),r.toString("hex").replace("0x",""))},l=function(){var t=Array.prototype.slice.call(arguments),e=n.map(t,h);return o.sha3("0x"+e.join(""))},d=function(){return o.sha3Raw("0x"+n.map(Array.prototype.slice.call(arguments),h).join(""))};t.exports={soliditySha3:l,soliditySha3Raw:d}},"20f6":function(t,e,r){var n=e;n.der=r("cfbd"),n.pem=r("8df7")},2137:function(t,e,r){"use strict";var n=r("c3c0"),i=r("da3e");function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e>1),"0x","0x"],o=e.slice(0,6).concat(i),a=f.encode(o);return u.recover(c.keccak256(a),r)},w.prototype.hashMessage=function(t){var e=m.isHexStrict(t)?m.hexToBytes(t):t,r=n.from(e),i="Ethereum Signed Message:\n"+e.length,o=n.from(i),a=n.concat([o,r]);return c.keccak256s(a)},w.prototype.sign=function(t,e){var r=this.hashMessage(t),n=u.sign(r,e),i=u.decodeSignature(n);return{message:t,messageHash:r,v:i[0],r:i[1],s:i[2],signature:n}},w.prototype.recover=function(t,e,r){var n=[].slice.apply(arguments);return i.isObject(t)?this.recover(t.messageHash,u.encodeSignature([t.v,t.r,t.s]),!0):(r||(t=this.hashMessage(t)),n.length>=4?(r=n.slice(-1)[0],r=!!i.isBoolean(r)&&!!r,this.recover(t,u.encodeSignature(n.slice(1,4)),r)):u.recover(t,e))},w.prototype.decrypt=function(t,e,r){if(!i.isString(e))throw new Error("No password given.");var o,a,s=i.isObject(t)?t:JSON.parse(r?t.toLowerCase():t);if(3!==s.version)throw new Error("Not a valid V3 wallet");if("scrypt"===s.crypto.kdf)a=s.crypto.kdfparams,o=d(n.from(e),n.from(a.salt,"hex"),a.n,a.r,a.p,a.dklen);else{if("pbkdf2"!==s.crypto.kdf)throw new Error("Unsupported key derivation scheme");if(a=s.crypto.kdfparams,"hmac-sha256"!==a.prf)throw new Error("Unsupported parameters to PBKDF2");o=l.pbkdf2Sync(n.from(e),n.from(a.salt,"hex"),a.c,a.dklen,"sha256")}var u=n.from(s.crypto.ciphertext,"hex"),c=m.sha3(n.concat([o.slice(16,32),u])).replace("0x","");if(c!==s.crypto.mac)throw new Error("Key derivation failed - possibly wrong password");var f=l.createDecipheriv(s.crypto.cipher,o.slice(0,16),n.from(s.crypto.cipherparams.iv,"hex")),h="0x"+n.concat([f.update(u),f.final()]).toString("hex");return this.privateKeyToAccount(h)},w.prototype.encrypt=function(t,e,r){var i=this.privateKeyToAccount(t);r=r||{};var o,a=r.salt||l.randomBytes(32),s=r.iv||l.randomBytes(16),u=r.kdf||"scrypt",c={dklen:r.dklen||32,salt:a.toString("hex")};if("pbkdf2"===u)c.c=r.c||262144,c.prf="hmac-sha256",o=l.pbkdf2Sync(n.from(e),n.from(c.salt,"hex"),c.c,c.dklen,"sha256");else{if("scrypt"!==u)throw new Error("Unsupported kdf");c.n=r.n||8192,c.r=r.r||8,c.p=r.p||1,o=d(n.from(e),n.from(c.salt,"hex"),c.n,c.r,c.p,c.dklen)}var f=l.createCipheriv(r.cipher||"aes-128-ctr",o.slice(0,16),s);if(!f)throw new Error("Unsupported cipher");var h=n.concat([f.update(n.from(i.privateKey.replace("0x",""),"hex")),f.final()]),y=m.sha3(n.concat([o.slice(16,32),n.from(h,"hex")])).replace("0x","");return{version:3,id:p.v4({random:r.uuid||l.randomBytes(16)}),address:i.address.toLowerCase().replace("0x",""),crypto:{ciphertext:h.toString("hex"),cipherparams:{iv:s.toString("hex")},cipher:r.cipher||"aes-128-ctr",kdf:u,kdfparams:c,mac:y.toString("hex")}}},_.prototype._findSafeIndex=function(t){return t=t||0,i.has(this,t)?this._findSafeIndex(t+1):t},_.prototype._currentIndexes=function(){var t=Object.keys(this),e=t.map((function(t){return parseInt(t)})).filter((function(t){return t<9e20}));return e},_.prototype.create=function(t,e){for(var r=0;rp;p++)if(y=f?g(n(b=t[p])[0],b[1]):g(t[p]),y&&y instanceof c)return y;return new c(!1)}l=d.call(t)}v=l.next;while(!(b=v.call(l)).done)if(y=u(l,g,b.value,f),"object"==typeof y&&y&&y instanceof c)return y;return new c(!1)};f.stop=function(t){return new c(!0,t)}},2330:function(t,e,r){"use strict";t.exports=r("3a89")(r("18fd"))},"23cb":function(t,e,r){var n=r("a691"),i=Math.max,o=Math.min;t.exports=function(t,e){var r=n(t);return r<0?i(r+e,0):o(r,e)}},"23e7":function(t,e,r){var n=r("da84"),i=r("06cf").f,o=r("9112"),a=r("6eeb"),s=r("ce4e"),u=r("e893"),c=r("94ca");t.exports=function(t,e){var r,f,h,l,d,p,m=t.target,y=t.global,v=t.stat;if(f=y?n:v?n[m]||s(m,{}):(n[m]||{}).prototype,f)for(h in e){if(d=e[h],t.noTargetGet?(p=i(f,h),l=p&&p.value):l=f[h],r=c(y?h:m+(v?".":"#")+h,t.forced),!r&&void 0!==l){if(typeof d===typeof l)continue;u(d,l)}(t.sham||l&&l.sham)&&o(d,"sham",!0),a(f,h,d,t)}}},2416:function(t,e,r){"use strict";const n=r("97cc").Buffer,i=r("6fde");function o(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}o.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1},o.prototype.absorb=function(t){for(let e=0;e>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0);return e},o.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing},t.exports=o},"241c":function(t,e,r){var n=r("ca84"),i=r("7839"),o=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,o)}},"24f8":function(t,e,r){var n=r("9490"),i=r("0b16"),o=t.exports;for(var a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);function s(t){if("string"===typeof t&&(t=i.parse(t)),t.protocol||(t.protocol="https:"),"https:"!==t.protocol)throw new Error('Protocol "'+t.protocol+'" not supported. Expected "https:"');return t}o.request=function(t,e){return t=s(t),n.request.call(this,t,e)},o.get=function(t,e){return t=s(t),n.get.call(this,t,e)}},"25f2":function(t,e,r){var n=r("aaa4");t.exports=function(t,e){return new Promise((function(r,i){n(t,e,(function(t,e){t?i(t):r(e)}))}))}},2613:function(t){t.exports=JSON.parse('{"name":"ropsten","chainId":3,"networkId":3,"comment":"PoW test network","url":"https://github.com/ethereum/ropsten","genesis":{"hash":"0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d","timestamp":null,"gasLimit":16777216,"difficulty":1048576,"nonce":"0x0000000000000042","extraData":"0x3535353535353535353535353535353535353535353535353535353535353535","stateRoot":"0x217b0bbcfb72e2d57e28f33cb361b9983513177755dc3f33ce3e7022ed62b77b"},"hardforks":[{"name":"chainstart","block":0,"consensus":"pow","finality":null},{"name":"homestead","block":0,"consensus":"pow","finality":null},{"name":"dao","block":null,"consensus":"pow","finality":null},{"name":"tangerineWhistle","block":0,"consensus":"pow","finality":null},{"name":"spuriousDragon","block":10,"consensus":"pow","finality":null},{"name":"byzantium","block":1700000,"consensus":"pow","finality":null},{"name":"constantinople","block":4230000,"consensus":"pow","finality":null},{"name":"petersburg","block":4939394,"consensus":"pow","finality":null},{"name":"istanbul","block":6485846,"consensus":"pow","finality":null},{"name":"muirGlacier","block":7117117,"consensus":"pow","finality":null}],"bootstrapNodes":[{"ip":"52.176.7.10","port":"30303","id":"30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606","network":"Ropsten","chainId":3,"location":"US","comment":"US-Azure geth"},{"ip":"52.176.100.77","port":"30303","id":"865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c","network":"Ropsten","chainId":3,"location":"US","comment":"US-Azure parity"},{"ip":"52.232.243.152","port":"30303","id":"6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f","network":"Ropsten","chainId":3,"location":"US","comment":"Parity"},{"ip":"192.81.208.223","port":"30303","id":"94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09","network":"Ropsten","chainId":3,"location":"US","comment":"@gpip"}]}')},2626:function(t,e,r){"use strict";var n=r("d066"),i=r("9bf2"),o=r("b622"),a=r("83ab"),s=o("species");t.exports=function(t){var e=n(t),r=i.f;a&&e&&!e[s]&&r(e,s,{configurable:!0,get:function(){return this}})}},"27bf":function(t,e,r){"use strict";t.exports=a;var n=r("b19a"),i=Object.create(r("3a7c"));function o(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length>6|192,r[o++]=63&s|128):55296==(64512&s)&&a+1>18|240,r[o++]=s>>12&63|128,r[o++]=s>>6&63|128,r[o++]=63&s|128):(r[o++]=s>>12|224,r[o++]=s>>6&63|128,r[o++]=63&s|128)}return i.arrayify(r)}function a(t){t=i.arrayify(t);var e="",r=0;while(r>7!=0){if(n>>6!=2){var o=null;if(n>>5==6)o=1;else if(n>>4==14)o=2;else if(n>>3==30)o=3;else if(n>>2==62)o=4;else{if(n>>1!=126)continue;o=5}if(r+o>t.length){for(;r>6!=2)break;if(r!=t.length)continue;return e}var a,s=n&(1<<8-o-1)-1;for(a=0;a>6!=2)break;s=s<<6|63&u}a==o?s<=65535?e+=String.fromCharCode(s):(s-=65536,e+=String.fromCharCode(55296+(s>>10&1023),56320+(1023&s))):r--}}else e+=String.fromCharCode(n)}return e}(function(t){t["current"]="",t["NFC"]="NFC",t["NFD"]="NFD",t["NFKC"]="NFKC",t["NFKD"]="NFKD"})(n=e.UnicodeNormalizationForm||(e.UnicodeNormalizationForm={})),e.toUtf8Bytes=o,e.toUtf8String=a},"2ad0":function(t,e,r){var n=r("a00b"),i=r("f5e1"),o=i;o.v1=n,o.v4=i,t.exports=o},"2aee":function(t,e,r){var n=r("4111"),i=r("d70e"),o=r("4dd0"),a=r("fda6"),s=r("a099"),u=r("8707").Buffer;function c(t){var e;"object"!==typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"===typeof t&&(t=u.from(t));var r,i,a=o(t,e),s=a.tag,c=a.data;switch(s){case"CERTIFICATE":i=n.certificate.decode(c,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(i||(i=n.PublicKey.decode(c,"der")),r=i.algorithm.algorithm.join("."),r){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(i.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return i.subjectPrivateKey=i.subjectPublicKey,{type:"ec",data:i};case"1.2.840.10040.4.1":return i.algorithm.params.pub_key=n.DSAparam.decode(i.subjectPublicKey.data,"der"),{type:"dsa",data:i.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+s);case"ENCRYPTED PRIVATE KEY":c=n.EncryptedPrivateKey.decode(c,"der"),c=f(c,e);case"PRIVATE KEY":switch(i=n.PrivateKey.decode(c,"der"),r=i.algorithm.algorithm.join("."),r){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(i.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:i.algorithm.curve,privateKey:n.ECPrivateKey.decode(i.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return i.algorithm.params.priv_key=n.DSAparam.decode(i.subjectPrivateKey,"der"),{type:"dsa",params:i.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+s);case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(c,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(c,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(c,"der")};case"EC PRIVATE KEY":return c=n.ECPrivateKey.decode(c,"der"),{curve:c.parameters.value,privateKey:c.privateKey};default:throw new Error("unknown key type "+s)}}function f(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[t.algorithm.decrypt.cipher.algo.join(".")],c=t.algorithm.decrypt.cipher.iv,f=t.subjectPrivateKey,h=parseInt(o.split("-")[1],10)/8,l=s.pbkdf2Sync(e,r,n,h,"sha1"),d=a.createDecipheriv(o,l,c),p=[];return p.push(d.update(f)),p.push(d.final()),u.concat(p)}t.exports=c,c.signature=n.signature},"2b0e":function(t,e,r){"use strict";(function(t){ +/*! + * Vue.js v2.6.11 + * (c) 2014-2019 Evan You + * Released under the MIT License. + */ +var r=Object.freeze({});function n(t){return void 0===t||null===t}function i(t){return void 0!==t&&null!==t}function o(t){return!0===t}function a(t){return!1===t}function s(t){return"string"===typeof t||"number"===typeof t||"symbol"===typeof t||"boolean"===typeof t}function u(t){return null!==t&&"object"===typeof t}var c=Object.prototype.toString;function f(t){return"[object Object]"===c.call(t)}function h(t){return"[object RegExp]"===c.call(t)}function l(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function d(t){return i(t)&&"function"===typeof t.then&&"function"===typeof t.catch}function p(t){return null==t?"":Array.isArray(t)||f(t)&&t.toString===c?JSON.stringify(t,null,2):String(t)}function m(t){var e=parseFloat(t);return isNaN(e)?t:e}function y(t,e){for(var r=Object.create(null),n=t.split(","),i=0;i-1)return t.splice(r,1)}}var g=Object.prototype.hasOwnProperty;function w(t,e){return g.call(t,e)}function _(t){var e=Object.create(null);return function(r){var n=e[r];return n||(e[r]=t(r))}}var A=/-(\w)/g,E=_((function(t){return t.replace(A,(function(t,e){return e?e.toUpperCase():""}))})),x=_((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),M=/\B([A-Z])/g,k=_((function(t){return t.replace(M,"-$1").toLowerCase()}));function S(t,e){function r(r){var n=arguments.length;return n?n>1?t.apply(e,arguments):t.call(e,r):t.call(e)}return r._length=t.length,r}function I(t,e){return t.bind(e)}var C=Function.prototype.bind?I:S;function T(t,e){e=e||0;var r=t.length-e,n=new Array(r);while(r--)n[r]=t[r+e];return n}function U(t,e){for(var r in e)t[r]=e[r];return t}function O(t){for(var e={},r=0;r0,rt=Q&&Q.indexOf("edge/")>0,nt=(Q&&Q.indexOf("android"),Q&&/iphone|ipad|ipod|ios/.test(Q)||"ios"===X),it=(Q&&/chrome\/\d+/.test(Q),Q&&/phantomjs/.test(Q),Q&&Q.match(/firefox\/(\d+)/)),ot={}.watch,at=!1;if(Z)try{var st={};Object.defineProperty(st,"passive",{get:function(){at=!0}}),window.addEventListener("test-passive",null,st)}catch(Ea){}var ut=function(){return void 0===Y&&(Y=!Z&&!J&&"undefined"!==typeof t&&(t["process"]&&"server"===t["process"].env.VUE_ENV)),Y},ct=Z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ft(t){return"function"===typeof t&&/native code/.test(t.toString())}var ht,lt="undefined"!==typeof Symbol&&ft(Symbol)&&"undefined"!==typeof Reflect&&ft(Reflect.ownKeys);ht="undefined"!==typeof Set&&ft(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var dt=P,pt=0,mt=function(){this.id=pt++,this.subs=[]};mt.prototype.addSub=function(t){this.subs.push(t)},mt.prototype.removeSub=function(t){b(this.subs,t)},mt.prototype.depend=function(){mt.target&&mt.target.addDep(this)},mt.prototype.notify=function(){var t=this.subs.slice();for(var e=0,r=t.length;e-1)if(o&&!w(i,"default"))a=!1;else if(""===a||a===k(t)){var u=te(String,i.type);(u<0||s0&&(a=Se(a,(e||"")+"_"+r),ke(a[0])&&ke(c)&&(f[u]=At(c.text+a[0].text),a.shift()),f.push.apply(f,a)):s(a)?ke(c)?f[u]=At(c.text+a):""!==a&&f.push(At(a)):ke(a)&&ke(c)?f[u]=At(c.text+a.text):(o(t._isVList)&&i(a.tag)&&n(a.key)&&i(e)&&(a.key="__vlist"+e+"_"+r+"__"),f.push(a)));return f}function Ie(t){var e=t.$options.provide;e&&(t._provided="function"===typeof e?e.call(t):e)}function Ce(t){var e=Te(t.$options.inject,t);e&&(Ct(!1),Object.keys(e).forEach((function(r){Rt(t,r,e[r])})),Ct(!0))}function Te(t,e){if(t){for(var r=Object.create(null),n=lt?Reflect.ownKeys(t):Object.keys(t),i=0;i0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&n&&n!==r&&s===n.$key&&!o&&!n.$hasNormal)return n;for(var u in i={},t)t[u]&&"$"!==u[0]&&(i[u]=Re(e,u,t[u]))}else i={};for(var c in e)c in i||(i[c]=Ne(e,c));return t&&Object.isExtensible(t)&&(t._normalized=i),V(i,"$stable",a),V(i,"$key",s),V(i,"$hasNormal",o),i}function Re(t,e,r){var n=function(){var t=arguments.length?r.apply(null,arguments):r({});return t=t&&"object"===typeof t&&!Array.isArray(t)?[t]:Me(t),t&&(0===t.length||1===t.length&&t[0].isComment)?void 0:t};return r.proxy&&Object.defineProperty(t,e,{get:n,enumerable:!0,configurable:!0}),n}function Ne(t,e){return function(){return t[e]}}function Be(t,e){var r,n,o,a,s;if(Array.isArray(t)||"string"===typeof t)for(r=new Array(t.length),n=0,o=t.length;n1?T(r):r;for(var n=T(arguments,1),i='event handler for "'+t+'"',o=0,a=r.length;odocument.createEvent("Event").timeStamp&&($r=function(){return Yr.now()})}function Wr(){var t,e;for(Gr=$r(),zr=!0,Dr.sort((function(t,e){return t.id-e.id})),Kr=0;KrKr&&Dr[r].id>t.id)r--;Dr.splice(r+1,0,t)}else Dr.push(t);Hr||(Hr=!0,pe(Wr))}}var tn=0,en=function(t,e,r,n,i){this.vm=t,i&&(t._watcher=this),t._watchers.push(this),n?(this.deep=!!n.deep,this.user=!!n.user,this.lazy=!!n.lazy,this.sync=!!n.sync,this.before=n.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=r,this.id=++tn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ht,this.newDepIds=new ht,this.expression="","function"===typeof e?this.getter=e:(this.getter=$(e),this.getter||(this.getter=P)),this.value=this.lazy?void 0:this.get()};en.prototype.get=function(){var t;vt(this);var e=this.vm;try{t=this.getter.call(e,e)}catch(Ea){if(!this.user)throw Ea;ee(Ea,e,'getter for watcher "'+this.expression+'"')}finally{this.deep&&ye(t),bt(),this.cleanupDeps()}return t},en.prototype.addDep=function(t){var e=t.id;this.newDepIds.has(e)||(this.newDepIds.add(e),this.newDeps.push(t),this.depIds.has(e)||t.addSub(this))},en.prototype.cleanupDeps=function(){var t=this.deps.length;while(t--){var e=this.deps[t];this.newDepIds.has(e.id)||e.removeSub(this)}var r=this.depIds;this.depIds=this.newDepIds,this.newDepIds=r,this.newDepIds.clear(),r=this.deps,this.deps=this.newDeps,this.newDeps=r,this.newDeps.length=0},en.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():Qr(this)},en.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||u(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(Ea){ee(Ea,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},en.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},en.prototype.depend=function(){var t=this.deps.length;while(t--)this.deps[t].depend()},en.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||b(this.vm._watchers,this);var t=this.deps.length;while(t--)this.deps[t].removeSub(this);this.active=!1}};var rn={enumerable:!0,configurable:!0,get:P,set:P};function nn(t,e,r){rn.get=function(){return this[e][r]},rn.set=function(t){this[e][r]=t},Object.defineProperty(t,r,rn)}function on(t){t._watchers=[];var e=t.$options;e.props&&an(t,e.props),e.methods&&pn(t,e.methods),e.data?sn(t):Pt(t._data={},!0),e.computed&&fn(t,e.computed),e.watch&&e.watch!==ot&&mn(t,e.watch)}function an(t,e){var r=t.$options.propsData||{},n=t._props={},i=t.$options._propKeys=[],o=!t.$parent;o||Ct(!1);var a=function(o){i.push(o);var a=Zt(o,e,r,t);Rt(n,o,a),o in t||nn(t,"_props",o)};for(var s in e)a(s);Ct(!0)}function sn(t){var e=t.$options.data;e=t._data="function"===typeof e?un(e,t):e||{},f(e)||(e={});var r=Object.keys(e),n=t.$options.props,i=(t.$options.methods,r.length);while(i--){var o=r[i];0,n&&w(n,o)||K(o)||nn(t,"_data",o)}Pt(e,!0)}function un(t,e){vt();try{return t.call(e,e)}catch(Ea){return ee(Ea,e,"data()"),{}}finally{bt()}}var cn={lazy:!0};function fn(t,e){var r=t._computedWatchers=Object.create(null),n=ut();for(var i in e){var o=e[i],a="function"===typeof o?o:o.get;0,n||(r[i]=new en(t,a||P,P,cn)),i in t||hn(t,i,o)}}function hn(t,e,r){var n=!ut();"function"===typeof r?(rn.get=n?ln(e):dn(r),rn.set=P):(rn.get=r.get?n&&!1!==r.cache?ln(e):dn(r.get):P,rn.set=r.set||P),Object.defineProperty(t,e,rn)}function ln(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),mt.target&&e.depend(),e.value}}function dn(t){return function(){return t.call(this,this)}}function pn(t,e){t.$options.props;for(var r in e)t[r]="function"!==typeof e[r]?P:C(e[r],t)}function mn(t,e){for(var r in e){var n=e[r];if(Array.isArray(n))for(var i=0;i-1)return this;var r=T(arguments,1);return r.unshift(this),"function"===typeof t.install?t.install.apply(t,r):"function"===typeof t&&t.apply(null,r),e.push(t),this}}function Mn(t){t.mixin=function(t){return this.options=Yt(this.options,t),this}}function kn(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var r=this,n=r.cid,i=t._Ctor||(t._Ctor={});if(i[n])return i[n];var o=t.name||r.options.name;var a=function(t){this._init(t)};return a.prototype=Object.create(r.prototype),a.prototype.constructor=a,a.cid=e++,a.options=Yt(r.options,t),a["super"]=r,a.options.props&&Sn(a),a.options.computed&&In(a),a.extend=r.extend,a.mixin=r.mixin,a.use=r.use,F.forEach((function(t){a[t]=r[t]})),o&&(a.options.components[o]=a),a.superOptions=r.options,a.extendOptions=t,a.sealedOptions=U({},a.options),i[n]=a,a}}function Sn(t){var e=t.options.props;for(var r in e)nn(t.prototype,"_props",r)}function In(t){var e=t.options.computed;for(var r in e)hn(t.prototype,r,e[r])}function Cn(t){F.forEach((function(e){t[e]=function(t,r){return r?("component"===e&&f(r)&&(r.name=r.name||t,r=this.options._base.extend(r)),"directive"===e&&"function"===typeof r&&(r={bind:r,update:r}),this.options[e+"s"][t]=r,r):this.options[e+"s"][t]}}))}function Tn(t){return t&&(t.Ctor.options.name||t.tag)}function Un(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"===typeof t?t.split(",").indexOf(e)>-1:!!h(t)&&t.test(e)}function On(t,e){var r=t.cache,n=t.keys,i=t._vnode;for(var o in r){var a=r[o];if(a){var s=Tn(a.componentOptions);s&&!e(s)&&Pn(r,o,n,i)}}}function Pn(t,e,r,n){var i=t[e];!i||n&&i.tag===n.tag||i.componentInstance.$destroy(),t[e]=null,b(r,e)}gn(En),vn(En),Ir(En),Or(En),vr(En);var Rn=[String,RegExp,Array],Nn={name:"keep-alive",abstract:!0,props:{include:Rn,exclude:Rn,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)Pn(this.cache,t,this.keys)},mounted:function(){var t=this;this.$watch("include",(function(e){On(t,(function(t){return Un(e,t)}))})),this.$watch("exclude",(function(e){On(t,(function(t){return!Un(e,t)}))}))},render:function(){var t=this.$slots.default,e=Ar(t),r=e&&e.componentOptions;if(r){var n=Tn(r),i=this,o=i.include,a=i.exclude;if(o&&(!n||!Un(o,n))||a&&n&&Un(a,n))return e;var s=this,u=s.cache,c=s.keys,f=null==e.key?r.Ctor.cid+(r.tag?"::"+r.tag:""):e.key;u[f]?(e.componentInstance=u[f].componentInstance,b(c,f),c.push(f)):(u[f]=e,c.push(f),this.max&&c.length>parseInt(this.max)&&Pn(u,c[0],c,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}},Bn={KeepAlive:Nn};function jn(t){var e={get:function(){return H}};Object.defineProperty(t,"config",e),t.util={warn:dt,extend:U,mergeOptions:Yt,defineReactive:Rt},t.set=Nt,t.delete=Bt,t.nextTick=pe,t.observable=function(t){return Pt(t),t},t.options=Object.create(null),F.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,U(t.options.components,Bn),xn(t),Mn(t),kn(t),Cn(t)}jn(En),Object.defineProperty(En.prototype,"$isServer",{get:ut}),Object.defineProperty(En.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(En,"FunctionalRenderContext",{value:Je}),En.version="2.6.11";var Ln=y("style,class"),Dn=y("input,textarea,option,select,progress"),Fn=function(t,e,r){return"value"===r&&Dn(t)&&"button"!==e||"selected"===r&&"option"===t||"checked"===r&&"input"===t||"muted"===r&&"video"===t},qn=y("contenteditable,draggable,spellcheck"),Hn=y("events,caret,typing,plaintext-only"),zn=function(t,e){return Yn(e)||"false"===e?"false":"contenteditable"===t&&Hn(e)?e:"true"},Kn=y("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Vn="http://www.w3.org/1999/xlink",Gn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},$n=function(t){return Gn(t)?t.slice(6,t.length):""},Yn=function(t){return null==t||!1===t};function Wn(t){var e=t.data,r=t,n=t;while(i(n.componentInstance))n=n.componentInstance._vnode,n&&n.data&&(e=Zn(n.data,e));while(i(r=r.parent))r&&r.data&&(e=Zn(e,r.data));return Jn(e.staticClass,e.class)}function Zn(t,e){return{staticClass:Xn(t.staticClass,e.staticClass),class:i(t.class)?[t.class,e.class]:e.class}}function Jn(t,e){return i(t)||i(e)?Xn(t,Qn(e)):""}function Xn(t,e){return t?e?t+" "+e:t:e||""}function Qn(t){return Array.isArray(t)?ti(t):u(t)?ei(t):"string"===typeof t?t:""}function ti(t){for(var e,r="",n=0,o=t.length;n-1?si[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:si[t]=/HTMLUnknownElement/.test(e.toString())}var ci=y("text,number,password,search,email,tel,url");function fi(t){if("string"===typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}function hi(t,e){var r=document.createElement(t);return"select"!==t?r:(e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&r.setAttribute("multiple","multiple"),r)}function li(t,e){return document.createElementNS(ri[t],e)}function di(t){return document.createTextNode(t)}function pi(t){return document.createComment(t)}function mi(t,e,r){t.insertBefore(e,r)}function yi(t,e){t.removeChild(e)}function vi(t,e){t.appendChild(e)}function bi(t){return t.parentNode}function gi(t){return t.nextSibling}function wi(t){return t.tagName}function _i(t,e){t.textContent=e}function Ai(t,e){t.setAttribute(e,"")}var Ei=Object.freeze({createElement:hi,createElementNS:li,createTextNode:di,createComment:pi,insertBefore:mi,removeChild:yi,appendChild:vi,parentNode:bi,nextSibling:gi,tagName:wi,setTextContent:_i,setStyleScope:Ai}),xi={create:function(t,e){Mi(e)},update:function(t,e){t.data.ref!==e.data.ref&&(Mi(t,!0),Mi(e))},destroy:function(t){Mi(t,!0)}};function Mi(t,e){var r=t.data.ref;if(i(r)){var n=t.context,o=t.componentInstance||t.elm,a=n.$refs;e?Array.isArray(a[r])?b(a[r],o):a[r]===o&&(a[r]=void 0):t.data.refInFor?Array.isArray(a[r])?a[r].indexOf(o)<0&&a[r].push(o):a[r]=[o]:a[r]=o}}var ki=new gt("",{},[]),Si=["create","activate","update","remove","destroy"];function Ii(t,e){return t.key===e.key&&(t.tag===e.tag&&t.isComment===e.isComment&&i(t.data)===i(e.data)&&Ci(t,e)||o(t.isAsyncPlaceholder)&&t.asyncFactory===e.asyncFactory&&n(e.asyncFactory.error))}function Ci(t,e){if("input"!==t.tag)return!0;var r,n=i(r=t.data)&&i(r=r.attrs)&&r.type,o=i(r=e.data)&&i(r=r.attrs)&&r.type;return n===o||ci(n)&&ci(o)}function Ti(t,e,r){var n,o,a={};for(n=e;n<=r;++n)o=t[n].key,i(o)&&(a[o]=n);return a}function Ui(t){var e,r,a={},u=t.modules,c=t.nodeOps;for(e=0;em?(h=n(r[b+1])?null:r[b+1].elm,E(t,h,r,p,b,o)):p>b&&M(e,l,m)}function I(t,e,r,n){for(var o=r;o-1?Hi(t,e,r):Kn(e)?Yn(r)?t.removeAttribute(e):(r="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,r)):qn(e)?t.setAttribute(e,zn(e,r)):Gn(e)?Yn(r)?t.removeAttributeNS(Vn,$n(e)):t.setAttributeNS(Vn,e,r):Hi(t,e,r)}function Hi(t,e,r){if(Yn(r))t.removeAttribute(e);else{if(tt&&!et&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==r&&!t.__ieph){var n=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",n)};t.addEventListener("input",n),t.__ieph=!0}t.setAttribute(e,r)}}var zi={create:Fi,update:Fi};function Ki(t,e){var r=e.elm,o=e.data,a=t.data;if(!(n(o.staticClass)&&n(o.class)&&(n(a)||n(a.staticClass)&&n(a.class)))){var s=Wn(e),u=r._transitionClasses;i(u)&&(s=Xn(s,Qn(u))),s!==r._prevClass&&(r.setAttribute("class",s),r._prevClass=s)}}var Vi,Gi={create:Ki,update:Ki},$i="__r",Yi="__c";function Wi(t){if(i(t[$i])){var e=tt?"change":"input";t[e]=[].concat(t[$i],t[e]||[]),delete t[$i]}i(t[Yi])&&(t.change=[].concat(t[Yi],t.change||[]),delete t[Yi])}function Zi(t,e,r){var n=Vi;return function i(){var o=e.apply(null,arguments);null!==o&&Qi(t,i,r,n)}}var Ji=ae&&!(it&&Number(it[1])<=53);function Xi(t,e,r,n){if(Ji){var i=Gr,o=e;e=o._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=i||t.timeStamp<=0||t.target.ownerDocument!==document)return o.apply(this,arguments)}}Vi.addEventListener(t,e,at?{capture:r,passive:n}:r)}function Qi(t,e,r,n){(n||Vi).removeEventListener(t,e._wrapper||e,r)}function to(t,e){if(!n(t.data.on)||!n(e.data.on)){var r=e.data.on||{},i=t.data.on||{};Vi=e.elm,Wi(r),we(r,i,Xi,Qi,Zi,e.context),Vi=void 0}}var eo,ro={create:to,update:to};function no(t,e){if(!n(t.data.domProps)||!n(e.data.domProps)){var r,o,a=e.elm,s=t.data.domProps||{},u=e.data.domProps||{};for(r in i(u.__ob__)&&(u=e.data.domProps=U({},u)),s)r in u||(a[r]="");for(r in u){if(o=u[r],"textContent"===r||"innerHTML"===r){if(e.children&&(e.children.length=0),o===s[r])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===r&&"PROGRESS"!==a.tagName){a._value=o;var c=n(o)?"":String(o);io(a,c)&&(a.value=c)}else if("innerHTML"===r&&ii(a.tagName)&&n(a.innerHTML)){eo=eo||document.createElement("div"),eo.innerHTML=""+o+"";var f=eo.firstChild;while(a.firstChild)a.removeChild(a.firstChild);while(f.firstChild)a.appendChild(f.firstChild)}else if(o!==s[r])try{a[r]=o}catch(Ea){}}}}function io(t,e){return!t.composing&&("OPTION"===t.tagName||oo(t,e)||ao(t,e))}function oo(t,e){var r=!0;try{r=document.activeElement!==t}catch(Ea){}return r&&t.value!==e}function ao(t,e){var r=t.value,n=t._vModifiers;if(i(n)){if(n.number)return m(r)!==m(e);if(n.trim)return r.trim()!==e.trim()}return r!==e}var so={create:no,update:no},uo=_((function(t){var e={},r=/;(?![^(]*\))/g,n=/:(.+)/;return t.split(r).forEach((function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}})),e}));function co(t){var e=fo(t.style);return t.staticStyle?U(t.staticStyle,e):e}function fo(t){return Array.isArray(t)?O(t):"string"===typeof t?uo(t):t}function ho(t,e){var r,n={};if(e){var i=t;while(i.componentInstance)i=i.componentInstance._vnode,i&&i.data&&(r=co(i.data))&&U(n,r)}(r=co(t.data))&&U(n,r);var o=t;while(o=o.parent)o.data&&(r=co(o.data))&&U(n,r);return n}var lo,po=/^--/,mo=/\s*!important$/,yo=function(t,e,r){if(po.test(e))t.style.setProperty(e,r);else if(mo.test(r))t.style.setProperty(k(e),r.replace(mo,""),"important");else{var n=bo(e);if(Array.isArray(r))for(var i=0,o=r.length;i-1?e.split(_o).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var r=" "+(t.getAttribute("class")||"")+" ";r.indexOf(" "+e+" ")<0&&t.setAttribute("class",(r+e).trim())}}function Eo(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(_o).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{var r=" "+(t.getAttribute("class")||"")+" ",n=" "+e+" ";while(r.indexOf(n)>=0)r=r.replace(n," ");r=r.trim(),r?t.setAttribute("class",r):t.removeAttribute("class")}}function xo(t){if(t){if("object"===typeof t){var e={};return!1!==t.css&&U(e,Mo(t.name||"v")),U(e,t),e}return"string"===typeof t?Mo(t):void 0}}var Mo=_((function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}})),ko=Z&&!et,So="transition",Io="animation",Co="transition",To="transitionend",Uo="animation",Oo="animationend";ko&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Co="WebkitTransition",To="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Uo="WebkitAnimation",Oo="webkitAnimationEnd"));var Po=Z?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Ro(t){Po((function(){Po(t)}))}function No(t,e){var r=t._transitionClasses||(t._transitionClasses=[]);r.indexOf(e)<0&&(r.push(e),Ao(t,e))}function Bo(t,e){t._transitionClasses&&b(t._transitionClasses,e),Eo(t,e)}function jo(t,e,r){var n=Do(t,e),i=n.type,o=n.timeout,a=n.propCount;if(!i)return r();var s=i===So?To:Oo,u=0,c=function(){t.removeEventListener(s,f),r()},f=function(e){e.target===t&&++u>=a&&c()};setTimeout((function(){u0&&(r=So,f=a,h=o.length):e===Io?c>0&&(r=Io,f=c,h=u.length):(f=Math.max(a,c),r=f>0?a>c?So:Io:null,h=r?r===So?o.length:u.length:0);var l=r===So&&Lo.test(n[Co+"Property"]);return{type:r,timeout:f,propCount:h,hasTransform:l}}function Fo(t,e){while(t.length1}function Go(t,e){!0!==e.data.show&&Ho(e)}var $o=Z?{create:Go,activate:Go,remove:function(t,e){!0!==t.data.show?zo(t,e):e()}}:{},Yo=[zi,Gi,ro,so,wo,$o],Wo=Yo.concat(Di),Zo=Ui({nodeOps:Ei,modules:Wo});et&&document.addEventListener("selectionchange",(function(){var t=document.activeElement;t&&t.vmodel&&ia(t,"input")}));var Jo={inserted:function(t,e,r,n){"select"===r.tag?(n.elm&&!n.elm._vOptions?_e(r,"postpatch",(function(){Jo.componentUpdated(t,e,r)})):Xo(t,e,r.context),t._vOptions=[].map.call(t.options,ea)):("textarea"===r.tag||ci(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",ra),t.addEventListener("compositionend",na),t.addEventListener("change",na),et&&(t.vmodel=!0)))},componentUpdated:function(t,e,r){if("select"===r.tag){Xo(t,e,r.context);var n=t._vOptions,i=t._vOptions=[].map.call(t.options,ea);if(i.some((function(t,e){return!B(t,n[e])}))){var o=t.multiple?e.value.some((function(t){return ta(t,i)})):e.value!==e.oldValue&&ta(e.value,i);o&&ia(t,"change")}}}};function Xo(t,e,r){Qo(t,e,r),(tt||rt)&&setTimeout((function(){Qo(t,e,r)}),0)}function Qo(t,e,r){var n=e.value,i=t.multiple;if(!i||Array.isArray(n)){for(var o,a,s=0,u=t.options.length;s-1,a.selected!==o&&(a.selected=o);else if(B(ea(a),n))return void(t.selectedIndex!==s&&(t.selectedIndex=s));i||(t.selectedIndex=-1)}}function ta(t,e){return e.every((function(e){return!B(e,t)}))}function ea(t){return"_value"in t?t._value:t.value}function ra(t){t.target.composing=!0}function na(t){t.target.composing&&(t.target.composing=!1,ia(t.target,"input"))}function ia(t,e){var r=document.createEvent("HTMLEvents");r.initEvent(e,!0,!0),t.dispatchEvent(r)}function oa(t){return!t.componentInstance||t.data&&t.data.transition?t:oa(t.componentInstance._vnode)}var aa={bind:function(t,e,r){var n=e.value;r=oa(r);var i=r.data&&r.data.transition,o=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;n&&i?(r.data.show=!0,Ho(r,(function(){t.style.display=o}))):t.style.display=n?o:"none"},update:function(t,e,r){var n=e.value,i=e.oldValue;if(!n!==!i){r=oa(r);var o=r.data&&r.data.transition;o?(r.data.show=!0,n?Ho(r,(function(){t.style.display=t.__vOriginalDisplay})):zo(r,(function(){t.style.display="none"}))):t.style.display=n?t.__vOriginalDisplay:"none"}},unbind:function(t,e,r,n,i){i||(t.style.display=t.__vOriginalDisplay)}},sa={model:Jo,show:aa},ua={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ca(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?ca(Ar(e.children)):t}function fa(t){var e={},r=t.$options;for(var n in r.propsData)e[n]=t[n];var i=r._parentListeners;for(var o in i)e[E(o)]=i[o];return e}function ha(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}function la(t){while(t=t.parent)if(t.data.transition)return!0}function da(t,e){return e.key===t.key&&e.tag===t.tag}var pa=function(t){return t.tag||_r(t)},ma=function(t){return"show"===t.name},ya={name:"transition",props:ua,abstract:!0,render:function(t){var e=this,r=this.$slots.default;if(r&&(r=r.filter(pa),r.length)){0;var n=this.mode;0;var i=r[0];if(la(this.$vnode))return i;var o=ca(i);if(!o)return i;if(this._leaving)return ha(t,i);var a="__transition-"+this._uid+"-";o.key=null==o.key?o.isComment?a+"comment":a+o.tag:s(o.key)?0===String(o.key).indexOf(a)?o.key:a+o.key:o.key;var u=(o.data||(o.data={})).transition=fa(this),c=this._vnode,f=ca(c);if(o.data.directives&&o.data.directives.some(ma)&&(o.data.show=!0),f&&f.data&&!da(o,f)&&!_r(f)&&(!f.componentInstance||!f.componentInstance._vnode.isComment)){var h=f.data.transition=U({},u);if("out-in"===n)return this._leaving=!0,_e(h,"afterLeave",(function(){e._leaving=!1,e.$forceUpdate()})),ha(t,i);if("in-out"===n){if(_r(o))return c;var l,d=function(){l()};_e(u,"afterEnter",d),_e(u,"enterCancelled",d),_e(h,"delayLeave",(function(t){l=t}))}}return i}}},va=U({tag:String,moveClass:String},ua);delete va.mode;var ba={props:va,beforeMount:function(){var t=this,e=this._update;this._update=function(r,n){var i=Tr(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,i(),e.call(t,r,n)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",r=Object.create(null),n=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=fa(this),s=0;s=0;i--){var s=n(o[i]);r=n(new t(r+s,"hex"))}}return"0x"+r}function a(t){return t?i.toUnicode(t,{useStd3ASCII:!0,transitional:!1}):t}e.hash=o,e.normalize=a}).call(this,r("b639").Buffer)},"2c63":function(t,e,r){t.exports=r("dc14")},"2cf4":function(t,e,r){var n,i,o,a=r("da84"),s=r("d039"),u=r("c6b6"),c=r("0366"),f=r("1be4"),h=r("cc12"),l=r("1cdc"),d=a.location,p=a.setImmediate,m=a.clearImmediate,y=a.process,v=a.MessageChannel,b=a.Dispatch,g=0,w={},_="onreadystatechange",A=function(t){if(w.hasOwnProperty(t)){var e=w[t];delete w[t],e()}},E=function(t){return function(){A(t)}},x=function(t){A(t.data)},M=function(t){a.postMessage(t+"",d.protocol+"//"+d.host)};p&&m||(p=function(t){var e=[],r=1;while(arguments.length>r)e.push(arguments[r++]);return w[++g]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},n(g),g},m=function(t){delete w[t]},"process"==u(y)?n=function(t){y.nextTick(E(t))}:b&&b.now?n=function(t){b.now(E(t))}:v&&!l?(i=new v,o=i.port2,i.port1.onmessage=x,n=c(o.postMessage,o,1)):!a.addEventListener||"function"!=typeof postMessage||a.importScripts||s(M)?n=_ in h("script")?function(t){f.appendChild(h("script"))[_]=function(){f.removeChild(this),A(t)}}:function(t){setTimeout(E(t),0)}:(n=M,a.addEventListener("message",x,!1))),t.exports={set:p,clear:m}},"2d00":function(t,e,r){var n,i,o=r("da84"),a=r("342f"),s=o.process,u=s&&s.versions,c=u&&u.v8;c?(n=c.split("."),i=n[0]+n[1]):a&&(n=a.match(/Edge\/(\d+)/),(!n||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/),n&&(i=n[1]))),t.exports=i&&+i},"2f62":function(t,e,r){"use strict";(function(t){ +/** + * vuex v3.1.2 + * (c) 2019 Evan You + * @license MIT + */ +function r(t){var e=Number(t.version.split(".")[0]);if(e>=2)t.mixin({beforeCreate:n});else{var r=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[n].concat(t.init):n,r.call(this,t)}}function n(){var t=this.$options;t.store?this.$store="function"===typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}var n="undefined"!==typeof window?window:"undefined"!==typeof t?t:{},i=n.__VUE_DEVTOOLS_GLOBAL_HOOK__;function o(t){i&&(t._devtoolHook=i,i.emit("vuex:init",t),i.on("vuex:travel-to-state",(function(e){t.replaceState(e)})),t.subscribe((function(t,e){i.emit("vuex:mutation",t,e)})))}function a(t,e){Object.keys(t).forEach((function(r){return e(t[r],r)}))}function s(t){return null!==t&&"object"===typeof t}function u(t){return t&&"function"===typeof t.then}function c(t,e){return function(){return t(e)}}var f=function(t,e){this.runtime=e,this._children=Object.create(null),this._rawModule=t;var r=t.state;this.state=("function"===typeof r?r():r)||{}},h={namespaced:{configurable:!0}};h.namespaced.get=function(){return!!this._rawModule.namespaced},f.prototype.addChild=function(t,e){this._children[t]=e},f.prototype.removeChild=function(t){delete this._children[t]},f.prototype.getChild=function(t){return this._children[t]},f.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},f.prototype.forEachChild=function(t){a(this._children,t)},f.prototype.forEachGetter=function(t){this._rawModule.getters&&a(this._rawModule.getters,t)},f.prototype.forEachAction=function(t){this._rawModule.actions&&a(this._rawModule.actions,t)},f.prototype.forEachMutation=function(t){this._rawModule.mutations&&a(this._rawModule.mutations,t)},Object.defineProperties(f.prototype,h);var l=function(t){this.register([],t,!1)};function d(t,e,r){if(e.update(r),r.modules)for(var n in r.modules){if(!e.getChild(n))return void 0;d(t.concat(n),e.getChild(n),r.modules[n])}}l.prototype.get=function(t){return t.reduce((function(t,e){return t.getChild(e)}),this.root)},l.prototype.getNamespace=function(t){var e=this.root;return t.reduce((function(t,r){return e=e.getChild(r),t+(e.namespaced?r+"/":"")}),"")},l.prototype.update=function(t){d([],this.root,t)},l.prototype.register=function(t,e,r){var n=this;void 0===r&&(r=!0);var i=new f(e,r);if(0===t.length)this.root=i;else{var o=this.get(t.slice(0,-1));o.addChild(t[t.length-1],i)}e.modules&&a(e.modules,(function(e,i){n.register(t.concat(i),e,r)}))},l.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),r=t[t.length-1];e.getChild(r).runtime&&e.removeChild(r)};var p;var m=function(t){var e=this;void 0===t&&(t={}),!p&&"undefined"!==typeof window&&window.Vue&&C(window.Vue);var r=t.plugins;void 0===r&&(r=[]);var n=t.strict;void 0===n&&(n=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new l(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new p,this._makeLocalGettersCache=Object.create(null);var i=this,a=this,s=a.dispatch,u=a.commit;this.dispatch=function(t,e){return s.call(i,t,e)},this.commit=function(t,e,r){return u.call(i,t,e,r)},this.strict=n;var c=this._modules.root.state;w(this,c,[],this._modules.root),g(this,c),r.forEach((function(t){return t(e)}));var f=void 0!==t.devtools?t.devtools:p.config.devtools;f&&o(this)},y={state:{configurable:!0}};function v(t,e){return e.indexOf(t)<0&&e.push(t),function(){var r=e.indexOf(t);r>-1&&e.splice(r,1)}}function b(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var r=t.state;w(t,r,[],t._modules.root,!0),g(t,r,e)}function g(t,e,r){var n=t._vm;t.getters={},t._makeLocalGettersCache=Object.create(null);var i=t._wrappedGetters,o={};a(i,(function(e,r){o[r]=c(e,t),Object.defineProperty(t.getters,r,{get:function(){return t._vm[r]},enumerable:!0})}));var s=p.config.silent;p.config.silent=!0,t._vm=new p({data:{$$state:e},computed:o}),p.config.silent=s,t.strict&&k(t),n&&(r&&t._withCommit((function(){n._data.$$state=null})),p.nextTick((function(){return n.$destroy()})))}function w(t,e,r,n,i){var o=!r.length,a=t._modules.getNamespace(r);if(n.namespaced&&(t._modulesNamespaceMap[a],t._modulesNamespaceMap[a]=n),!o&&!i){var s=S(e,r.slice(0,-1)),u=r[r.length-1];t._withCommit((function(){p.set(s,u,n.state)}))}var c=n.context=_(t,a,r);n.forEachMutation((function(e,r){var n=a+r;E(t,n,e,c)})),n.forEachAction((function(e,r){var n=e.root?r:a+r,i=e.handler||e;x(t,n,i,c)})),n.forEachGetter((function(e,r){var n=a+r;M(t,n,e,c)})),n.forEachChild((function(n,o){w(t,e,r.concat(o),n,i)}))}function _(t,e,r){var n=""===e,i={dispatch:n?t.dispatch:function(r,n,i){var o=I(r,n,i),a=o.payload,s=o.options,u=o.type;return s&&s.root||(u=e+u),t.dispatch(u,a)},commit:n?t.commit:function(r,n,i){var o=I(r,n,i),a=o.payload,s=o.options,u=o.type;s&&s.root||(u=e+u),t.commit(u,a,s)}};return Object.defineProperties(i,{getters:{get:n?function(){return t.getters}:function(){return A(t,e)}},state:{get:function(){return S(t.state,r)}}}),i}function A(t,e){if(!t._makeLocalGettersCache[e]){var r={},n=e.length;Object.keys(t.getters).forEach((function(i){if(i.slice(0,n)===e){var o=i.slice(n);Object.defineProperty(r,o,{get:function(){return t.getters[i]},enumerable:!0})}})),t._makeLocalGettersCache[e]=r}return t._makeLocalGettersCache[e]}function E(t,e,r,n){var i=t._mutations[e]||(t._mutations[e]=[]);i.push((function(e){r.call(t,n.state,e)}))}function x(t,e,r,n){var i=t._actions[e]||(t._actions[e]=[]);i.push((function(e){var i=r.call(t,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:t.getters,rootState:t.state},e);return u(i)||(i=Promise.resolve(i)),t._devtoolHook?i.catch((function(e){throw t._devtoolHook.emit("vuex:error",e),e})):i}))}function M(t,e,r,n){t._wrappedGetters[e]||(t._wrappedGetters[e]=function(t){return r(n.state,n.getters,t.state,t.getters)})}function k(t){t._vm.$watch((function(){return this._data.$$state}),(function(){0}),{deep:!0,sync:!0})}function S(t,e){return e.length?e.reduce((function(t,e){return t[e]}),t):t}function I(t,e,r){return s(t)&&t.type&&(r=e,e=t,t=t.type),{type:t,payload:e,options:r}}function C(t){p&&t===p||(p=t,r(p))}y.state.get=function(){return this._vm._data.$$state},y.state.set=function(t){0},m.prototype.commit=function(t,e,r){var n=this,i=I(t,e,r),o=i.type,a=i.payload,s=(i.options,{type:o,payload:a}),u=this._mutations[o];u&&(this._withCommit((function(){u.forEach((function(t){t(a)}))})),this._subscribers.forEach((function(t){return t(s,n.state)})))},m.prototype.dispatch=function(t,e){var r=this,n=I(t,e),i=n.type,o=n.payload,a={type:i,payload:o},s=this._actions[i];if(s){try{this._actionSubscribers.filter((function(t){return t.before})).forEach((function(t){return t.before(a,r.state)}))}catch(c){0}var u=s.length>1?Promise.all(s.map((function(t){return t(o)}))):s[0](o);return u.then((function(t){try{r._actionSubscribers.filter((function(t){return t.after})).forEach((function(t){return t.after(a,r.state)}))}catch(c){0}return t}))}},m.prototype.subscribe=function(t){return v(t,this._subscribers)},m.prototype.subscribeAction=function(t){var e="function"===typeof t?{before:t}:t;return v(e,this._actionSubscribers)},m.prototype.watch=function(t,e,r){var n=this;return this._watcherVM.$watch((function(){return t(n.state,n.getters)}),e,r)},m.prototype.replaceState=function(t){var e=this;this._withCommit((function(){e._vm._data.$$state=t}))},m.prototype.registerModule=function(t,e,r){void 0===r&&(r={}),"string"===typeof t&&(t=[t]),this._modules.register(t,e),w(this,this.state,t,this._modules.get(t),r.preserveState),g(this,this.state)},m.prototype.unregisterModule=function(t){var e=this;"string"===typeof t&&(t=[t]),this._modules.unregister(t),this._withCommit((function(){var r=S(e.state,t.slice(0,-1));p.delete(r,t[t.length-1])})),b(this)},m.prototype.hotUpdate=function(t){this._modules.update(t),b(this,!0)},m.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(m.prototype,y);var T=j((function(t,e){var r={};return N(e).forEach((function(e){var n=e.key,i=e.val;r[n]=function(){var e=this.$store.state,r=this.$store.getters;if(t){var n=L(this.$store,"mapState",t);if(!n)return;e=n.context.state,r=n.context.getters}return"function"===typeof i?i.call(this,e,r):e[i]},r[n].vuex=!0})),r})),U=j((function(t,e){var r={};return N(e).forEach((function(e){var n=e.key,i=e.val;r[n]=function(){var e=[],r=arguments.length;while(r--)e[r]=arguments[r];var n=this.$store.commit;if(t){var o=L(this.$store,"mapMutations",t);if(!o)return;n=o.context.commit}return"function"===typeof i?i.apply(this,[n].concat(e)):n.apply(this.$store,[i].concat(e))}})),r})),O=j((function(t,e){var r={};return N(e).forEach((function(e){var n=e.key,i=e.val;i=t+i,r[n]=function(){if(!t||L(this.$store,"mapGetters",t))return this.$store.getters[i]},r[n].vuex=!0})),r})),P=j((function(t,e){var r={};return N(e).forEach((function(e){var n=e.key,i=e.val;r[n]=function(){var e=[],r=arguments.length;while(r--)e[r]=arguments[r];var n=this.$store.dispatch;if(t){var o=L(this.$store,"mapActions",t);if(!o)return;n=o.context.dispatch}return"function"===typeof i?i.apply(this,[n].concat(e)):n.apply(this.$store,[i].concat(e))}})),r})),R=function(t){return{mapState:T.bind(null,t),mapGetters:O.bind(null,t),mapMutations:U.bind(null,t),mapActions:P.bind(null,t)}};function N(t){return B(t)?Array.isArray(t)?t.map((function(t){return{key:t,val:t}})):Object.keys(t).map((function(e){return{key:e,val:t[e]}})):[]}function B(t){return Array.isArray(t)||s(t)}function j(t){return function(e,r){return"string"!==typeof e?(r=e,e=""):"/"!==e.charAt(e.length-1)&&(e+="/"),t(e,r)}}function L(t,e,r){var n=t._modulesNamespaceMap[r];return n}var D={Store:m,install:C,version:"3.1.2",mapState:T,mapMutations:U,mapGetters:O,mapActions:P,createNamespacedHelpers:R};e["a"]=D}).call(this,r("c8ba"))},"2fc8":function(t,e,r){"use strict";function n(){if("undefined"===typeof window.Promise)throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}}t.exports=r("78ae")(window,n)},"2fd2":function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n=r("f654"),i=r("9a12"),o=r("a3ca"),a=r("40c9");e.defineProperties=function(e,r,s){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return a.baToJSON(e.raw)},e.serialize=function(){return o.encode(e.raw)},r.forEach((function(r,i){function o(){return e.raw[i]}function s(o){o=a.toBuffer(o),"00"!==o.toString("hex")||r.allowZero||(o=t.allocUnsafe(0)),r.allowLess&&r.length?(o=a.stripZeros(o),n(r.length>=o.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===o.length||!r.length||n(r.length===o.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[i]=o}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:o,set:s}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:s,get:o})})),s)if("string"===typeof s&&(s=t.from(i.stripHexPrefix(s),"hex")),t.isBuffer(s)&&(s=o.decode(s)),Array.isArray(s)){if(s.length>e._fields.length)throw new Error("wrong number of fields in data");s.forEach((function(t,r){e[e._fields[r]]=a.toBuffer(t)}))}else{if("object"!==typeof s)throw new Error("invalid data");var u=Object.keys(s);r.forEach((function(t){-1!==u.indexOf(t.name)&&(e[t.name]=s[t.name]),-1!==u.indexOf(t.alias)&&(e[t.alias]=s[t.alias])}))}}}).call(this,r("b639").Buffer)},3022:function(t,e,r){(function(t){var n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}})),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(r)?n.showHidden=r:r&&e._extend(n,r),x(n.showHidden)&&(n.showHidden=!1),x(n.depth)&&(n.depth=2),x(n.colors)&&(n.colors=!1),x(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),h(n,t,n.depth)}function u(t,e){var r=s.styles[e];return r?"["+s.colors[r][0]+"m"+t+"["+s.colors[r][1]+"m":t}function c(t,e){return t}function f(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}function h(t,r,n){if(t.customInspect&&r&&C(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return A(i)||(i=h(t,i,n)),i}var o=l(t,r);if(o)return o;var a=Object.keys(r),s=f(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),I(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return d(r);if(0===a.length){if(C(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(M(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return t.stylize(Date.prototype.toString.call(r),"date");if(I(r))return d(r)}var c,b="",g=!1,w=["{","}"];if(v(r)&&(g=!0,w=["[","]"]),C(r)){var _=r.name?": "+r.name:"";b=" [Function"+_+"]"}return M(r)&&(b=" "+RegExp.prototype.toString.call(r)),S(r)&&(b=" "+Date.prototype.toUTCString.call(r)),I(r)&&(b=" "+d(r)),0!==a.length||g&&0!=r.length?n<0?M(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),c=g?p(t,r,n,s,a):a.map((function(e){return m(t,r,n,s,e,g)})),t.seen.pop(),y(c,b,w)):w[0]+b+w[1]}function l(t,e){if(x(e))return t.stylize("undefined","undefined");if(A(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return _(e)?t.stylize(""+e,"number"):b(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,r,n,i){for(var o=[],a=0,s=e.length;a-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n"))):s=t.stylize("[Circular]","special")),x(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function y(t,e,r){var n=t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return n>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function v(t){return Array.isArray(t)}function b(t){return"boolean"===typeof t}function g(t){return null===t}function w(t){return null==t}function _(t){return"number"===typeof t}function A(t){return"string"===typeof t}function E(t){return"symbol"===typeof t}function x(t){return void 0===t}function M(t){return k(t)&&"[object RegExp]"===U(t)}function k(t){return"object"===typeof t&&null!==t}function S(t){return k(t)&&"[object Date]"===U(t)}function I(t){return k(t)&&("[object Error]"===U(t)||t instanceof Error)}function C(t){return"function"===typeof t}function T(t){return null===t||"boolean"===typeof t||"number"===typeof t||"string"===typeof t||"symbol"===typeof t||"undefined"===typeof t}function U(t){return Object.prototype.toString.call(t)}function O(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(x(o)&&(o=Object({NODE_ENV:"production",BASE_URL:"/"}).NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,n,t)}}else a[r]=function(){};return a[r]},e.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=v,e.isBoolean=b,e.isNull=g,e.isNullOrUndefined=w,e.isNumber=_,e.isString=A,e.isSymbol=E,e.isUndefined=x,e.isRegExp=M,e.isObject=k,e.isDate=S,e.isError=I,e.isFunction=C,e.isPrimitive=T,e.isBuffer=r("d60a");var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":");return[t.getDate(),P[t.getMonth()],e].join(" ")}function N(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",R(),e.format.apply(e,arguments))},e.inherits=r("28a0"),e._extend=function(t,e){if(!e||!k(e))return t;var r=Object.keys(e),n=r.length;while(n--)t[r[n]]=e[r[n]];return t};var B="undefined"!==typeof Symbol?Symbol("util.promisify.custom"):void 0;function j(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}function L(e){if("function"!==typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n=0&&(a=e,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a:a,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b),f=t.sub(a).sub(s),h=u.add(c).neg();return{k1:f,k2:h}},u.prototype.pointFromX=function(t,e){t=new i(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},c.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},o(f,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),h=n.redMul(c),l=u.redSqr().redIAdd(f).redISub(h).redISub(h),d=u.redMul(h.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),f=r.redMul(u),h=s.redSqr().redIAdd(c).redISub(f).redISub(f),l=s.redMul(f.redISub(h)).redISub(i.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(h,l,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},3337:function(t,e,r){"use strict";var n=e;n.version=r("2801").version,n.utils=r("f3a3"),n.rand=r("fdac"),n.curve=r("4136"),n.curves=r("0cbb"),n.ec=r("b9a8"),n.eddsa=r("945d")},"33a0":function(t,e){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);t.exports=function(){return r(n),n}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},"33fb":function(t,e,r){var n=function(){throw"This swarm.js function isn't available on the browser."},i={readFile:n},o={download:n,safeDownloadArchived:n,directoryTree:n},a={platform:n,arch:n},s={join:n,slice:n},u={spawn:n},c={lookup:n},f={},h=null,l=r("25f2"),d=r("73f3"),p=r("69dc"),m=r("e2aa"),y=r("aad6");t.exports=y({fs:i,files:o,os:a,path:s,child_process:u,defaultArchives:f,mimetype:c,request:l,downloadUrl:h,bytes:d,hash:p,pick:m})},"342f":function(t,e,r){var n=r("d066");t.exports=n("navigator","userAgent")||""},"343e":function(t,e,r){var n=e;n.der=r("3768"),n.pem=r("85b3")},3505:function(t,e,r){var n=r("8707").Buffer,i=r("8c8a");function o(t,e,r){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:a]),a}e.encrypt=function(t,e,r){var i,a=n.allocUnsafe(0);while(e.length){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){a=n.concat([a,o(t,e,r)]);break}i=t._cache.length,a=n.concat([a,o(t,e.slice(0,i),r)]),e=e.slice(i)}return a}},"35a1":function(t,e,r){var n=r("f5df"),i=r("3f8c"),o=r("b622"),a=o("iterator");t.exports=function(t){if(void 0!=t)return t[a]||t["@@iterator"]||i[n(t)]}},"35e8":function(t,e,r){"use strict";t.exports={isString:function(t){return"string"===typeof t},isObject:function(t){return"object"===typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},3667:function(t,e,r){var n,i;(function(r,o,a,s,u,c){var f=m((function(t,e){var r=e.length;return m((function(n){for(var i=0;if&&(Y("Max buffer length exceeded: textNode"),t=Math.max(t,N.length)),B.length>f&&(Y("Max buffer length exceeded: numberNode"),t=Math.max(t,B.length)),R=f-t+K}function Y(t){N!==c&&(o(N),a(),N=c),e=s(t+"\nLn: "+G+"\nCol: "+V+"\nChr: "+r),u(vt(c,c,e))}function W(){if(D==d)return o({}),a(),void(L=!0);D===p&&0===z||Y("Unexpected end"),N!==c&&(o(N),a(),N=c),L=!0}function Z(t){return"\r"==t||"\n"==t||" "==t||"\t"==t}function J(t){if(!e){if(L)return Y("Cannot write after close");var s=0;r=t[0];while(r){if(s>0&&(n=r),r=t[s++],!r)break;switch(K++,"\n"==r?(G++,V=0):V++,D){case d:if("{"===r)D=m;else if("["===r)D=v;else if(!Z(r))return Y("Non-whitespace before {[.");continue;case w:case m:if(Z(r))continue;if(D===w)F.push(_);else{if("}"===r){o({}),a(),D=F.pop()||p;continue}F.push(y)}if('"'!==r)return Y('Malformed object key should start with " ');D=g;continue;case _:case y:if(Z(r))continue;if(":"===r)D===y?(F.push(y),N!==c&&(o({}),i(N),N=c),z++):N!==c&&(i(N),N=c),D=p;else if("}"===r)N!==c&&(o(N),a(),N=c),a(),z--,D=F.pop()||p;else{if(","!==r)return Y("Bad object");D===y&&F.push(y),N!==c&&(o(N),a(),N=c),D=w}continue;case v:case p:if(Z(r))continue;if(D===v){if(o([]),z++,D=p,"]"===r){a(),z--,D=F.pop()||p;continue}F.push(b)}if('"'===r)D=g;else if("{"===r)D=m;else if("["===r)D=v;else if("t"===r)D=A;else if("f"===r)D=M;else if("n"===r)D=C;else if("-"===r)B+=r;else if("0"===r)B+=r,D=P;else{if(-1==="123456789".indexOf(r))return Y("Bad value");B+=r,D=P}continue;case b:if(","===r)F.push(b),N!==c&&(o(N),a(),N=c),D=p;else{if("]"!==r){if(Z(r))continue;return Y("Bad array")}N!==c&&(o(N),a(),N=c),a(),z--,D=F.pop()||p}continue;case g:N===c&&(N="");var u=s-1;t:while(1){while(H>0)if(q+=r,r=t.charAt(s++),4===H?(N+=String.fromCharCode(parseInt(q,16)),H=0,u=s-1):H++,!r)break t;if('"'===r&&!j){D=F.pop()||p,N+=t.substring(u,s-1);break}if("\\"===r&&!j&&(j=!0,N+=t.substring(u,s-1),r=t.charAt(s++),!r))break;if(j){if(j=!1,"n"===r?N+="\n":"r"===r?N+="\r":"t"===r?N+="\t":"f"===r?N+="\f":"b"===r?N+="\b":"u"===r?(H=1,q=""):N+=r,r=t.charAt(s++),u=s-1,r)continue;break}h.lastIndex=s;var f=h.exec(t);if(!f){s=t.length+1,N+=t.substring(u,s-1);break}if(s=f.index+1,r=t.charAt(f.index),!r){N+=t.substring(u,s-1);break}}continue;case A:if(!r)continue;if("r"!==r)return Y("Invalid true started with t"+r);D=E;continue;case E:if(!r)continue;if("u"!==r)return Y("Invalid true started with tr"+r);D=x;continue;case x:if(!r)continue;if("e"!==r)return Y("Invalid true started with tru"+r);o(!0),a(),D=F.pop()||p;continue;case M:if(!r)continue;if("a"!==r)return Y("Invalid false started with f"+r);D=k;continue;case k:if(!r)continue;if("l"!==r)return Y("Invalid false started with fa"+r);D=S;continue;case S:if(!r)continue;if("s"!==r)return Y("Invalid false started with fal"+r);D=I;continue;case I:if(!r)continue;if("e"!==r)return Y("Invalid false started with fals"+r);o(!1),a(),D=F.pop()||p;continue;case C:if(!r)continue;if("u"!==r)return Y("Invalid null started with n"+r);D=T;continue;case T:if(!r)continue;if("l"!==r)return Y("Invalid null started with nu"+r);D=U;continue;case U:if(!r)continue;if("l"!==r)return Y("Invalid null started with nul"+r);o(null),a(),D=F.pop()||p;continue;case O:if("."!==r)return Y("Leading zero not followed by .");B+=r,D=P;continue;case P:if(-1!=="0123456789".indexOf(r))B+=r;else if("."===r){if(-1!==B.indexOf("."))return Y("Invalid number has two dots");B+=r}else if("e"===r||"E"===r){if(-1!==B.indexOf("e")||-1!==B.indexOf("E"))return Y("Invalid number has two exponential");B+=r}else if("+"===r||"-"===r){if("e"!==n&&"E"!==n)return Y("Invalid symbol in number");B+=r}else B&&(o(parseFloat(B)),a(),B=""),s--,D=F.pop()||p;continue;default:return Y("Unknown state: "+D)}}K>=R&&$()}}t(ht).on(J),t(lt).on(W)}function q(t,e){"use strict";var r,n={};function i(t){return function(e){r=t(r,e)}}for(var o in e)t(o).on(i(e[o]),n);t(ot).on((function(t){var e,n=I(r),i=W(n),o=C(r);o&&(e=Z(I(o)),e[i]=t)})),t(at).on((function(){var t,e=I(r),n=W(e),i=C(r);i&&(t=Z(I(i)),delete t[n])})),t(dt).on((function(){for(var r in e)t(r).un(n)}))}function H(t){var e={};return t&&t.split("\r\n").forEach((function(t){var r=t.indexOf(": ");e[t.substring(0,r)]=t.substring(r+2)})),e}function z(t,e){function r(t){return{"http:":80,"https:":443}[t]}function n(e){return e.port||r(e.protocol||t.protocol)}return!!(e.protocol&&e.protocol!=t.protocol||e.host&&e.host!=t.host||e.host&&n(e)!=n(t))}function K(t){var e=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,r=e.exec(t)||[];return{protocol:r[1]||"",host:r[2]||"",port:r[3]||""}}function V(){return new XMLHttpRequest}function G(t,e,n,i,o,a,s){"use strict";var u=t(ht).emit,h=t(st).emit,l=0,d=!0;function p(){var t=e.responseText,r=t.substr(l);r&&u(r),l=A(t)}t(dt).on((function(){e.onreadystatechange=null,e.abort()})),"onprogress"in e&&(e.onprogress=p),e.onreadystatechange=function(){function r(){try{d&&t(ft).emit(e.status,H(e.getAllResponseHeaders())),d=!1}catch(r){}}switch(e.readyState){case 2:case 3:return r();case 4:r();var n=2==String(e.status)[0];n?(p(),t(lt).emit()):h(vt(e.status,e.responseText))}};try{for(var m in e.open(n,i,!0),a)e.setRequestHeader(m,a[m]);z(r.location,K(i))||e.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.withCredentials=s,e.send(o)}catch(y){r.setTimeout(f(h,vt(c,c,y)),0)}}var $=function(){var t=function(t){return t.exec.bind(t)},e=m((function(e){return e.unshift(/^/),t(RegExp(e.map(l("source")).join("")))})),r=/(\$?)/,n=/([\w-_]+|\*)/,i=/()/,o=/\["([^"]+)"\]/,a=/\[(\d+|\*)\]/,s=/{([\w ]*?)}/,u=/(?:{([\w ]*?)})?/,c=e(r,n,u),f=e(r,o,u),h=e(r,a,u),p=e(r,i,s),y=e(/\.\./),v=e(/\./),b=e(r,/!/),g=e(/$/);return function(t){return t(d(c,f,h,p),y,v,b,g)}}();function Y(t,e){return{key:t,node:e}}var W=l("key"),Z=l("node"),J={};function X(t){var e=t(nt).emit,r=t(it).emit,n=t(ct).emit,i=t(ut).emit;function o(t,e){var r=Z(I(t));return _(a,r)?c(t,A(r),e):t}function s(t,e){if(!t)return n(e),c(t,J,e);var r=o(t,e),i=C(r),a=W(I(r));return u(i,a,e),k(Y(a,e),i)}function u(t,e,r){Z(I(t))[e]=r}function c(t,r,n){t&&u(t,r,n);var i=k(Y(r,n),t);return e(i),i}function f(t){return r(t),C(t)||i(Z(I(t)))}var h={};return h[mt]=s,h[yt]=f,h[pt]=c,h}var Q=$((function(t,e,r,n,i){var o=1,a=2,u=3,c=h(W,I),l=h(Z,I);function p(t,e){var r=e[a],n=r&&"*"!=r?function(t){return c(t)==r}:g;return v(n,t)}function m(t,e){var r=e[u];if(!r)return t;var n=f(M,T(r.split(/\W+/))),i=h(n,l);return v(i,t)}function y(t,e){var r=!!e[o];return r?v(t,I):t}function b(t){if(t==g)return g;function e(t){return c(t)!=J}return v(e,h(t,C))}function w(t){if(t==g)return g;var e=_(),r=t,n=b((function(t){return i(t)})),i=d(e,r,n);return i}function _(){return function(t){return c(t)==J}}function E(t){return function(e){var r=t(e);return!0===r?I(e):r}}function x(t,e,r){return R((function(t,e){return e(t,r)}),e,t)}function k(t,e,r,n,i){var o=t(r);if(o){var a=x(e,n,o),s=r.substr(A(o[0]));return i(s,a)}}function S(t,e){return f(k,t,e)}var O=d(S(t,U(y,m,p,b)),S(e,U(w)),S(r,U()),S(n,U(y,_)),S(i,U(E)),(function(t){throw s('"'+t+'" could not be tokenised')}));function P(t,e){return e}function N(t,e){var r=t?N:P;return O(t,e,r)}return function(t){try{return N(t,g)}catch(e){throw s('Could not compile "'+t+'" because '+e.message)}}}));function tt(t,e,r){var n,i;function o(t){return function(e){return e.id==t}}return{on:function(r,o){var a={listener:r,id:o||r};return e&&e.emit(t,r,a.id),n=k(a,n),i=k(r,i),this},emit:function(){j(i,arguments)},un:function(e){var a;n=N(n,o(e),(function(t){a=t})),a&&(i=N(i,(function(t){return t==a.listener})),r&&r.emit(t,a.listener,a.id))},listeners:function(){return i},hasListener:function(t){var e=t?o(t):g;return x(D(e,n))}}}function et(){var t={},e=n("newListener"),r=n("removeListener");function n(n){return t[n]=tt(n,e,r)}function i(e){return t[e]||n(e)}return["emit","on","un"].forEach((function(t){i[t]=m((function(e,r){p(r,i(e)[t])}))})),i}var rt=1,nt=rt++,it=rt++,ot=rt++,at=rt++,st="fail",ut=rt++,ct=rt++,ft="start",ht="data",lt="end",dt=rt++,pt=rt++,mt=rt++,yt=rt++;function vt(t,e,r){try{var n=u.parse(e)}catch(i){}return{statusCode:t,body:e,jsonBody:n,thrown:r}}function bt(t,e){var r={node:t(it),path:t(nt)};function n(t,e,r){var n=L(r);t(e,O(C(P(W,n))),O(P(Z,n)))}function i(e,r,i){var o=t(e).emit;r.on((function(t){var e=i(t);!1!==e&&n(o,Z(e),t)}),e),t("removeListener").on((function(n){n==e&&(t(n).listeners()||r.un(e))}))}t("newListener").on((function(t){var n=/(node|path):(.*)/.exec(t);if(n){var o=r[n[1]];o.hasListener(t)||i(t,o,e(n[2]))}}))}function gt(t,e){var r,n=/^(node|path):./,i=t(ut),o=t(at).emit,a=t(ot).emit,u=m((function(e,i){if(r[e])p(i,r[e]);else{var o=t(e),a=i[0];n.test(e)?l(o,a):o.on(a)}return r})),c=function(e,n,o){if("done"==e)i.un(n);else if("node"==e||"path"==e)t.un(e+":"+n,o);else{var a=n;t(e).un(a)}return r};function h(e,n){return t(e).on(d(n),n),r}function l(t,e,n){n=n||e;var i=d(e);return t.on((function(){var e=!1;r.forget=function(){e=!0},p(arguments,i),delete r.forget,e&&t.un(n)}),n),r}function d(t){return function(){try{return t.apply(r,arguments)}catch(e){setTimeout((function(){throw new s(e.message)}))}}}function y(e,r){return t(e+":"+r)}function v(t){return function(){var e=t.apply(this,arguments);x(e)&&(e==At.drop?o():a(e))}}function g(t,e,r){var n;n="node"==t?v(r):r,l(y(t,e),n,r)}function _(t,e){for(var r in e)g(t,r,e[r])}function A(t,e,n){return E(e)?g(t,e,n):_(t,e),r}return t(ct).on((function(t){r.root=w(t)})),t(ft).on((function(t,e){r.header=function(t){return t?e[t]:e}})),r={on:u,addListener:u,removeListener:c,emit:t.emit,node:f(A,"node"),path:f(A,"path"),done:f(l,i),start:f(h,ft),fail:t(st).on,abort:t(dt).emit,header:b,root:b,source:e}}function wt(t,e,r,n,i){var o=et();return e&&G(o,V(),t,e,r,n,i),F(o),q(o,X(o)),bt(o,Q),gt(o,e)}function _t(t,e,r,n,i,o,a){function s(t,e){return!1===e&&(-1==t.indexOf("?")?t+="?":t+="&",t+="_="+(new Date).getTime()),t}return i=i?u.parse(u.stringify(i)):{},n?(E(n)||(n=u.stringify(n),i["Content-Type"]=i["Content-Type"]||"application/json"),i["Content-Length"]=i["Content-Length"]||n.length):n=null,t(r||"GET",s(e,a),n,i,o||!1)}function At(t){var e=U("resume","pause","pipe"),r=f(M,e);return t?r(t)||E(t)?_t(wt,t):_t(wt,t.url,t.method,t.body,t.headers,t.withCredentials,t.cached):wt()}At.drop=function(){return At.drop},n=[],i=function(){return At}.apply(e,n),i===c||(t.exports=i)})(function(){try{return window}catch(t){return self}}(),Object,Array,Error,JSON)},3768:function(t,e,r){var n=r("3fb5"),i=r("b639").Buffer,o=r("7f7a"),a=o.base,s=o.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){a.Node.call(this,"der",t)}function f(t){return t<10?"0"+t:t}function h(t,e,r,n){var i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),s.tagByName.hasOwnProperty(t))i=s.tagByName[t];else{if("number"!==typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}return i>=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=s.tagClassByName[r||"universal"]<<6,i)}t.exports=u,u.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},n(c,a.Node),c.prototype._encodeComposite=function(t,e,r,n){var o=h(t,e,r,this.reporter);if(n.length<128){var a=new i(2);return a[0]=o,a[1]=n.length,this._createEncoderBuffer([a,n])}for(var s=1,u=n.length;u>=256;u>>=8)s++;a=new i(2+s);a[0]=o,a[1]=128|s;u=1+s;for(var c=n.length;c>0;u--,c>>=8)a[u]=255&c;return this._createEncoderBuffer([a,n])},c.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new i(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n=128;a>>=7)o++}var s=new i(o),u=s.length-1;for(n=t.length-1;n>=0;n--){a=t[n];s[u--]=127&a;while((a>>=7)>0)s[u--]=128|127&a}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[f(n.getFullYear()),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[f(n.getFullYear()%100),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(t,e){if("string"===typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!==typeof t&&!i.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new i(r)}if(i.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new i(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var a=t;a>=256;a>>=8)n++;for(o=new Array(n),a=o.length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},c.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},c.prototype._use=function(t,e){return"function"===typeof t&&(t=t(e)),t._getEncoder("der").tree},c.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i["default"])return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i["default"],e,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n=0)return this._url=this._parseUrl(e.headers.location),this._method="GET",this._loweredHeaders["content-type"]&&(delete this._headers[this._loweredHeaders["content-type"]],delete this._loweredHeaders["content-type"]),null!=this._headers["Content-Type"]&&delete this._headers["Content-Type"],delete this._headers["Content-Length"],this.upload._reset(),this._finalizeHeaders(),void this._sendHxxpRequest();this._response=e,this._response.on("data",(function(t){return n._onHttpResponseData(e,t)})),this._response.on("end",(function(){return n._onHttpResponseEnd(e)})),this._response.on("close",(function(){return n._onHttpResponseClose(e)})),this.responseUrl=this._url.href.split("#")[0],this.status=e.statusCode,this.statusText=a.STATUS_CODES[this.status],this._parseResponseHeaders(e);var i=this._responseHeaders["content-length"]||"";this._totalBytes=+i,this._lengthComputable=!!i,this._setReadyState(r.HEADERS_RECEIVED)}},r.prototype._onHttpResponseData=function(t,e){this._response===t&&(this._responseParts.push(new n(e)),this._loadedBytes+=e.length,this.readyState!==r.LOADING&&this._setReadyState(r.LOADING),this._dispatchProgress("progress"))},r.prototype._onHttpResponseEnd=function(t){this._response===t&&(this._parseResponse(),this._request=null,this._response=null,this._setReadyState(r.DONE),this._dispatchProgress("load"),this._dispatchProgress("loadend"))},r.prototype._onHttpResponseClose=function(t){if(this._response===t){var e=this._request;this._setError(),e.abort(),this._setReadyState(r.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend")}},r.prototype._onHttpTimeout=function(t){this._request===t&&(this._setError(),t.abort(),this._setReadyState(r.DONE),this._dispatchProgress("timeout"),this._dispatchProgress("loadend"))},r.prototype._onHttpRequestError=function(t,e){this._request===t&&(this._setError(),t.abort(),this._setReadyState(r.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend"))},r.prototype._dispatchProgress=function(t){var e=new r.ProgressEvent(t);e.lengthComputable=this._lengthComputable,e.loaded=this._loadedBytes,e.total=this._totalBytes,this.dispatchEvent(e)},r.prototype._setError=function(){this._request=null,this._response=null,this._responseHeaders=null,this._responseParts=null},r.prototype._parseUrl=function(t,e,r){var n=null==this.nodejsBaseUrl?t:c.resolve(this.nodejsBaseUrl,t),i=c.parse(n,!1,!0);i.hash=null;var o=(i.auth||"").split(":"),a=o[0],s=o[1];return(a||s||e||r)&&(i.auth=(e||a||"")+":"+(r||s||"")),i},r.prototype._parseResponseHeaders=function(t){for(var e in this._responseHeaders={},t.headers){var r=e.toLowerCase();this._privateHeaders[r]||(this._responseHeaders[r]=t.headers[e])}null!=this._mimeOverride&&(this._responseHeaders["content-type"]=this._mimeOverride)},r.prototype._parseResponse=function(){var t=n.concat(this._responseParts);switch(this._responseParts=null,this.responseType){case"json":this.responseText=null;try{this.response=JSON.parse(t.toString("utf-8"))}catch(o){this.response=null}return;case"buffer":return this.responseText=null,void(this.response=t);case"arraybuffer":this.responseText=null;for(var e=new ArrayBuffer(t.length),r=new Uint8Array(e),i=0;iu)i.f(t,r=n[u++],e[r]);return t}},"380f":function(t,e,r){"use strict";var n=r("f3a3"),i=n.assert,o=n.parseBytes,a=n.cachedProperty;function s(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}s.fromPublic=function(t,e){return e instanceof s?e:new s(t,{pub:e})},s.fromSecret=function(t,e){return e instanceof s?e:new s(t,{secret:e})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),a(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),a(s,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),a(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),a(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),a(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},s.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},s.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},s.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=s},"399f":function(t,e,r){(function(t){(function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"===typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=r(1).Buffer}catch(k){}function s(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"===typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,s+=24,s>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,s+=24,s>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-o&4194303,o+=24,o>=26&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,c=0,f=r;f1&&0===this.words[this.length-1])this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;i=0|t.words[p],o=0|e.words[d],a=i*o+h,f+=a/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(t=t||10,e=0|e||1,16===t||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,r=0!==o||a!==this.length-1?c[6-u.length]+u+r:u+r,i+=2,i>=26&&(i-=26,a--)}0!==o&&(r=o.toString(16)+r);while(r.length%e!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=h[t];r="";var p=this.clone();p.negative=0;while(!p.isZero()){var m=p.modn(d).toString(t);p=p.idivn(d),r=p.isZero()?m+r:c[l-m.length]+m+r}this.isZero()&&(r="0"+r);while(r.length%e!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,m=d>>>13,y=0|a[2],v=8191&y,b=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,A=0|a[4],E=8191&A,x=A>>>13,M=0|a[5],k=8191&M,S=M>>>13,I=0|a[6],C=8191&I,T=I>>>13,U=0|a[7],O=8191&U,P=U>>>13,R=0|a[8],N=8191&R,B=R>>>13,j=0|a[9],L=8191&j,D=j>>>13,F=0|s[0],q=8191&F,H=F>>>13,z=0|s[1],K=8191&z,V=z>>>13,G=0|s[2],$=8191&G,Y=G>>>13,W=0|s[3],Z=8191&W,J=W>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,q),i=Math.imul(h,H),i=i+Math.imul(l,q)|0,o=Math.imul(l,H);var yt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,q),i=Math.imul(p,H),i=i+Math.imul(m,q)|0,o=Math.imul(m,H),n=n+Math.imul(h,K)|0,i=i+Math.imul(h,V)|0,i=i+Math.imul(l,K)|0,o=o+Math.imul(l,V)|0;var vt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,q),i=Math.imul(v,H),i=i+Math.imul(b,q)|0,o=Math.imul(b,H),n=n+Math.imul(p,K)|0,i=i+Math.imul(p,V)|0,i=i+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,Y)|0,i=i+Math.imul(l,$)|0,o=o+Math.imul(l,Y)|0;var bt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,q),i=Math.imul(w,H),i=i+Math.imul(_,q)|0,o=Math.imul(_,H),n=n+Math.imul(v,K)|0,i=i+Math.imul(v,V)|0,i=i+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,Y)|0,i=i+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0,n=n+Math.imul(h,Z)|0,i=i+Math.imul(h,J)|0,i=i+Math.imul(l,Z)|0,o=o+Math.imul(l,J)|0;var gt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(E,q),i=Math.imul(E,H),i=i+Math.imul(x,q)|0,o=Math.imul(x,H),n=n+Math.imul(w,K)|0,i=i+Math.imul(w,V)|0,i=i+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(v,$)|0,i=i+Math.imul(v,Y)|0,i=i+Math.imul(b,$)|0,o=o+Math.imul(b,Y)|0,n=n+Math.imul(p,Z)|0,i=i+Math.imul(p,J)|0,i=i+Math.imul(m,Z)|0,o=o+Math.imul(m,J)|0,n=n+Math.imul(h,Q)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(l,Q)|0,o=o+Math.imul(l,tt)|0;var wt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,q),i=Math.imul(k,H),i=i+Math.imul(S,q)|0,o=Math.imul(S,H),n=n+Math.imul(E,K)|0,i=i+Math.imul(E,V)|0,i=i+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(w,$)|0,i=i+Math.imul(w,Y)|0,i=i+Math.imul(_,$)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(v,Z)|0,i=i+Math.imul(v,J)|0,i=i+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(l,rt)|0,o=o+Math.imul(l,nt)|0;var _t=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,q),i=Math.imul(C,H),i=i+Math.imul(T,q)|0,o=Math.imul(T,H),n=n+Math.imul(k,K)|0,i=i+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(E,$)|0,i=i+Math.imul(E,Y)|0,i=i+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(w,Z)|0,i=i+Math.imul(w,J)|0,i=i+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(v,Q)|0,i=i+Math.imul(v,tt)|0,i=i+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0,n=n+Math.imul(h,ot)|0,i=i+Math.imul(h,at)|0,i=i+Math.imul(l,ot)|0,o=o+Math.imul(l,at)|0;var At=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(O,q),i=Math.imul(O,H),i=i+Math.imul(P,q)|0,o=Math.imul(P,H),n=n+Math.imul(C,K)|0,i=i+Math.imul(C,V)|0,i=i+Math.imul(T,K)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(k,$)|0,i=i+Math.imul(k,Y)|0,i=i+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(E,Z)|0,i=i+Math.imul(E,J)|0,i=i+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(w,Q)|0,i=i+Math.imul(w,tt)|0,i=i+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=i+Math.imul(v,nt)|0,i=i+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=i+Math.imul(p,at)|0,i=i+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0,n=n+Math.imul(h,ut)|0,i=i+Math.imul(h,ct)|0,i=i+Math.imul(l,ut)|0,o=o+Math.imul(l,ct)|0;var Et=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,q),i=Math.imul(N,H),i=i+Math.imul(B,q)|0,o=Math.imul(B,H),n=n+Math.imul(O,K)|0,i=i+Math.imul(O,V)|0,i=i+Math.imul(P,K)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(C,$)|0,i=i+Math.imul(C,Y)|0,i=i+Math.imul(T,$)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(k,Z)|0,i=i+Math.imul(k,J)|0,i=i+Math.imul(S,Z)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(E,Q)|0,i=i+Math.imul(E,tt)|0,i=i+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(w,rt)|0,i=i+Math.imul(w,nt)|0,i=i+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(v,ot)|0,i=i+Math.imul(v,at)|0,i=i+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(p,ut)|0,i=i+Math.imul(p,ct)|0,i=i+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,lt)|0,i=i+Math.imul(l,ht)|0,o=o+Math.imul(l,lt)|0;var xt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,q),i=Math.imul(L,H),i=i+Math.imul(D,q)|0,o=Math.imul(D,H),n=n+Math.imul(N,K)|0,i=i+Math.imul(N,V)|0,i=i+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(O,$)|0,i=i+Math.imul(O,Y)|0,i=i+Math.imul(P,$)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(C,Z)|0,i=i+Math.imul(C,J)|0,i=i+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(k,Q)|0,i=i+Math.imul(k,tt)|0,i=i+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,i=i+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(w,ot)|0,i=i+Math.imul(w,at)|0,i=i+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(v,ut)|0,i=i+Math.imul(v,ct)|0,i=i+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,lt)|0,i=i+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,mt)|0,i=i+Math.imul(l,pt)|0,o=o+Math.imul(l,mt)|0;var Mt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,K),i=Math.imul(L,V),i=i+Math.imul(D,K)|0,o=Math.imul(D,V),n=n+Math.imul(N,$)|0,i=i+Math.imul(N,Y)|0,i=i+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(O,Z)|0,i=i+Math.imul(O,J)|0,i=i+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(C,Q)|0,i=i+Math.imul(C,tt)|0,i=i+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,i=i+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(E,ot)|0,i=i+Math.imul(E,at)|0,i=i+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(w,ut)|0,i=i+Math.imul(w,ct)|0,i=i+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(v,ht)|0,i=i+Math.imul(v,lt)|0,i=i+Math.imul(b,ht)|0,o=o+Math.imul(b,lt)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,mt)|0,i=i+Math.imul(m,pt)|0,o=o+Math.imul(m,mt)|0;var kt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(L,$),i=Math.imul(L,Y),i=i+Math.imul(D,$)|0,o=Math.imul(D,Y),n=n+Math.imul(N,Z)|0,i=i+Math.imul(N,J)|0,i=i+Math.imul(B,Z)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(O,Q)|0,i=i+Math.imul(O,tt)|0,i=i+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,i=i+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(k,ot)|0,i=i+Math.imul(k,at)|0,i=i+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,n=n+Math.imul(E,ut)|0,i=i+Math.imul(E,ct)|0,i=i+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(w,ht)|0,i=i+Math.imul(w,lt)|0,i=i+Math.imul(_,ht)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(v,pt)|0,i=i+Math.imul(v,mt)|0,i=i+Math.imul(b,pt)|0,o=o+Math.imul(b,mt)|0;var St=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,Z),i=Math.imul(L,J),i=i+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(N,Q)|0,i=i+Math.imul(N,tt)|0,i=i+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(O,rt)|0,i=i+Math.imul(O,nt)|0,i=i+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(C,ot)|0,i=i+Math.imul(C,at)|0,i=i+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(k,ut)|0,i=i+Math.imul(k,ct)|0,i=i+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,n=n+Math.imul(E,ht)|0,i=i+Math.imul(E,lt)|0,i=i+Math.imul(x,ht)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(w,pt)|0,i=i+Math.imul(w,mt)|0,i=i+Math.imul(_,pt)|0,o=o+Math.imul(_,mt)|0;var It=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,Q),i=Math.imul(L,tt),i=i+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(N,rt)|0,i=i+Math.imul(N,nt)|0,i=i+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(O,ot)|0,i=i+Math.imul(O,at)|0,i=i+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(C,ut)|0,i=i+Math.imul(C,ct)|0,i=i+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(k,ht)|0,i=i+Math.imul(k,lt)|0,i=i+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0,n=n+Math.imul(E,pt)|0,i=i+Math.imul(E,mt)|0,i=i+Math.imul(x,pt)|0,o=o+Math.imul(x,mt)|0;var Ct=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,rt),i=Math.imul(L,nt),i=i+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(N,ot)|0,i=i+Math.imul(N,at)|0,i=i+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(O,ut)|0,i=i+Math.imul(O,ct)|0,i=i+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(C,ht)|0,i=i+Math.imul(C,lt)|0,i=i+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(k,pt)|0,i=i+Math.imul(k,mt)|0,i=i+Math.imul(S,pt)|0,o=o+Math.imul(S,mt)|0;var Tt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,ot),i=Math.imul(L,at),i=i+Math.imul(D,ot)|0,o=Math.imul(D,at),n=n+Math.imul(N,ut)|0,i=i+Math.imul(N,ct)|0,i=i+Math.imul(B,ut)|0,o=o+Math.imul(B,ct)|0,n=n+Math.imul(O,ht)|0,i=i+Math.imul(O,lt)|0,i=i+Math.imul(P,ht)|0,o=o+Math.imul(P,lt)|0,n=n+Math.imul(C,pt)|0,i=i+Math.imul(C,mt)|0,i=i+Math.imul(T,pt)|0,o=o+Math.imul(T,mt)|0;var Ut=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,n=Math.imul(L,ut),i=Math.imul(L,ct),i=i+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(N,ht)|0,i=i+Math.imul(N,lt)|0,i=i+Math.imul(B,ht)|0,o=o+Math.imul(B,lt)|0,n=n+Math.imul(O,pt)|0,i=i+Math.imul(O,mt)|0,i=i+Math.imul(P,pt)|0,o=o+Math.imul(P,mt)|0;var Ot=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,ht),i=Math.imul(L,lt),i=i+Math.imul(D,ht)|0,o=Math.imul(D,lt),n=n+Math.imul(N,pt)|0,i=i+Math.imul(N,mt)|0,i=i+Math.imul(B,pt)|0,o=o+Math.imul(B,mt)|0;var Pt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(L,pt),i=Math.imul(L,mt),i=i+Math.imul(D,pt)|0,o=Math.imul(D,mt);var Rt=(c+n|0)+((8191&i)<<13)|0;return c=(o+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=yt,u[1]=vt,u[2]=bt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=At,u[7]=Et,u[8]=xt,u[9]=Mt,u[10]=kt,u[11]=St,u[12]=It,u[13]=Ct,u[14]=Tt,u[15]=Ut,u[16]=Ot,u[17]=Pt,u[18]=Rt,0!==c&&(u[19]=c,r.length++),r};function m(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0,i+=a>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}function y(t,e,r){var n=new v;return n.mulp(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?m(this,t,e):y(this,t,e),r},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=l(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,a=0|i.words[i.length-1],s=this._countBits(a);r=26-s,0!==r&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var u,c=n.length-i.length;if("mod"!==e){u=new o(null),u.length=c+1,u.words=new Array(u.length);for(var f=0;f=0;l--){var d=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,l);while(0!==n.negative)d--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);u&&(u.words[l]=d)}return u&&u.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:u||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;while(e.isEven()&&r.isEven())e.iushrn(1),r.iushrn(1),++c;var f=r.clone(),h=e.clone();while(!e.isZero()){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0){e.iushrn(l);while(l-- >0)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1)}for(var p=0,m=1;0===(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0){r.iushrn(p);while(p-- >0)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1)}e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();var i,a=new o(1),s=new o(0),u=r.clone();while(e.cmpn(1)>0&&r.cmpn(1)>0){for(var c=0,f=1;0===(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0){e.iushrn(c);while(c-- >0)a.isOdd()&&a.iadd(u),a.iushrn(1)}for(var h=0,l=1;0===(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0){r.iushrn(h);while(h-- >0)s.isOdd()&&s.iadd(u),s.iushrn(1)}e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return i=0===e.cmpn(1)?a:s,i.cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);do{while(e.isEven())e.iushrn(1);while(r.isEven())r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}while(1);return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(w,g),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},x.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}var i=this.m.subn(1),a=0;while(!i.isZero()&&0===i.andln(1))a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();f=new o(2*f*f).toRed(this);while(0!==this.pow(f,c).cmp(u))f.redIAdd(u);var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;while(0!==d.cmp(s)){for(var m=d,y=0;0!==m.cmp(s);y++)m=m.redSqr();n(y=0;i--){for(var f=e.words[i],h=c-1;h>=0;h--){var l=f>>h&1;a!==n[0]&&(a=this.sqr(a)),0!==l||0!==s?(s<<=1,s|=l,u++,(u===r||0===i&&0===h)&&(a=this.mul(a,n[s]),u=0,s=0)):u=0}c=26}return a},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,x),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}})(t,this)}).call(this,r("62e4")(t))},"39d4":function(t,e,r){"use strict";var n=r("5f2e"),i=r("175f");t.exports={errors:n,formatters:i}},"39f5":function(t,e,r){var n=r("8707").Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i>>24]^f[p>>>16&255]^h[m>>>8&255]^l[255&y]^e[v++],a=c[p>>>24]^f[m>>>16&255]^h[y>>>8&255]^l[255&d]^e[v++],s=c[m>>>24]^f[y>>>16&255]^h[d>>>8&255]^l[255&p]^e[v++],u=c[y>>>24]^f[d>>>16&255]^h[p>>>8&255]^l[255&m]^e[v++],d=o,p=a,m=s,y=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[m>>>8&255]<<8|n[255&y])^e[v++],a=(n[p>>>24]<<24|n[m>>>16&255]<<16|n[y>>>8&255]<<8|n[255&d])^e[v++],s=(n[m>>>24]<<24|n[y>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^e[v++],u=(n[y>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&m])^e[v++],o>>>=0,a>>>=0,s>>>=0,u>>>=0,[o,a,s,u]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,r[a]=c,n[c]=a;var f=t[a],h=t[f],l=t[h],d=257*t[c]^16843008*c;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*l^65537*h^257*f^16843008*a,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===a?a=s=1:(a=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e===4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-e]^a}for(var c=[],f=0;f>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return t=i(t),a(t,this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},c.prototype.decryptBlock=function(t){t=i(t);var e=t[1];t[1]=t[3],t[3]=e;var r=a(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},"3a7c":function(t,e,r){(function(t){function r(t){return Array.isArray?Array.isArray(t):"[object Array]"===y(t)}function n(t){return"boolean"===typeof t}function i(t){return null===t}function o(t){return null==t}function a(t){return"number"===typeof t}function s(t){return"string"===typeof t}function u(t){return"symbol"===typeof t}function c(t){return void 0===t}function f(t){return"[object RegExp]"===y(t)}function h(t){return"object"===typeof t&&null!==t}function l(t){return"[object Date]"===y(t)}function d(t){return"[object Error]"===y(t)||t instanceof Error}function p(t){return"function"===typeof t}function m(t){return null===t||"boolean"===typeof t||"number"===typeof t||"string"===typeof t||"symbol"===typeof t||"undefined"===typeof t}function y(t){return Object.prototype.toString.call(t)}e.isArray=r,e.isBoolean=n,e.isNull=i,e.isNullOrUndefined=o,e.isNumber=a,e.isString=s,e.isSymbol=u,e.isUndefined=c,e.isRegExp=f,e.isObject=h,e.isDate=l,e.isError=d,e.isFunction=p,e.isPrimitive=m,e.isBuffer=t.isBuffer}).call(this,r("b639").Buffer)},"3a89":function(t,e,r){"use strict";var n=r("8ac4"),i=r("1b54"),o=r("f8c1");function a(t,e){return void 0===t?e:(n.isBoolean(t,o.COMPRESSED_TYPE_INVALID),t)}t.exports=function(t){return{privateKeyVerify:function(e){return n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),32===e.length&&t.privateKeyVerify(e)},privateKeyExport:function(e,r){n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(e,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=a(r,!0);var s=t.privateKeyExport(e,r);return i.privateKeyExport(e,s,r)},privateKeyImport:function(e){if(n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),e=i.privateKeyImport(e),e&&32===e.length&&t.privateKeyVerify(e))return e;throw new Error(o.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(e){return n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(e,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyNegate(e)},privateKeyModInverse:function(e){return n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(e,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyModInverse(e)},privateKeyTweakAdd:function(e,r){return n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(e,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),t.privateKeyTweakAdd(e,r)},privateKeyTweakMul:function(e,r){return n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(e,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),t.privateKeyTweakMul(e,r)},publicKeyCreate:function(e,r){return n.isBuffer(e,o.EC_PRIVATE_KEY_TYPE_INVALID),n.isBufferLength(e,32,o.EC_PRIVATE_KEY_LENGTH_INVALID),r=a(r,!0),t.publicKeyCreate(e,r)},publicKeyConvert:function(e,r){return n.isBuffer(e,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(e,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),r=a(r,!0),t.publicKeyConvert(e,r)},publicKeyVerify:function(e){return n.isBuffer(e,o.EC_PUBLIC_KEY_TYPE_INVALID),t.publicKeyVerify(e)},publicKeyTweakAdd:function(e,r,i){return n.isBuffer(e,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(e,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=a(i,!0),t.publicKeyTweakAdd(e,r,i)},publicKeyTweakMul:function(e,r,i){return n.isBuffer(e,o.EC_PUBLIC_KEY_TYPE_INVALID),n.isBufferLength2(e,33,65,o.EC_PUBLIC_KEY_LENGTH_INVALID),n.isBuffer(r,o.TWEAK_TYPE_INVALID),n.isBufferLength(r,32,o.TWEAK_LENGTH_INVALID),i=a(i,!0),t.publicKeyTweakMul(e,r,i)},publicKeyCombine:function(e,r){n.isArray(e,o.EC_PUBLIC_KEYS_TYPE_INVALID),n.isLengthGTZero(e,o.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i>=8;return e}function o(t,e,r){for(var n=0,i=0;ie+1+n)throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function c(t,e){if(0===t.length)throw new Error("invalid rlp data");if(t[e]>=248){var r=t[e]-247;if(e+1+r>t.length)throw new Error("too short");var i=o(t,e+1,r);if(e+1+r+i>t.length)throw new Error("to short");return u(t,e,e+1+r,r+i)}if(t[e]>=192){i=t[e]-192;if(e+1+i>t.length)throw new Error("invalid rlp data");return u(t,e,e+1,i)}if(t[e]>=184){r=t[e]-183;if(e+1+r>t.length)throw new Error("invalid rlp data");i=o(t,e+1,r);if(e+1+r+i>t.length)throw new Error("invalid rlp data");var a=n.hexlify(t.slice(e+1+r,e+1+r+i));return{consumed:1+r+i,result:a}}if(t[e]>=128){i=t[e]-128;if(e+1+i>t.length)throw new Error("invlaid rlp data");a=n.hexlify(t.slice(e+1,e+1+i));return{consumed:1+i,result:a}}return{consumed:1,result:n.hexlify(t[e])}}function f(t){var e=n.arrayify(t),r=c(e,0);if(r.consumed!==e.length)throw new Error("invalid rlp data");return r.result}e.encode=s,e.decode=f},"3bbe":function(t,e,r){var n=r("861d");t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},"3c21":function(t,e,r){"use strict";var n=r("39d4").formatters,i=r("6248"),o=r("1131"),a=function(t){var e=function(e){var r;return e.property?(t[e.property]||(t[e.property]={}),r=t[e.property]):r=t,e.methods&&e.methods.forEach((function(e){e instanceof i||(e=new i(e)),e.attachToObject(r),e.setRequestManager(t._requestManager)})),t};return e.formatters=n,e.utils=o,e.Method=i,e};t.exports=a},"3c35":function(t,e){(function(e){t.exports=e}).call(this,{})},"3c3c":function(t,e,r){"use strict";(function(e,n){var i=r("17fb"),o=r("39d4").errors,a=r("5ee3").w3cwebsocket,s="[object process]"===Object.prototype.toString.call("undefined"!==typeof e?e:0),u=null,c=null;if(s){u=function(t){return n.from(t).toString("base64")};var f=r("0b16");if(f.URL){var h=f.URL;c=function(t){return new h(t)}}else c=r("0b16").parse}else u=btoa,c=function(t){return new URL(t)};var l=function(t,e){if(!a)throw new Error("websocket is not available");var r=this;this.responseCallbacks={},this.notificationCallbacks=[],e=e||{},this._customTimeout=e.timeout;var n=c(t),o=e.headers||{},s=e.protocol||void 0;n.username&&n.password&&(o.authorization="Basic "+u(n.username+":"+n.password));var f=e.clientConfig||void 0,h=e.requestOptions||void 0;n.auth&&(o.authorization="Basic "+u(n.auth)),this.connection=new a(t,s,void 0,o,h,f),this.addDefaultEvents(),this.connection.onmessage=function(t){var e="string"===typeof t.data?t.data:"";r._parseResponse(e).forEach((function(t){var e=null;i.isArray(t)?t.forEach((function(t){r.responseCallbacks[t.id]&&(e=t.id)})):e=t.id,!e&&t&&t.method&&-1!==t.method.indexOf("_subscription")?r.notificationCallbacks.forEach((function(e){i.isFunction(e)&&e(t)})):r.responseCallbacks[e]&&(r.responseCallbacks[e](null,t),delete r.responseCallbacks[e])}))},Object.defineProperty(this,"connected",{get:function(){return this.connection&&this.connection.readyState===this.connection.OPEN},enumerable:!0})};l.prototype.addDefaultEvents=function(){var t=this;this.connection.onerror=function(){t._timeout()},this.connection.onclose=function(){t._timeout(),t.reset()}},l.prototype._parseResponse=function(t){var e=this,r=[],n=t.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|");return n.forEach((function(t){e.lastChunk&&(t=e.lastChunk+t);var n=null;try{n=JSON.parse(t)}catch(i){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout((function(){throw e._timeout(),o.InvalidResponse(t)}),15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,n&&r.push(n)})),r},l.prototype._addResponseCallback=function(t,e){var r=t.id||t[0].id,n=t.method||t[0].method;this.responseCallbacks[r]=e,this.responseCallbacks[r].method=n;var i=this;this._customTimeout&&setTimeout((function(){i.responseCallbacks[r]&&(i.responseCallbacks[r](o.ConnectionTimeout(i._customTimeout)),delete i.responseCallbacks[r])}),this._customTimeout)},l.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](o.InvalidConnection("on WS")),delete this.responseCallbacks[t])},l.prototype.send=function(t,e){var r=this;if(this.connection.readyState!==this.connection.CONNECTING){if(this.connection.readyState!==this.connection.OPEN)return console.error("connection not open on send()"),"function"===typeof this.connection.onerror?this.connection.onerror(new Error("connection not open")):console.error("no error callback"),void e(new Error("connection not open"));this.connection.send(JSON.stringify(t)),this._addResponseCallback(t,e)}else setTimeout((function(){r.send(t,e)}),10)},l.prototype.on=function(t,e){if("function"!==typeof e)throw new Error("The second parameter callback must be a function.");switch(t){case"data":this.notificationCallbacks.push(e);break;case"connect":this.connection.onopen=e;break;case"end":this.connection.onclose=e;break;case"error":this.connection.onerror=e;break}},l.prototype.removeListener=function(t,e){var r=this;switch(t){case"data":this.notificationCallbacks.forEach((function(t,n){t===e&&r.notificationCallbacks.splice(n,1)}));break}},l.prototype.removeAllListeners=function(t){switch(t){case"data":this.notificationCallbacks=[];break;case"connect":this.connection.onopen=null;break;case"end":this.connection.onclose=null;break;case"error":this.connection.onerror=null;break;default:break}},l.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.addDefaultEvents()},l.prototype.disconnect=function(){this.connection&&this.connection.close()},l.prototype.supportsSubscriptions=function(){return!0},t.exports=l}).call(this,r("4362"),r("b639").Buffer)},"3c43":function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!==typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!==typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n",e.homedir=function(){return"/"}},"3daf":function(t,e,r){"use strict";var n=r("f3a3"),i=r("399f"),o=r("3fb5"),a=r("ea53"),s=n.assert;function u(t){this.twisted=1!==(0|t.a),this.mOneA=this.twisted&&-1===(0|t.a),this.extended=this.mOneA,a.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1===(0|t.c)}function c(t,e,r,n,o){a.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,a),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){t=new i(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=n.redMul(o.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},u.prototype.pointFromY=function(t,e){t=new i(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(o.redInvm());if(0===a.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(c,a.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new c(this,t,e,r,n)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),u=i.redMul(a),c=o.redMul(s),f=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,f)},c.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=this.curve._mulA(i),s=a.redAdd(o);if(this.zOne)t=n.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),e=s.redMul(a.redSub(o)),r=s.redSqr().redSub(s).redSub(s);else{var u=this.z.redSqr(),c=s.redSub(u).redISub(u);t=n.redSub(i).redISub(o).redMul(c),e=s.redMul(a.redSub(o)),r=s.redMul(c)}}else{a=i.redAdd(o),u=this.curve._mulC(this.z).redSqr(),c=a.redSub(u).redSub(u);t=this.curve._mulC(n.redISub(a)).redMul(c),e=this.curve._mulC(a).redMul(i.redISub(o)),r=a.redMul(c)}return this.curve.point(t,e,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(e),c=o.redMul(a),f=s.redMul(u),h=o.redMul(u),l=a.redMul(s);return this.curve.point(c,f,l,h)},c.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=n.redMul(u).redMul(f);return this.curve.twisted?(e=n.redMul(c).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(c)):(e=n.redMul(c).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,r)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},c.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},"3f62":function(t,e,r){var n=r("8707").Buffer,i=n.alloc(16,0);function o(t){return[t.readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)]}function a(t){var e=n.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}s.prototype.ghash=function(t){var e=-1;while(++e0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=a(i)},s.prototype.update=function(t){var e;this.cache=n.concat([this.cache,t]);while(this.cache.length>=16)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(a([0,t,0,e])),this.state},t.exports=s},"3f8c":function(t,e){t.exports={}},"3fb5":function(t,e){"function"===typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},"409b":function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},"40c9":function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n=r("9a12"),i=r("399f");e.zeros=function(e){return t.allocUnsafe(e).fill(0)},e.setLengthLeft=function(t,r,n){void 0===n&&(n=!1);var i=e.zeros(r);return t=e.toBuffer(t),n?t.length0&&"0"===e.toString())t=t.slice(1),e=t[0];return t},e.stripZeros=e.unpad,e.toBuffer=function(e){if(!t.isBuffer(e))if(Array.isArray(e))e=t.from(e);else if("string"===typeof e){if(!n.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);e=t.from(n.padToEven(n.stripHexPrefix(e)),"hex")}else if("number"===typeof e)e=n.intToBuffer(e);else if(null===e||void 0===e)e=t.allocUnsafe(0);else if(i.isBN(e))e=e.toArrayLike(t);else{if(!e.toArray)throw new Error("invalid type");e=t.from(e.toArray())}return e},e.bufferToInt=function(t){return new i(e.toBuffer(t)).toNumber()},e.bufferToHex=function(t){return t=e.toBuffer(t),"0x"+t.toString("hex")},e.fromSigned=function(t){return new i(t).fromTwos(256)},e.toUnsigned=function(e){return t.from(e.toTwos(256).toArray())},e.addHexPrefix=function(t){return"string"!==typeof t?t:n.isHexPrefixed(t)?t:"0x"+t},e.baToJSON=function(r){if(t.isBuffer(r))return"0x"+r.toString("hex");if(r instanceof Array){for(var n=[],i=0;i16)throw new Error("unable to decrypt data");var r=-1;while(++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=m,e.createDecipheriv=p},"428f":function(t,e,r){var n=r("da84");t.exports=n},"429b":function(t,e,r){t.exports=r("faa1").EventEmitter},4348:function(t,e,r){"use strict";function n(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function i(t,e,r){var n=JSON.stringify(r);Object.defineProperty(t,e,{enumerable:!0,get:function(){return JSON.parse(n)}})}function o(t){var e={},r=[];return Object.keys(t).forEach((function(n){var i=t[n];i instanceof Promise?r.push(i.then((function(t){return e[n]=t,null}))):e[n]=i})),Promise.all(r).then((function(){return e}))}function a(t){var e={};for(var r in t)e[r]=t[r];return e}function s(t){return JSON.parse(JSON.stringify(t))}Object.defineProperty(e,"__esModule",{value:!0}),e.defineReadOnly=n,e.defineFrozen=i,e.resolveProperties=o,e.shallowCopy=a,e.jsonCopy=s},4362:function(t,e,r){e.nextTick=function(t){var e=Array.prototype.slice.call(arguments);e.shift(),setTimeout((function(){t.apply(null,e)}),0)},e.platform=e.arch=e.execPath=e.title="browser",e.pid=1,e.browser=!0,e.env={},e.argv=[],e.binding=function(t){throw new Error("No such module. (Possibly not yet loaded)")},function(){var t,n="/";e.cwd=function(){return n},e.chdir=function(e){t||(t=r("df7c")),n=t.resolve(e,n)}}(),e.exit=e.kill=e.umask=e.dlopen=e.uptime=e.memoryUsage=e.uvCounters=function(){},e.features={}},"43c5":function(t){t.exports=JSON.parse('{"name":"byzantium","comment":"Hardfork with new precompiles, instructions and other protocol changes","eip":{"url":"https://eips.ethereum.org/EIPS/eip-609","status":"Final"},"gasConfig":{},"gasPrices":{"modexpGquaddivisor":{"v":20,"d":"Gquaddivisor from modexp precompile for gas calculation"},"ecAdd":{"v":500,"d":"Gas costs for curve addition precompile"},"ecMul":{"v":40000,"d":"Gas costs for curve multiplication precompile"},"ecPairing":{"v":100000,"d":"Base gas costs for curve pairing precompile"},"ecPairingWord":{"v":80000,"d":"Gas costs regarding curve pairing precompile input length"}},"vm":{},"pow":{"minerReward":{"v":"3000000000000000000","d":"the amount a miner get rewarded for mining a block"}},"casper":{},"sharding":{}}')},"44a3":function(t,e,r){"use strict";var n=r("399f"),i=r("f3a3"),o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(t,e){this.eddsa=t,"object"!==typeof e&&(e=s(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),a(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),a(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),a(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},"44ad":function(t,e,r){var n=r("d039"),i=r("c6b6"),o="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?o.call(t,""):Object(t)}:Object},"44d2":function(t,e,r){var n=r("b622"),i=r("7c73"),o=r("9bf2"),a=n("unscopables"),s=Array.prototype;void 0==s[a]&&o.f(s,a,{configurable:!0,value:i(null)}),t.exports=function(t){s[a][t]=!0}},"44de":function(t,e,r){var n=r("da84");t.exports=function(t,e){var r=n.console;r&&r.error&&(1===arguments.length?r.error(t):r.error(t,e))}},4633:function(t,e,r){"use strict";(function(t){var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r("65eb"),o=function(e){function r(){var t=e.call(this)||this;return t._contentType=null,t._body=null,t._reset(),t}return n(r,e),r.prototype._reset=function(){this._contentType=null,this._body=null},r.prototype._setData=function(e){if(null!=e)if("string"===typeof e)0!==e.length&&(this._contentType="text/plain;charset=UTF-8"),this._body=new t(e,"utf-8");else if(t.isBuffer(e))this._body=e;else if(e instanceof ArrayBuffer){for(var r=new t(e.byteLength),n=new Uint8Array(e),i=0;i1?(t[r[0]]=t[r[0]]||{},t[r[0]][r[1]]=e):t[r[0]]=e},i.prototype.buildCall=function(){var t=this;return function(){t.subscriptions[arguments[0]]||console.warn("Subscription "+JSON.stringify(arguments[0])+" doesn't exist. Subscribing anyway.");var e=new n({subscription:t.subscriptions[arguments[0]],requestManager:t.requestManager,type:t.type});return e.subscribe.apply(e,arguments)}},t.exports={subscriptions:i,subscription:n}},4930:function(t,e,r){var n=r("d039");t.exports=!!Object.getOwnPropertySymbols&&!n((function(){return!String(Symbol())}))},"4a87":function(t,e,r){(function(t){(function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"===typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=r("b639").Buffer}catch(k){}function s(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"===typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,s+=24,s>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,s+=24,s>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-o&4194303,o+=24,o>=26&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,c=0,f=r;f1&&0===this.words[this.length-1])this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;i=0|t.words[p],o=0|e.words[d],a=i*o+h,f+=a/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(t=t||10,e=0|e||1,16===t||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,r=0!==o||a!==this.length-1?c[6-u.length]+u+r:u+r,i+=2,i>=26&&(i-=26,a--)}0!==o&&(r=o.toString(16)+r);while(r.length%e!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=h[t];r="";var p=this.clone();p.negative=0;while(!p.isZero()){var m=p.modn(d).toString(t);p=p.idivn(d),r=p.isZero()?m+r:c[l-m.length]+m+r}this.isZero()&&(r="0"+r);while(r.length%e!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,m=d>>>13,y=0|a[2],v=8191&y,b=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,A=0|a[4],E=8191&A,x=A>>>13,M=0|a[5],k=8191&M,S=M>>>13,I=0|a[6],C=8191&I,T=I>>>13,U=0|a[7],O=8191&U,P=U>>>13,R=0|a[8],N=8191&R,B=R>>>13,j=0|a[9],L=8191&j,D=j>>>13,F=0|s[0],q=8191&F,H=F>>>13,z=0|s[1],K=8191&z,V=z>>>13,G=0|s[2],$=8191&G,Y=G>>>13,W=0|s[3],Z=8191&W,J=W>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,q),i=Math.imul(h,H),i=i+Math.imul(l,q)|0,o=Math.imul(l,H);var yt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,q),i=Math.imul(p,H),i=i+Math.imul(m,q)|0,o=Math.imul(m,H),n=n+Math.imul(h,K)|0,i=i+Math.imul(h,V)|0,i=i+Math.imul(l,K)|0,o=o+Math.imul(l,V)|0;var vt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,q),i=Math.imul(v,H),i=i+Math.imul(b,q)|0,o=Math.imul(b,H),n=n+Math.imul(p,K)|0,i=i+Math.imul(p,V)|0,i=i+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,Y)|0,i=i+Math.imul(l,$)|0,o=o+Math.imul(l,Y)|0;var bt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,q),i=Math.imul(w,H),i=i+Math.imul(_,q)|0,o=Math.imul(_,H),n=n+Math.imul(v,K)|0,i=i+Math.imul(v,V)|0,i=i+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,Y)|0,i=i+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0,n=n+Math.imul(h,Z)|0,i=i+Math.imul(h,J)|0,i=i+Math.imul(l,Z)|0,o=o+Math.imul(l,J)|0;var gt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(E,q),i=Math.imul(E,H),i=i+Math.imul(x,q)|0,o=Math.imul(x,H),n=n+Math.imul(w,K)|0,i=i+Math.imul(w,V)|0,i=i+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(v,$)|0,i=i+Math.imul(v,Y)|0,i=i+Math.imul(b,$)|0,o=o+Math.imul(b,Y)|0,n=n+Math.imul(p,Z)|0,i=i+Math.imul(p,J)|0,i=i+Math.imul(m,Z)|0,o=o+Math.imul(m,J)|0,n=n+Math.imul(h,Q)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(l,Q)|0,o=o+Math.imul(l,tt)|0;var wt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,q),i=Math.imul(k,H),i=i+Math.imul(S,q)|0,o=Math.imul(S,H),n=n+Math.imul(E,K)|0,i=i+Math.imul(E,V)|0,i=i+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(w,$)|0,i=i+Math.imul(w,Y)|0,i=i+Math.imul(_,$)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(v,Z)|0,i=i+Math.imul(v,J)|0,i=i+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(l,rt)|0,o=o+Math.imul(l,nt)|0;var _t=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,q),i=Math.imul(C,H),i=i+Math.imul(T,q)|0,o=Math.imul(T,H),n=n+Math.imul(k,K)|0,i=i+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(E,$)|0,i=i+Math.imul(E,Y)|0,i=i+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(w,Z)|0,i=i+Math.imul(w,J)|0,i=i+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(v,Q)|0,i=i+Math.imul(v,tt)|0,i=i+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0,n=n+Math.imul(h,ot)|0,i=i+Math.imul(h,at)|0,i=i+Math.imul(l,ot)|0,o=o+Math.imul(l,at)|0;var At=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(O,q),i=Math.imul(O,H),i=i+Math.imul(P,q)|0,o=Math.imul(P,H),n=n+Math.imul(C,K)|0,i=i+Math.imul(C,V)|0,i=i+Math.imul(T,K)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(k,$)|0,i=i+Math.imul(k,Y)|0,i=i+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(E,Z)|0,i=i+Math.imul(E,J)|0,i=i+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(w,Q)|0,i=i+Math.imul(w,tt)|0,i=i+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=i+Math.imul(v,nt)|0,i=i+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=i+Math.imul(p,at)|0,i=i+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0,n=n+Math.imul(h,ut)|0,i=i+Math.imul(h,ct)|0,i=i+Math.imul(l,ut)|0,o=o+Math.imul(l,ct)|0;var Et=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,q),i=Math.imul(N,H),i=i+Math.imul(B,q)|0,o=Math.imul(B,H),n=n+Math.imul(O,K)|0,i=i+Math.imul(O,V)|0,i=i+Math.imul(P,K)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(C,$)|0,i=i+Math.imul(C,Y)|0,i=i+Math.imul(T,$)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(k,Z)|0,i=i+Math.imul(k,J)|0,i=i+Math.imul(S,Z)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(E,Q)|0,i=i+Math.imul(E,tt)|0,i=i+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(w,rt)|0,i=i+Math.imul(w,nt)|0,i=i+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(v,ot)|0,i=i+Math.imul(v,at)|0,i=i+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(p,ut)|0,i=i+Math.imul(p,ct)|0,i=i+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,lt)|0,i=i+Math.imul(l,ht)|0,o=o+Math.imul(l,lt)|0;var xt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,q),i=Math.imul(L,H),i=i+Math.imul(D,q)|0,o=Math.imul(D,H),n=n+Math.imul(N,K)|0,i=i+Math.imul(N,V)|0,i=i+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(O,$)|0,i=i+Math.imul(O,Y)|0,i=i+Math.imul(P,$)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(C,Z)|0,i=i+Math.imul(C,J)|0,i=i+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(k,Q)|0,i=i+Math.imul(k,tt)|0,i=i+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,i=i+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(w,ot)|0,i=i+Math.imul(w,at)|0,i=i+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(v,ut)|0,i=i+Math.imul(v,ct)|0,i=i+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,lt)|0,i=i+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,mt)|0,i=i+Math.imul(l,pt)|0,o=o+Math.imul(l,mt)|0;var Mt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,K),i=Math.imul(L,V),i=i+Math.imul(D,K)|0,o=Math.imul(D,V),n=n+Math.imul(N,$)|0,i=i+Math.imul(N,Y)|0,i=i+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(O,Z)|0,i=i+Math.imul(O,J)|0,i=i+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(C,Q)|0,i=i+Math.imul(C,tt)|0,i=i+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,i=i+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(E,ot)|0,i=i+Math.imul(E,at)|0,i=i+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(w,ut)|0,i=i+Math.imul(w,ct)|0,i=i+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(v,ht)|0,i=i+Math.imul(v,lt)|0,i=i+Math.imul(b,ht)|0,o=o+Math.imul(b,lt)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,mt)|0,i=i+Math.imul(m,pt)|0,o=o+Math.imul(m,mt)|0;var kt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(L,$),i=Math.imul(L,Y),i=i+Math.imul(D,$)|0,o=Math.imul(D,Y),n=n+Math.imul(N,Z)|0,i=i+Math.imul(N,J)|0,i=i+Math.imul(B,Z)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(O,Q)|0,i=i+Math.imul(O,tt)|0,i=i+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,i=i+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(k,ot)|0,i=i+Math.imul(k,at)|0,i=i+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,n=n+Math.imul(E,ut)|0,i=i+Math.imul(E,ct)|0,i=i+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(w,ht)|0,i=i+Math.imul(w,lt)|0,i=i+Math.imul(_,ht)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(v,pt)|0,i=i+Math.imul(v,mt)|0,i=i+Math.imul(b,pt)|0,o=o+Math.imul(b,mt)|0;var St=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,Z),i=Math.imul(L,J),i=i+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(N,Q)|0,i=i+Math.imul(N,tt)|0,i=i+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(O,rt)|0,i=i+Math.imul(O,nt)|0,i=i+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(C,ot)|0,i=i+Math.imul(C,at)|0,i=i+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(k,ut)|0,i=i+Math.imul(k,ct)|0,i=i+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,n=n+Math.imul(E,ht)|0,i=i+Math.imul(E,lt)|0,i=i+Math.imul(x,ht)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(w,pt)|0,i=i+Math.imul(w,mt)|0,i=i+Math.imul(_,pt)|0,o=o+Math.imul(_,mt)|0;var It=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,Q),i=Math.imul(L,tt),i=i+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(N,rt)|0,i=i+Math.imul(N,nt)|0,i=i+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(O,ot)|0,i=i+Math.imul(O,at)|0,i=i+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(C,ut)|0,i=i+Math.imul(C,ct)|0,i=i+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(k,ht)|0,i=i+Math.imul(k,lt)|0,i=i+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0,n=n+Math.imul(E,pt)|0,i=i+Math.imul(E,mt)|0,i=i+Math.imul(x,pt)|0,o=o+Math.imul(x,mt)|0;var Ct=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,rt),i=Math.imul(L,nt),i=i+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(N,ot)|0,i=i+Math.imul(N,at)|0,i=i+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(O,ut)|0,i=i+Math.imul(O,ct)|0,i=i+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(C,ht)|0,i=i+Math.imul(C,lt)|0,i=i+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(k,pt)|0,i=i+Math.imul(k,mt)|0,i=i+Math.imul(S,pt)|0,o=o+Math.imul(S,mt)|0;var Tt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,ot),i=Math.imul(L,at),i=i+Math.imul(D,ot)|0,o=Math.imul(D,at),n=n+Math.imul(N,ut)|0,i=i+Math.imul(N,ct)|0,i=i+Math.imul(B,ut)|0,o=o+Math.imul(B,ct)|0,n=n+Math.imul(O,ht)|0,i=i+Math.imul(O,lt)|0,i=i+Math.imul(P,ht)|0,o=o+Math.imul(P,lt)|0,n=n+Math.imul(C,pt)|0,i=i+Math.imul(C,mt)|0,i=i+Math.imul(T,pt)|0,o=o+Math.imul(T,mt)|0;var Ut=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,n=Math.imul(L,ut),i=Math.imul(L,ct),i=i+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(N,ht)|0,i=i+Math.imul(N,lt)|0,i=i+Math.imul(B,ht)|0,o=o+Math.imul(B,lt)|0,n=n+Math.imul(O,pt)|0,i=i+Math.imul(O,mt)|0,i=i+Math.imul(P,pt)|0,o=o+Math.imul(P,mt)|0;var Ot=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,ht),i=Math.imul(L,lt),i=i+Math.imul(D,ht)|0,o=Math.imul(D,lt),n=n+Math.imul(N,pt)|0,i=i+Math.imul(N,mt)|0,i=i+Math.imul(B,pt)|0,o=o+Math.imul(B,mt)|0;var Pt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(L,pt),i=Math.imul(L,mt),i=i+Math.imul(D,pt)|0,o=Math.imul(D,mt);var Rt=(c+n|0)+((8191&i)<<13)|0;return c=(o+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=yt,u[1]=vt,u[2]=bt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=At,u[7]=Et,u[8]=xt,u[9]=Mt,u[10]=kt,u[11]=St,u[12]=It,u[13]=Ct,u[14]=Tt,u[15]=Ut,u[16]=Ot,u[17]=Pt,u[18]=Rt,0!==c&&(u[19]=c,r.length++),r};function m(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0,i+=a>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}function y(t,e,r){var n=new v;return n.mulp(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?m(this,t,e):y(this,t,e),r},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=l(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,a=0|i.words[i.length-1],s=this._countBits(a);r=26-s,0!==r&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var u,c=n.length-i.length;if("mod"!==e){u=new o(null),u.length=c+1,u.words=new Array(u.length);for(var f=0;f=0;l--){var d=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,l);while(0!==n.negative)d--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);u&&(u.words[l]=d)}return u&&u.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:u||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;while(e.isEven()&&r.isEven())e.iushrn(1),r.iushrn(1),++c;var f=r.clone(),h=e.clone();while(!e.isZero()){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0){e.iushrn(l);while(l-- >0)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1)}for(var p=0,m=1;0===(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0){r.iushrn(p);while(p-- >0)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1)}e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();var i,a=new o(1),s=new o(0),u=r.clone();while(e.cmpn(1)>0&&r.cmpn(1)>0){for(var c=0,f=1;0===(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0){e.iushrn(c);while(c-- >0)a.isOdd()&&a.iadd(u),a.iushrn(1)}for(var h=0,l=1;0===(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0){r.iushrn(h);while(h-- >0)s.isOdd()&&s.iadd(u),s.iushrn(1)}e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return i=0===e.cmpn(1)?a:s,i.cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);do{while(e.isEven())e.iushrn(1);while(r.isEven())r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}while(1);return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(w,g),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},x.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}var i=this.m.subn(1),a=0;while(!i.isZero()&&0===i.andln(1))a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();f=new o(2*f*f).toRed(this);while(0!==this.pow(f,c).cmp(u))f.redIAdd(u);var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;while(0!==d.cmp(s)){for(var m=d,y=0;0!==m.cmp(s);y++)m=m.redSqr();n(y=0;i--){for(var f=e.words[i],h=c-1;h>=0;h--){var l=f>>h&1;a!==n[0]&&(a=this.sqr(a)),0!==l||0!==s?(s<<=1,s|=l,u++,(u===r||0===i&&0===h)&&(a=this.mul(a,n[s]),u=0,s=0)):u=0}c=26}return a},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,x),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}})(t,this)}).call(this,r("62e4")(t))},"4d64":function(t,e,r){var n=r("fc6a"),i=r("50c4"),o=r("23cb"),a=function(t){return function(e,r,a){var s,u=n(e),c=i(u.length),f=o(a,c);if(t&&r!=r){while(c>f)if(s=u[f++],s!=s)return!0}else for(;c>f;f++)if((t||f in u)&&u[f]===r)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},"4dd0":function(t,e,r){var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,a=r("ae84"),s=r("fda6"),u=r("8707").Buffer;t.exports=function(t,e){var r,c=t.toString(),f=c.match(n);if(f){var h="aes"+f[1],l=u.from(f[2],"hex"),d=u.from(f[3].replace(/[\r\n]/g,""),"base64"),p=a(e,l.slice(0,8),parseInt(f[1],10)).key,m=[],y=s.createDecipheriv(h,p,l);m.push(y.update(d)),m.push(y.final()),r=u.concat(m)}else{var v=c.match(o);r=new u(v[2].replace(/[\r\n]/g,""),"base64")}var b=c.match(i)[1];return{tag:b,data:r}}},"4dec":function(t,e){t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,r){"use strict";function n(){return Math.floor(9e4*Math.random())+1e4}Object.defineProperty(e,"__esModule",{value:!0}),e.sendAsyncWrapper=function(t,e){var r=this;return new Promise((function(i,o){r.sendAsync({jsonrpc:"2.0",id:n(),method:t,params:e||[]},(function(t,e){t?o(t):i(e.result)}))}))},e.sendFortmaticAsyncWrapper=function(t){var e=this;return new Promise((function(r,n){e.getProvider().sendFortmaticAsync(t,(function(t,e){t?n(t):r(e?e.result:{})}))}))},e.randomId=n,e.findExistingResponse=function(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=new v(m);return e.params=[t],a.sendFortmaticAsyncWrapper.call(b,e)}};var v=function t(e,r){(0,i.default)(this,t),this.id=(0,a.randomId)(),this.method=e,this.params=r?[r]:[{}]}},function(t,e,r){"use strict";var n=r(0);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(6)),o=n(r(9)),a=n(r(1)),s=n(r(10)),u=r(11),c=n(r(12)),f=r(2),h=function(){function t(e,r){if((0,a.default)(this,t),this.fortmaticClient=e,this.requests={},this.queue=[],this.account=null,this.network=null,this.isFortmatic=!0,this.overlayReady=!1,this.isLoggedIn=!1,this.postMessages={FORTMATIC_HANDLE_BATCH_REQUEST:"FORTMATIC_HANDLE_BATCH_REQUEST",FORTMATIC_HANDLE_REQUEST:"FORTMATIC_HANDLE_REQUEST",FORTMATIC_HANDLE_FORTMATIC_REQUEST:"FORTMATIC_HANDLE_FORTMATIC_REQUEST",FORTMATIC_HANDLE_RESPONSE:"FORTMATIC_HANDLE_RESPONSE",FORTMATIC_OVERLAY_READY:"FORTMATIC_OVERLAY_READY",FORTMATIC_SHOW_OVERLAY:"FORTMATIC_SHOW_OVERLAY",FORTMATIC_HIDE_OVERLAY:"FORTMATIC_HIDE_OVERLAY",FORTMATIC_USER_DENIED:"FORTMATIC_USER_DENIED",FORTMATIC_USER_LOGOUT:"FORTMATIC_USER_LOGOUT",FORTMATIC_UNAUTHORIZED_API_KEY:"FORTMATIC_UNAUTHORIZED_API_KEY"},!r.API_KEY)throw new Error("Please provide a Fortmatic API key that you acquired from the developer dashboard.");this.options={API_KEY:r.API_KEY,ETH_NETWORK:r.ETH_NETWORK,DOMAIN_ORIGIN:window.location?window.location.origin:"",version:u.version},this.queryParams=btoa(JSON.stringify(this.options)),this.constructPostMessage(),this.overlay=this.createOverlay(),this.listenMessage()}return(0,s.default)(t,[{key:"constructPostMessage",value:function(){var t=this;Object.keys(this.postMessages).map((function(e){t.postMessages[e]+="-".concat(t.queryParams)}))}},{key:"createOverlay",value:function(){var t=this;return new Promise((function(e,r){var n=function(){if(function(){var e=!0,r=!1,n=void 0;try{for(var i,o=document.getElementsByClassName("fortmatic-iframe")[Symbol.iterator]();!(e=(i=o.next()).done);e=!0)if(i.value.src.includes(t.queryParams))return!1}catch(t){r=!0,n=t}finally{try{e||null==o.return||o.return()}finally{if(r)throw n}}return!0}()){var r=document.createElement("style");r.innerHTML=c.default.css,r.type="text/css",document.head.appendChild(r);var n=document.createElement("iframe");n.className="fortmatic-iframe",n.src="".concat(t.fortmaticClient,"/send?params=").concat(t.queryParams),document.body.appendChild(n);var i=document.createElement("img");i.src="https://static.fortmatic.com/assets/trans.gif",document.body.appendChild(i),e({iframe:n})}else console.error("Fortmatic: Duplicate instances found.")};["loaded","interactive","complete"].indexOf(document.readyState)>-1?n():window.addEventListener("load",n.bind(t),!1)}))}},{key:"showOverlay",value:function(){var t=(0,o.default)(i.default.mark((function t(){return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.overlay;case 2:t.sent.iframe.style.display="block";case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"hideOverlay",value:function(){var t=(0,o.default)(i.default.mark((function t(){return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.overlay;case 2:t.sent.iframe.style.display="none";case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"sendAsync",value:function(t,e){t.length>0?this.enqueue({payload:{id:(0,f.randomId)(),batch:t.map((function(t){return t.id=(0,f.randomId)(),t})),method:"eth_batchRequest"},cb:e}):this.enqueue({payload:t,cb:e})}},{key:"sendFortmaticAsync",value:function(t,e){this.enqueue({payload:t,cb:e,isNative:!0})}},{key:"send",value:function(t,e){if("string"==typeof t)return f.sendAsyncWrapper.call(this,t,e);if(!e){console.warn("Non-async web3 methods will be deprecated in web3 > 1.0, and are not supported by the Fortmatic provider. An async method to be used instead."),this.sendAsync(t,(function(){}));var r={};switch(t.method){case"eth_accounts":r=this.account?[this.account]:[];break;case"eth_coinbase":r=this.account;break;case"net_version":r=this.network||(this.options.API_KEY.startsWith("pk_live")?1:4);break;case"eth_uninstallFilter":r=!0;break;default:r={}}return{id:t.id,jsonrpc:t.jsonrpc,result:r}}this.sendAsync(t,e)}},{key:"enqueue",value:function(t){this.queue.push(t),this.overlayReady&&this.dequeue()}},{key:"dequeue",value:function(){var t=(0,o.default)(i.default.mark((function t(){var e,r,n,o=this;return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==this.queue.length){t.next=2;break}return t.abrupt("return");case 2:if(!(e=this.queue.shift())){t.next=11;break}return r=e.payload,n=e.cb,r.id=(0,f.randomId)(),t.next=9,this.postMessage(e.isNative?this.postMessages.FORTMATIC_HANDLE_FORTMATIC_REQUEST:this.postMessages.FORTMATIC_HANDLE_REQUEST,e.payload);case 9:r.batch&&r.batch.length>0?(r.batch.forEach((function(t){o.requests[t.id]={parentId:r.id,payload:t,cb:function(t,e){var n=o.requests[r.id].batchResponse;if(t&&t.response&&!(0,f.findExistingResponse)(n,t.response.id))throw n.push({jsonrpc:"2.0",id:t.response.id,error:{code:t.response.code,message:t.response.message}}),o.requests[r.id].cb(null,n),t.response;if(e&&e.result&&!(0,f.findExistingResponse)(n,e.id))return n.push(e);throw new Error("Fortmatic: unexpected callback behavior")}}})),this.requests[r.id]={payload:r,cb:n,batchResponse:[]}):this.requests[r.id]={payload:r,cb:n},this.dequeue();case 11:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"postMessage",value:function(){var t=(0,o.default)(i.default.mark((function t(e,r){var n;return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.overlay;case 2:if(!(n=t.sent).iframe.contentWindow){t.next=7;break}n.iframe.contentWindow.postMessage({msgType:e,payload:r},"*"),t.next=8;break;case 7:throw new Error("Fortmatic: Modal is not ready.");case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}()},{key:"enable",value:function(){return f.sendAsyncWrapper.call(this,"eth_accounts")}},{key:"listenMessage",value:function(){var t=this;window.addEventListener("message",(function(e){if(e.origin===t.fortmaticClient){var r=e.data.response?e.data.response.id:null;switch(e.data.msgType){case t.postMessages.FORTMATIC_OVERLAY_READY:t.overlayReady=!0,t.dequeue();break;case t.postMessages.FORTMATIC_HANDLE_RESPONSE:try{t.requests[r].cb(null,e.data.response);var n=t.requests[r].parentId;n&&t.requests[n].payload.batch.length===t.requests[n].batchResponse.length&&t.requests[n].cb(null,t.requests[n].batchResponse),"eth_accounts"===t.requests[r].payload.method?t.account=e.data.response.result[0]:"eth_coinbase"===t.requests[r].payload.method?t.account=e.data.response.result:"net_version"===t.requests[r].payload.method&&(t.network=e.data.response.result)}catch(t){}t.isLoggedIn=!0,t.dequeue();break;case t.postMessages.FORTMATIC_HIDE_OVERLAY:t.hideOverlay();break;case t.postMessages.FORTMATIC_SHOW_OVERLAY:t.showOverlay();break;case t.postMessages.FORTMATIC_USER_LOGOUT:t.account=null,t.network=null,t.isLoggedIn=!1;break;case t.postMessages.FORTMATIC_UNAUTHORIZED_API_KEY:throw t.overlayReady=!1,new Error("Given API key is not authorized to access the resource.");case t.postMessages.FORTMATIC_USER_DENIED:if(r){var i=e.data.response&&e.data.response.message?e.data.response.message:"Fortmatic: Modal was closed without executing action!",o=e.data.response&&e.data.response.code?e.data.response.code:1;t.requests[r].cb({message:i,code:o,response:e.data.response})}else t.queue.forEach((function(t){return t.cb({message:"Fortmatic: Modal was closed without executing action!",code:1})}));t.dequeue()}}}))}}]),t}();e.default=h},function(t,e,r){t.exports=r(7)},function(t,e,r){var n=function(){return this||"object"==typeof self&&self}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,o=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(8),i)n.regeneratorRuntime=o;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";var r,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag",c="object"==typeof t,f=e.regeneratorRuntime;if(f)c&&(t.exports=f);else{(f=e.regeneratorRuntime=c?t.exports:{}).wrap=w;var h="suspendedStart",l="suspendedYield",d="executing",p="completed",m={},y={};y[a]=function(){return this};var v=Object.getPrototypeOf,b=v&&v(v(U([])));b&&b!==n&&i.call(b,a)&&(y=b);var g=x.prototype=A.prototype=Object.create(y);E.prototype=g.constructor=x,x.constructor=E,x[u]=E.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===E||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(g),t},f.awrap=function(t){return{__await:t}},M(k.prototype),k.prototype[s]=function(){return this},f.AsyncIterator=k,f.async=function(t,e,r,n){var i=new k(w(t,e,r,n));return f.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},M(g),g[u]="Generator",g[a]=function(){return this},g.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=U,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(C),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return s.type="throw",s.arg=t,e.next=n,i&&(e.method="next",e.arg=r),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:U(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),m}}}function w(t,e,r,n){var i=e&&e.prototype instanceof A?e:A,o=Object.create(i.prototype),a=new T(n||[]);return o._invoke=function(t,e,r){var n=h;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=S(a,r);if(s){if(s===m)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=_(t,e,r);if("normal"===u.type){if(n=r.done?p:l,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(t,r,a),o}function _(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function A(){}function E(){}function x(){}function M(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function k(t){var e;this._invoke=function(r,n){function o(){return new Promise((function(e,o){!function e(r,n,o,a){var s=_(t[r],t,n);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&i.call(c,"__await")?Promise.resolve(c.__await).then((function(t){e("next",t,o,a)}),(function(t){e("throw",t,o,a)})):Promise.resolve(c).then((function(t){u.value=t,o(u)}),(function(t){return e("throw",t,o,a)}))}a(s.arg)}(r,n,e,o)}))}return e=e?e.then(o,o):o()}}function S(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,S(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=_(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function U(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n (https://fortmatic.com/)",license:"MIT",repository:{type:"git",url:"https://github.com/fortmatic/fortmatic-js"},keywords:["Auth","Login","Web3","Crypto","Ethereum","MetaMask","Wallet","Blockchain","Dapp"],homepage:"https://www.fortmatic.com",ava:{require:["@babel/register"],files:["test/**/*.spec.js"],babel:{testOptions:{presets:["@babel/env"],plugins:["@babel/plugin-proposal-function-bind","@babel/plugin-transform-runtime"]}},verbose:!0},nyc:{all:!1,"check-coverage":!0,"per-file":!0,lines:80,statements:80,functions:80,branches:80,include:["src/**/*.js"],exclude:["*/style.js"],require:[],reporter:["html","lcov"]},dependencies:{"@babel/runtime":"7.3.4"},devDependencies:{"@babel/core":"7.3.4","@babel/plugin-proposal-function-bind":"7.2.0","@babel/plugin-transform-modules-commonjs":"7.2.0","@babel/plugin-transform-runtime":"7.3.4","@babel/preset-env":"7.3.4","@babel/register":"7.0.0",ava:"2.2.0","babel-eslint":"10.0.1","babel-loader":"8.0.5",eslint:"5.9.0",lodash:"4.17.11",nyc:"13.1.0",sinon:"7.1.1",webpack:"4.26.1","webpack-cli":"3.1.2"}}},function(t,e,r){"use strict";e.css="\n .fortmatic-iframe {\n display: none;\n position: fixed;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n border: none;\n border-radius: 0;\n z-index: 2147483647;\n }\n"}])},"4e2b":function(t,e,r){"use strict";var n=r("da3e"),i=r("3fb5"),o=r("5ee7"),a=r("0184");function s(){this.tmp=new Array(2),this.keys=null}function u(t){a.call(this,t);var e=new s;this._desState=e,this.deriveKeys(e,t.key)}i(u,a),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),n.equal(e.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(e,0),i=o.readUInt32BE(e,4);o.pc1(r,i,t.tmp,0),r=t.tmp[0],i=t.tmp[1];for(var a=0;a>>1];r=o.r28shl(r,s),i=o.r28shl(i,s),o.pc2(r,i,t.keys,a)}},u.prototype._update=function(t,e,r,n){var i=this._desState,a=o.readUInt32BE(t,e),s=o.readUInt32BE(t,e+4);o.ip(a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,s,i.tmp,0):this._decrypt(i,a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],o.writeUInt32BE(r,a,n),o.writeUInt32BE(r,s,n+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,a=d}o.rip(s,a,n,i)},u.prototype._decrypt=function(t,e,r,n,i){for(var a=r,s=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],f=t.keys[u+1];o.expand(a,t.tmp,0),c^=t.tmp[0],f^=t.tmp[1];var h=o.substitute(c,f),l=o.permute(h),d=a;a=(s^l)>>>0,s=d}o.rip(a,s,n,i)}},"4e33":function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e["default"]=t,e};Object.defineProperty(e,"__esModule",{value:!0});var o=r("cd08"),a=r("5384"),s=r("948b"),u=r("2a61"),c=r("4348"),f=i(r("4f1b")),h=new RegExp(/^bytes([0-9]*)$/),l=new RegExp(/^(u?int)([0-9]*)$/),d=new RegExp(/^(.*)\[([0-9]*)\]$/);e.defaultCoerceFunc=function(t,e){var r=t.match(l);return r&&parseInt(r[2])<=48?e.toNumber():e};var p=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),m=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function y(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}function v(t,e){function r(e){throw new Error('unexpected character "'+t[e]+'" at position '+e+' in "'+t+'"')}for(var n={type:"",name:"",state:{allowType:!0}},i=n,o=0;o1){var i=r[1].match(p);if(""!=i[1].trim()||""!=i[3].trim())throw new Error("unexpected tokens");q(i[2]).forEach((function(t){e.outputs.push(v(t))}))}return e}function w(t){return v(t,!0)}function _(t){return K(e.defaultCoerceFunc,t).type}function A(t){return t.name+"("+t.inputs.map((function(t){return _(t)})).join(",")+")"}function E(t){if("string"===typeof t)return t=t.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),t=t.trim(),"event "===t.substring(0,6)?b(t.substring(6).trim()):("function "===t.substring(0,9)&&(t=t.substring(9)),g(t.trim()));throw new Error("unknown signature")}e.parseParamType=w,e.formatParamType=_,e.formatSignature=A,e.parseSignature=E;var x=function(){function t(t,e,r,n,i){this.coerceFunc=t,this.name=e,this.type=r,this.localName=n,this.dynamic=i}return t}(),M=function(t){function e(e){var r=t.call(this,e.coerceFunc,e.name,e.type,void 0,e.dynamic)||this;return c.defineReadOnly(r,"coder",e),r}return n(e,t),e.prototype.encode=function(t){return this.coder.encode(t)},e.prototype.decode=function(t,e){return this.coder.decode(t,e)},e}(x),k=function(t){function e(e,r){return t.call(this,e,"null","",r,!1)||this}return n(e,t),e.prototype.encode=function(t){return s.arrayify([])},e.prototype.decode=function(t,e){if(e>t.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},e}(x),S=function(t){function e(e,r,n,i){var o=this,a=(n?"int":"uint")+8*r;return o=t.call(this,e,a,a,i,!1)||this,o.size=r,o.signed=n,o}return n(e,t),e.prototype.encode=function(t){try{var e=a.bigNumberify(t);return e=e.toTwos(8*this.size).maskn(8*this.size),this.signed&&(e=e.fromTwos(8*this.size).toTwos(256)),s.padZeros(s.arrayify(e),32)}catch(r){f.throwError("invalid number value",f.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t})}return null},e.prototype.decode=function(t,e){t.length32)throw new Error;e.set(r)}catch(n){f.throwError("invalid "+this.name+" value",f.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:n.value||t})}return e},e.prototype.decode=function(t,e){return t.length=0?n:"")+"]",s=-1===n||r.dynamic;return o=t.call(this,e,"array",a,i,s)||this,o.coder=r,o.length=n,o}return n(e,t),e.prototype.encode=function(t){Array.isArray(t)||f.throwError("expected array value",f.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t});var e=this.length,r=new Uint8Array(0);-1===e&&(e=t.length,r=I.encode(e)),f.checkArgumentCount(e,t.length,"in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;i256||i%8!==0)&&f.throwError("invalid "+n[1]+" bit length",f.INVALID_ARGUMENT,{arg:"param",value:e}),new S(t,i/8,"int"===n[1],e.name)}n=e.type.match(h);if(n){i=parseInt(n[1]);return(0===i||i>32)&&f.throwError("invalid bytes length",f.INVALID_ARGUMENT,{arg:"param",value:e}),new T(t,i,e.name)}n=e.type.match(d);if(n){i=parseInt(n[2]||"-1");return e=c.jsonCopy(e),e.type=n[1],new D(t,K(t,e),i,e.name)}return"tuple"===e.type.substring(0,5)?z(t,e.components,e.name):""===e.type?new k(t,e.name):(f.throwError("invalid type",f.INVALID_ARGUMENT,{arg:"type",value:e.type}),null)}var V=function(){function t(r){f.checkNew(this,t),r||(r=e.defaultCoerceFunc),c.defineReadOnly(this,"coerceFunc",r)}return t.prototype.encode=function(t,e){t.length!==e.length&&f.throwError("types/values length mismatch",f.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});var r=[];return t.forEach((function(t){var e=null;e="string"===typeof t?v(t):t,r.push(K(this.coerceFunc,e))}),this),s.hexlify(new F(this.coerceFunc,r,"_").encode(e))},t.prototype.decode=function(t,e){var r=[];return t.forEach((function(t){var e=null;e="string"===typeof t?v(t):c.jsonCopy(t),r.push(K(this.coerceFunc,e))}),this),new F(this.coerceFunc,r,"_").decode(s.arrayify(e),0).value},t}();e.AbiCoder=V,e.defaultAbiCoder=new V},"4f1b":function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.MISSING_NEW="MISSING_NEW",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.NUMERIC_FAULT="NUMERIC_FAULT",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION";var n=!1,i=!1;function o(t,r,n){if(i)throw new Error("unknown error");r||(r=e.UNKNOWN_ERROR),n||(n={});var o=[];Object.keys(n).forEach((function(t){try{o.push(t+"="+JSON.stringify(n[t]))}catch(s){o.push(t+"="+JSON.stringify(n[t].toString()))}}));var a=t;o.length&&(t+=" ("+o.join(", ")+")");var s=new Error(t);throw s.reason=a,s.code=r,Object.keys(n).forEach((function(t){s[t]=n[t]})),s}function a(t,r){t instanceof r||o("missing new",e.MISSING_NEW,{name:r.name})}function s(t,r,n){n||(n=""),tr&&o("too many arguments"+n,e.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}function u(t,r){n&&o("error censorship permanent",e.UNSUPPORTED_OPERATION,{operation:"setCersorship"}),i=!!t,n=!!r}e.throwError=o,e.checkNew=a,e.checkArgumentCount=s,e.setCensorship=u},"4fcc":function(t,e,r){var n=r("eec7"),i=r("0ed4"),o=function(){};function a(t,e){delete t.uri;var r=!1;"json"===t.responseType&&(t.responseType="text",r=!0);var a=n(t,(function(n,a,s){if(r&&!n)try{var u=a.rawRequest.responseText;s=JSON.parse(u)}catch(c){n=c}a=i(t,a),e(n,n?null:s,a),e=o})),s=a.onabort;return a.onabort=function(){var t=s.apply(a,Array.prototype.slice.call(arguments));return e(new Error("XHR Aborted")),e=o,t},a}t.exports=a},"4fd1":function(t,e,r){var n=r("3fb5"),i=r("b672"),o=r("8707").Buffer,a=[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],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function c(t,e,r){return r^t&(e^r)}function f(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 d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function v(t,e){return t>>>0>>0?1:0}n(u,i),u.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},u.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,s=0|this._eh,u=0|this._fh,b=0|this._gh,g=0|this._hh,w=0|this._al,_=0|this._bl,A=0|this._cl,E=0|this._dl,x=0|this._el,M=0|this._fl,k=0|this._gl,S=0|this._hl,I=0;I<32;I+=2)e[I]=t.readInt32BE(4*I),e[I+1]=t.readInt32BE(4*I+4);for(;I<160;I+=2){var C=e[I-30],T=e[I-30+1],U=d(C,T),O=p(T,C);C=e[I-4],T=e[I-4+1];var P=m(C,T),R=y(T,C),N=e[I-14],B=e[I-14+1],j=e[I-32],L=e[I-32+1],D=O+B|0,F=U+N+v(D,O)|0;D=D+R|0,F=F+P+v(D,R)|0,D=D+L|0,F=F+j+v(D,L)|0,e[I]=F,e[I+1]=D}for(var q=0;q<160;q+=2){F=e[q],D=e[q+1];var H=f(r,n,i),z=f(w,_,A),K=h(r,w),V=h(w,r),G=l(s,x),$=l(x,s),Y=a[q],W=a[q+1],Z=c(s,u,b),J=c(x,M,k),X=S+$|0,Q=g+G+v(X,S)|0;X=X+J|0,Q=Q+Z+v(X,J)|0,X=X+W|0,Q=Q+Y+v(X,W)|0,X=X+D|0,Q=Q+F+v(X,D)|0;var tt=V+z|0,et=K+H+v(tt,V)|0;g=b,S=k,b=u,k=M,u=s,M=x,x=E+X|0,s=o+Q+v(x,E)|0,o=i,E=A,i=n,A=_,n=r,_=w,w=X+tt|0,r=Q+et+v(w,X)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+A|0,this._dl=this._dl+E|0,this._el=this._el+x|0,this._fl=this._fl+M|0,this._gl=this._gl+k|0,this._hl=this._hl+S|0,this._ah=this._ah+r+v(this._al,w)|0,this._bh=this._bh+n+v(this._bl,_)|0,this._ch=this._ch+i+v(this._cl,A)|0,this._dh=this._dh+o+v(this._dl,E)|0,this._eh=this._eh+s+v(this._el,x)|0,this._fh=this._fh+u+v(this._fl,M)|0,this._gh=this._gh+b+v(this._gl,k)|0,this._hh=this._hh+g+v(this._hl,S)|0},u.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},t.exports=u},"509b":function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r("1c55");function i(t){return"0x"+n.keccak_256(a(t))}function o(t){let e=[];for(let r=0;r>>4).toString(16)),e.push((15&t[r]).toString(16));return`0x${e.join("").replace(/^0+/,"")}`}function a(t){if(null==t)throw new Error("cannot convert null value to array");if("string"===typeof t){let e=t.match(/^(0x)?[0-9a-fA-F]*$/);if(!e)throw new Error("invalid hexidecimal string");if("0x"!==e[1])throw new Error("hex string must have 0x prefix");t=t.substring(2),t.length%2&&(t="0"+t);const r=[];for(let n=0;n=256||parseInt(String(r))!=r)return!1}return!0}function u(t){return t.slice?t:(t.slice=function(){const e=Array.prototype.slice.call(arguments);return u(new Uint8Array(Array.prototype.slice.apply(t,e)))},t)}e.keccak256=i,e.padLeft=(t,e)=>{const r=/^0x/i.test(t)||"number"===typeof t;t=t.toString().replace(/^0x/i,"");const n=e-t.length+1>=0?e-t.length+1:0;return(r?"0x":"")+new Array(n).join("0")+t},e.bytesToHex=o,e.toByteArray=a},"50c4":function(t,e,r){var n=r("a691"),i=Math.min;t.exports=function(t){return t>0?i(n(t),9007199254740991):0}},5135:function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},5146:function(t,e,r){"use strict";var n=r("17fb"),i=r("33fb"),o=function t(e){this.givenProvider=t.givenProvider,e&&e._requestManager&&(e=e.currentProvider),"undefined"!==typeof document&&(this.pick=i.pick),this.setProvider(e)};o.givenProvider=null,"undefined"!==typeof ethereumProvider&ðereumProvider.bzz&&(o.givenProvider=ethereumProvider.bzz),o.prototype.setProvider=function(t){if(n.isObject(t)&&n.isString(t.bzz)&&(t=t.bzz),!n.isString(t)){this.currentProvider=null;var e=new Error("No provider set, please set one using bzz.setProvider().");return this.download=this.upload=this.isAvailable=function(){throw e},!1}return this.currentProvider=t,this.download=i.at(t).download,this.upload=i.at(t).upload,this.isAvailable=i.at(t).isAvailable,!0},t.exports=o},5162:function(t,e){t.exports=function(t){if("string"!==typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},5165:function(t,e,r){(function(t){var n=r("8c8a");function i(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(e,r){while(e._cache.length>s%8,t._prev=o(t._prev,r?i:a);return c}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);t=n.concat([t,n.from([e])]);while(++i>7;return o}e.encrypt=function(t,e,r){var o=e.length,a=n.allocUnsafe(o),s=-1;while(++s3600)throw new Error("Network not synced; last block was "+r+" seconds ago");return t.eth.net.getNetworkType()})).then((function(t){var e=n.addresses[t];if("undefined"===typeof e)throw new Error("ENS is not supported on network "+t);return e}))},t.exports=a},5384:function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e["default"]=t,e};Object.defineProperty(e,"__esModule",{value:!0});var a=i(r("399f")),s=r("948b"),u=r("4348"),c=r("31d3"),f=o(r("4f1b")),h=new a.default.BN(-1);function l(t){var e=t.toString(16);return"-"===e[0]?e.length%2===0?"-0x0"+e.substring(1):"-0x"+e.substring(1):e.length%2===1?"0x0"+e:"0x"+e}function d(t){return y(t)._bn}function p(t){return new m(l(t))}var m=function(t){function e(r){var n=t.call(this)||this;if(f.checkNew(n,e),"string"===typeof r)s.isHexString(r)?("0x"==r&&(r="0x0"),u.defineReadOnly(n,"_hex",r)):"-"===r[0]&&s.isHexString(r.substring(1))?u.defineReadOnly(n,"_hex",r):r.match(/^-?[0-9]*$/)?(""==r&&(r="0"),u.defineReadOnly(n,"_hex",l(new a.default.BN(r)))):f.throwError("invalid BigNumber string value",f.INVALID_ARGUMENT,{arg:"value",value:r});else if("number"===typeof r){parseInt(String(r))!==r&&f.throwError("underflow",f.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:r,outputValue:parseInt(String(r))});try{u.defineReadOnly(n,"_hex",l(new a.default.BN(r)))}catch(i){f.throwError("overflow",f.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:i.message})}}else r instanceof e?u.defineReadOnly(n,"_hex",r._hex):r.toHexString?u.defineReadOnly(n,"_hex",l(d(r.toHexString()))):s.isArrayish(r)?u.defineReadOnly(n,"_hex",l(new a.default.BN(s.hexlify(r).substring(2),16))):f.throwError("invalid BigNumber value",f.INVALID_ARGUMENT,{arg:"value",value:r});return n}return n(e,t),Object.defineProperty(e.prototype,"_bn",{get:function(){return"-"===this._hex[0]?new a.default.BN(this._hex.substring(3),16).mul(h):new a.default.BN(this._hex.substring(2),16)},enumerable:!0,configurable:!0}),e.prototype.fromTwos=function(t){return p(this._bn.fromTwos(t))},e.prototype.toTwos=function(t){return p(this._bn.toTwos(t))},e.prototype.add=function(t){return p(this._bn.add(d(t)))},e.prototype.sub=function(t){return p(this._bn.sub(d(t)))},e.prototype.div=function(t){var e=y(t);return e.isZero()&&f.throwError("division by zero",f.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),p(this._bn.div(d(t)))},e.prototype.mul=function(t){return p(this._bn.mul(d(t)))},e.prototype.mod=function(t){return p(this._bn.mod(d(t)))},e.prototype.pow=function(t){return p(this._bn.pow(d(t)))},e.prototype.maskn=function(t){return p(this._bn.maskn(t))},e.prototype.eq=function(t){return this._bn.eq(d(t))},e.prototype.lt=function(t){return this._bn.lt(d(t))},e.prototype.lte=function(t){return this._bn.lte(d(t))},e.prototype.gt=function(t){return this._bn.gt(d(t))},e.prototype.gte=function(t){return this._bn.gte(d(t))},e.prototype.isZero=function(){return this._bn.isZero()},e.prototype.toNumber=function(){try{return this._bn.toNumber()}catch(t){f.throwError("overflow",f.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},e.prototype.toString=function(){return this._bn.toString(10)},e.prototype.toHexString=function(){return this._hex},e}(c.BigNumber);function y(t){return t instanceof m?t:new m(t)}e.bigNumberify=y,e.ConstantNegativeOne=y(-1),e.ConstantZero=y(0),e.ConstantOne=y(1),e.ConstantTwo=y(2),e.ConstantWeiPerEther=y("1000000000000000000")},"53a8":function(t,e){t.exports=n;var r=Object.prototype.hasOwnProperty;function n(){for(var t={},e=0;et)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(c),e.cmp(c)){if(!e.cmp(f))while(r.mod(h).cmp(l))r.iadd(p)}else while(r.mod(o).cmp(d))r.iadd(p);if(a=r.shrn(1),v(a)&&v(r)&&b(a)&&b(r)&&s.test(a)&&s.test(r))return r}}},"58ab":function(t,e,r){"use strict";var n=r("636c"),i=r("39d4").errors,o=function(t){this.requestManager=t,this.requests=[]};o.prototype.add=function(t){this.requests.push(t)},o.prototype.execute=function(){var t=this.requests;this.requestManager.sendBatch(t,(function(e,r){r=r||[],t.map((function(t,e){return r[e]||{}})).forEach((function(r,o){if(t[o].callback){if(r&&r.error)return t[o].callback(i.ErrorResponse(r));if(!n.isValidResponse(r))return t[o].callback(i.InvalidResponse(r));try{t[o].callback(null,t[o].format?t[o].format(r.result):r.result)}catch(e){t[o].callback(e)}}}))}))},t.exports=o},5919:function(t,e,r){"use strict";e.sha1=r("13e2"),e.sha224=r("07f2"),e.sha256=r("6eed"),e.sha384=r("8b95"),e.sha512=r("b525")},"5a76":function(t,e,r){var n=r("f576");t.exports=function(t){return(new n).update(t).digest()}},"5c6c":function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},"5e1a":function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=r("8707").Buffer,o=r(3);function a(t,e,r){t.copy(e,r)}t.exports=function(){function t(){n(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=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}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";var e=this.head,r=""+e.data;while(e=e.next)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;var e=i.allocUnsafe(t>>>0),r=this.head,n=0;while(r)a(r.data,e,n),n+=r.data.length,r=r.next;return e},t}(),o&&o.inspect&&o.inspect.custom&&(t.exports.prototype[o.inspect.custom]=function(){var t=o.inspect({length:this.length});return this.constructor.name+" "+t})},"5e89":function(t,e,r){"use strict";var n={addresses:{main:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",ropsten:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",rinkeby:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",goerli:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"}};t.exports=n},"5ee3":function(t,e,r){var n;try{n=r("6787")}catch(s){}finally{if(n||"undefined"===typeof window||(n=window),!n)throw new Error("Could not determine global this")}var i=n.WebSocket||n.MozWebSocket,o=r("7b6b");function a(t,e){var r;return r=e?new i(t,e):new i(t),r}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(t){Object.defineProperty(a,t,{get:function(){return i[t]}})})),t.exports={w3cwebsocket:i?a:null,version:o}},"5ee7":function(t,e,r){"use strict";e.readUInt32BE=function(t,e){var r=t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e];return r>>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,n){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},e.rip=function(t,e,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.pc1=function(t,e,r,n){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,i){for(var o=0,a=0,s=n.length>>>1,u=0;u>>n[u]&1;for(u=s;u>>n[u]&1;r[i+0]=o>>>0,r[i+1]=a>>>0},e.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,n=0;n<4;n++){var o=t>>>18-6*n&63,a=i[64*n+o];r<<=4,r|=a}for(n=0;n<4;n++){o=e>>>18-6*n&63,a=i[256+64*n+o];r<<=4,r|=a}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r>>o[r]&1;return e>>>0},e.padSplit=function(t,e,r){var n=t.toString(2);while(n.lengthf){var d,p=c(arguments[f++]),m=h?o(p).concat(h(p)):o(p),y=m.length,v=0;while(y>v)d=m[v++],n&&!l.call(p,d)||(r[d]=p[d])}return r}:f},6238:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("1037"),i=r("948b");function o(t){return"0x"+n.keccak_256(i.arrayify(t))}e.keccak256=o},6248:function(t,e,r){"use strict";var n=r("17fb"),i=r("39d4").errors,o=r("39d4").formatters,a=r("1131"),s=r("5562"),u=r("4923").subscriptions,c=function(t){if(!t.call||!t.name)throw new Error('When creating a method you need to provide at least the "name" and "call" property.');this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter,this.transformPayload=t.transformPayload,this.extraFormatters=t.extraFormatters,this.abiCoder=t.abiCoder,this.requestManager=t.requestManager,this.accounts=t.accounts,this.defaultBlock=t.defaultBlock||"latest",this.defaultAccount=t.defaultAccount||null,this.transactionBlockTimeout=t.transactionBlockTimeout||50,this.transactionConfirmationBlocks=t.transactionConfirmationBlocks||24,this.transactionPollingTimeout=t.transactionPollingTimeout||750,this.defaultCommon=t.defaultCommon,this.defaultChain=t.defaultChain,this.defaultHardfork=t.defaultHardfork,this.handleRevert=t.handleRevert};c.prototype.setRequestManager=function(t,e){this.requestManager=t,e&&(this.accounts=e)},c.prototype.createFunction=function(t,e){var r=this.buildCall();return r.call=this.call,this.setRequestManager(t||this.requestManager,e||this.accounts),r},c.prototype.attachToObject=function(t){var e=this.buildCall();e.call=this.call;var r=this.name.split(".");r.length>1?(t[r[0]]=t[r[0]]||{},t[r[0]][r[1]]=e):t[r[0]]=e},c.prototype.getCall=function(t){return n.isFunction(this.call)?this.call(t):this.call},c.prototype.extractCallback=function(t){if(n.isFunction(t[t.length-1]))return t.pop()},c.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams(t.length,this.params,this.name)},c.prototype.formatInput=function(t){var e=this;return this.inputFormatter?this.inputFormatter.map((function(r,n){return r?r.call(e,t[n]):t[n]})):t},c.prototype.formatOutput=function(t){var e=this;return n.isArray(t)?t.map((function(t){return e.outputFormatter&&t?e.outputFormatter(t):t})):this.outputFormatter&&t?this.outputFormatter(t):t},c.prototype.toPayload=function(t){var e=this.getCall(t),r=this.extractCallback(t),n=this.formatInput(t);this.validateArgs(n);var i={method:e,params:n,callback:r};return this.transformPayload&&(i=this.transformPayload(i)),i},c.prototype._confirmTransaction=function(t,e,r){var f=this,h=!1,l=!0,d=0,p=0,m=null,y=null,v=n.isObject(r.params[0])&&r.params[0].gas?r.params[0].gas:null,b=n.isObject(r.params[0])&&r.params[0].data&&r.params[0].from&&!r.params[0].to,g=b&&r.params[0].data.length>2,w=[new c({name:"getBlockByNumber",call:"eth_getBlockByNumber",params:2,inputFormatter:[o.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:o.outputBlockFormatter}),new c({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,inputFormatter:[null],outputFormatter:o.outputTransactionReceiptFormatter}),new c({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[o.inputAddressFormatter,o.inputDefaultBlockNumberFormatter]}),new u({name:"subscribe",type:"eth",subscriptions:{newBlockHeaders:{subscriptionName:"newHeads",params:0,outputFormatter:o.outputBlockFormatter}}})],_={};n.each(w,(function(t){t.attachToObject(_),t.requestManager=f.requestManager}));var A=function(n,o,u,c,w){if(!u)return w||(w={unsubscribe:function(){clearInterval(m)}}),(n?s.resolve(n):_.getTransactionReceipt(e)).catch((function(e){w.unsubscribe(),h=!0,a._fireError({message:"Failed to check for transaction receipt:",data:e},t.eventEmitter,t.reject)})).then((async function(e){if(!e||!e.blockHash)throw new Error("Receipt missing or blockHash null");var r;(f.extraFormatters&&f.extraFormatters.receiptFormatter&&(e=f.extraFormatters.receiptFormatter(e)),t.eventEmitter.listeners("confirmation").length>0)&&(void 0!==n&&0===p||(o?y?(r=await _.getBlockByNumber(y.number+1),r&&(y=r,t.eventEmitter.emit("confirmation",p,e))):(r=await _.getBlockByNumber(e.blockNumber),y=r,t.eventEmitter.emit("confirmation",p,e)):t.eventEmitter.emit("confirmation",p,e)),(o&&r||!o)&&p++,l=!1,p===f.transactionConfirmationBlocks+1&&(w.unsubscribe(),t.eventEmitter.removeAllListeners()));return e})).then((async function(e){if(b&&!h){if(!e.contractAddress)return l&&(w.unsubscribe(),h=!0),void a._fireError(i.NoContractAddressFoundError(e),t.eventEmitter,t.reject,null,e);var r;try{r=await _.getCode(e.contractAddress)}catch(u){}if(!r)return;var n=!0===e.status&&g;n||r.length>2?(t.eventEmitter.emit("receipt",e),f.extraFormatters&&f.extraFormatters.contractDeployFormatter?t.resolve(f.extraFormatters.contractDeployFormatter(e)):t.resolve(e),l&&t.eventEmitter.removeAllListeners()):a._fireError(i.ContractCodeNotStoredError(e),t.eventEmitter,t.reject,null,e),l&&w.unsubscribe(),h=!0}return e})).then((async function(e){if(!b&&!h){if(e.outOfGas||v&&v===e.gasUsed||!0!==e.status&&"0x1"!==e.status&&"undefined"!==typeof e.status)if(JSON.stringify(e,null,2),!1===e.status||"0x0"===e.status)try{var n=null;if(!f.handleRevert||"eth_sendTransaction"!==f.call)throw!1;if(n=await f.getRevertReason(r.params[0],e.blockNumber),!n)throw!1;a._fireError(i.TransactionRevertInstructionError(n.reason,n.signature,e),t.eventEmitter,t.reject,null,e)}catch(o){a._fireError(i.TransactionRevertedWithoutReasonError(e),t.eventEmitter,t.reject,null,e)}else a._fireError(i.TransactionOutOfGasError(e),t.eventEmitter,t.reject,null,e);else t.eventEmitter.emit("receipt",e),t.resolve(e),l&&t.eventEmitter.removeAllListeners();l&&w.unsubscribe(),h=!0}})).catch((function(){d++,o?d-1>=f.transactionPollingTimeout&&(w.unsubscribe(),h=!0,a._fireError(i.TransactionError("Transaction was not mined within "+f.transactionPollingTimeout+" seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!"),t.eventEmitter,t.reject)):d-1>=f.transactionBlockTimeout&&(w.unsubscribe(),h=!0,a._fireError(i.TransactionError("Transaction was not mined within "+f.transactionBlockTimeout+" blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!"),t.eventEmitter,t.reject))}));w.unsubscribe(),h=!0,a._fireError({message:"Failed to subscribe to new newBlockHeaders to confirm the transaction receipts.",data:u},t.eventEmitter,t.reject)},E=function(t){n.isFunction(this.requestManager.provider.on)?_.subscribe("newBlockHeaders",A.bind(null,t,!1)):m=setInterval(A.bind(null,t,!0),1e3)}.bind(this);_.getTransactionReceipt(e).then((function(e){e&&e.blockHash?(t.eventEmitter.listeners("confirmation").length>0&&E(e),A(e,!1)):h||E()})).catch((function(){h||E()}))};var f=function(t,e){var r=null;return r=n.isNumber(t)?e.wallet[t]:n.isObject(t)&&t.address&&t.privateKey?t:e.wallet[t.toLowerCase()],r};c.prototype.buildCall=function(){var t=this,e="eth_sendTransaction"===t.call||"eth_sendRawTransaction"===t.call,r="eth_call"===t.call,o=function(){var o=s(!e),u=t.toPayload(Array.prototype.slice.call(arguments)),h=function(n,s){if(t.handleRevert&&!n&&r&&t.isRevertReasonString(s)&&t.abiCoder){var c=t.abiCoder.decodeParameter("string","0x"+s.substring(10)),f="Error(String)";a._fireError(i.RevertInstructionError(c,f),o.eventEmitter,o.reject,u.callback,{reason:c,signature:f})}else{try{s=t.formatOutput(s)}catch(h){n=h}if(s instanceof Error&&(n=s),n)return n.error&&(n=n.error),a._fireError(n,o.eventEmitter,o.reject,u.callback);u.callback&&u.callback(null,s),e?(o.eventEmitter.emit("transactionHash",s),t._confirmTransaction(o,s,u)):n||o.resolve(s)}},l=function(e){var r=n.extend({},u,{method:"eth_sendRawTransaction",params:[e.rawTransaction]});t.requestManager.send(r,h)},d=function(t,e){var r;if(e&&e.accounts&&e.accounts.wallet&&e.accounts.wallet.length)if("eth_sendTransaction"===t.method){var i=t.params[0];if(r=f(n.isObject(i)?i.from:null,e.accounts),r&&r.privateKey){var a=n.omit(i,"from");return e.defaultChain&&!a.chain&&(a.chain=e.defaultChain),e.defaultHardfork&&!a.hardfork&&(a.hardfork=e.defaultHardfork),e.defaultCommon&&!a.common&&(a.common=e.defaultCommon),e.accounts.signTransaction(a,r.privateKey).then(l).catch((function(t){n.isFunction(o.eventEmitter.listeners)&&o.eventEmitter.listeners("error").length&&(o.eventEmitter.emit("error",t),o.eventEmitter.removeAllListeners(),o.eventEmitter.catch((function(){}))),o.reject(t)}))}}else if("eth_sign"===t.method){var s=t.params[1];if(r=f(t.params[0],e.accounts),r&&r.privateKey){var u=e.accounts.sign(s,r.privateKey);return t.callback&&t.callback(null,u.signature),void o.resolve(u.signature)}}return e.requestManager.send(t,h)};if(e&&n.isObject(u.params[0])&&"undefined"===typeof u.params[0].gasPrice){var p=new c({name:"getGasPrice",call:"eth_gasPrice",params:0}).createFunction(t.requestManager);p((function(e,r){r&&(u.params[0].gasPrice=r),d(u,t)}))}else d(u,t);return o.eventEmitter};return o.method=t,o.request=this.request.bind(this),o},c.prototype.getRevertReason=function(t,e){var r=this;return new Promise((function(n,i){new c({name:"call",call:"eth_call",params:2,abiCoder:r.abiCoder,handleRevert:!0}).createFunction(r.requestManager)(t,a.numberToHex(e)).then((function(){n(!1)})).catch((function(t){t.reason?n({reason:t.reason,signature:t.signature}):i(t)}))}))},c.prototype.isRevertReasonString=function(t){return n.isString(t)&&(t.length-2)/2%32===4&&"0x08c379a0"===t.substring(0,10)},c.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},t.exports=c},6283:function(t,e,r){var n=r("3fb5"),i=r("41df").Reporter,o=r("b639").Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof s||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"===typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"===typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}n(a,i),e.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){var e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=s,s.prototype.join=function(t,e){return t||(t=new o(this.length)),e||(e=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"===typeof this.value?t[e]=this.value:"string"===typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length),t)}},"62c9":function(t,e,r){var n=r("8707").Buffer;function i(t,e,r){var i=t._cipher.encryptBlock(t._prev),o=i[0]^e;return t._prev=n.concat([t._prev.slice(1),n.from([r?e:o])]),o}e.encrypt=function(t,e,r){var o=e.length,a=n.allocUnsafe(o),s=-1;while(++s"0x"+t.toString("hex"),a=t=>new n(t.slice(2),16),s=t=>{const e="0x"+("0x"===t.slice(0,2)?new n(t.slice(2),16):new n(t,10)).toString("hex");return"0x0"===e?"0x":e},u=t=>l(v(t,s("10000000000")))/1e8,c=t=>y(h(Math.floor(1e8*t)),s("10000000000")),f=t=>a(t).toString(10),h=t=>"string"===typeof t?/^0x/.test(t)?t:"0x"+t:"0x"+new n(t).toString("hex"),l=t=>a(t).toNumber(),d=t=>i.pad(32,t),p=t=>(e,r)=>o(a(e)[t](a(r))),m=p("add"),y=p("mul"),v=p("div"),b=p("sub");t.exports={toString:f,fromString:s,toNumber:l,fromNumber:h,toEther:u,fromEther:c,toUint256:d,add:m,mul:y,div:v,sub:b}},6430:function(t,e,r){var n=r("8707").Buffer,i=r("d485").Transform,o=r("7d72").StringDecoder,a=r("3fb5");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}a(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(i){n=i}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(r){e=r}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},t.exports=s},6442:function(t,e,r){e.publicEncrypt=r("ad25"),e.privateDecrypt=r("0f2c"),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},6444:function(t,e){var r=function(t){return t.replace(/^\s+|\s+$/g,"")},n=function(t){return"[object Array]"===Object.prototype.toString.call(t)};t.exports=function(t){if(!t)return{};for(var e={},i=r(t).split("\n"),o=0;o=2*this.getChainId()+35&&this._common.gteHardfork("spuriousDragon");this._senderPubKey=i.ecrecover(t,e,this.r,this.s,r?this.getChainId():void 0)}catch(n){return!1}return!!this._senderPubKey},t.prototype.sign=function(t){this.v=new a.Buffer([]),this.s=new a.Buffer([]),this.r=new a.Buffer([]);var e=this.hash(!1),r=i.ecsign(e,t);this._implementsEIP155()&&(r.v+=2*this.getChainId()+8),Object.assign(this,r)},t.prototype.getDataFee=function(){for(var t=this.raw[5],e=new i.BN(0),r=0;r0&&e.push(["gas limit is too low. Need at least "+this.getBaseFee()]),!1===t?0===e.length:e.join(" ")},t.prototype.serialize=function(){return i.rlp.encode(this.raw)},t.prototype.toJSON=function(t){return void 0===t&&(t=!1),{}},t.prototype._validateV=function(t){if(void 0!==t&&0!==t.length&&this._common.gteHardfork("spuriousDragon")){var e=i.bufferToInt(t);if(27!==e&&28!==e){var r=e===2*this.getChainId()+35||e===2*this.getChainId()+36;if(!r)throw new Error("Incompatible EIP155-based V "+e+" and chain id "+this.getChainId()+". See the second parameter of the Transaction constructor to set the chain id.")}}},t.prototype._isSigned=function(){return this.v.length>0&&this.r.length>0&&this.s.length>0},t.prototype._overrideVSetterWithValidation=function(){var t=this,e=Object.getOwnPropertyDescriptor(this,"v");Object.defineProperty(this,"v",n({},e,{set:function(r){void 0!==r&&t._validateV(i.toBuffer(r)),e.set(r)}}))},t.prototype._implementsEIP155=function(){var t=this._common.gteHardfork("spuriousDragon");if(!this._isSigned())return t;var e=i.bufferToInt(this.v),r=e===2*this.getChainId()+35||e===2*this.getChainId()+36;return r&&t},t}();e.default=u},"662a":function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hardforks=[["chainstart",r("fb6d")],["homestead",r("9825")],["dao",r("7306")],["tangerineWhistle",r("91b1")],["spuriousDragon",r("6aca")],["byzantium",r("43c5")],["constantinople",r("d665")],["petersburg",r("2044")],["istanbul",r("aea0")],["muirGlacier",r("8035")]]},"676f":function(t,e,r){"use strict";var n=r("399f"),i=r("3fb5"),o=r("ea53"),a=r("f3a3");function s(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),t.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e),i=n.redSqrt();return 0===i.redSqr().cmp(n)},i(u,o.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},s.prototype.point=function(t,e){return new u(this,t,e)},s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z),e=t.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),i=e.redSub(n),o=e.redMul(n),a=i.redMul(n.redAdd(this.curve.a24.redMul(i)));return this.curve.point(o,a)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z),a=o.redMul(r),s=i.redMul(n),u=e.z.redMul(a.redAdd(s).redSqr()),c=e.x.redMul(a.redISub(s).redSqr());return this.curve.point(u,c)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=this,o=[];0!==e.cmpn(0);e.iushrn(1))o.push(e.andln(1));for(var a=o.length-1;a>=0;a--)0===o[a]?(r=r.diffAdd(n,i),n=n.dbl()):(n=r.diffAdd(n,i),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6787:function(t,e){var r=function(){if("object"===typeof self&&self)return self;if("object"===typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;if("object"===typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return r()}try{return __global__||r()}finally{delete Object.prototype.__global__}}()},6983:function(t,e,r){"use strict";t.exports=r("c98c")(r("2416"))},"69dc":function(t,e,r){var n=r("7b0be").keccak256,i=r("73f3"),o=function(t,e){var r=i.reverse(i.pad(6,i.fromNumber(t))),o=i.flatten([r,"0x0000",e]);return n(o).slice(2)},a=function t(e){"string"===typeof e&&"0x"!==e.slice(0,2)?e=i.fromString(e):"string"!==typeof e&&void 0!==e.length&&(e=i.fromUint8Array(e));var r=i.length(e);if(r<=4096)return o(r,e);var n=4096;while(128*n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=a,a.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));var o=[];while(o.length>>31),p=l^(a<<1|o>>>31);const m=t[0]^d,y=t[1]^p,v=t[10]^d,b=t[11]^p,g=t[20]^d,w=t[21]^p,_=t[30]^d,A=t[31]^p,E=t[40]^d,x=t[41]^p;d=r^(s<<1|u>>>31),p=i^(u<<1|s>>>31);const M=t[2]^d,k=t[3]^p,S=t[12]^d,I=t[13]^p,C=t[22]^d,T=t[23]^p,U=t[32]^d,O=t[33]^p,P=t[42]^d,R=t[43]^p;d=o^(c<<1|f>>>31),p=a^(f<<1|c>>>31);const N=t[4]^d,B=t[5]^p,j=t[14]^d,L=t[15]^p,D=t[24]^d,F=t[25]^p,q=t[34]^d,H=t[35]^p,z=t[44]^d,K=t[45]^p;d=s^(h<<1|l>>>31),p=u^(l<<1|h>>>31);const V=t[6]^d,G=t[7]^p,$=t[16]^d,Y=t[17]^p,W=t[26]^d,Z=t[27]^p,J=t[36]^d,X=t[37]^p,Q=t[46]^d,tt=t[47]^p;d=c^(r<<1|i>>>31),p=f^(i<<1|r>>>31);const et=t[8]^d,rt=t[9]^p,nt=t[18]^d,it=t[19]^p,ot=t[28]^d,at=t[29]^p,st=t[38]^d,ut=t[39]^p,ct=t[48]^d,ft=t[49]^p,ht=m,lt=y,dt=b<<4|v>>>28,pt=v<<4|b>>>28,mt=g<<3|w>>>29,yt=w<<3|g>>>29,vt=A<<9|_>>>23,bt=_<<9|A>>>23,gt=E<<18|x>>>14,wt=x<<18|E>>>14,_t=M<<1|k>>>31,At=k<<1|M>>>31,Et=I<<12|S>>>20,xt=S<<12|I>>>20,Mt=C<<10|T>>>22,kt=T<<10|C>>>22,St=O<<13|U>>>19,It=U<<13|O>>>19,Ct=P<<2|R>>>30,Tt=R<<2|P>>>30,Ut=B<<30|N>>>2,Ot=N<<30|B>>>2,Pt=j<<6|L>>>26,Rt=L<<6|j>>>26,Nt=F<<11|D>>>21,Bt=D<<11|F>>>21,jt=q<<15|H>>>17,Lt=H<<15|q>>>17,Dt=K<<29|z>>>3,Ft=z<<29|K>>>3,qt=V<<28|G>>>4,Ht=G<<28|V>>>4,zt=Y<<23|$>>>9,Kt=$<<23|Y>>>9,Vt=W<<25|Z>>>7,Gt=Z<<25|W>>>7,$t=J<<21|X>>>11,Yt=X<<21|J>>>11,Wt=tt<<24|Q>>>8,Zt=Q<<24|tt>>>8,Jt=et<<27|rt>>>5,Xt=rt<<27|et>>>5,Qt=nt<<20|it>>>12,te=it<<20|nt>>>12,ee=at<<7|ot>>>25,re=ot<<7|at>>>25,ne=st<<8|ut>>>24,ie=ut<<8|st>>>24,oe=ct<<14|ft>>>18,ae=ft<<14|ct>>>18;t[0]=ht^~Et&Nt,t[1]=lt^~xt&Bt,t[10]=qt^~Qt&mt,t[11]=Ht^~te&yt,t[20]=_t^~Pt&Vt,t[21]=At^~Rt&Gt,t[30]=Jt^~dt&Mt,t[31]=Xt^~pt&kt,t[40]=Ut^~zt&ee,t[41]=Ot^~Kt&re,t[2]=Et^~Nt&$t,t[3]=xt^~Bt&Yt,t[12]=Qt^~mt&St,t[13]=te^~yt&It,t[22]=Pt^~Vt&ne,t[23]=Rt^~Gt&ie,t[32]=dt^~Mt&jt,t[33]=pt^~kt&Lt,t[42]=zt^~ee&vt,t[43]=Kt^~re&bt,t[4]=Nt^~$t&oe,t[5]=Bt^~Yt&ae,t[14]=mt^~St&Dt,t[15]=yt^~It&Ft,t[24]=Vt^~ne>,t[25]=Gt^~ie&wt,t[34]=Mt^~jt&Wt,t[35]=kt^~Lt&Zt,t[44]=ee^~vt&Ct,t[45]=re^~bt&Tt,t[6]=$t^~oe&ht,t[7]=Yt^~ae<,t[16]=St^~Dt&qt,t[17]=It^~Ft&Ht,t[26]=ne^~gt&_t,t[27]=ie^~wt&At,t[36]=jt^~Wt&Jt,t[37]=Lt^~Zt&Xt,t[46]=vt^~Ct&Ut,t[47]=bt^~Tt&Ot,t[8]=oe^~ht&Et,t[9]=ae^~lt&xt,t[18]=Dt^~qt&Qt,t[19]=Ft^~Ht&te,t[28]=gt^~_t&Pt,t[29]=wt^~At&Rt,t[38]=Wt^~Jt&dt,t[39]=Zt^~Xt&pt,t[48]=Ct^~Ut&zt,t[49]=Tt^~Ot&Kt,t[0]^=n[2*e],t[1]^=n[2*e+1]}}},"6fe7":function(t,e,r){(function(e){var n=r("1a2a"),i=r("a958"),o=r("3337").ec,a=r("399f"),s=r("2aee"),u=r("cd91");function c(t,r,n,o,a){var u=s(r);if(u.curve){if("ecdsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong private key type");return f(t,u)}if("dsa"===u.type){if("dsa"!==o)throw new Error("wrong private key type");return h(t,u,n)}if("rsa"!==o&&"ecdsa/rsa"!==o)throw new Error("wrong private key type");t=e.concat([a,t]);var c=u.modulus.byteLength(),l=[0,1];while(t.length+l.length+10&&r.ishrn(n),r}function m(t,r){t=p(t,r),t=t.mod(r);var n=new e(t.toArray());if(n.length=8?o+=t[a].toUpperCase():o+=t[a];return o},e.isValidChecksumAddress=function(t,r){return e.isValidAddress(t)&&e.toChecksumAddress(t,r)===t},e.generateAddress=function(e,r){e=s.toBuffer(e);var n=new a(r);return n.isZero()?u.rlphash([e,null]).slice(-20):u.rlphash([e,t.from(n.toArray())]).slice(-20)},e.generateAddress2=function(e,r,i){var o=s.toBuffer(e),a=s.toBuffer(r),c=s.toBuffer(i);n(20===o.length),n(32===a.length);var f=u.keccak256(t.concat([t.from("ff","hex"),o,a,u.keccak256(c)]));return f.slice(-20)},e.isPrecompiled=function(t){var e=s.unpad(t);return 1===e.length&&e[0]>=1&&e[0]<=8},e.isValidPrivate=function(t){return o.privateKeyVerify(t)},e.isValidPublic=function(e,r){return void 0===r&&(r=!1),64===e.length?o.publicKeyVerify(t.concat([t.from([4]),e])):!!r&&o.publicKeyVerify(e)},e.pubToAddress=function(t,e){return void 0===e&&(e=!1),t=s.toBuffer(t),e&&64!==t.length&&(t=o.publicKeyConvert(t,!1).slice(1)),n(64===t.length),u.keccak(t).slice(-20)},e.publicToAddress=e.pubToAddress,e.privateToAddress=function(t){return e.publicToAddress(e.privateToPublic(t))},e.privateToPublic=function(t){return t=s.toBuffer(t),o.publicKeyCreate(t,!1).slice(1)},e.importPublic=function(t){return t=s.toBuffer(t),64!==t.length&&(t=o.publicKeyConvert(t,!1).slice(1)),t}}).call(this,r("b639").Buffer)},"701e":function(t,e,r){"use strict";var n=r("52c6");t.exports=n},"70c1":function(t,e,r){"use strict";var n=r("4a87"),i=r("a6b6"),o=new n(0),a=new n(-1),s={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"};function u(t){var e=t?t.toLowerCase():"ether",r=s[e];if("string"!==typeof r)throw new Error("[ethjs-unit] the unit provided "+t+" doesn't exists, please use the one of the following units "+JSON.stringify(s,null,2));return new n(r,10)}function c(t){if("string"===typeof t){if(!t.match(/^-?[0-9.]+$/))throw new Error("while converting number to string, invalid number value '"+t+"', should be a number matching (^-?[0-9.]+).");return t}if("number"===typeof t)return String(t);if("object"===typeof t&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error("while converting number to string, invalid number value '"+t+"' type "+typeof t+".")}function f(t,e,r){var n=i(t),c=n.lt(o),f=u(e),h=s[e].length-1||1,l=r||{};c&&(n=n.mul(a));var d=n.mod(f).toString(10);while(d.length2)throw new Error("[ethjs-unit] while converting number "+t+" to wei, too many decimal points");var l=h[0],d=h[1];if(l||(l="0"),d||(d="0"),d.length>o)throw new Error("[ethjs-unit] while converting number "+t+" to wei, too many decimal places");while(d.length>6|192);else{if(i>55295&&i<56320){if(++n==t.length)return null;var o=t.charCodeAt(n);if(o<56320||o>57343)return null;i=65536+((1023&i)<<10)+(1023&o),r+=e(i>>18|240),r+=e(i>>12&63|128)}else r+=e(i>>12|224);r+=e(i>>6&63|128)}r+=e(63&i|128)}}return r},E=function(t){var e="",r=0,i=o(t);while(r127){if(a>191&&a<224){if(r>=i)return null;a=(31&a)<<6|63&n(t,r)}else if(a>223&&a<240){if(r+1>=i)return null;a=(15&a)<<12|(63&n(t,r))<<6|63&n(t,++r)}else{if(!(a>239&&a<248))return null;if(r+2>=i)return null;a=(7&a)<<18|(63&n(t,r))<<12|(63&n(t,++r))<<6|63&n(t,++r)}++r}if(a<=65535)e+=String.fromCharCode(a);else{if(!(a<=1114111))return null;a-=65536,e+=String.fromCharCode(a>>10|55296),e+=String.fromCharCode(1023&a|56320)}}return e};t.exports={random:i,length:o,concat:v,flatten:a,slice:s,reverse:u,pad:c,padRight:f,fromAscii:w,toAscii:_,fromString:A,toString:E,fromNumber:m,toNumber:y,fromNat:b,toNat:g,fromArray:l,toArray:h,fromUint8Array:p,toUint8Array:d}},7418:function(t,e){e.f=Object.getOwnPropertySymbols},"75cc":function(t,e,r){"use strict";(function(t,n){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r("8707"),a=r("11dc"),s=o.Buffer,u=o.kMaxLength,c=t.crypto||t.msCrypto,f=Math.pow(2,32)-1;function h(t,e){if("number"!==typeof t||t!==t)throw new TypeError("offset must be a number");if(t>f||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function l(t,e,r){if("number"!==typeof t||t!==t)throw new TypeError("size must be a number");if(t>f||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function d(e,r,n,i){if(!s.isBuffer(e)&&!(e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"===typeof r)i=r,r=0,n=e.length;else if("function"===typeof n)i=n,n=e.length-r;else if("function"!==typeof i)throw new TypeError('"cb" argument must be a function');return h(r,e.length),l(n,r,e.length),p(e,r,n,i)}function p(t,e,r,i){if(n.browser){var o=t.buffer,s=new Uint8Array(o,e,r);return c.getRandomValues(s),i?void n.nextTick((function(){i(null,t)})):t}if(!i){var u=a(r);return u.copy(t,e),t}a(r,(function(r,n){if(r)return i(r);n.copy(t,e),i(null,t)}))}function m(e,r,n){if("undefined"===typeof r&&(r=0),!s.isBuffer(e)&&!(e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return h(r,e.length),void 0===n&&(n=e.length-r),l(n,r,e.length),p(e,r,n)}c&&c.getRandomValues||!n.browser?(e.randomFill=d,e.randomFillSync=m):(e.randomFill=i,e.randomFillSync=i)}).call(this,r("c8ba"),r("4362"))},7658:function(t,e,r){"use strict";var n=e;function i(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!==typeof t){for(var n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}return r}function o(t){return 1===t.length?"0"+t:t}function a(t){for(var e="",r=0;r=0);return i},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var i=t.bitLength(),o=n.mont(t),a=new n(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var c=t.shrn(u),f=s.toRed(o),h=!0;e>0;e--){var l=this._randrange(new n(2),s);r&&r(l);var d=l.toRed(o).redPow(c);if(0!==d.cmp(a)&&0!==d.cmp(f)){for(var p=1;p0;e--){var f=this._randrange(new n(2),a),h=t.gcd(f);if(0!==h.cmpn(1))return h;var l=f.toRed(i).redPow(u);if(0!==l.cmp(o)&&0!==l.cmp(c)){for(var d=1;d>5,outputBlocks:t>>5,s:function(t){return[].concat(t,t,t,t,t)}([0,0,0,0,0,0,0,0,0,0])}},s=function(t,e){var o,a=e.length,s=t.blocks,c=t.blockCount<<2,f=t.blockCount,h=t.outputBlocks,l=t.s,d=0;while(d>2]|=e[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[y>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=c){for(t.start=y-c,t.block=s[f],y=0;y>2]|=n[3&y],t.lastByteIndex===c)for(s[0]=s[f],y=1;y>4&15]+r[15&p]+r[p>>12&15]+r[p>>8&15]+r[p>>20&15]+r[p>>16&15]+r[p>>28&15]+r[p>>24&15];v%f===0&&(u(l),y=0)}return"0x"+m},u=function(t){var e,r,n,i,a,s,u,c,f,h,l,d,p,m,y,v,b,g,w,_,A,E,x,M,k,S,I,C,T,U,O,P,R,N,B,j,L,D,F,q,H,z,K,V,G,$,Y,W,Z,J,X,Q,tt,et,rt,nt,it,ot,at,st,ut,ct,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],a=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],c=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],d=t[8]^t[18]^t[28]^t[38]^t[48],p=t[9]^t[19]^t[29]^t[39]^t[49],e=d^(s<<1|u>>>31),r=p^(u<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(c<<1|f>>>31),r=a^(f<<1|c>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(h<<1|l>>>31),r=u^(l<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=c^(d<<1|p>>>31),r=f^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|a>>>31),r=l^(a<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],y=t[1],$=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,C=t[20]<<3|t[21]>>>29,T=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,N=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,U=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,j=t[14]<<6|t[15]>>>26,L=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,J=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,I=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=m^~v&g,t[1]=y^~b&w,t[10]=M^~S&C,t[11]=k^~I&T,t[20]=N^~j&D,t[21]=B^~L&F,t[30]=V^~$&W,t[31]=G^~Y&Z,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=v^~g&_,t[3]=b^~w&A,t[12]=S^~C&U,t[13]=I^~T&O,t[22]=j^~D&q,t[23]=L^~F&H,t[32]=$^~W&J,t[33]=Y^~Z&X,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~_&E,t[5]=w^~A&x,t[14]=C^~U&P,t[15]=T^~O&R,t[24]=D^~q&z,t[25]=F^~H&K,t[34]=W^~J&Q,t[35]=Z^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&ft,t[6]=_^~E&m,t[7]=A^~x&y,t[16]=U^~P&M,t[17]=O^~R&k,t[26]=q^~z&N,t[27]=H^~K&B,t[36]=J^~Q&V,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~ft&rt,t[8]=E^~m&v,t[9]=x^~y&b,t[18]=P^~M&S,t[19]=R^~k&I,t[28]=z^~N&j,t[29]=K^~B&L,t[38]=Q^~V&$,t[39]=tt^~G&Y,t[48]=ct^~et&nt,t[49]=ft^~rt&it,t[0]^=o[n],t[1]^=o[n+1]},c=function(t){return function(e){var r;if("0x"===e.slice(0,2)){r=[];for(var n=2,i=e.length;nparseInt(t.slice(2*e+2,2*e+4),16),i=t=>{let e;e="undefined"!==typeof window&&window.crypto&&window.crypto.getRandomValues?window.crypto.getRandomValues(new Uint8Array(t)):r("1c46").randomBytes(t);let n="0x";for(let r=0;r(t.length-2)/2,a=t=>"0x"+t.reduce((t,e)=>t+e.slice(2),""),s=(t,e,r)=>"0x"+r.slice(2*t+2,2*e+2),u=t=>{let e="0x";for(let r=0,n=o(t);re.length===2*t+2?e:c(t,"0x0"+e.slice(2)),f=(t,e)=>e.length===2*t+2?e:f(t,e+"0"),h=t=>{let e=[];for(let r=2,n=t.length;r{let e="0x";for(let r=0,n=t.length;rnew Uint8Array(h(t)),p=t=>l([].slice.call(t,0)),m=t=>{let e=t.toString(16);return e.length%2===0?"0x"+e:"0x0"+e},y=t=>parseInt(t.slice(2),16),v=(t,e)=>t.concat(e.slice(2)),b=t=>"0x0"===t?"0x":t.length%2===0?t:"0x0"+t.slice(2),g=t=>"0"===t[2]?"0x"+t.slice(3):t,w=t=>{let e="0x";for(let r=0;r{let e="";for(let r=2;r{const e=t=>{const e=t.toString(16);return e.length<2?"0"+e:e};let r="0x";for(let n=0;n!=t.length;n++){let i=t.charCodeAt(n);if(i<128)r+=e(i);else{if(i<2048)r+=e(i>>6|192);else{if(i>55295&&i<56320){if(++n==t.length)return null;let o=t.charCodeAt(n);if(o<56320||o>57343)return null;i=65536+((1023&i)<<10)+(1023&o),r+=e(i>>18|240),r+=e(i>>12&63|128)}else r+=e(i>>12|224);r+=e(i>>6&63|128)}r+=e(63&i|128)}}return r},E=t=>{let e="",r=0,i=o(t);while(r127){if(o>191&&o<224){if(r>=i)return null;o=(31&o)<<6|63&n(t,r)}else if(o>223&&o<240){if(r+1>=i)return null;o=(15&o)<<12|(63&n(t,r))<<6|63&n(t,++r)}else{if(!(o>239&&o<248))return null;if(r+2>=i)return null;o=(7&o)<<18|(63&n(t,r))<<12|(63&n(t,++r))<<6|63&n(t,++r)}++r}if(o<=65535)e+=String.fromCharCode(o);else{if(!(o<=1114111))return null;o-=65536,e+=String.fromCharCode(o>>10|55296),e+=String.fromCharCode(1023&o|56320)}}return e};t.exports={random:i,length:o,concat:v,flatten:a,slice:s,reverse:u,pad:c,padRight:f,fromAscii:w,toAscii:_,fromString:A,toString:E,fromNumber:m,toNumber:y,fromNat:b,toNat:g,fromArray:l,toArray:h,fromUint8Array:p,toUint8Array:d}},"7c73":function(t,e,r){var n,i=r("825a"),o=r("37e8"),a=r("7839"),s=r("d012"),u=r("1be4"),c=r("cc12"),f=r("f772"),h=">",l="<",d="prototype",p="script",m=f("IE_PROTO"),y=function(){},v=function(t){return l+p+h+t+l+"/"+p+h},b=function(t){t.write(v("")),t.close();var e=t.parentWindow.Object;return t=null,e},g=function(){var t,e=c("iframe"),r="java"+p+":";return e.style.display="none",u.appendChild(e),e.src=String(r),t=e.contentWindow.document,t.open(),t.write(v("document.F=Object")),t.close(),t.F},w=function(){try{n=document.domain&&new ActiveXObject("htmlfile")}catch(e){}w=n?b(n):g();var t=a.length;while(t--)delete w[d][a[t]];return w()};s[m]=!0,t.exports=Object.create||function(t,e){var r;return null!==t?(y[d]=i(t),r=new y,y[d]=null,r[m]=t):r=w(),void 0===e?r:o(r,e)}},"7d2a":function(t,e,r){(function(e){var r=Math.pow(2,30)-1;function n(t,r){if("string"!==typeof t&&!e.isBuffer(t))throw new TypeError(r+" must be a buffer or string")}t.exports=function(t,e,i,o){if(n(t,"Password"),n(e,"Salt"),"number"!==typeof i)throw new TypeError("Iterations not a number");if(i<0)throw new TypeError("Bad iterations");if("number"!==typeof o)throw new TypeError("Key length not a number");if(o<0||o>r||o!==o)throw new TypeError("Bad key length")}}).call(this,r("b639").Buffer)},"7d72":function(t,e,r){"use strict";var n=r("8707").Buffer,i=n.isEncoding||function(t){switch(t=""+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){if(!t)return"utf8";var e;while(1)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}}function a(t){var e=o(t);if("string"!==typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}function s(t){var e;switch(this.encoding=a(t),this.encoding){case"utf16le":this.text=p,this.end=m,e=4;break;case"utf8":this.fillLast=h,e=4;break;case"base64":this.text=y,this.end=v,e=3;break;default:return this.write=b,void(this.end=g)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function u(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function c(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0))}function f(t,e,r){if(128!==(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!==(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!==(192&e[2]))return t.lastNeed=2,"�"}}function h(t){var e=this.lastTotal-this.lastNeed,r=f(this,t,e);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 l(t,e){var r=c(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)}function d(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function p(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 m(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 y(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 v(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function b(t){return t.toString(this.encoding)}function g(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),void 0===e)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5,outputBlocks:t>>5,s:function(t){return[].concat(t,t,t,t,t)}([0,0,0,0,0,0,0,0,0,0])}},s=function(t,e){var o,a=e.length,s=t.blocks,c=t.blockCount<<2,f=t.blockCount,h=t.outputBlocks,l=t.s,d=0;while(d>2]|=e[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[y>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=c){for(t.start=y-c,t.block=s[f],y=0;y>2]|=n[3&y],t.lastByteIndex===c)for(s[0]=s[f],y=1;y>4&15]+r[15&p]+r[p>>12&15]+r[p>>8&15]+r[p>>20&15]+r[p>>16&15]+r[p>>28&15]+r[p>>24&15];v%f===0&&(u(l),y=0)}return"0x"+m},u=function(t){var e,r,n,i,a,s,u,c,f,h,l,d,p,m,y,v,b,g,w,_,A,E,x,M,k,S,I,C,T,U,O,P,R,N,B,j,L,D,F,q,H,z,K,V,G,$,Y,W,Z,J,X,Q,tt,et,rt,nt,it,ot,at,st,ut,ct,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],a=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],c=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],d=t[8]^t[18]^t[28]^t[38]^t[48],p=t[9]^t[19]^t[29]^t[39]^t[49],e=d^(s<<1|u>>>31),r=p^(u<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(c<<1|f>>>31),r=a^(f<<1|c>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(h<<1|l>>>31),r=u^(l<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=c^(d<<1|p>>>31),r=f^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|a>>>31),r=l^(a<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],y=t[1],$=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,C=t[20]<<3|t[21]>>>29,T=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,N=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,U=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,j=t[14]<<6|t[15]>>>26,L=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,J=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,I=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=m^~v&g,t[1]=y^~b&w,t[10]=M^~S&C,t[11]=k^~I&T,t[20]=N^~j&D,t[21]=B^~L&F,t[30]=V^~$&W,t[31]=G^~Y&Z,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=v^~g&_,t[3]=b^~w&A,t[12]=S^~C&U,t[13]=I^~T&O,t[22]=j^~D&q,t[23]=L^~F&H,t[32]=$^~W&J,t[33]=Y^~Z&X,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~_&E,t[5]=w^~A&x,t[14]=C^~U&P,t[15]=T^~O&R,t[24]=D^~q&z,t[25]=F^~H&K,t[34]=W^~J&Q,t[35]=Z^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&ft,t[6]=_^~E&m,t[7]=A^~x&y,t[16]=U^~P&M,t[17]=O^~R&k,t[26]=q^~z&N,t[27]=H^~K&B,t[36]=J^~Q&V,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~ft&rt,t[8]=E^~m&v,t[9]=x^~y&b,t[18]=P^~M&S,t[19]=R^~k&I,t[28]=z^~N&j,t[29]=K^~B&L,t[38]=Q^~V&$,t[39]=tt^~G&Y,t[48]=ct^~et&nt,t[49]=ft^~rt&it,t[0]^=o[n],t[1]^=o[n+1]},c=function(t){return function(e){var r;if("0x"===e.slice(0,2)){r=[];for(var n=2,i=e.length;n>>31}function f(t){return t<<5|t>>>27}function h(t){return t<<30|t>>>2}function l(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0;u<16;++u)e[u]=t.readInt32BE(4*u);for(;u<80;++u)e[u]=c(e[u-3]^e[u-8]^e[u-14]^e[u-16]);for(var d=0;d<80;++d){var p=~~(d/20),m=f(r)+l(p,n,i,o)+s+e[d]+a[p]|0;s=o,o=i,i=h(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},u.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},t.exports=u},"7f7a":function(t,e,r){var n=e;n.bignum=r("399f"),n.define=r("ef3a").define,n.base=r("41df"),n.constants=r("0211"),n.decoders=r("20f6"),n.encoders=r("343e")},"7f9a":function(t,e,r){var n=r("da84"),i=r("8925"),o=n.WeakMap;t.exports="function"===typeof o&&/native code/.test(i(o))},8035:function(t){t.exports=JSON.parse('{"name":"muirGlacier","comment":"HF to delay the difficulty bomb","eip":{"url":"https://eips.ethereum.org/EIPS/eip-2384","status":"Last Call"},"gasConfig":{},"gasPrices":{},"vm":{},"pow":{},"casper":{},"sharding":{}}')},8148:function(t,e,r){var n=r("39d4").errors,i=r("8602").XMLHttpRequest,o=r("9490"),a=r("24f8"),s=function(t,e){e=e||{},this.withCredentials=e.withCredentials||!1,this.timeout=e.timeout||0,this.headers=e.headers,this.agent=e.agent,this.connected=!1;var r=!0===e.keepAlive||!1!==e.keepAlive;this.host=t||"http://localhost:8545",this.agent||("https"===this.host.substring(0,5)?this.httpsAgent=new a.Agent({keepAlive:r}):this.httpAgent=new o.Agent({keepAlive:r}))};s.prototype._prepareRequest=function(){var t;if("undefined"!==typeof XMLHttpRequest)t=new XMLHttpRequest;else{t=new i;var e={httpsAgent:this.httpsAgent,httpAgent:this.httpAgent,baseUrl:this.baseUrl};this.agent&&(e.httpsAgent=this.agent.https,e.httpAgent=this.agent.http,e.baseUrl=this.agent.baseUrl),t.nodejsSet(e)}return t.open("POST",this.host,!0),t.setRequestHeader("Content-Type","application/json"),t.timeout=this.timeout,t.withCredentials=this.withCredentials,this.headers&&this.headers.forEach((function(e){t.setRequestHeader(e.name,e.value)})),t},s.prototype.send=function(t,e){var r=this,i=this._prepareRequest();i.onreadystatechange=function(){if(4===i.readyState&&1!==i.timeout){var t=i.responseText,o=null;try{t=JSON.parse(t)}catch(a){o=n.InvalidResponse(i.responseText)}r.connected=!0,e(o,t)}},i.ontimeout=function(){r.connected=!1,e(n.ConnectionTimeout(this.timeout))};try{i.send(JSON.stringify(t))}catch(o){this.connected=!1,e(n.InvalidConnection(this.host))}},s.prototype.disconnect=function(){},s.prototype.supportsSubscriptions=function(){return!1},t.exports=s},"825a":function(t,e,r){var n=r("861d");t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},"82f0":function(t,e,r){var n=r("39f5"),i=r("8707").Buffer,o=r("6430"),a=r("3fb5"),s=r("3f62"),u=r("8c8a"),c=r("bd9d");function f(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;while(++r=r)throw RangeError(n)}}).call(this,r("b639").Buffer)},"8b71":function(t,e,r){var n=r("0211");e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=n._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=n._reverse(e.tag)},"8b95":function(t,e,r){"use strict";var n=r("c3c0"),i=r("b525");function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},"8c05":function(t,e){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},"8c4f":function(t,e,r){"use strict"; +/*! + * vue-router v3.1.5 + * (c) 2020 Evan You + * @license MIT + */function n(t,e){0}function i(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function o(t,e){return e instanceof t||e&&(e.name===t.name||e._name===t._name)}function a(t,e){for(var r in e)t[r]=e[r];return t}var s={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var r=e.props,n=e.children,i=e.parent,o=e.data;o.routerView=!0;var s=i.$createElement,c=r.name,f=i.$route,h=i._routerViewCache||(i._routerViewCache={}),l=0,d=!1;while(i&&i._routerRoot!==i){var p=i.$vnode?i.$vnode.data:{};p.routerView&&l++,p.keepAlive&&i._directInactive&&i._inactive&&(d=!0),i=i.$parent}if(o.routerViewDepth=l,d){var m=h[c],y=m&&m.component;return y?(m.configProps&&u(y,o,m.route,m.configProps),s(y,o,n)):s()}var v=f.matched[l],b=v&&v.components[c];if(!v||!b)return h[c]=null,s();h[c]={component:b},o.registerRouteInstance=function(t,e){var r=v.instances[c];(e&&r!==t||!e&&r===t)&&(v.instances[c]=e)},(o.hook||(o.hook={})).prepatch=function(t,e){v.instances[c]=e.componentInstance},o.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==v.instances[c]&&(v.instances[c]=t.componentInstance)};var g=v.props&&v.props[c];return g&&(a(h[c],{route:f,configProps:g}),u(b,o,f,g)),s(b,o,n)}};function u(t,e,r,n){var i=e.props=c(r,n);if(i){i=e.props=a({},i);var o=e.attrs=e.attrs||{};for(var s in i)t.props&&s in t.props||(o[s]=i[s],delete i[s])}}function c(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0;default:0}}var f=/[!'()*]/g,h=function(t){return"%"+t.charCodeAt(0).toString(16)},l=/%2C/g,d=function(t){return encodeURIComponent(t).replace(f,h).replace(l,",")},p=decodeURIComponent;function m(t,e,r){void 0===e&&(e={});var n,i=r||y;try{n=i(t||"")}catch(a){n={}}for(var o in e)n[o]=e[o];return n}function y(t){var e={};return t=t.trim().replace(/^(\?|#|&)/,""),t?(t.split("&").forEach((function(t){var r=t.replace(/\+/g," ").split("="),n=p(r.shift()),i=r.length>0?p(r.join("=")):null;void 0===e[n]?e[n]=i:Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]})),e):e}function v(t){var e=t?Object.keys(t).map((function(e){var r=t[e];if(void 0===r)return"";if(null===r)return d(e);if(Array.isArray(r)){var n=[];return r.forEach((function(t){void 0!==t&&(null===t?n.push(d(e)):n.push(d(e)+"="+d(t)))})),n.join("&")}return d(e)+"="+d(r)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var b=/\/?$/;function g(t,e,r,n){var i=n&&n.options.stringifyQuery,o=e.query||{};try{o=w(o)}catch(s){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:o,params:e.params||{},fullPath:E(e,i),matched:t?A(t):[]};return r&&(a.redirectedFrom=E(r,i)),Object.freeze(a)}function w(t){if(Array.isArray(t))return t.map(w);if(t&&"object"===typeof t){var e={};for(var r in t)e[r]=w(t[r]);return e}return t}var _=g(null,{path:"/"});function A(t){var e=[];while(t)e.unshift(t),t=t.parent;return e}function E(t,e){var r=t.path,n=t.query;void 0===n&&(n={});var i=t.hash;void 0===i&&(i="");var o=e||v;return(r||"/")+o(n)+i}function x(t,e){return e===_?t===e:!!e&&(t.path&&e.path?t.path.replace(b,"")===e.path.replace(b,"")&&t.hash===e.hash&&M(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&M(t.query,e.query)&&M(t.params,e.params)))}function M(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every((function(r){var n=t[r],i=e[r];return"object"===typeof n&&"object"===typeof i?M(n,i):String(n)===String(i)}))}function k(t,e){return 0===t.path.replace(b,"/").indexOf(e.path.replace(b,"/"))&&(!e.hash||t.hash===e.hash)&&S(t.query,e.query)}function S(t,e){for(var r in e)if(!(r in t))return!1;return!0}function I(t,e,r){var n=t.charAt(0);if("/"===n)return t;if("?"===n||"#"===n)return e+t;var i=e.split("/");r&&i[i.length-1]||i.pop();for(var o=t.replace(/^\//,"").split("/"),a=0;a=0&&(e=t.slice(n),t=t.slice(0,n));var i=t.indexOf("?");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{path:t,query:r,hash:e}}function T(t){return t.replace(/\/\//g,"/")}var U=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},O=J,P=L,R=D,N=H,B=Z,j=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function L(t,e){var r,n=[],i=0,o=0,a="",s=e&&e.delimiter||"/";while(null!=(r=j.exec(t))){var u=r[0],c=r[1],f=r.index;if(a+=t.slice(o,f),o=f+u.length,c)a+=c[1];else{var h=t[o],l=r[2],d=r[3],p=r[4],m=r[5],y=r[6],v=r[7];a&&(n.push(a),a="");var b=null!=l&&null!=h&&h!==l,g="+"===y||"*"===y,w="?"===y||"*"===y,_=r[2]||s,A=p||m;n.push({name:d||i++,prefix:l||"",delimiter:_,optional:w,repeat:g,partial:b,asterisk:!!v,pattern:A?K(A):v?".*":"[^"+z(_)+"]+?"})}}return o1||!_.length)return 0===_.length?t():t("span",{},_)}if("a"===this.tag)w.on=b,w.attrs={href:u};else{var A=st(this.$slots.default);if(A){A.isStatic=!1;var E=A.data=a({},A.data);for(var M in E.on=E.on||{},E.on){var S=E.on[M];M in b&&(E.on[M]=Array.isArray(S)?S:[S])}for(var I in b)I in E.on?E.on[I].push(b[I]):E.on[I]=v;var C=A.data.attrs=a({},A.data.attrs);C.href=u}else w.on=b}return t(this.tag,w,this.$slots.default)}};function at(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&(void 0===t.button||0===t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function st(t){if(t)for(var e,r=0;r-1&&(s.params[l]=r.params[l]);return s.path=Q(c.path,s.params,'named route "'+u+'"'),f(c,s,a)}if(s.path){s.params={};for(var d=0;d=t.length?r():t[i]?e(t[i],(function(){n(i+1)})):n(i+1)};n(0)}function Lt(t){return function(e,r,n){var o=!1,a=0,s=null;Dt(t,(function(t,e,r,u){if("function"===typeof t&&void 0===t.cid){o=!0,a++;var c,f=zt((function(e){Ht(e)&&(e=e.default),t.resolved="function"===typeof e?e:et.extend(e),r.components[u]=e,a--,a<=0&&n()})),h=zt((function(t){var e="Failed to resolve async component "+u+": "+t;s||(s=i(t)?t:new Error(e),n(s))}));try{c=t(f,h)}catch(d){h(d)}if(c)if("function"===typeof c.then)c.then(f,h);else{var l=c.component;l&&"function"===typeof l.then&&l.then(f,h)}}})),o||n()}}function Dt(t,e){return Ft(t.map((function(t){return Object.keys(t.components).map((function(r){return e(t.components[r],t.instances[r],t,r)}))})))}function Ft(t){return Array.prototype.concat.apply([],t)}var qt="function"===typeof Symbol&&"symbol"===typeof Symbol.toStringTag;function Ht(t){return t.__esModule||qt&&"Module"===t[Symbol.toStringTag]}function zt(t){var e=!1;return function(){var r=[],n=arguments.length;while(n--)r[n]=arguments[n];if(!e)return e=!0,t.apply(this,r)}}var Kt=function(t){function e(e){t.call(this),this.name=this._name="NavigationDuplicated",this.message='Navigating to current location ("'+e.fullPath+'") is not allowed',Object.defineProperty(this,"stack",{value:(new t).stack,writable:!0,configurable:!0})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);Kt._name="NavigationDuplicated";var Vt=function(t,e){this.router=t,this.base=Gt(e),this.current=_,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function Gt(t){if(!t)if(ct){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function $t(t,e){var r,n=Math.max(t.length,e.length);for(r=0;r-1?decodeURI(t.slice(0,n))+t.slice(n):decodeURI(t)}else t=decodeURI(t.slice(0,r))+t.slice(r);return t}function ue(t){var e=window.location.href,r=e.indexOf("#"),n=r>=0?e.slice(0,r):e;return n+"#"+t}function ce(t){Rt?Nt(ue(t)):window.location.hash=t}function fe(t){Rt?Bt(ue(t)):window.location.replace(ue(t))}var he=function(t){function e(e,r){t.call(this,e,r),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,r){var n=this;this.transitionTo(t,(function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++,e&&e(t)}),r)},e.prototype.replace=function(t,e,r){var n=this;this.transitionTo(t,(function(t){n.stack=n.stack.slice(0,n.index).concat(t),e&&e(t)}),r)},e.prototype.go=function(t){var e=this,r=this.index+t;if(!(r<0||r>=this.stack.length)){var n=this.stack[r];this.confirmTransition(n,(function(){e.index=r,e.updateRoute(n)}),(function(t){o(Kt,t)&&(e.index=r)}))}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Vt),le=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=pt(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Rt&&!1!==t.fallback,this.fallback&&(e="hash"),ct||(e="abstract"),this.mode=e,e){case"history":this.history=new re(this,t.base);break;case"hash":this.history=new ie(this,t.base,this.fallback);break;case"abstract":this.history=new he(this,t.base);break;default:0}},de={currentRoute:{configurable:!0}};function pe(t,e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}}function me(t,e,r){var n="hash"===r?"#"+e:e;return t?T(t+"/"+n):n}le.prototype.match=function(t,e,r){return this.matcher.match(t,e,r)},de.currentRoute.get=function(){return this.history&&this.history.current},le.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",(function(){var r=e.apps.indexOf(t);r>-1&&e.apps.splice(r,1),e.app===t&&(e.app=e.apps[0]||null)})),!this.app){this.app=t;var r=this.history;if(r instanceof re)r.transitionTo(r.getCurrentLocation());else if(r instanceof ie){var n=function(){r.setupListeners()};r.transitionTo(r.getCurrentLocation(),n,n)}r.listen((function(t){e.apps.forEach((function(e){e._route=t}))}))}},le.prototype.beforeEach=function(t){return pe(this.beforeHooks,t)},le.prototype.beforeResolve=function(t){return pe(this.resolveHooks,t)},le.prototype.afterEach=function(t){return pe(this.afterHooks,t)},le.prototype.onReady=function(t,e){this.history.onReady(t,e)},le.prototype.onError=function(t){this.history.onError(t)},le.prototype.push=function(t,e,r){var n=this;if(!e&&!r&&"undefined"!==typeof Promise)return new Promise((function(e,r){n.history.push(t,e,r)}));this.history.push(t,e,r)},le.prototype.replace=function(t,e,r){var n=this;if(!e&&!r&&"undefined"!==typeof Promise)return new Promise((function(e,r){n.history.replace(t,e,r)}));this.history.replace(t,e,r)},le.prototype.go=function(t){this.history.go(t)},le.prototype.back=function(){this.go(-1)},le.prototype.forward=function(){this.go(1)},le.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map((function(t){return Object.keys(t.components).map((function(e){return t.components[e]}))}))):[]},le.prototype.resolve=function(t,e,r){e=e||this.history.current;var n=tt(t,e,r,this),i=this.match(n,e),o=i.redirectedFrom||i.fullPath,a=this.history.base,s=me(a,o,this.mode);return{location:n,route:i,href:s,normalizedTo:n,resolved:i}},le.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==_&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(le.prototype,de),le.install=ut,le.version="3.1.5",ct&&window.Vue&&window.Vue.use(le),e["a"]=le},"8c8a":function(t,e,r){(function(e){t.exports=function(t,r){for(var n=Math.min(t.length,r.length),i=new e(n),o=0;o 0 and a power of 2");if(o>i/128/a)throw Error("Parameter N is too large");if(a>i/128/s)throw Error("Parameter r is too large");let f,h=e.alloc(256*a),l=e.alloc(128*a*o),d=new Int32Array(16),p=new Int32Array(16),m=e.alloc(64),y=n.pbkdf2Sync(t,r,1,128*s*a,"sha256");if(c){let t=s*o*2,e=0;f=function(){++e,e%1e3===0&&c({current:e,total:t,percent:e/t*100})}}return{XY:h,V:l,B32:d,x:p,_X:m,B:y,tickCallback:f}}async function s(t,e,r,n,i,a,s,u,f,h,d){d=d||o;let p,m=0,y=128*r;for(t.copy(a,m,e,e+y),p=0;psetImmediate(t)),c(a,m,y,r,s,u,f),h&&h();for(p=0;psetImmediate(t)),c(a,m,y,r,s,u,f),h&&h()}a.copy(t,e,m,m+y)}function u(t,e,r,n,i,o,a,s,u,f){let h,d=0,p=128*r;for(t.copy(o,d,e,e+p),h=0;h>>32-e}function h(t,e,r){let n;for(n=0;n<16;n++)e[n]=(255&t[4*n+0])<<0,e[n]|=(255&t[4*n+1])<<8,e[n]|=(255&t[4*n+2])<<16,e[n]|=(255&t[4*n+3])<<24;for(d(e,0,r,0,16),n=8;n>0;n-=2)r[4]^=f(r[0]+r[12],7),r[8]^=f(r[4]+r[0],9),r[12]^=f(r[8]+r[4],13),r[0]^=f(r[12]+r[8],18),r[9]^=f(r[5]+r[1],7),r[13]^=f(r[9]+r[5],9),r[1]^=f(r[13]+r[9],13),r[5]^=f(r[1]+r[13],18),r[14]^=f(r[10]+r[6],7),r[2]^=f(r[14]+r[10],9),r[6]^=f(r[2]+r[14],13),r[10]^=f(r[6]+r[2],18),r[3]^=f(r[15]+r[11],7),r[7]^=f(r[3]+r[15],9),r[11]^=f(r[7]+r[3],13),r[15]^=f(r[11]+r[7],18),r[1]^=f(r[0]+r[3],7),r[2]^=f(r[1]+r[0],9),r[3]^=f(r[2]+r[1],13),r[0]^=f(r[3]+r[2],18),r[6]^=f(r[5]+r[4],7),r[7]^=f(r[6]+r[5],9),r[4]^=f(r[7]+r[6],13),r[5]^=f(r[4]+r[7],18),r[11]^=f(r[10]+r[9],7),r[8]^=f(r[11]+r[10],9),r[9]^=f(r[8]+r[11],13),r[10]^=f(r[9]+r[8],18),r[12]^=f(r[15]+r[14],7),r[13]^=f(r[12]+r[15],9),r[14]^=f(r[13]+r[12],13),r[15]^=f(r[14]+r[13],18);for(n=0;n<16;++n)e[n]=r[n]+e[n];for(n=0;n<16;n++){let r=4*n;t[r+0]=e[n]>>0&255,t[r+1]=e[n]>>8&255,t[r+2]=e[n]>>16&255,t[r+3]=e[n]>>24&255}}function l(t,e,r,n,i){for(let o=0;o>1,f=-7,h=r?i-1:0,l=r?-1:1,d=t[e+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+t[e+h],h+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+t[e+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+h>=1?l/u:l*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=f?(s=0,a=f):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,c-=8);t[r+d-p]|=128*m}},"91b1":function(t){t.exports=JSON.parse('{"name":"tangerineWhistle","comment":"Hardfork with gas cost changes for IO-heavy operations","eip":{"url":"https://eips.ethereum.org/EIPS/eip-608","status":"Final"},"gasConfig":{},"gasPrices":{"sload":{"v":200,"d":"Once per SLOAD operation"},"call":{"v":700,"d":"Once per CALL operation & message call transaction"}},"vm":{},"pow":{},"casper":{},"sharding":{}}')},"91dd":function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,o){e=e||"&",r=r||"=";var a={};if("string"!==typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var u=1e3;o&&"number"===typeof o.maxKeys&&(u=o.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var f=0;f=0?(h=m.substr(0,y),l=m.substr(y+1)):(h=m,l=""),d=decodeURIComponent(h),p=decodeURIComponent(l),n(a,d)?i(a[d])?a[d].push(p):a[d]=[a[d],p]:a[d]=p}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},"925e":function(t,e,r){(function(e,n,i){var o=r("a9f1"),a=r("3fb5"),s=r("c90b"),u=r("e372"),c=r("d938"),f=s.IncomingMessage,h=s.readyStates;function l(t,e){return o.fetch&&e?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&t?"arraybuffer":o.vbArray&&t?"text:vbarray":"text"}var d=t.exports=function(t){var r,n=this;u.Writable.call(n),n._opts=t,n._body=[],n._headers={},t.auth&&n.setHeader("Authorization","Basic "+new e(t.auth).toString("base64")),Object.keys(t.headers).forEach((function(e){n.setHeader(e,t.headers[e])}));var i=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!o.abortController)i=!1,r=!0;else if("prefer-streaming"===t.mode)r=!1;else if("allow-wrong-content-type"===t.mode)r=!o.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");r=!0}n._mode=l(r,i),n._fetchTimer=null,n.on("finish",(function(){n._onFinish()}))};function p(t){try{var e=t.status;return null!==e&&0!==e}catch(r){return!1}}a(d,u.Writable),d.prototype.setHeader=function(t,e){var r=this,n=t.toLowerCase();-1===m.indexOf(n)&&(r._headers[n]={name:t,value:e})},d.prototype.getHeader=function(t){var e=this._headers[t.toLowerCase()];return e?e.value:null},d.prototype.removeHeader=function(t){var e=this;delete e._headers[t.toLowerCase()]},d.prototype._onFinish=function(){var t=this;if(!t._destroyed){var r=t._opts,a=t._headers,s=null;"GET"!==r.method&&"HEAD"!==r.method&&(s=o.arraybuffer?c(e.concat(t._body)):o.blobConstructor?new n.Blob(t._body.map((function(t){return c(t)})),{type:(a["content-type"]||{}).value||""}):e.concat(t._body).toString());var u=[];if(Object.keys(a).forEach((function(t){var e=a[t].name,r=a[t].value;Array.isArray(r)?r.forEach((function(t){u.push([e,t])})):u.push([e,r])})),"fetch"===t._mode){var f=null;if(o.abortController){var l=new AbortController;f=l.signal,t._fetchAbortController=l,"requestTimeout"in r&&0!==r.requestTimeout&&(t._fetchTimer=n.setTimeout((function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()}),r.requestTimeout))}n.fetch(t._opts.url,{method:t._opts.method,headers:u,body:s||void 0,mode:"cors",credentials:r.withCredentials?"include":"same-origin",signal:f}).then((function(e){t._fetchResponse=e,t._connect()}),(function(e){n.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",e)}))}else{var d=t._xhr=new n.XMLHttpRequest;try{d.open(t._opts.method,t._opts.url,!0)}catch(p){return void i.nextTick((function(){t.emit("error",p)}))}"responseType"in d&&(d.responseType=t._mode.split(":")[0]),"withCredentials"in d&&(d.withCredentials=!!r.withCredentials),"text"===t._mode&&"overrideMimeType"in d&&d.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in r&&(d.timeout=r.requestTimeout,d.ontimeout=function(){t.emit("requestTimeout")}),u.forEach((function(t){d.setRequestHeader(t[0],t[1])})),t._response=null,d.onreadystatechange=function(){switch(d.readyState){case h.LOADING:case h.DONE:t._onXHRProgress();break}},"moz-chunked-arraybuffer"===t._mode&&(d.onprogress=function(){t._onXHRProgress()}),d.onerror=function(){t._destroyed||t.emit("error",new Error("XHR error"))};try{d.send(s)}catch(p){return void i.nextTick((function(){t.emit("error",p)}))}}}},d.prototype._onXHRProgress=function(){var t=this;p(t._xhr)&&!t._destroyed&&(t._response||t._connect(),t._response._onXHRProgress())},d.prototype._connect=function(){var t=this;t._destroyed||(t._response=new f(t._xhr,t._fetchResponse,t._mode,t._fetchTimer),t._response.on("error",(function(e){t.emit("error",e)})),t.emit("response",t._response))},d.prototype._write=function(t,e,r){var n=this;n._body.push(t),r()},d.prototype.abort=d.prototype.destroy=function(){var t=this;t._destroyed=!0,n.clearTimeout(t._fetchTimer),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort()},d.prototype.end=function(t,e,r){var n=this;"function"===typeof t&&(r=t,t=void 0),u.Writable.prototype.end.call(n,t,e,r)},d.prototype.flushHeaders=function(){},d.prototype.setTimeout=function(){},d.prototype.setNoDelay=function(){},d.prototype.setSocketKeepAlive=function(){};var m=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,r("b639").Buffer,r("c8ba"),r("4362"))},"929f":function(t){t.exports=JSON.parse('{"name":"kovan","chainId":42,"networkId":42,"comment":"Parity PoA test network","url":"https://kovan-testnet.github.io/website/","genesis":{"hash":"0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9","timestamp":null,"gasLimit":6000000,"difficulty":131072,"nonce":"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","extraData":"0x","stateRoot":"0x2480155b48a1cea17d67dbfdfaafe821c1d19cdd478c5358e8ec56dec24502b2"},"hardforks":[{"name":"chainstart","block":0,"consensus":"poa","finality":null},{"name":"homestead","block":0,"consensus":"poa","finality":null},{"name":"dao","block":0,"consensus":"poa","finality":null},{"name":"tangerineWhistle","block":0,"consensus":"poa","finality":null},{"name":"spuriousDragon","block":0,"consensus":"poa","finality":null},{"name":"byzantium","block":5067000,"consensus":"poa","finality":null},{"name":"constantinople","block":9200000,"consensus":"poa","finality":null},{"name":"petersburg","block":10255201,"consensus":"poa","finality":null},{"name":"istanbul","block":14111141,"consensus":"poa","finality":null}],"bootstrapNodes":[{"ip":"40.71.221.215","port":30303,"id":"56abaf065581a5985b8c5f4f88bd202526482761ba10be9bfdcd14846dd01f652ec33fde0f8c0fd1db19b59a4c04465681fcef50e11380ca88d25996191c52de","location":"","comment":"Parity Bootnode"},{"ip":"52.166.117.77","port":30303,"id":"d07827483dc47b368eaf88454fb04b41b7452cf454e194e2bd4c14f98a3278fed5d819dbecd0d010407fc7688d941ee1e58d4f9c6354d3da3be92f55c17d7ce3","location":"","comment":"Parity Bootnode"},{"ip":"52.165.239.18","port":30303,"id":"8fa162563a8e5a05eef3e1cd5abc5828c71344f7277bb788a395cce4a0e30baf2b34b92fe0b2dbbba2313ee40236bae2aab3c9811941b9f5a7e8e90aaa27ecba","location":"","comment":"Parity Bootnode"},{"ip":"52.243.47.56","port":30303,"id":"7e2e7f00784f516939f94e22bdc6cf96153603ca2b5df1c7cc0f90a38e7a2f218ffb1c05b156835e8b49086d11fdd1b3e2965be16baa55204167aa9bf536a4d9","location":"","comment":"Parity Bootnode"},{"ip":"40.68.248.100","port":30303,"id":"0518a3d35d4a7b3e8c433e7ffd2355d84a1304ceb5ef349787b556197f0c87fad09daed760635b97d52179d645d3e6d16a37d2cc0a9945c2ddf585684beb39ac","location":"","comment":"Parity Bootnode"}]}')},"92a9":function(t,e,r){"use strict";const n=r("97cc").Buffer,i=r("d485").Transform,o=r("3fb5");t.exports=function(t){function e(e,r,n,o){i.call(this,o),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._options=o,this._state=new t,this._state.initialize(e,r),this._finalized=!1}return o(e,i),e.prototype._transform=function(t,e,r){let n=null;try{this.update(t,e)}catch(i){n=i}r(n)},e.prototype._flush=function(){},e.prototype._read=function(t){this.push(this.squeeze(t))},e.prototype.update=function(t,e){if(!n.isBuffer(t)&&"string"!==typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return n.isBuffer(t)||(t=n.from(t,e)),this._state.absorb(t),this},e.prototype.squeeze=function(t,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(t);return void 0!==e&&(r=r.toString(e)),r},e.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},e.prototype._clone=function(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t},e}},"93a0":function(t,e,r){"use strict";var n=r("17fb"),i=r("39d4").errors,o=r("3667"),a=function(t,e){var r=this;this.responseCallbacks={},this.notificationCallbacks=[],this.path=t,this.connected=!1,this.connection=e.connect({path:this.path}),this.addDefaultEvents();var i=function(t){var e=null;n.isArray(t)?t.forEach((function(t){r.responseCallbacks[t.id]&&(e=t.id)})):e=t.id,e||-1===t.method.indexOf("_subscription")?r.responseCallbacks[e]&&(r.responseCallbacks[e](null,t),delete r.responseCallbacks[e]):r.notificationCallbacks.forEach((function(e){n.isFunction(e)&&e(t)}))};"Socket"===e.constructor.name?o(this.connection).done(i):this.connection.on("data",(function(t){r._parseResponse(t.toString()).forEach(i)}))};a.prototype.addDefaultEvents=function(){var t=this;this.connection.on("connect",(function(){t.connected=!0})),this.connection.on("close",(function(){t.connected=!1})),this.connection.on("error",(function(){t._timeout()})),this.connection.on("end",(function(){t._timeout()})),this.connection.on("timeout",(function(){t._timeout()}))},a.prototype._parseResponse=function(t){var e=this,r=[],n=t.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|");return n.forEach((function(t){e.lastChunk&&(t=e.lastChunk+t);var n=null;try{n=JSON.parse(t)}catch(o){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout((function(){throw e._timeout(),i.InvalidResponse(t)}),15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,n&&r.push(n)})),r},a.prototype._addResponseCallback=function(t,e){var r=t.id||t[0].id,n=t.method||t[0].method;this.responseCallbacks[r]=e,this.responseCallbacks[r].method=n},a.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.InvalidConnection("on IPC")),delete this.responseCallbacks[t])},a.prototype.reconnect=function(){this.connection.connect({path:this.path})},a.prototype.send=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},a.prototype.on=function(t,e){if("function"!==typeof e)throw new Error("The second parameter callback must be a function.");switch(t){case"data":this.notificationCallbacks.push(e);break;default:this.connection.on(t,e);break}},a.prototype.once=function(t,e){if("function"!==typeof e)throw new Error("The second parameter callback must be a function.");this.connection.once(t,e)},a.prototype.removeListener=function(t,e){var r=this;switch(t){case"data":this.notificationCallbacks.forEach((function(t,n){t===e&&r.notificationCallbacks.splice(n,1)}));break;default:this.connection.removeListener(t,e);break}},a.prototype.removeAllListeners=function(t){switch(t){case"data":this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(t);break}},a.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners("error"),this.connection.removeAllListeners("end"),this.connection.removeAllListeners("timeout"),this.addDefaultEvents()},a.prototype.supportsSubscriptions=function(){return!0},t.exports=a},"93e6":function(t,e,r){"use strict";var n=r("8707").Buffer,i=r("d485").Transform,o=r("3fb5");function a(t,e){if(!n.isBuffer(t)&&"string"!==typeof t)throw new TypeError(e+" must be a string or a buffer")}function s(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}o(s,i),s.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(i){n=i}r(n)},s.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(r){e=r}t(e)},s.prototype.update=function(t,e){if(a(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));var r=this._block,i=0;while(this._blockOffset+t.length-i>=this._blockSize){for(var o=this._blockOffset;o0;++s)this._length[s]+=u,u=this._length[s]/4294967296|0,u>0&&(this._length[s]-=4294967296*u);return this},s.prototype._update=function(){throw new Error("_update is not implemented")},s.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},s.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=s},"945d":function(t,e,r){"use strict";var n=r("7d92"),i=r("0cbb"),o=r("f3a3"),a=o.assert,s=o.parseBytes,u=r("380f"),c=r("44a3");function f(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=i[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=f,f.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},f.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S()),a=e.R().add(n.pub().mul(i));return a.eq(o)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=256||parseInt(String(r))!=r)return!1}return!0}function u(t){if(null==t&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:t}),o(t)&&(t=t.toHexString()),"string"===typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);e||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==e[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),t=t.substring(2),t.length%2&&(t="0"+t);for(var r=[],n=0;n>4]+d[15&u])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function m(t){return l(t)&&t.length%2===0?(t.length-2)/2:null}function y(t,e,r){return l(t)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!==0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,e+2*r):"0x"+t.substring(e)}function v(t){l(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});while(t.length>3&&"0x0"===t.substring(0,3))t="0x"+t.substring(3);return t}function b(t,e){l(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});while(t.length<2*e+2)t="0x0"+t.substring(2);return t}function g(t){return t&&null!=t.r&&null!=t.s}function w(t){var e=0,r="0x",n="0x";if(g(t)){null==t.v&&null==t.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:t}),r=b(t.r,32),n=b(t.s,32),e=t.v,"string"===typeof e&&(e=parseInt(e,16));var o=t.recoveryParam;null==o&&null!=t.v&&(o=1-e%2),e=27+o}else{var a=u(t);if(65!==a.length)throw new Error("invalid signature");r=p(a.slice(0,32)),n=p(a.slice(32,64)),e=a[64],27!==e&&28!==e&&(e=27+e%2)}return{r:r,s:n,recoveryParam:e-27,v:e}}function _(t){return t=w(t),p(c([t.r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}e.hexlify=p,e.hexDataLength=m,e.hexDataSlice=y,e.hexStripZeros=v,e.hexZeroPad=b,e.splitSignature=w,e.joinSignature=_},9490:function(t,e,r){(function(t){var n=r("925e"),i=r("c90b"),o=r("53a8"),a=r("8c05"),s=r("0b16"),u=e;u.request=function(e,r){e="string"===typeof e?s.parse(e):o(e);var i=-1===t.location.protocol.search(/^https?:$/)?"http:":"",a=e.protocol||i,u=e.hostname||e.host,c=e.port,f=e.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),e.url=(u?a+"//"+u:"")+(c?":"+c:"")+f,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var h=new n(e);return r&&h.on("response",r),h},u.get=function(t,e){var r=u.request(t,e);return r.end(),r},u.ClientRequest=n,u.IncomingMessage=i.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=a,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,r("c8ba"))},"94ca":function(t,e,r){var n=r("d039"),i=/#|\.prototype\./,o=function(t,e){var r=s[a(t)];return r==c||r!=u&&("function"==typeof e?n(e):!!e)},a=o.normalize=function(t){return String(t).replace(i,".").toLowerCase()},s=o.data={},u=o.NATIVE="N",c=o.POLYFILL="P";t.exports=o},9505:function(t,e,r){(function(e,r){ +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.5.7 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2016 + * @license MIT + */ +(function(){"use strict";var n="object"===typeof window?window:{},i=!n.JS_SHA3_NO_NODE_JS&&"object"===typeof e&&e.versions&&e.versions.node;i&&(n=r);for(var o=!n.JS_SHA3_NO_COMMON_JS&&"object"===typeof t&&t.exports,a="0123456789abcdef".split(""),s=[31,7936,2031616,520093696],u=[1,256,65536,16777216],c=[6,1536,393216,100663296],f=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],l=[224,256,384,512],d=[128,256],p=["hex","buffer","arrayBuffer","array"],m=function(t,e,r){return function(n){return new S(t,e,t).update(n)[r]()}},y=function(t,e,r){return function(n,i){return new S(t,e,i).update(n)[r]()}},v=function(t,e){var r=m(t,e,"hex");r.create=function(){return new S(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}S.prototype.update=function(t){var e="string"!==typeof t;e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));var r,n,i=t.length,o=this.blocks,a=this.byteCount,s=this.blockCount,u=0,c=this.s;while(u>2]|=t[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(o[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<=a){for(this.start=r-a,this.block=o[s],r=0;r>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+a[15&t]+a[t>>12&15]+a[t>>8&15]+a[t>>20&15]+a[t>>16&15]+a[t>>28&15]+a[t>>24&15];s%e===0&&(I(r),o=0)}return i&&(t=r[o],i>0&&(u+=a[t>>4&15]+a[15&t]),i>1&&(u+=a[t>>12&15]+a[t>>8&15]),i>2&&(u+=a[t>>20&15]+a[t>>16&15])),u},S.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);var u=new Uint32Array(t);while(a>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r===0&&I(n)}return o&&(t=s<<2,e=n[a],o>0&&(u[t]=255&e),o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u};var I=function(t){var e,r,n,i,o,a,s,u,c,f,l,d,p,m,y,v,b,g,w,_,A,E,x,M,k,S,I,C,T,U,O,P,R,N,B,j,L,D,F,q,H,z,K,V,G,$,Y,W,Z,J,X,Q,tt,et,rt,nt,it,ot,at,st,ut,ct,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],d=t[8]^t[18]^t[28]^t[38]^t[48],p=t[9]^t[19]^t[29]^t[39]^t[49],e=d^(a<<1|s>>>31),r=p^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(d<<1|p>>>31),r=c^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],y=t[1],$=t[11]<<4|t[10]>>>28,Y=t[10]<<4|t[11]>>>28,C=t[20]<<3|t[21]>>>29,T=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,N=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,b=t[12]<<12|t[13]>>>20,W=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,U=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,j=t[14]<<6|t[15]>>>26,L=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,J=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,I=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,H=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=m^~v&g,t[1]=y^~b&w,t[10]=M^~S&C,t[11]=k^~I&T,t[20]=N^~j&D,t[21]=B^~L&F,t[30]=V^~$&W,t[31]=G^~Y&Z,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=v^~g&_,t[3]=b^~w&A,t[12]=S^~C&U,t[13]=I^~T&O,t[22]=j^~D&q,t[23]=L^~F&H,t[32]=$^~W&J,t[33]=Y^~Z&X,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~_&E,t[5]=w^~A&x,t[14]=C^~U&P,t[15]=T^~O&R,t[24]=D^~q&z,t[25]=F^~H&K,t[34]=W^~J&Q,t[35]=Z^~X&tt,t[44]=ot^~st&ct,t[45]=at^~ut&ft,t[6]=_^~E&m,t[7]=A^~x&y,t[16]=U^~P&M,t[17]=O^~R&k,t[26]=q^~z&N,t[27]=H^~K&B,t[36]=J^~Q&V,t[37]=X^~tt&G,t[46]=st^~ct&et,t[47]=ut^~ft&rt,t[8]=E^~m&v,t[9]=x^~y&b,t[18]=P^~M&S,t[19]=R^~k&I,t[28]=z^~N&j,t[29]=K^~B&L,t[38]=Q^~V&$,t[39]=tt^~G&Y,t[48]=ct^~et&nt,t[49]=ft^~rt&it,t[0]^=h[n],t[1]^=h[n+1]};if(o)t.exports=w;else for(A=0;A<_.length;++A)n[_[A]]=w[_[A]]})()}).call(this,r("4362"),r("c8ba"))},"956a":function(t,e,r){var n=r("1e3c"),i=r("fda6"),o=r("bac2"),a=r("0be8"),s=r("ae84");function u(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return f(t,i.key,i.iv)}function c(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");r=8*a[t].key,n=a[t].iv}var i=s(e,!1,r,n);return h(t,i.key,i.iv)}function f(t,e,r){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function h(t,e,r){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,r);if(a[t])return new n({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}function l(){return Object.keys(a).concat(i.getCiphers())}e.createCipher=e.Cipher=u,e.createCipheriv=e.Cipheriv=f,e.createDecipher=e.Decipher=c,e.createDecipheriv=e.Decipheriv=h,e.listCiphers=e.getCiphers=l},"966d":function(t,e,r){"use strict";(function(e){function r(t,r,n,i){if("function"!==typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,n)}));case 4:return e.nextTick((function(){t.call(null,r,n,i)}));default:o=new Array(s-1),a=0;while(a=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:C(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),p}},t}(t.exports);try{regeneratorRuntime=n}catch(i){Function("r","regeneratorRuntime = r")(n)}},"97cc":function(t,e,r){var n=r("b639"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,r){if("number"===typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.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},a.allocUnsafe=function(t){if("number"!==typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!==typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},"980c":function(t,e,r){(function(e){var n=r("399f"),i=r("3337").ec,o=r("2aee"),a=r("cd91");function s(t,r,i,a,s){var f=o(i);if("ec"===f.type){if("ecdsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong public key type");return u(t,r,f)}if("dsa"===f.type){if("dsa"!==a)throw new Error("wrong public key type");return c(t,r,f)}if("rsa"!==a&&"ecdsa/rsa"!==a)throw new Error("wrong public key type");r=e.concat([s,r]);var h=f.modulus.byteLength(),l=[1],d=0;while(r.length+l.length+2=e)throw new Error("invalid sig")}t.exports=s}).call(this,r("b639").Buffer)},9825:function(t){t.exports=JSON.parse('{"name":"homestead","comment":"Homestead hardfork with protocol and network changes","eip":{"url":"https://eips.ethereum.org/EIPS/eip-606","status":"Final"},"gasConfig":{},"gasPrices":{},"vm":{},"pow":{},"casper":{},"sharding":{}}')},9850:function(t,e){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);function i(t,e){var n=e||0,i=r;return[i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],"-",i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]],i[t[n++]]].join("")}t.exports=i},"98e6":function(t,e,r){"use strict";var n=r("3fb5"),i=r("f576"),o=r("b5ca"),a=r("69f2"),s=r("6430");function u(t){s.call(this,"digest"),this._hash=t}n(u,s),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return t=t.toLowerCase(),"md5"===t?new i:"rmd160"===t||"ripemd160"===t?new o:new u(a(t))}},"9a12":function(t,e,r){"use strict";(function(e){var n=r("5162"),i=r("85b1");function o(t){var e=t;if("string"!==typeof e)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof e+", while padToEven.");return e.length%2&&(e="0"+e),e}function a(t){var e=t.toString(16);return"0x"+e}function s(t){var r=a(t);return new e(o(r.slice(2)),"hex")}function u(t){if("string"!==typeof t)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof t+"'.");return e.byteLength(t,"utf8")}function c(t,e,r){if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof t+"'");if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof e+"'");return e[Boolean(r)?"some":"every"]((function(e){return t.indexOf(e)>=0}))}function f(t){var r=new e(o(i(t).replace(/^0+|0+$/g,"")),"hex");return r.toString("utf8")}function h(t){var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r=0.10.0"},"homepage":"https://github.com/web3-js/WebSocket-Node","keywords":["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],"license":"Apache-2.0","main":"index","name":"@web3-js/websocket","repository":{"type":"git","url":"git+https://github.com/web3-js/WebSocket-Node.git"},"scripts":{"gulp":"gulp","install":"(node-gyp rebuild 2> builderror.log) || (exit 0)","test":"faucet test/unit"},"version":"1.0.30"}')},"9ed3":function(t,e,r){"use strict";var n=r("ae93").IteratorPrototype,i=r("7c73"),o=r("5c6c"),a=r("d44e"),s=r("3f8c"),u=function(){return this};t.exports=function(t,e,r){var c=e+" Iterator";return t.prototype=i(n,{next:o(1,r)}),a(t,c,!1,!0),s[c]=u,t}},"9f9d":function(t,e,r){(function(e){var r;if(e.browser)r="utf-8";else{var n=parseInt(e.version.split(".")[0].slice(1),10);r=n>=6?"utf-8":"binary"}t.exports=r}).call(this,r("4362"))},a00b:function(t,e,r){var n,i,o=r("33a0"),a=r("9850"),s=0,u=0;function c(t,e,r){var c=e&&r||0,f=e||[];t=t||{};var h=t.node||n,l=void 0!==t.clockseq?t.clockseq:i;if(null==h||null==l){var d=o();null==h&&(h=n=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==l&&(l=i=16383&(d[6]<<8|d[7]))}var p=void 0!==t.msecs?t.msecs:(new Date).getTime(),m=void 0!==t.nsecs?t.nsecs:u+1,y=p-s+(m-u)/1e4;if(y<0&&void 0===t.clockseq&&(l=l+1&16383),(y<0||p>s)&&void 0===t.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=p,u=m,i=l,p+=122192928e5;var v=(1e4*(268435455&p)+m)%4294967296;f[c++]=v>>>24&255,f[c++]=v>>>16&255,f[c++]=v>>>8&255,f[c++]=255&v;var b=p/4294967296*1e4&268435455;f[c++]=b>>>8&255,f[c++]=255&b,f[c++]=b>>>24&15|16,f[c++]=b>>>16&255,f[c++]=l>>>8|128,f[c++]=255&l;for(var g=0;g<6;++g)f[c+g]=h[g];return e||a(f)}t.exports=c},a099:function(t,e,r){e.pbkdf2=r("206d"),e.pbkdf2Sync=r("e07b")},a255:function(t,e,r){var n=r("3fb5"),i=r("b672"),o=r("8707").Buffer,a=[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],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t,e,r){return r^t&(e^r)}function f(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 d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function p(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}n(u,i),u.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},u.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0|this._f,m=0|this._g,y=0|this._h,v=0;v<16;++v)e[v]=t.readInt32BE(4*v);for(;v<64;++v)e[v]=p(e[v-2])+e[v-7]+d(e[v-15])+e[v-16]|0;for(var b=0;b<64;++b){var g=y+l(s)+c(s,u,m)+a[b]+e[b]|0,w=h(r)+f(r,n,i)|0;y=m,m=u,u=s,s=o+g|0,o=i,i=n,n=r,r=g+w|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=m+this._g|0,this._h=y+this._h|0},u.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},t.exports=u},a393:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.type=t,this.bubbles=!1,this.cancelable=!1,this.loaded=0,this.lengthComputable=!1,this.total=0}return t}();e.ProgressEvent=n},a3ca:function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n=r("399f");function i(e){if(Array.isArray(e)){for(var r=[],n=0;ne.length)throw new Error("invalid rlp: total length is larger than the data");if(a=e.slice(n,h),0===a.length)throw new Error("invalid rlp, List has a invalid length");while(a.length)s=c(a),u.push(s.data),a=s.remainder;return{data:u,remainder:e.slice(h)}}function f(t){return"0x"===t.slice(0,2)}function h(t){return"string"!==typeof t?t:f(t)?t.slice(2):t}function l(t){if(t<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=t.toString(16);return e.length%2?"0"+e:e}function d(t){return t.length%2?"0"+t:t}function p(e){var r=l(e);return t.from(r,"hex")}function m(e){if(!t.isBuffer(e)){if("string"===typeof e)return f(e)?t.from(d(h(e)),"hex"):t.from(e);if("number"===typeof e)return e?p(e):t.from([]);if(null===e||void 0===e)return t.from([]);if(e instanceof Uint8Array)return t.from(e);if(n.isBN(e))return t.from(e.toArray());throw new Error("invalid type")}return e}e.encode=i,e.decode=s,e.getLength=u}).call(this,r("b639").Buffer)},a62e:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0))return!0;for(var e=0,r=this._supportedHardforks;e=i},t.prototype.activeOnBlock=function(t,e){return this.hardforkIsActiveOnBlock(null,t,e)},t.prototype.hardforkGteHardfork=function(t,e,r){r=void 0!==r?r:{};var n,i=void 0!==r.onlyActive&&r.onlyActive;t=this._chooseHardfork(t,r.onlySupported),n=i?this.activeHardforks(null,r):this.hardforks();for(var o=-1,a=-1,s=0,u=0,c=n;u=a},t.prototype.gteHardfork=function(t,e){return this.hardforkGteHardfork(null,t,e)},t.prototype.hardforkIsActiveOnChain=function(t,e){e=void 0!==e?e:{};var r=void 0!==e.onlySupported&&e.onlySupported;t=this._chooseHardfork(t,r);for(var n=0,i=this.hardforks();n0)return r[r.length-1]["name"];throw new Error("No (supported) active hardfork found")},t.prototype.hardforkBlock=function(t){return t=this._chooseHardfork(t,!1),this._getHardfork(t)["block"]},t.prototype.isHardforkBlock=function(t,e){return e=this._chooseHardfork(e,!1),this.hardforkBlock(e)===t},t.prototype.consensus=function(t){return t=this._chooseHardfork(t),this._getHardfork(t)["consensus"]},t.prototype.finality=function(t){return t=this._chooseHardfork(t),this._getHardfork(t)["finality"]},t.prototype.genesis=function(){return this._chainParams["genesis"]},t.prototype.hardforks=function(){return this._chainParams["hardforks"]},t.prototype.bootstrapNodes=function(){return this._chainParams["bootstrapNodes"]},t.prototype.hardfork=function(){return this._hardfork},t.prototype.chainId=function(){return this._chainParams["chainId"]},t.prototype.chainName=function(){return i.chains["names"][this.chainId()]||this._chainParams["name"]},t.prototype.networkId=function(){return this._chainParams["networkId"]},t}();e.default=a},a691:function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},a6b6:function(t,e,r){var n=r("e943"),i=r("85b1");t.exports=function(t){if("string"===typeof t||"number"===typeof t){var e=new n(1),r=String(t).toLowerCase().trim(),o="0x"===r.substr(0,2)||"-0x"===r.substr(0,3),a=i(r);if("-"===a.substr(0,1)&&(a=i(a.slice(1)),e=new n(-1,10)),a=""===a?"0":a,!a.match(/^-?[0-9]+$/)&&a.match(/^[0-9A-Fa-f]+$/)||a.match(/^[a-fA-F]+$/)||!0===o&&a.match(/^[0-9A-Fa-f]+$/))return new n(a,16).mul(e);if((a.match(/^-?[0-9]+$/)||""===a)&&!1===o)return new n(a,10).mul(e)}else if("object"===typeof t&&t.toString&&!t.pop&&!t.push&&t.toString(10).match(/^-?[0-9]+$/)&&(t.mul||t.dividedToIntegerBy))return new n(t.toString(10),10);throw new Error("[number-to-bn] while converting number "+JSON.stringify(t)+" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.")}},a6ca:function(t,e){(function(){"use strict";function t(e,r,n,i){return this instanceof t?(this.domain=e||void 0,this.path=r||"/",this.secure=!!n,this.script=!!i,this):new t(e,r,n,i)}function r(t,e,n){return t instanceof r?t:this instanceof r?(this.name=null,this.value=null,this.expiration_date=1/0,this.path=String(n||"/"),this.explicit_path=!1,this.domain=e||null,this.explicit_domain=!1,this.secure=!1,this.noscript=!1,t&&this.parse(t,e,n),this):new r(t,e,n)}t.All=Object.freeze(Object.create(null)),e.CookieAccessInfo=t,e.Cookie=r,r.prototype.toString=function(){var t=[this.name+"="+this.value];return this.expiration_date!==1/0&&t.push("expires="+new Date(this.expiration_date).toGMTString()),this.domain&&t.push("domain="+this.domain),this.path&&t.push("path="+this.path),this.secure&&t.push("secure"),this.noscript&&t.push("httponly"),t.join("; ")},r.prototype.toValueString=function(){return this.name+"="+this.value};var n=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;function i(){var t,e,n;return this instanceof i?(t=Object.create(null),this.setCookie=function(i,o,a){var s,u;if(i=new r(i,o,a),s=i.expiration_date<=Date.now(),void 0!==t[i.name]){for(e=t[i.name],u=0;u=0||!r.umod(t.prime1)||!r.umod(t.prime2))r=new n(i(e));return r}t.exports=a,a.getr=s}).call(this,r("b639").Buffer)},a9f1:function(t,e,r){(function(t){e.fetch=s(t.fetch)&&s(t.ReadableStream),e.writableStream=s(t.WritableStream),e.abortController=s(t.AbortController),e.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),e.blobConstructor=!0}catch(u){}var r;function n(){if(void 0!==r)return r;if(t.XMLHttpRequest){r=new t.XMLHttpRequest;try{r.open("GET",t.XDomainRequest?"/":"https://example.com")}catch(u){r=null}}else r=null;return r}function i(t){var e=n();if(!e)return!1;try{return e.responseType=t,e.responseType===t}catch(u){}return!1}var o="undefined"!==typeof t.ArrayBuffer,a=o&&s(t.ArrayBuffer.prototype.slice);function s(t){return"function"===typeof t}e.arraybuffer=e.fetch||o&&i("arraybuffer"),e.msstream=!e.fetch&&a&&i("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&o&&i("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||!!n()&&s(n().overrideMimeType),e.vbArray=s(t.VBArray),r=null}).call(this,r("c8ba"))},aa56:function(t,e,r){"use strict";var n=r("c3c0"),i=n.rotr32;function o(t,e,r,n){return 0===t?a(e,r,n):1===t||3===t?u(e,r,n):2===t?s(e,r,n):void 0}function a(t,e,r){return t&e^~t&r}function s(t,e,r){return t&e^t&r^e&r}function u(t,e,r){return t^e^r}function c(t){return i(t,2)^i(t,13)^i(t,22)}function f(t){return i(t,6)^i(t,11)^i(t,25)}function h(t){return i(t,7)^i(t,18)^t>>>3}function l(t){return i(t,17)^i(t,19)^t>>>10}e.ft_1=o,e.ch32=a,e.maj32=s,e.p32=u,e.s0_256=c,e.s1_256=f,e.g0_256=h,e.g1_256=l},aaa4:function(t,e,r){var n=r("556a"),i=r("d39a"),o=r("320c"),a=r("f9a0"),s=r("4fcc"),u="application/json",c=function(){};function f(t,e,r){if(!t||"string"!==typeof t)throw new TypeError("must specify a URL");if("function"===typeof e&&(r=e,e={}),r&&"function"!==typeof r)throw new TypeError("expected cb to be undefined or a function");r=r||c,e=e||{};var f=e.json?"json":"text";e=o({responseType:f},e);var h=e.headers||{},l=(e.method||"GET").toUpperCase(),d=e.query;return d&&("string"!==typeof d&&(d=n.stringify(d)),t=i(t,d)),"json"===e.responseType&&a(h,"Accept",u),e.json&&"GET"!==l&&"HEAD"!==l&&(a(h,"Content-Type",u),e.body=JSON.stringify(e.body)),e.method=l,e.url=t,e.headers=h,delete e.query,delete e.json,s(e,r)}t.exports=f},aad6:function(t,e){t.exports=function(t){var e=t.fs,r=t.files,n=t.os,i=t.path,o=t.child_process,a=t.mimetype,s=t.defaultArchives,u=t.request,c=t.downloadUrl,f=t.bytes,h=t.hash,l=t.pick,d=function(t){return function(e){return function(r){return r[t]=e,r}}},p=function(t){return function(e){for(var r={},n=0,i=t.length;n0){var a=i.join(r,o);n.push(A(t)(e[o])(a))}return Promise.all(n).then((function(){return r}))}))}}},x=function(t){return function(e){return u("".concat(t,"/bzzr:/"),{body:"string"===typeof e?q(e):e,method:"POST"})}},M=function(t){return function(e){return function(r){return function(n){var i=function i(o){var a="/"===r[0]?r:"/"+r,s="".concat(t,"/bzz:/").concat(e).concat(a),c={method:"PUT",headers:{"Content-Type":n.type},body:n.data};return u(s,c).then((function(t){if(-1!==t.indexOf("error"))throw t;return t})).catch((function(t){return o>0&&i(o-1)}))};return i(3)}}}},k=function(t){return function(e){return I(t)({"":e})}},S=function(t){return function(r){return e.readFile(r).then((function(e){return k(t)({type:a.lookup(r),data:e})}))}},I=function(t){return function(e){return x(t)("{}").then((function(r){var n=function(r){return function(n){return M(t)(n)(r)(e[r])}},i=function(t,e){return t.then(n(e))};return Object.keys(e).reduce(i,Promise.resolve(r))}))}},C=function(t){return function(r){return e.readFile(r).then(x(t))}},T=function(t){return function(n){return function(i){return r.directoryTree(i).then((function(t){return Promise.all(t.map((function(t){return e.readFile(t)}))).then((function(e){var r=t.map((function(t){return t.slice(i.length)})),n=t.map((function(t){return a.lookup(t)||"text/plain"}));return p(r)(e.map((function(t,e){return{type:n[e],data:t}})))}))})).then((function(t){return m(n?{"":t[n]}:{})(t)})).then(I(t))}}},U=function(t){return function(e){if("data"===e.pick)return l.data().then(x(t));if("file"===e.pick)return l.file().then(k(t));if("directory"===e.pick)return l.directory().then(I(t));if(e.path)switch(e.kind){case"data":return C(t)(e.path);case"file":return S(t)(e.path);case"directory":return T(t)(e.defaultFile)(e.path)}else{if(e.length||"string"===typeof e)return x(t)(e);if(e instanceof Object)return I(t)(e)}return Promise.reject(new Error("Bad arguments"))}},O=function(t){return function(e){return function(r){return L(t)(e).then((function(n){return n?r?E(t)(e)(r):_(t)(e):r?A(t)(e)(r):b(t)(e)}))}}},P=function(t,e){var i=n.platform().replace("win32","windows")+"-"+("x64"===n.arch()?"amd64":"386"),o=(e||s)[i],a=c+o.archive+".tar.gz",u=o.archiveMD5,f=o.binaryMD5;return r.safeDownloadArchived(a)(u)(f)(t)},R=function(t){return new Promise((function(e,r){var n=o.spawn,i=function(t){return function(e){return-1!==(""+e).indexOf(t)}},a=t.account,s=t.password,u=t.dataDir,c=t.ensApi,f=t.privateKey,h=0,l=1,d=2,p="Passphrase",m="Swarm http proxy started",y=h,v=n(t.binPath,["--bzzaccount",a||f,"--datadir",u,"--ens-api",c]),b=function(t){y===h&&i(p)(t)?setTimeout((function(){y=l,v.stdin.write(s+"\n")}),500):i(m)(t)&&(y=d,clearTimeout(w),e(v))};v.stdout.on("data",b),v.stderr.on("data",b);var g=function(){return r(new Error("Couldn't start swarm process."))},w=setTimeout(g,2e4)}))},N=function(t){return new Promise((function(e,r){t.stderr.removeAllListeners("data"),t.stdout.removeAllListeners("data"),t.stdin.removeAllListeners("error"),t.removeAllListeners("error"),t.removeAllListeners("exit"),t.kill("SIGINT");var n=setTimeout((function(){return t.kill("SIGKILL")}),8e3);t.once("close",(function(){clearTimeout(n),e()}))}))},B=function(t){return function(e){return j("http://localhost:8500").then((function(r){return r?e(H("http://localhost:8500")).then((function(){})):P(t.binPath,t.archives).onData((function(e){return(t.onProgress||function(){})(e.length)})).then((function(){return R(t)})).then((function(t){return e(H("http://localhost:8500")).then((function(){return t}))})).then(N)}))}},j=function(t){var e="test",r="c9a99c7d326dcc6316f32fe2625b311f6dc49a175e6877681ded93137d3569e7";return x(t)(e).then((function(t){return t===r})).catch((function(){return!1}))},L=function(t){return function(e){return b(t)(e).then((function(t){try{return!!JSON.parse(F(t)).entries}catch(e){return!1}}))}},D=function(t){return function(e,r,n,i,o){var a;return"undefined"!==typeof e&&(a=t(e)),"undefined"!==typeof r&&(a=t(r)),"undefined"!==typeof n&&(a=t(n)),"undefined"!==typeof i&&(a=t(i)),"undefined"!==typeof o&&(a=t(o)),a}},F=function(t){return f.toString(f.fromUint8Array(t))},q=function(t){return f.toUint8Array(f.fromString(t))},H=function(t){return{download:function(e,r){return O(t)(e)(r)},downloadData:D(b(t)),downloadDataToDisk:D(A(t)),downloadDirectory:D(_(t)),downloadDirectoryToDisk:D(E(t)),downloadEntries:D(g(t)),downloadRoutes:D(w(t)),isAvailable:function(){return j(t)},upload:function(e){return U(t)(e)},uploadData:D(x(t)),uploadFile:D(k(t)),uploadFileFromDisk:D(k(t)),uploadDataFromDisk:D(C(t)),uploadDirectory:D(I(t)),uploadDirectoryFromDisk:D(T(t)),uploadToManifest:D(M(t)),pick:l,hash:h,fromString:q,toString:F}};return{at:H,local:B,download:O,downloadBinary:P,downloadData:b,downloadDataToDisk:A,downloadDirectory:_,downloadDirectoryToDisk:E,downloadEntries:g,downloadRoutes:w,isAvailable:j,startProcess:R,stopProcess:N,upload:U,uploadData:x,uploadDataFromDisk:C,uploadFile:k,uploadFileFromDisk:S,uploadDirectory:I,uploadDirectoryFromDisk:T,uploadToManifest:M,pick:l,hash:h,fromString:q,toString:F}}},ab7e:function(t,e,r){"use strict";var n=r("f1ee"),i=r("4923").subscriptions,o=r("6248"),a=r("ae52"),s=function(){var t=this;n.packageInit(this,arguments);var e=this.setProvider;this.setProvider=function(){e.apply(t,arguments),t.net.setProvider.apply(t,arguments)},this.net=new a(this.currentProvider),[new i({name:"subscribe",type:"shh",subscriptions:{messages:{params:1}}}),new o({name:"getVersion",call:"shh_version",params:0}),new o({name:"getInfo",call:"shh_info",params:0}),new o({name:"setMaxMessageSize",call:"shh_setMaxMessageSize",params:1}),new o({name:"setMinPoW",call:"shh_setMinPoW",params:1}),new o({name:"markTrustedPeer",call:"shh_markTrustedPeer",params:1}),new o({name:"newKeyPair",call:"shh_newKeyPair",params:0}),new o({name:"addPrivateKey",call:"shh_addPrivateKey",params:1}),new o({name:"deleteKeyPair",call:"shh_deleteKeyPair",params:1}),new o({name:"hasKeyPair",call:"shh_hasKeyPair",params:1}),new o({name:"getPublicKey",call:"shh_getPublicKey",params:1}),new o({name:"getPrivateKey",call:"shh_getPrivateKey",params:1}),new o({name:"newSymKey",call:"shh_newSymKey",params:0}),new o({name:"addSymKey",call:"shh_addSymKey",params:1}),new o({name:"generateSymKeyFromPassword",call:"shh_generateSymKeyFromPassword",params:1}),new o({name:"hasSymKey",call:"shh_hasSymKey",params:1}),new o({name:"getSymKey",call:"shh_getSymKey",params:1}),new o({name:"deleteSymKey",call:"shh_deleteSymKey",params:1}),new o({name:"newMessageFilter",call:"shh_newMessageFilter",params:1}),new o({name:"getFilterMessages",call:"shh_getFilterMessages",params:1}),new o({name:"deleteMessageFilter",call:"shh_deleteMessageFilter",params:1}),new o({name:"post",call:"shh_post",params:1,inputFormatter:[null]}),new o({name:"unsubscribe",call:"shh_unsubscribe",params:1})].forEach((function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)}))};s.prototype.clearSubscriptions=function(){this._requestManager.clearSubscriptions()},n.addProviders(s),t.exports=s},abeb:function(t,e,r){var n,i;(function(r,o){n=[],i=function(){return o()}.apply(e,n),void 0===i||(t.exports=i)})(0,(function(){var t=[new Uint32Array([2157250,2157314,2157378,2157442,2157506,2157570,2157634,0,2157698,2157762,2157826,2157890,2157954,0,2158018,0]),new Uint32Array([2179041,6291456,2179073,6291456,2179105,6291456,2179137,6291456,2179169,6291456,2179201,6291456,2179233,6291456,2179265,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([0,2113729,2197345,2197377,2113825,2197409,2197441,2113921,2197473,2114017,2197505,2197537,2197569,2197601,2197633,2197665]),new Uint32Array([6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,23068672,23068672,23068672,0,0,0,0,23068672]),new Uint32Array([14680064,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,14680064,14680064]),new Uint32Array([2196001,2196033,2196065,2196097,2196129,2196161,2196193,2196225,2196257,2196289,2196321,2196353,2196385,2196417,2196449,2196481]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,6291456,0,0,0,0,0]),new Uint32Array([2097281,2105921,2097729,2106081,0,2097601,2162337,2106017,2133281,2097505,2105889,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([2177025,6291456,2177057,6291456,2177089,6291456,2177121,6291456,2177153,6291456,2177185,6291456,2177217,6291456,2177249,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,0,6291456,6291456,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456]),new Uint32Array([2134435,2134531,2134627,2134723,2134723,2134819,2134819,2134915,2134915,2135011,2105987,2135107,2135203,2135299,2131587,2135395]),new Uint32Array([0,0,0,0,0,0,0,6291456,2168673,2169249,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2147906,2147970,2148034,2148098,2148162,2148226,2148290,2148354,2147906,2147970,2148034,2148098,2148162,2148226,2148290,2148354]),new Uint32Array([2125219,2125315,2152834,2152898,2125411,2152962,2153026,2125506,2125507,2125603,2153090,2153154,2153218,2153282,2153346,2105348]),new Uint32Array([2203393,6291456,2203425,6291456,2203457,6291456,2203489,6291456,6291456,6291456,6291456,2203521,6291456,2181281,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,6291456,2145538,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,6291456]),new Uint32Array([2139426,2160834,2160898,2160962,2134242,2161026,2161090,2161154,2161218,2161282,2161346,2161410,2138658,2161474,2161538,2134722]),new Uint32Array([2119939,2124930,2125026,2106658,2125218,2128962,2129058,2129154,2129250,2129346,2129442,2108866,2108770,2150466,2150530,2150594]),new Uint32Array([2201601,6291456,2201633,6291456,2201665,6291456,2201697,6291456,2201729,6291456,2201761,6291456,2201793,6291456,2201825,6291456]),new Uint32Array([2193537,2193569,2193601,2193633,2193665,2193697,2193729,2193761,2193793,2193825,2193857,2193889,2193921,2193953,2193985,2194017]),new Uint32Array([6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2190561,6291456,2190593,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2190625,6291456,2190657,6291456,23068672]),new Uint32Array([2215905,2215937,2215969,2216001,2216033,2216065,2216097,2216129,2216161,2216193,2216225,2216257,2105441,2216289,2216321,2216353]),new Uint32Array([23068672,18884130,23068672,23068672,23068672,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2191233,2191265,2191297,2191329,2191361,2191393,2191425,2117377,2191457,2191489,2191521,2191553,2191585,2191617,2191649,2117953]),new Uint32Array([2132227,2132323,2132419,2132419,2132515,2132515,2132611,2132707,2132707,2132803,2132899,2132899,2132995,2132995,2133091,2133187]),new Uint32Array([0,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,6291456,0,0]),new Uint32Array([2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,10609889,10610785,10609921,10610817,2222241]),new Uint32Array([6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0]),new Uint32Array([2219969,2157121,2157441,2157505,2157889,2157953,2220001,2158465,2158529,10575617,2156994,2157058,2129923,2130019,2157122,2157186]),new Uint32Array([6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2185249,6291456,2185281,6291456,2185313,6291456,2185345,6291456,2185377,6291456,2185409,6291456,2185441,6291456,2185473,6291456]),new Uint32Array([0,0,0,0,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,0,0,23068672,23068672,23068672,6291456,0]),new Uint32Array([2183361,6291456,2183393,6291456,2183425,6291456,2183457,6291456,2183489,6291456,2183521,6291456,2183553,6291456,2183585,6291456]),new Uint32Array([2192161,2192193,2192225,2192257,2192289,2192321,2192353,2192385,2192417,2192449,2192481,2192513,2192545,2192577,2192609,2192641]),new Uint32Array([2212001,2212033,2212065,2212097,2212129,2212161,2212193,2212225,2212257,2212289,2212321,2212353,2212385,2212417,2212449,2207265]),new Uint32Array([2249825,2249857,2249889,2249921,2249954,2250018,2250082,2250145,2250177,2250209,2250241,2250274,2250337,2250370,2250433,2250465]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2147905,2147969,2148033,2148097,2148161,2148225,2148289,2148353]),new Uint32Array([10485857,6291456,2197217,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,23068672,23068672]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2180353,2180385,2144033,2180417,2180449,2180481,2180513,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,10610209,10610465,10610241,10610753,10609857]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,0,0]),new Uint32Array([2223842,2223906,2223970,2224034,2224098,2224162,2224226,2224290,2224354,2224418,2224482,2224546,2224610,2224674,2224738,2224802]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([23068672,23068672,23068672,18923650,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,18923714,23068672,23068672]),new Uint32Array([2126179,2125538,2126275,2126371,2126467,2125634,2126563,2105603,2105604,2125346,2126659,2126755,2126851,2098179,2098181,2098182]),new Uint32Array([2227426,2227490,2227554,2227618,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2192353,2240642,2240642,2240705,2240737,2240737,2240769,2240802,2240866,2240929,2240961,2240993,2241025,2241057,2241089,2241121]),new Uint32Array([6291456,2170881,2170913,2170945,6291456,2170977,6291456,2171009,2171041,6291456,6291456,6291456,2171073,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2132226,2132514,2163586,2132610,2160386,2133090,2133186,2160450,2160514,2160578,2133570,2106178,2160642,2133858,2160706,2160770]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,10532162,10532226,10532290,10532354,10532418,10532482,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,23068672]),new Uint32Array([2098209,2108353,2108193,2108481,2170241,2111713,2105473,2105569,2105601,2112289,2112481,2098305,2108321,0,0,0]),new Uint32Array([2209121,2209153,2209185,2209217,2209249,2209281,2209313,2209345,2209377,2209409,2209441,2209473,2207265,2209505,2209537,2209569]),new Uint32Array([2189025,6291456,2189057,6291456,2189089,6291456,2189121,6291456,2189153,6291456,2189185,6291456,2189217,6291456,2189249,6291456]),new Uint32Array([2173825,2153473,2173857,2173889,2173921,2173953,2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233057]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2165764,2140004]),new Uint32Array([2215105,6291456,2215137,6291456,6291456,2215169,2215201,6291456,6291456,6291456,2215233,2215265,2215297,2215329,2215361,2215393]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,23068672,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([10505091,10505187,10505283,10505379,10505475,10505571,10505667,10505763,10505859,10505955,10506051,10506147,10506243,10506339,10506435,10506531]),new Uint32Array([2229730,2229794,2229858,2229922,2229986,2230050,2230114,2230178,2230242,2230306,2230370,2230434,2230498,2230562,2230626,2230690]),new Uint32Array([2105505,2098241,2108353,2108417,2105825,0,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177]),new Uint32Array([6291456,6291456,6291456,6291456,10502115,10502178,10502211,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456]),new Uint32Array([2190305,6291456,2190337,6291456,2190369,6291456,2190401,6291456,2190433,6291456,2190465,6291456,2190497,6291456,2190529,6291456]),new Uint32Array([2173793,2173985,2174017,6291456,2173761,2173697,6291456,2174689,6291456,2174017,2174721,6291456,6291456,2174753,2174785,2174817]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2099521,2099105,2120705,2098369,2120801,2103361,2097985,2098433,2121377,2121473,2099169,2099873,2098401,2099393,2152609,2100033]),new Uint32Array([2132898,2163842,2163906,2133282,2132034,2131938,2137410,2132802,2132706,2164866,2133282,2160578,2165186,2165186,6291456,6291456]),new Uint32Array([10500003,10500099,10500195,10500291,10500387,10500483,10500579,10500675,10500771,10500867,10500963,10501059,10501155,10501251,10501347,10501443]),new Uint32Array([2163458,2130978,2131074,2131266,2131362,2163522,2160130,2132066,2131010,2131106,2106018,2131618,2131298,2132034,2131938,2137410]),new Uint32Array([2212961,2116993,2212993,2213025,2213057,2213089,2213121,2213153,2213185,2213217,2213249,2209633,2213281,2213313,2213345,2213377]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2113729,2113825,2113921,2114017,2114113,2114209,2114305,2114401,2114497,2114593,2114689,2114785,2114881,2114977,2115073,2115169]),new Uint32Array([2238177,2238209,2238241,2238273,2238305,2238337,2238337,2217537,2238369,2238401,2238433,2238465,2215649,2238497,2238529,2238561]),new Uint32Array([2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905]),new Uint32Array([6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,0]),new Uint32Array([6291456,0,6291456,2145026,0,6291456,2145090,0,6291456,6291456,0,0,23068672,0,23068672,23068672]),new Uint32Array([2099233,2122017,2200673,2098113,2121537,2103201,2200705,2104033,2121857,2121953,2122401,2099649,2099969,2123009,2100129,2100289]),new Uint32Array([6291456,23068672,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,23068672,23068672,0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0]),new Uint32Array([2187681,2187713,2187745,2187777,2187809,2187841,2187873,2187905,2187937,2187969,2188001,2188033,2188065,2188097,2188129,2188161]),new Uint32Array([0,10554498,10554562,10554626,10554690,10554754,10554818,10554882,10554946,10555010,10555074,6291456,6291456,0,0,0]),new Uint32Array([2235170,2235234,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0]),new Uint32Array([2181153,6291456,2188897,6291456,6291456,2188929,6291456,6291456,6291456,6291456,6291456,6291456,2111905,2100865,2188961,2188993]),new Uint32Array([2100833,2100897,0,0,2101569,2101697,2101825,2101953,2102081,2102209,10575617,2187041,10502177,10489601,10489697,2112289]),new Uint32Array([6291456,2172833,6291456,2172865,2172897,2172929,2172961,6291456,2172993,6291456,2173025,6291456,2173057,6291456,2173089,6291456]),new Uint32Array([6291456,0,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,0,0,23068672,6291456,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,2190721]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,23068672,6291456,6291456]),new Uint32Array([2184993,6291456,2185025,6291456,2185057,6291456,2185089,6291456,2185121,6291456,2185153,6291456,2185185,6291456,2185217,6291456]),new Uint32Array([2115265,2115361,2115457,2115553,2115649,2115745,2115841,2115937,2116033,2116129,2116225,2116321,2150658,2150722,2200225,6291456]),new Uint32Array([2168321,6291456,2168353,6291456,2168385,6291456,2168417,6291456,2168449,6291456,2168481,6291456,2168513,6291456,2168545,6291456]),new Uint32Array([23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,0,6291456,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,2186625,0,0,6291456,6291456,2186657,2186689,2186721,2173505,0,10496067,10496163,10496259]),new Uint32Array([2178785,6291456,2178817,6291456,2178849,6291456,2178881,6291456,2178913,6291456,2178945,6291456,2178977,6291456,2179009,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0]),new Uint32Array([2097152,0,0,0,2097152,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,2197857,2197889,2197921,2197953,2197985,2198017,0,0,2198049,2198081,2198113,2198145,2198177,2198209]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2098209,2167297,2111137,6291456]),new Uint32Array([2171393,6291456,2171425,6291456,2171457,6291456,2171489,6291456,2171521,6291456,2171553,6291456,2171585,6291456,2171617,6291456]),new Uint32Array([2206753,2206785,2195457,2206817,2206849,2206881,2206913,2197153,2197153,2206945,2117857,2206977,2207009,2207041,2207073,2207105]),new Uint32Array([0,0,0,0,0,0,0,23068672,0,0,0,0,2144834,2144898,0,2144962]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,23068672]),new Uint32Array([2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,0,2105505,2098241]),new Uint32Array([6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,2202049,6291456,2202081,6291456,2202113,6291456,2202145,6291456,2202177,6291456,2202209,6291456,2202241,6291456]),new Uint32Array([10501155,10501251,10501347,10501443,10501539,10501635,10501731,10501827,10501923,10502019,2141731,2105505,2098177,2155586,2166530,0]),new Uint32Array([2102081,2102209,2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,2100833,2100737,2098337,2101441]),new Uint32Array([2146882,2146946,2147010,2147074,2147138,2147202,2147266,2147330,2146882,2146946,2147010,2147074,2147138,2147202,2147266,2147330]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([10502307,10502403,10502499,10502595,10502691,10502787,10502883,10502979,10503075,10503171,10503267,10503363,10503459,10503555,10503651,10503747]),new Uint32Array([2179937,2179969,2180001,2180033,2156545,2180065,2156577,2180097,2180129,2180161,2180193,2180225,2180257,2180289,2156737,2180321]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,0,0,0,6291456,0,0,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0]),new Uint32Array([2227682,2227746,2227810,2227874,2227938,2228002,2228066,2228130,2228194,2228258,2228322,2228386,2228450,2228514,2228578,2228642]),new Uint32Array([2105601,2169121,2108193,2170049,2181025,2181057,2112481,2108321,2108289,2181089,2170497,2100865,2181121,2173601,2173633,2173665]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2180641,6291456,6291456,6291456]),new Uint32Array([0,6291456,6291456,6291456,0,6291456,0,6291456,0,0,6291456,6291456,0,6291456,6291456,6291456]),new Uint32Array([2178273,6291456,2178305,6291456,2178337,6291456,2178369,6291456,2178401,6291456,2178433,6291456,2178465,6291456,2178497,6291456]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,6291456,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,14680064,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456]),new Uint32Array([2237377,2237409,2236225,2237441,2237473,2217441,2215521,2215553,2217473,2237505,2237537,2209697,2237569,2215585,2237601,2237633]),new Uint32Array([2221985,2165601,2165601,2165665,2165665,2222017,2222017,2165729,2165729,2158913,2158913,2158913,2158913,2097281,2097281,2105921]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2149634,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2176897,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,2176929,6291456,2176961,6291456,2176993,6291456]),new Uint32Array([2172641,6291456,2172673,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2172705,2172737,6291456,2172769,2172801,6291456]),new Uint32Array([2099173,2104196,2121667,2099395,2121763,2152258,2152322,2098946,2152386,2121859,2121955,2099333,2122051,2104324,2099493,2122147]),new Uint32Array([6291456,6291456,6291456,2145794,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,2145858,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,0,0,6291456,0]),new Uint32Array([0,2105921,2097729,0,2097377,0,0,2106017,0,2097505,2105889,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2239074,2239138,2239201,2239233,2239265,2239297,2239329,2239361,0,2239393,2239425,2239425,2239458,2239521,2239553,2209569]),new Uint32Array([14680064,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,6291456,23068672]),new Uint32Array([2108321,2108289,2113153,2098209,2180897,2180929,2180961,2111137,2098241,2108353,2170241,2170273,2180993,2105825,6291456,2105473]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2146114,6291456,6291456,6291456,0,0,0]),new Uint32Array([2105921,2105921,2105921,2222049,2222049,2130977,2130977,2130977,2130977,2160065,2160065,2160065,2160065,2097729,2097729,2097729]),new Uint32Array([2218145,2214785,2207937,2218177,2218209,2192993,2210113,2212769,2218241,2218273,2216129,2218305,2216161,2218337,2218369,2218401]),new Uint32Array([0,0,0,2156546,2156610,2156674,2156738,2156802,0,0,0,0,0,2156866,23068672,2156930]),new Uint32Array([23068672,23068672,23068672,0,0,0,0,23068672,23068672,0,0,23068672,23068672,23068672,0,0]),new Uint32Array([2213409,2213441,2213473,2213505,2213537,2213569,2213601,2213633,2213665,2195681,2213697,2213729,2213761,2213793,2213825,2213857]),new Uint32Array([2100033,2099233,2122017,2200673,2098113,2121537,2103201,2200705,2104033,2121857,2121953,2122401,2099649,2099969,2123009,2100129]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2201857,6291456,2201889,6291456,2201921,6291456,2201953,6291456,2201985,6291456,2202017,6291456,2176193,2176257,23068672,23068672]),new Uint32Array([6291456,6291456,23068672,23068672,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2188193,2188225,2188257,2188289,2188321,2188353,2188385,2188417,2188449,2188481,2188513,2188545,2188577,2188609,2188641,0]),new Uint32Array([10554529,2221089,0,10502113,10562017,10537921,10538049,2221121,2221153,0,0,0,0,0,0,0]),new Uint32Array([2213889,2213921,2213953,2213985,2214017,2214049,2214081,2194177,2214113,2214145,2214177,2214209,2214241,2214273,2214305,2214337]),new Uint32Array([2166978,2167042,2099169,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2180545,6291456,6291456,6291456]),new Uint32Array([10518915,10519011,10519107,10519203,2162242,2162306,2159554,2162370,2159362,2159618,2105922,2162434,2159746,2162498,2159810,2159874]),new Uint32Array([2161730,2161794,2135586,2161858,2161922,2137186,2131810,2160290,2135170,2161986,2137954,2162050,2162114,2162178,10518723,10518819]),new Uint32Array([10506627,10506723,10506819,10506915,10507011,10507107,10507203,10507299,10507395,10507491,10507587,10507683,10507779,10507875,10507971,10508067]),new Uint32Array([6291456,23068672,23068672,23068672,0,23068672,23068672,0,0,0,0,0,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0]),new Uint32Array([2175873,2175905,2175937,2175969,2176001,2176033,2176065,2176097,2176129,2176161,2176193,2176225,2176257,2176289,2176321,2176353]),new Uint32Array([2140006,2140198,2140390,2140582,2140774,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,23068672,23068672,23068672]),new Uint32Array([2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241]),new Uint32Array([0,23068672,0,0,0,0,0,0,0,2145154,2145218,2145282,6291456,0,2145346,0]),new Uint32Array([0,0,0,0,10531458,10495395,2148545,2143201,2173473,2148865,2173505,0,2173537,0,2173569,2149121]),new Uint32Array([10537282,10495683,2148738,2148802,2148866,0,6291456,2148930,2186593,2173473,2148737,2148865,2148802,10495779,10495875,10495971]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2215425,2215457,2215489,2215521,2215553,2215585,2215617,2215649,2215681,2215713,2215745,2215777,2192033,2215809,2215841,2215873]),new Uint32Array([2242049,2242081,2242113,2242145,2242177,2242209,2242241,2242273,2215937,2242305,2242338,2242401,2242433,2242465,2242497,2216001]),new Uint32Array([10554529,2221089,0,0,10562017,10502113,10538049,10537921,2221185,10489601,10489697,10609889,10609921,2141729,2141793,10610273]),new Uint32Array([2141923,2142019,2142115,2142211,2142307,2142403,2142499,2142595,2142691,0,0,0,0,0,0,0]),new Uint32Array([0,2221185,2221217,10609857,10609857,10489601,10489697,10609889,10609921,2141729,2141793,2221345,2221377,2221409,2221441,2187105]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,18923970,23068672,23068672,23068672,0,6291456,6291456]),new Uint32Array([2183105,6291456,2183137,6291456,2183169,6291456,2183201,6291456,2183233,6291456,2183265,6291456,2183297,6291456,2183329,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([2134434,2134818,2097666,2097186,2097474,2097698,2105986,2131586,2132450,2131874,2131778,2135970,2135778,2161602,2136162,2161666]),new Uint32Array([2236865,2236897,2236930,2236993,2237025,2235681,2237058,2237121,2237153,2237185,2237217,2217281,2237250,2191233,2237313,2237345]),new Uint32Array([2190049,6291456,2190081,6291456,2190113,6291456,2190145,6291456,2190177,6291456,2190209,6291456,2190241,6291456,2190273,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2101922,2102050,2102178,2102306,10498755,10498851,10498947,10499043,10499139,10499235,10499331,10499427,10499523,10489604,10489732,10489860]),new Uint32Array([2166914,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2181601,2170561,2181633,2181665,2170753,2181697,2172897,2170881,2181729,2170913,2172929,2113441,2181761,2181793,2171009,2173761]),new Uint32Array([0,2105921,2097729,2106081,0,2097601,2162337,2106017,2133281,2097505,0,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([2248001,2248033,2248066,2248130,2248193,2248226,2248289,2248322,2248385,2248417,2216673,2248450,2248514,2248577,2248610,2248673]),new Uint32Array([6291456,6291456,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,0,0,0]),new Uint32Array([2169729,6291456,2169761,6291456,2169793,6291456,2169825,6291456,2169857,2169889,6291456,2169921,6291456,2143329,6291456,2098305]),new Uint32Array([2162178,2163202,2163266,2135170,2136226,2161986,2137954,2159426,2159490,2163330,2159554,2163394,2159682,2139522,2136450,2159746]),new Uint32Array([2173953,2173985,0,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2174209,2174241,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,4271169,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2174273]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,0,0,0,0,0,0,0,6291456,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,2190785,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2189793,6291456,2189825,6291456,2189857,6291456,2189889,6291456,2189921,6291456,2189953,6291456,2189985,6291456,2190017,6291456]),new Uint32Array([2105601,2112289,2108193,2112481,2112577,0,2098305,2108321,2108289,2100865,2113153,2108481,2113345,0,2098209,2111137]),new Uint32Array([2172129,6291456,2172161,6291456,2172193,6291456,2172225,6291456,2172257,6291456,2172289,6291456,2172321,6291456,2172353,6291456]),new Uint32Array([2214753,6291456,2214785,6291456,6291456,2214817,2214849,2214881,2214913,2214945,2214977,2215009,2215041,2215073,2194401,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([0,0,0,0,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([10610305,10610337,10575617,2221761,10610401,10610433,10502177,0,10610465,10610497,10610529,10610561,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,23068672,0,0,0,0,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2187105,2187137,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2199393,2199425,2199457,2199489,2199521,2199553,2199585,2199617,2199649,2199681,2199713,2199745,2199777,2199809,2199841,0]),new Uint32Array([2217249,2217281,2217313,2217345,2217377,2217409,2217441,2217473,2215617,2217505,2217537,2217569,2214753,2217601,2217633,2217665]),new Uint32Array([2170273,2170305,6291456,2170337,2170369,6291456,2170401,2170433,2170465,6291456,6291456,6291456,2170497,2170529,6291456,2170561]),new Uint32Array([2188673,6291456,2188705,2188737,2188769,6291456,6291456,2188801,6291456,2188833,6291456,2188865,6291456,2180929,2181505,2180897]),new Uint32Array([10489988,10490116,10490244,10490372,10490500,10490628,10490756,10490884,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2147393,2147457,2147521,2147585,2147649,2147713,2147777,2147841]),new Uint32Array([23068672,23068672,0,23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2241153,2241185,2241217,2215809,2241250,2241313,2241345,2241377,2217921,2241377,2241409,2215873,2241441,2241473,2241505,2241537]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2220417,2220417,2220449,2220449,2220481,2220481,2220513,2220513,2220545,2220545,2220577,2220577,2220609,2220609,2220641,2220641]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,2144002,0,6291456,6291456,0,0,6291456,6291456,6291456]),new Uint32Array([2167105,2167137,2167169,2167201,2167233,2167265,2167297,2167329,2167361,2167393,2167425,2167457,2167489,2167521,2167553,2167585]),new Uint32Array([10575521,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193]),new Uint32Array([2234146,2234210,2234274,2234338,2234402,2234466,2234530,2234594,2234658,2234722,2234786,2234850,2234914,2234978,2235042,2235106]),new Uint32Array([0,0,0,0,0,0,0,2180577,0,0,0,0,0,2180609,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,0,0,6291456,6291456]),new Uint32Array([2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2242529,2242561,2242593,2242625,2242657,2242689,2242721,2242753,2207937,2218177,2242785,2242817,2242849,2242882,2242945,2242977]),new Uint32Array([2118049,2105345,2118241,2105441,2118433,2118529,2118625,2118721,2118817,2200257,2200289,2191809,2200321,2200353,2200385,2200417]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([2185505,6291456,2185537,6291456,2185569,6291456,2185601,6291456,2185633,6291456,2185665,6291456,2185697,6291456,2185729,6291456]),new Uint32Array([2231970,2232034,2232098,2232162,2232226,2232290,2232354,2232418,2232482,2232546,2232610,2232674,2232738,2232802,2232866,2232930]),new Uint32Array([2218625,2246402,2246466,2246530,2246594,2246657,2246689,2246689,2218657,2219681,2246721,2246753,2246785,2246818,2246881,2208481]),new Uint32Array([2197025,2197057,2197089,2197121,2197153,2197185,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2219137,2216961,2219169,2219201,2219233,2219265,2219297,2217025,2215041,2219329,2217057,2219361,2217089,2219393,2197153,2219426]),new Uint32Array([23068672,23068672,23068672,0,0,0,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713]),new Uint32Array([2243522,2243585,2243617,2243649,2243681,2210113,2243713,2243746,2243810,2243874,2243937,2243970,2244033,2244065,2244097,2244129]),new Uint32Array([2178017,6291456,2178049,6291456,2178081,6291456,2178113,6291456,2178145,6291456,2178177,6291456,2178209,6291456,2178241,6291456]),new Uint32Array([10553858,2165314,10518722,6291456,10518818,0,10518914,2130690,10519010,2130786,10519106,2130882,10519202,2165378,10554050,2165506]),new Uint32Array([0,0,2135491,2135587,2135683,2135779,2135875,2135971,2135971,2136067,2136163,2136259,2136355,2136355,2136451,2136547]),new Uint32Array([23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2220033,2220033,2220065,2220065,2220065,2220065,2220097,2220097,2220097,2220097,2220129,2220129,2220129,2220129,2220161,2220161]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2100897,2100898,2100899,2150018,2100865,2100866,2100867,2100868,2150082,2108481,2109858,2109859,2105569,2105505,2098241,2105601]),new Uint32Array([2097217,2097505,2097505,2097505,2097505,2165570,2165570,2165634,2165634,2165698,2165698,2097858,2097858,0,0,2097152]),new Uint32Array([23068672,6291456,23068672,23068672,23068672,6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,23068672,23068672]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([10503843,10503939,10504035,10504131,10504227,10504323,10504419,10504515,10504611,10504707,10504803,10504899,10504995,10491140,10491268,0]),new Uint32Array([2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2173761,2174017,2174049]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2134145,2097153,2134241,2105953,2132705,2130977,2160065,2131297,2162049,2133089,2160577,2133857,2235297,2220769,2235329,2235361]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2222401,2222433,2222465,10531394,2222497,2222529,2222561,0,2222593,2222625,2222657,2222689,2222721,2222753,2222785,0]),new Uint32Array([2184481,6291456,2184513,6291456,2184545,6291456,2184577,6291456,2184609,6291456,2184641,6291456,2184673,6291456,2184705,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0,0,0,0,0,0,0,0]),new Uint32Array([2105570,2156034,2126947,2156098,2153666,2127043,2127139,2156162,0,2127235,2156226,2156290,2156354,2156418,2127331,2127427]),new Uint32Array([2215905,2207041,2153185,2241569,2241601,2241633,2241665,2241697,2241730,2241793,2241825,2241857,2241889,2241921,2241954,2242017]),new Uint32Array([2203777,6291456,2203809,6291456,2203841,6291456,2203873,6291456,2203905,6291456,2173121,2180993,2181249,2203937,2181313,0]),new Uint32Array([2168577,6291456,2168609,6291456,2168641,6291456,2168673,6291456,2168705,6291456,2168737,6291456,2168769,6291456,2168801,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,23068672,23068672,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,0,23068672,23068672,23068672,0,0]),new Uint32Array([2210113,2195521,2210145,2210177,2210209,2210241,2210273,2210305,2210337,2210369,2210401,2210433,2210465,2210497,2210529,2210561]),new Uint32Array([6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([2228706,2228770,2228834,2228898,2228962,2229026,2229090,2229154,2229218,2229282,2229346,2229410,2229474,2229538,2229602,2229666]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,18874368,18874368,18874368,0,0]),new Uint32Array([2133089,2133281,2133281,2133281,2133281,2160577,2160577,2160577,2160577,2097441,2097441,2097441,2097441,2133857,2133857,2133857]),new Uint32Array([6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2173825,2153473,2173857,2173889,2173921,2173953,2173985,2174017,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233089]),new Uint32Array([2178529,6291456,2178561,6291456,2178593,6291456,2178625,6291456,2178657,6291456,2178689,6291456,2178721,6291456,2178753,6291456]),new Uint32Array([2221025,2221025,2221057,2221057,2159329,2159329,2159329,2159329,2097217,2097217,2158914,2158914,2158978,2158978,2159042,2159042]),new Uint32Array([2208161,2208193,2208225,2208257,2194433,2208289,2208321,2208353,2208385,2208417,2208449,2208481,2208513,2208545,2208577,2208609]),new Uint32Array([2169217,6291456,2169249,6291456,2169281,6291456,2169313,6291456,2169345,6291456,2169377,6291456,2169409,6291456,2169441,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([2133187,2133283,2133283,2133379,2133475,2133571,2133667,2133667,2133763,2133859,2133955,2134051,2134147,2134147,2134243,2134339]),new Uint32Array([2197697,2114113,2114209,2197729,2197761,2114305,2197793,2114401,2114497,2197825,2114593,2114689,2114785,2114881,2114977,0]),new Uint32Array([2193089,2193121,2193153,2193185,2117665,2117569,2193217,2193249,2193281,2193313,2193345,2193377,2193409,2193441,2193473,2193505]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2184225,6291456,2184257,6291456,2184289,6291456,2184321,6291456,2184353,6291456,2184385,6291456,2184417,6291456,2184449,6291456]),new Uint32Array([2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2100833,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2098657,2098049,2200737,2123489,2123681,2200769,2098625,2100321,2098145,2100449,2098017,2098753,2200801,2200833,2200865,0]),new Uint32Array([23068672,23068672,23068672,0,0,0,0,0,0,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,0,2098241,2108353,2108417,2105825,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2181153,2105505,2181185,2167617,2180993]),new Uint32Array([2160002,2160066,2160130,2160194,2160258,2132066,2131010,2131106,2106018,2131618,2160322,2131298,2132034,2131938,2137410,2132226]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,6291456]),new Uint32Array([2183617,6291456,2183649,6291456,2183681,6291456,2183713,6291456,2183745,6291456,2183777,6291456,2183809,6291456,2183841,6291456]),new Uint32Array([0,6291456,6291456,0,6291456,0,0,6291456,6291456,0,6291456,0,0,6291456,0,0]),new Uint32Array([2250977,2251009,2251041,2251073,2195009,2251106,2251169,2251201,2251233,2251265,2251297,2251330,2251394,2251457,2251489,2251521]),new Uint32Array([2205729,2205761,2205793,2205825,2205857,2205889,2205921,2205953,2205985,2206017,2206049,2206081,2206113,2206145,2206177,2206209]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2143170,2168993,6291456,2169025,6291456,2169057,6291456,2169089,6291456,2143234,2169121,6291456,2169153,6291456,2169185,6291456]),new Uint32Array([23068672,23068672,2190689,6291456,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2248706,2248769,2248801,2248833,2248865,2248897,2248929,2248962,2249026,2249090,2249154,2240705,2249217,2249249,2249281,2249313]),new Uint32Array([10485857,6291456,6291456,6291456,6291456,6291456,6291456,6291456,10495394,6291456,2098209,6291456,6291456,2097152,6291456,10531394]),new Uint32Array([0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([14680064,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2173985,2173953,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889]),new Uint32Array([6291456,2186977,6291456,6291456,6291456,6291456,6291456,10537858,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2209601,2209633,2209665,2209697,2209729,2209761,2209793,2209825,2209857,2209889,2209921,2209953,2209985,2210017,2210049,2210081]),new Uint32Array([10501539,10501635,10501731,10501827,10501923,10502019,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905]),new Uint32Array([2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2174017,2174017,2174049]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2194561,2194593,2194625,2119777,2119873,2194657,2194689,2194721,2194753,2194785,2194817,2194849,2194881,2194913,2194945,2194977]),new Uint32Array([2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569]),new Uint32Array([2222818,2222882,2222946,2223010,2223074,2223138,2223202,2223266,2223330,2223394,2223458,2223522,2223586,2223650,2223714,2223778]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672]),new Uint32Array([0,2179553,2179585,2179617,2179649,2144001,2179681,2179713,2179745,2179777,2179809,2156705,2179841,2156833,2179873,2179905]),new Uint32Array([6291456,23068672,6291456,2145602,23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,6291456,0,0]),new Uint32Array([2196513,2196545,2196577,2196609,2196641,2196673,2196705,2196737,2196769,2196801,2196833,2196865,2196897,2196929,2196961,2196993]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2177281,6291456,2177313,6291456,2177345,6291456,2177377,6291456,2177409,6291456,2177441,6291456,2177473,6291456,2177505,6291456]),new Uint32Array([2187137,2221473,2221505,2221537,2221569,6291456,6291456,10610209,10610241,10537986,10537986,10537986,10537986,10609857,10609857,10609857]),new Uint32Array([2243009,2243041,2216033,2243074,2243137,2243169,2243201,2219617,2243233,2243265,2243297,2243329,2243362,2243425,2243457,2243489]),new Uint32Array([10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,2097152,4194304,4194304,0,0]),new Uint32Array([2143042,6291456,2143106,2143106,2168833,6291456,2168865,6291456,6291456,2168897,6291456,2168929,6291456,2168961,6291456,2143170]),new Uint32Array([6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2204193,2204225,2204257,2204289,2204321,2204353,2204385,2204417,2204449,2204481,2204513,2204545,2204577,2204609,2204641,2204673]),new Uint32Array([2202753,6291456,2202785,6291456,2202817,6291456,2202849,6291456,2202881,6291456,2202913,6291456,2202945,6291456,2202977,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321]),new Uint32Array([2147394,2147458,2147522,2147586,2147650,2147714,2147778,2147842,2147394,2147458,2147522,2147586,2147650,2147714,2147778,2147842]),new Uint32Array([2253313,2253346,2253409,2253441,2253473,2253505,2253537,2253569,2253601,2253634,2219393,2253697,2253729,2253761,2253793,2253825]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([2162562,2162626,2131362,2162690,2159938,2160002,2162754,2162818,2160130,2162882,2160194,2160258,2160834,2160898,2161026,2161090]),new Uint32Array([2175361,2175393,2175425,2175457,2175489,2175521,2175553,2175585,2175617,2175649,2175681,2175713,2175745,2175777,2175809,2175841]),new Uint32Array([2253858,2253921,2253954,2254018,2254082,2196737,2254145,2196865,2254177,2254209,2254241,2254273,2197025,2254306,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2202113,2204129,2188705,2204161]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([2173985,2174017,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113,2173985,2173953]),new Uint32Array([2101569,2101697,2101825,2101953,2102081,2102209,2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209]),new Uint32Array([2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,0,2108417,0,2111713,2100897,2111905]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0]),new Uint32Array([2175425,2175489,2175809,2175905,2175937,2175937,2176193,2176417,2180865,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,2143298,2143298,2143298,2143362,2143362,2143362,2143426,2143426,2143426,2171105,6291456,2171137]),new Uint32Array([2120162,2120258,2151618,2151682,2151746,2151810,2151874,2151938,2152002,2120035,2120131,2120227,2152066,2120323,2152130,2120419]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2195361,2142433,2236065,2236097,2236129,2236161,2118241,2117473,2236193,2236225,2236257,2236289,0,0,0,0]),new Uint32Array([2189281,6291456,2189313,6291456,2189345,6291456,2189377,6291456,2189409,6291456,2189441,6291456,2189473,6291456,2189505,6291456]),new Uint32Array([6291456,6291456,2145922,6291456,6291456,6291456,6291456,2145986,6291456,6291456,6291456,6291456,2146050,6291456,6291456,6291456]),new Uint32Array([2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,10502113,10562017,10610401,10502177,10610433,10538049]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,2186401,0,2186433,0,2186465,0,2186497]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,23068672,23068672,23068672]),new Uint32Array([0,0,2198241,2198273,2198305,2198337,2198369,2198401,0,0,2198433,2198465,2198497,0,0,0]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,6291456,0,23068672,23068672,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,0,0,23068672,6291456,23068672,23068672]),new Uint32Array([0,2105921,2097729,0,2097377,0,0,2106017,2133281,2097505,2105889,0,2097697,2135777,2097633,2097441]),new Uint32Array([2197889,2197921,2197953,2197985,2198017,2198049,2198081,2198113,2198145,2198177,2198209,2198241,2198273,2198305,2198337,2198369]),new Uint32Array([2132514,2132610,2160386,2133090,2133186,2160450,2160514,2133282,2160578,2133570,2106178,2160642,2133858,2160706,2160770,2134146]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,23068672,6291456,23068672,23068672,6291456,23068672,0,0,0,0,0,0,0,0]),new Uint32Array([2184737,6291456,2184769,6291456,2184801,6291456,2184833,6291456,2184865,6291456,2184897,6291456,2184929,6291456,2184961,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,2186753,6291456,6291456,6291456,6291456,2186785,2186817,2186849,2173569,2186881,10496355,10495395,10575521]),new Uint32Array([0,0,2097729,0,0,0,0,2106017,0,2097505,0,2097185,0,2135777,2097633,2097441]),new Uint32Array([2189537,6291456,2189569,6291456,2189601,6291456,2189633,6291456,2189665,6291456,2189697,6291456,2189729,6291456,2189761,6291456]),new Uint32Array([2202497,6291456,2202529,6291456,2202561,6291456,2202593,6291456,2202625,6291456,2202657,6291456,2202689,6291456,2202721,6291456]),new Uint32Array([2245217,2218369,2245249,2245282,2245345,2245377,2245410,2245474,2245537,2245569,2245601,2245633,2245665,2245665,2245697,2245729]),new Uint32Array([6291456,0,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,0,0,0,0,0,0,23068672,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,6291456,23068672,6291456,23068672,6291456,6291456,6291456,6291456,23068672,23068672]),new Uint32Array([0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2097281,2105921,2097729,2106081,2097377,2097601,2162337,2106017,2133281,2097505,0,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([2176641,6291456,2176673,6291456,2176705,6291456,2176737,6291456,2176769,6291456,2176801,6291456,2176833,6291456,2176865,6291456]),new Uint32Array([2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113,2173985,2173953,2174369,2174369,0,0,2100833,2100737]),new Uint32Array([2116513,2190817,2190849,2190881,2190913,2190945,2116609,2190977,2191009,2191041,2191073,2117185,2191105,2191137,2191169,2191201]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,6291456,6291456,6291456]),new Uint32Array([0,0,0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456]),new Uint32Array([2167617,2167649,2167681,2167713,2167745,2167777,2167809,6291456,2167841,2167873,2167905,2167937,2167969,2168001,2168033,4240130]),new Uint32Array([2165122,2163970,2164034,2164098,2164162,2164226,2164290,2164354,2164418,2164482,2164546,2133122,2134562,2132162,2132834,2136866]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,2186209,2186241,2186273,2186305,2186337,2186369,0,0]),new Uint32Array([2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([0,0,23068672,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456]),new Uint32Array([0,10537921,10610689,10610273,10610497,10610529,10610305,10610721,10489601,10489697,10610337,10575617,10554529,2221761,2197217,10496577]),new Uint32Array([2105473,2105569,2105601,2112289,0,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441]),new Uint32Array([2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481]),new Uint32Array([2125346,2153410,2153474,2127394,2153538,2153602,2153666,2153730,2105507,2105476,2153794,2153858,2153922,2153986,2154050,2105794]),new Uint32Array([2200449,2119681,2200481,2153313,2199873,2199905,2199937,2200513,2200545,2200577,2200609,2119105,2119201,2119297,2119393,2119489]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2175777,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2222273,2197217,2221473,2221505,2221089,2222305,2200865,2099681,2104481,2222337,2099905,2120737,2222369,2103713,2100225,2098785]),new Uint32Array([2201377,6291456,2201409,6291456,2201441,6291456,2201473,6291456,2201505,6291456,2201537,6291456,2201569,6291456,6291456,23068672]),new Uint32Array([2174081,2174113,2174145,2174177,2149057,2233057,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793]),new Uint32Array([2200897,6291456,2200929,6291456,2200961,6291456,2200993,6291456,2201025,6291456,2180865,6291456,2201057,6291456,2201089,6291456]),new Uint32Array([0,0,0,0,0,23068672,23068672,0,6291456,6291456,6291456,0,0,0,0,0]),new Uint32Array([2161154,2161410,2138658,2161474,2161538,2097666,2097186,2097474,2162946,2132450,2163010,2163074,2136162,2163138,2161666,2161730]),new Uint32Array([2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953]),new Uint32Array([0,0,0,0,0,0,23068672,23068672,0,0,0,0,2145410,2145474,0,6291456]),new Uint32Array([2244161,2216065,2212769,2244193,2244225,2244257,2244290,2244353,2244385,2244417,2244449,2218273,2244481,2244514,2244577,2244609]),new Uint32Array([2125730,2125699,2125795,2125891,2125987,2154114,2154178,2154242,2154306,2154370,2154434,2154498,2126082,2126178,2126274,2126083]),new Uint32Array([2237665,2237697,2237697,2237697,2237730,2237793,2237825,2237857,2237890,2237953,2237985,2238017,2238049,2238081,2238113,2238145]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2150146,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,0,0,23068672,23068672,23068672,0,0]),new Uint32Array([2214369,2238593,2238625,2238657,2238689,2238721,2238753,2238785,2238817,2238850,2238913,2238945,2238977,2235457,2239009,2239041]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([2252066,2252130,2252193,2252225,2252257,2252290,2252353,2252385,2252417,2252449,2252481,2252513,2252545,2252578,2252641,2252673]),new Uint32Array([2197697,2114113,2114209,2197729,2197761,2114305,2197793,2114401,2114497,2197825,2114593,2114689,2114785,2114881,2114977,2197857]),new Uint32Array([2224866,2224930,2224994,2225058,2225122,2225186,2225250,2225314,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2219490,2219554,2219617,2219649,2219681,2219714,2219778,2219842,2219905,2219937,0,0,0,0,0,0]),new Uint32Array([6291456,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456]),new Uint32Array([2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289]),new Uint32Array([2174081,2174113,2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113,2173985,2173953,2148481,2173601,2173633,2173665]),new Uint32Array([2220161,2220161,2220193,2220193,2220193,2220193,2220225,2220225,2220225,2220225,2220257,2220257,2220257,2220257,2220289,2220289]),new Uint32Array([2192673,2192705,2192737,2192769,2192801,2192833,2192865,2118049,2192897,2117473,2117761,2192929,2192961,2192993,2193025,2193057]),new Uint32Array([2179297,6291456,2179329,6291456,2179361,6291456,2179393,6291456,2179425,6291456,2179457,6291456,2179489,6291456,2179521,6291456]),new Uint32Array([6291456,6291456,6291456,23068672,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2235745,2235777,2193633,2235809,2235841,2235873,2235905,2235937,2235969,2116513,2116705,2236001,2200513,2199905,2200545,2236033]),new Uint32Array([2113153,2108481,2113345,2113441,2232993,2233025,0,0,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761]),new Uint32Array([2170593,6291456,2170625,6291456,2170657,6291456,2170689,2170721,6291456,2170753,6291456,6291456,2170785,6291456,2170817,2170849]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2166786,2166850,0,0,0,0]),new Uint32Array([23068672,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,10575617,2187041,10502177,10489601,10489697,0]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2134562,2132162,2132834,2136866,2136482,2164610,2164674,2164738,2164802,2132802,2132706,2164866,2132898,2164930,2164994,2165058]),new Uint32Array([6291456,6291456,2098337,2101441,10531458,2153473,6291456,6291456,10531522,2100737,2108193,6291456,2106499,2106595,2106691,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0]),new Uint32Array([2233122,2233186,2233250,2233314,2233378,2233442,2233506,2233570,2233634,2233698,2233762,2233826,2233890,2233954,2234018,2234082]),new Uint32Array([23068672,6291456,23068672,23068672,23068672,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2205217,2205249,2205281,2205313,2205345,2205377,2205409,2205441,2205473,2205505,2205537,2205569,2205601,2205633,2205665,2205697]),new Uint32Array([6291456,0,6291456,0,0,0,6291456,6291456,6291456,6291456,0,0,23068672,6291456,23068672,23068672]),new Uint32Array([2173601,2173761,2174081,2173569,2174241,2174113,2173953,6291456,2174305,6291456,2174337,6291456,2174369,6291456,2174401,6291456]),new Uint32Array([6291456,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2152450,2152514,2099653,2104452,2099813,2122243,2099973,2152578,2122339,2122435,2122531,2122627,2122723,2104580,2122819,2152642]),new Uint32Array([2236385,2236417,2236449,2236482,2236545,2215425,2236577,2236609,2236641,2236673,2215457,2236705,2236737,2236770,2215489,2236833]),new Uint32Array([2163394,2159746,2163458,2131362,2163522,2160130,2163778,2132226,2163842,2132898,2163906,2161410,2138658,2097666,2136162,2163650]),new Uint32Array([2218721,2246913,2246946,2216385,2247010,2247074,2215009,2247137,2247169,2216481,2247201,2247233,2247266,2247330,2247330,0]),new Uint32Array([2129730,2129762,2129858,2129731,2129827,2156482,2156482,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,0,0,0,0,6291456,0,0]),new Uint32Array([2203969,2204001,2181377,2204033,2204065,6291456,2204097,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([2169473,6291456,2169505,6291456,2169537,6291456,2169569,6291456,2169601,6291456,2169633,6291456,2169665,6291456,2169697,6291456]),new Uint32Array([2141542,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2220801,2220801,2220801,2220801,2220833,2220833,2220865,2220865,2220865,2220865,2220897,2220897,2220897,2220897,2139873,2139873]),new Uint32Array([0,0,0,0,0,23068672,23068672,0,0,0,0,0,0,0,6291456,0]),new Uint32Array([2214849,2218433,2218465,2218497,2218529,2218561,2214881,2218593,2218625,2218657,2218689,2218721,2218753,2216545,2218785,2218817]),new Uint32Array([23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0,6291456]),new Uint32Array([2136482,2164610,2164674,2164738,2164802,2132802,2132706,2164866,2132898,2164930,2164994,2165058,2165122,2132802,2132706,2164866]),new Uint32Array([2207649,2207681,2207713,2207745,2207777,2207809,2207841,2207873,2207905,2207937,2207969,2208001,2208033,2208065,2208097,2208129]),new Uint32Array([2123683,2105092,2152706,2123779,2105220,2152770,2100453,2098755,2123906,2124002,2124098,2124194,2124290,2124386,2124482,2124578]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,6291456,0,0,0,0,0,0,0,10485857]),new Uint32Array([6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([10508163,10508259,10508355,10508451,2200129,2200161,2192737,2200193,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2203553,6291456,2203585,6291456,6291456,6291456,2203617,6291456,2203649,6291456,2203681,6291456,2203713,6291456,2203745,6291456]),new Uint32Array([18884449,18884065,23068672,18884417,18884034,18921185,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,18874368]),new Uint32Array([2247393,2247426,2247489,2247521,2247553,2247586,2247649,2247681,2247713,2247745,2247777,2247810,2247873,2247905,2247937,2247969]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,23068672]),new Uint32Array([2134145,2097153,2134241,0,2132705,2130977,2160065,2131297,0,2133089,2160577,2133857,2235297,0,2235329,0]),new Uint32Array([2182593,6291456,2182625,6291456,2182657,6291456,2182689,6291456,2182721,6291456,2182753,6291456,2182785,6291456,2182817,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2102402,2102403,6291456,2110050]),new Uint32Array([2149890,2108323,2149954,6291456,2113441,6291456,2149057,6291456,2113441,6291456,2105473,2167265,2111137,2105505,6291456,2108353]),new Uint32Array([2219105,2219137,2195233,2251554,2251617,2251649,2251681,2251713,2251746,2251810,2251873,2251905,2251937,2251970,2252033,2219169]),new Uint32Array([2203009,6291456,2203041,6291456,2203073,6291456,2203105,6291456,2203137,6291456,2203169,6291456,2203201,6291456,2203233,6291456]),new Uint32Array([2128195,2128291,2128387,2128483,2128579,2128675,2128771,2128867,2128963,2129059,2129155,2129251,2129347,2129443,2129539,2129635]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2140964,2141156,2140966,2141158,2141350]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2225378,2225442,2225506,2225570,2225634,2225698,2225762,2225826,2225890,2225954,2226018,2226082,2226146,2226210,2226274,2226338]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417]),new Uint32Array([2108353,2108417,0,2105601,2108193,2157121,2157313,2157377,2157441,2100897,6291456,2108419,2173953,2173633,2173633,2173953]),new Uint32Array([2111713,2173121,2111905,2098177,2173153,2173185,2173217,2113153,2113345,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,2190753]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,2197249,6291456,2117377,2197281,2197313,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,0,0,0,0,0,0,23068672,0,0,0,0,0,6291456,6291456,6291456]),new Uint32Array([2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0]),new Uint32Array([0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,23068672,23068672,23068672]),new Uint32Array([2173281,6291456,2173313,6291456,2173345,6291456,2173377,6291456,0,0,10532546,6291456,6291456,6291456,10562017,2173441]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0]),new Uint32Array([23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2159426,2159490,2159554,2159362,2159618,2159682,2139522,2136450,2159746,2159810,2159874,2130978,2131074,2131266,2131362,2159938]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2203233,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2203265,6291456,2203297,6291456,2203329,2203361,6291456]),new Uint32Array([6291456,6291456,2148418,2148482,2148546,0,6291456,2148610,2186529,2186561,2148417,2148545,2148482,10495778,2143969,10495778]),new Uint32Array([2134146,2139426,2160962,2134242,2161218,2161282,2161346,2161410,2138658,2134722,2134434,2134818,2097666,2097346,2097698,2105986]),new Uint32Array([2198881,2198913,2198945,2198977,2199009,2199041,2199073,2199105,2199137,2199169,2199201,2199233,2199265,2199297,2199329,2199361]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([10610561,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193]),new Uint32Array([2183873,6291456,2183905,6291456,2183937,6291456,2183969,6291456,2184001,6291456,2184033,6291456,2184065,6291456,2184097,6291456]),new Uint32Array([2244642,2244706,2244769,2244801,2218305,2244833,2244865,2244897,2244929,2244961,2244993,2245026,2245089,2245122,2245185,0]),new Uint32Array([6291456,6291456,2116513,2116609,2116705,2116801,2199873,2199905,2199937,2199969,2190913,2200001,2200033,2200065,2200097,2191009]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,2180673,2180705,2180737,2180769,2180801,2180833,0,0]),new Uint32Array([2098081,2099521,2099105,2120705,2098369,2120801,2103361,2097985,2098433,2121377,2121473,2099169,2099873,2098401,2099393,2152609]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2150402]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,2145666,2145730,6291456,6291456]),new Uint32Array([2173921,2173953,2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233057,2148481,2173601,2173633,2173665]),new Uint32Array([2187073,6291456,6291456,6291456,6291456,2098241,2098241,2108353,2100897,2111905,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2102404,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,2100612,6291456,6291456,6291456,6291456,6291456,6291456,6291456,10485857]),new Uint32Array([2149057,2233057,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889]),new Uint32Array([2217697,2217729,2217761,2217793,2217825,2217857,2217889,2217921,2217953,2215873,2217985,2215905,2218017,2218049,2218081,2218113]),new Uint32Array([2211233,2218849,2216673,2218881,2218913,2218945,2218977,2219009,2216833,2219041,2215137,2219073,2216865,2209505,2219105,2216897]),new Uint32Array([2240097,2240129,2240161,2240193,2240225,2240257,2240289,2240321,2240353,2240386,2240449,2240481,2240513,2240545,2207905,2240578]),new Uint32Array([6291456,6291456,2202273,6291456,2202305,6291456,2202337,6291456,2202369,6291456,2202401,6291456,2202433,6291456,2202465,6291456]),new Uint32Array([0,23068672,23068672,18923394,23068672,18923458,18923522,18884099,18923586,18884195,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2201121,6291456,2201153,6291456,2201185,6291456,2201217,6291456,2201249,6291456,2201281,6291456,2201313,6291456,2201345,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456]),new Uint32Array([2211041,2211073,2211105,2211137,2211169,2211201,2211233,2211265,2211297,2211329,2211361,2211393,2211425,2211457,2211489,2211521]),new Uint32Array([2181825,6291456,2181857,6291456,2181889,6291456,2181921,6291456,2181953,6291456,2181985,6291456,2182017,6291456,2182049,6291456]),new Uint32Array([2162337,2097633,2097633,2097633,2097633,2132705,2132705,2132705,2132705,2097153,2097153,2097153,2097153,2133089,2133089,2133089]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,2148545,6291456,2173473,6291456,2148865,6291456,2173505,6291456,2173537,6291456,2173569,6291456,2149121,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2174017,2174017,2174049,2174081,2174113]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2207137,2207169,2207201,2207233,2207265,2207297,2207329,2207361,2207393,2207425,2207457,2207489,2207521,2207553,2207585,2207617]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,6291456,6291456,0,23068672,23068672,0,0,0,0,0,0]),new Uint32Array([2198401,2198433,2198465,2198497,0,2198529,2198561,2198593,2198625,2198657,2198689,2198721,2198753,2198785,2198817,2198849]),new Uint32Array([2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,0,0]),new Uint32Array([2216385,2118721,2216417,2216449,2216481,2216513,2216545,2211233,2216577,2216609,2216641,2216673,2216705,2216737,2216737,2216769]),new Uint32Array([2216801,2216833,2216865,2216897,2216929,2216961,2216993,2215169,2217025,2217057,2217089,2217121,2217154,2217217,0,0]),new Uint32Array([2210593,2191809,2210625,2210657,2210689,2210721,2210753,2210785,2210817,2210849,2191297,2210881,2210913,2210945,2210977,2211009]),new Uint32Array([0,0,2105825,0,0,2111905,2105473,0,0,2112289,2108193,2112481,2112577,0,2098305,2108321]),new Uint32Array([0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,2097153,2134241,0,2132705,0,0,2131297,0,2133089,0,2133857,0,2220769,0,2235361]),new Uint32Array([14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,6291456,6291456,14680064]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([2171873,6291456,2171905,6291456,2171937,6291456,2171969,6291456,2172001,6291456,2172033,6291456,2172065,6291456,2172097,6291456]),new Uint32Array([2220929,2220929,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2133857,2134145,2134145,2134145,2134145,2134241,2134241,2134241,2134241,2105889,2105889,2105889,2105889,2097185,2097185,2097185]),new Uint32Array([2173697,2173761,2173793,2174113,2173985,2173953,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,10499619,10499715,10499811,10499907]),new Uint32Array([0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,0,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,2144322,2144386,2144450,2144514,2144578,2144642,2144706,2144770]),new Uint32Array([23068672,23068672,23068672,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456]),new Uint32Array([2113153,2108481,2113345,2113441,2098209,2111137,0,2098241,2108353,2108417,2105825,0,0,2111905,2105473,2105569]),new Uint32Array([2236321,2236353,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2152194,2121283,2103684,2103812,2097986,2098533,2097990,2098693,2098595,2098853,2099013,2103940,2121379,2121475,2121571,2104068]),new Uint32Array([2206241,2206273,2206305,2206337,2206369,2206401,2206433,2206465,2206497,2206529,2206561,2206593,2206625,2206657,2206689,2206721]),new Uint32Array([6291456,6291456,6291456,6291456,16777216,16777216,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,23068672,23068672,10538818,10538882,6291456,6291456,2150338]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2214369,2214401,2214433,2214465,2214497,2214529,2214561,2214593,2194977,2214625,2195073,2214657,2214689,2214721,6291456,6291456]),new Uint32Array([2097152,2097152,2097152,2097152,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2182081,6291456,2182113,6291456,2182145,6291456,2182177,6291456,2182209,6291456,2182241,6291456,2182273,6291456,2182305,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2146881,2146945,2147009,2147073,2147137,2147201,2147265,2147329]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,23068672,23068672]),new Uint32Array([0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2122915,2123011,2123107,2104708,2123203,2123299,2123395,2100133,2104836,2100290,2100293,2104962,2104964,2098052,2123491,2123587]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([6291456,2171169,6291456,2171201,6291456,2171233,6291456,2171265,6291456,2171297,6291456,2171329,6291456,6291456,2171361,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,2148994,2149058,2149122,0,6291456,2149186,2186945,2173537,2148993,2149121,2149058,10531458,10496066,0]),new Uint32Array([2195009,2195041,2195073,2195105,2195137,2195169,2195201,2195233,2195265,2195297,2195329,2195361,2195393,2195425,2195457,2195489]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,0,0,6291456,6291456]),new Uint32Array([2182849,6291456,2182881,6291456,2182913,6291456,2182945,6291456,2182977,6291456,2183009,6291456,2183041,6291456,2183073,6291456]),new Uint32Array([2211553,2210081,2211585,2211617,2211649,2211681,2211713,2211745,2211777,2211809,2209569,2211841,2211873,2211905,2211937,2211969]),new Uint32Array([2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2166594,2127298,2166658,2142978,2141827,2166722]),new Uint32Array([2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233057,2148481,2173601,2173633,2173665,2173697,2173729]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,2185761,2185793,2185825,2185857,2185889,2185921,0,0]),new Uint32Array([6291456,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,6291456]),new Uint32Array([0,0,0,2220961,2220961,2220961,2220961,2144193,2144193,2159201,2159201,2159265,2159265,2144194,2220993,2220993]),new Uint32Array([2192641,2235393,2235425,2152257,2116609,2235457,2235489,2200065,2235521,2235553,2235585,2212449,2235617,2235649,2235681,2235713]),new Uint32Array([2194049,2194081,2194113,2194145,2194177,2194209,2194241,2194273,2194305,2194337,2194369,2194401,2194433,2194465,2194497,2194529]),new Uint32Array([2196673,2208641,2208673,2208705,2208737,2208769,2208801,2208833,2208865,2208897,2208929,2208961,2208993,2209025,2209057,2209089]),new Uint32Array([2191681,2191713,2191745,2191777,2153281,2191809,2191841,2191873,2191905,2191937,2191969,2192001,2192033,2192065,2192097,2192129]),new Uint32Array([2230946,2231010,2231074,2231138,2231202,2231266,2231330,2231394,2231458,2231522,2231586,2231650,2231714,2231778,2231842,2231906]),new Uint32Array([14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2185953,2185985,2186017,2186049,2186081,2186113,2186145,2186177]),new Uint32Array([2139811,2139907,2097284,2105860,2105988,2106116,2106244,2097444,2097604,2097155,10485778,10486344,2106372,6291456,0,0]),new Uint32Array([2110051,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2172385,6291456,2172417,6291456,2172449,6291456,2172481,6291456,2172513,6291456,2172545,6291456,2172577,6291456,2172609,6291456]),new Uint32Array([0,0,23068672,23068672,6291456,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2249345,2249377,2249409,2249441,2249473,2249505,2249537,2249570,2210209,2249633,2249665,2249697,2249729,2249761,2249793,2216769]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([2187169,2187201,2187233,2187265,2187297,2187329,2187361,2187393,2187425,2187457,2187489,2187521,2187553,2187585,2187617,2187649]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,0,6291456,6291456,0,0,0,6291456,6291456,6291456,0,0,0,6291456,6291456]),new Uint32Array([2182337,6291456,2182369,6291456,2182401,6291456,2182433,6291456,2182465,6291456,2182497,6291456,2182529,6291456,2182561,6291456]),new Uint32Array([2138179,2138275,2138371,2138467,2134243,2134435,2138563,2138659,2138755,2138851,2138947,2139043,2138947,2138755,2139139,2139235]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([0,0,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2250498,2250562,2250625,2250657,2208321,2250689,2250721,2250753,2250785,2250817,2250849,2218945,2250881,2250913,2250945,0]),new Uint32Array([2170369,2105569,2098305,2108481,2173249,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456]),new Uint32Array([2100897,2111905,2105473,2105569,2105601,0,2108193,0,0,0,2098305,2108321,2108289,2100865,2113153,2108481]),new Uint32Array([2100897,2100897,2105569,2105569,6291456,2112289,2149826,6291456,6291456,2112481,2112577,2098177,2098177,2098177,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,6291456,6291456,6291456]),new Uint32Array([6291456,2169953,2169985,6291456,2170017,6291456,2170049,2170081,6291456,2170113,2170145,2170177,6291456,6291456,2170209,2170241]),new Uint32Array([6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2220641,2220641,2220673,2220673,2220673,2220673,2220705,2220705,2220705,2220705,2220737,2220737,2220737,2220737,2220769,2220769]),new Uint32Array([2127650,2127746,2127842,2127938,2128034,2128130,2128226,2128322,2128418,2127523,2127619,2127715,2127811,2127907,2128003,2128099]),new Uint32Array([2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177]),new Uint32Array([0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2204705,2204737,2204769,2204801,2204833,2204865,2204897,2204929,2204961,2204993,2205025,2205057,2205089,2205121,2205153,2205185]),new Uint32Array([2176385,6291456,2176417,6291456,2176449,6291456,2176481,6291456,2176513,6291456,2176545,6291456,2176577,6291456,2176609,6291456]),new Uint32Array([2195521,2195553,2195585,2195617,2195649,2195681,2117857,2195713,2195745,2195777,2195809,2195841,2195873,2195905,2195937,2195969]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456]),new Uint32Array([2173921,2173953,2173985,2174017,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113]),new Uint32Array([2131586,2132450,2135970,2135778,2161602,2136162,2163650,2161794,2135586,2163714,2137186,2131810,2160290,2135170,2097506,2159554]),new Uint32Array([2134145,2097153,2134241,2105953,2132705,2130977,2160065,2131297,2162049,2133089,2160577,2133857,0,0,0,0]),new Uint32Array([2116513,2116609,2116705,2116801,2116897,2116993,2117089,2117185,2117281,2117377,2117473,2117569,2117665,2117761,2117857,2117953]),new Uint32Array([2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,2100802,2101154,2101282,2101410,2101538,2101666,2101794]),new Uint32Array([2100289,2098657,2098049,2200737,2123489,2123681,2200769,2098625,2100321,2098145,2100449,2098017,2098753,2098977,2150241,2150305]),new Uint32Array([6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,2109955,6291456,6291456,0,0,0,0]),new Uint32Array([18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,6291456,0,0]),new Uint32Array([2130979,2131075,2131075,2131171,2131267,2131363,2131459,2131555,2131651,2131651,2131747,2131843,2131939,2132035,2132131,2132227]),new Uint32Array([0,2177793,6291456,2177825,6291456,2177857,6291456,2177889,6291456,2177921,6291456,2177953,6291456,2177985,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2113345,0,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289]),new Uint32Array([2136643,2136739,2136835,2136931,2137027,2137123,2137219,2137315,2137411,2137507,2137603,2137699,2137795,2137891,2137987,2138083]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([2174433,6291456,2174465,6291456,2174497,6291456,2174529,6291456,2174561,6291456,2174593,6291456,2174625,6291456,2174657,6291456]),new Uint32Array([0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441]),new Uint32Array([10496547,10496643,2105505,2149698,6291456,10496739,10496835,2170273,6291456,2149762,2105825,2111713,2111713,2111713,2111713,2168673]),new Uint32Array([6291456,2143490,2143490,2143490,2171649,6291456,2171681,2171713,2171745,6291456,2171777,6291456,2171809,6291456,2171841,6291456]),new Uint32Array([2159106,2159106,2159170,2159170,2159234,2159234,2159298,2159298,2159298,2159362,2159362,2159362,2106401,2106401,2106401,2106401]),new Uint32Array([2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137]),new Uint32Array([2108417,2181217,2181249,2181281,2170433,2170401,2181313,2181345,2181377,2181409,2181441,2181473,2181505,2181537,2170529,2181569]),new Uint32Array([2218433,2245761,2245793,2245825,2245857,2245890,2245953,2245986,2209665,2246050,2246113,2246146,2246210,2246274,2246337,2246369]),new Uint32Array([2230754,2230818,2230882,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2184129,6291456,2184161,6291456,2184193,6291456,6291456,6291456,6291456,6291456,2146818,2183361,6291456,6291456,2142978,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2135170,2097506,2130691,2130787,2130883,2163970,2164034,2164098,2164162,2164226,2164290,2164354,2164418,2164482,2164546,2133122]),new Uint32Array([2108515,2108611,2100740,2108707,2108803,2108899,2108995,2109091,2109187,2109283,2109379,2109475,2109571,2109667,2109763,2100738]),new Uint32Array([2102788,2102916,2103044,2120515,2103172,2120611,2120707,2098373,2103300,2120803,2120899,2120995,2103428,2103556,2121091,2121187]),new Uint32Array([2158082,2158146,0,2158210,2158274,0,2158338,2158402,2158466,2129922,2158530,2158594,2158658,2158722,2158786,2158850]),new Uint32Array([10499619,10499715,10499811,10499907,10500003,10500099,10500195,10500291,10500387,10500483,10500579,10500675,10500771,10500867,10500963,10501059]),new Uint32Array([2239585,2239618,2239681,2239713,0,2191969,2239745,2239777,2192033,2239809,2239841,2239874,2239937,2239970,2240033,2240065]),new Uint32Array([2252705,2252738,2252801,2252833,2252865,2252897,2252930,2252994,2253057,2253089,2253121,2253154,2253217,2253250,2219361,2219361]),new Uint32Array([2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,10538050,10538114,10538178,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2226402,2226466,2226530,2226594,2226658,2226722,2226786,2226850,2226914,2226978,2227042,2227106,2227170,2227234,2227298,2227362]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,2144066,2144130,2144194,2144258,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,6291456,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([2124674,2124770,2123875,2123971,2124067,2124163,2124259,2124355,2124451,2124547,2124643,2124739,2124835,2124931,2125027,2125123]),new Uint32Array([2168065,6291456,2168097,6291456,2168129,6291456,2168161,6291456,2168193,6291456,2168225,6291456,2168257,6291456,2168289,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,2100610,2100611,6291456,2107842,2107843,6291456,6291456,6291456,6291456,10537922,6291456,10537986,6291456]),new Uint32Array([2174849,2174881,2174913,2174945,2174977,2175009,2175041,2175073,2175105,2175137,2175169,2175201,2175233,2175265,2175297,2175329]),new Uint32Array([2154562,2154626,2154690,2154754,2141858,2154818,2154882,2127298,2154946,2127298,2155010,2155074,2155138,2155202,2155266,2155202]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,23068672,0]),new Uint32Array([2200641,2150786,2150850,2150914,2150978,2151042,2106562,2151106,2150562,2151170,2151234,2151298,2151362,2151426,2151490,2151554]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,6291456,6291456]),new Uint32Array([2220289,2220289,2220321,2220321,2220321,2220321,2220353,2220353,2220353,2220353,2220385,2220385,2220385,2220385,2220417,2220417]),new Uint32Array([2155330,2155394,0,2155458,2155522,2155586,2105732,0,2155650,2155714,2155778,2125314,2155842,2155906,2126274,2155970]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,6291456,23068672,23068672,6291456,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0]),new Uint32Array([2097729,2106017,2106017,2106017,2106017,2131297,2131297,2131297,2131297,2106081,2106081,2162049,2162049,2105953,2105953,2162337]),new Uint32Array([2097185,2097697,2097697,2097697,2097697,2135777,2135777,2135777,2135777,2097377,2097377,2097377,2097377,2097601,2097601,2097217]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23068672]),new Uint32Array([2139331,2139427,2139523,2139043,2133571,2132611,2139619,2139715,0,0,0,0,0,0,0,0]),new Uint32Array([2174113,2174145,2100897,2098177,2108289,2100865,2173601,2173633,2173985,2174113,2174145,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,23068672,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,18923778,23068672,23068672,23068672,23068672,18923842,23068672,23068672,23068672,23068672,18923906,23068672,23068672,23068672]),new Uint32Array([2134145,2097153,2134241,0,2132705,2130977,2160065,2131297,0,2133089,0,2133857,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2177537,6291456,2177569,6291456,2177601,6291456,2177633,6291456,2177665,6291456,2177697,6291456,2177729,6291456,2177761,6291456]),new Uint32Array([2212481,2212513,2212545,2212577,2197121,2212609,2212641,2212673,2212705,2212737,2212769,2212801,2212833,2212865,2212897,2212929]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2098241,2108353,2170209,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,6291456,2108193,2172417,2112481,2098177]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456])],e=new Uint16Array([616,616,565,147,161,411,330,2,131,131,328,454,241,408,86,86,696,113,285,350,325,301,473,214,639,232,447,64,369,598,124,672,567,223,621,154,107,86,86,86,86,86,86,505,86,68,634,86,218,218,218,218,486,218,218,513,188,608,216,86,217,463,668,85,700,360,184,86,86,86,647,402,153,10,346,718,662,260,145,298,117,1,443,342,138,54,563,86,240,572,218,70,387,86,118,460,641,602,86,86,306,218,86,692,86,86,86,86,86,162,707,86,458,26,86,218,638,86,86,86,86,86,65,449,86,86,306,183,86,58,391,667,86,157,131,131,131,131,86,433,131,406,31,218,247,86,86,693,218,581,351,86,438,295,69,462,45,126,173,650,14,295,69,97,168,187,641,78,523,390,69,108,287,664,173,219,83,295,69,108,431,426,173,694,412,115,628,52,257,398,641,118,501,121,69,579,151,423,173,620,464,121,69,382,151,476,173,27,53,121,86,594,578,226,173,86,632,130,86,96,228,268,641,622,563,86,86,21,148,650,131,131,321,43,144,343,381,531,131,131,178,20,86,399,156,375,164,541,30,60,715,198,92,118,131,131,86,86,306,407,86,280,457,196,488,358,131,131,244,86,86,143,86,86,86,86,86,667,563,86,86,86,86,86,86,86,86,86,86,86,86,86,336,363,86,86,336,86,86,380,678,67,86,86,86,678,86,86,86,512,86,307,86,708,86,86,86,86,86,528,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,563,307,86,86,86,86,86,104,450,337,86,720,86,32,450,397,86,86,86,587,218,558,708,708,293,708,86,86,86,86,86,694,205,86,8,86,86,86,86,549,86,667,697,697,679,86,458,460,86,86,650,86,708,543,86,86,86,245,86,86,86,140,218,127,708,708,458,197,131,131,131,131,500,86,86,483,251,86,306,510,515,86,722,86,86,86,65,201,86,86,483,580,470,86,86,86,368,131,131,131,694,114,110,555,86,86,123,721,163,142,713,418,86,317,675,209,218,218,218,371,545,592,629,490,603,199,46,320,525,680,310,279,388,111,42,252,593,607,235,617,410,377,50,548,135,356,17,520,189,116,392,600,349,332,482,699,690,535,119,106,451,71,152,667,131,218,218,265,671,637,492,504,533,683,269,269,658,86,86,86,86,86,86,86,86,86,491,619,86,86,6,86,86,86,86,86,86,86,86,86,86,86,229,86,86,86,86,86,86,86,86,86,86,86,86,667,86,86,171,131,118,131,656,206,234,571,89,334,670,246,311,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,534,86,86,86,86,86,86,82,86,86,86,86,86,430,86,86,86,86,86,86,86,86,86,599,86,324,86,470,69,640,264,131,626,101,174,86,86,667,233,105,73,374,394,221,204,84,28,326,86,86,471,86,86,86,109,573,86,171,200,200,200,200,218,218,86,86,86,86,460,131,131,131,86,506,86,86,86,86,86,220,404,34,614,47,442,305,25,612,338,601,648,7,344,255,131,131,51,86,312,507,563,86,86,86,86,588,86,86,86,86,86,530,511,86,458,3,435,384,556,522,230,527,86,118,86,86,717,86,137,273,79,181,484,23,93,112,655,249,417,703,370,87,98,313,684,585,155,465,596,481,695,18,416,428,61,701,706,282,643,495,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,549,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,549,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,307,86,86,86,171,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,650,131,422,542,420,263,24,172,86,86,86,86,86,566,86,86,132,540,395,353,494,519,19,485,284,472,131,131,131,16,714,86,211,708,86,86,86,694,698,86,86,483,704,708,218,272,86,86,120,86,159,478,86,307,247,86,86,663,597,459,627,667,86,86,277,455,39,302,86,250,86,86,86,271,99,452,306,281,329,400,200,86,86,362,549,352,646,461,323,586,86,86,4,708,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,717,86,518,86,86,650,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,125,554,480,300,613,72,333,288,561,544,604,48,719,91,169,176,590,224,76,191,29,559,560,231,537,166,477,538,256,437,131,131,469,167,40,0,685,266,441,705,239,642,475,568,640,610,299,673,517,318,385,22,202,180,179,359,424,215,90,66,521,653,467,682,453,409,479,88,131,661,35,303,15,262,666,630,712,131,131,618,659,175,218,195,347,193,227,261,150,165,709,546,294,569,710,270,413,376,524,55,242,38,419,529,170,657,3,304,122,379,278,131,651,86,67,576,458,458,131,131,86,86,86,86,86,86,86,118,309,86,86,547,86,86,86,86,667,650,664,131,131,86,86,56,131,131,131,131,131,131,131,131,86,307,86,86,86,664,238,650,86,86,717,86,118,86,86,315,86,59,86,86,574,549,131,131,340,57,436,86,86,86,86,86,86,458,708,499,691,62,86,650,86,86,694,86,86,86,319,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,171,86,549,694,131,131,131,131,131,131,131,131,131,77,86,86,139,86,502,86,86,86,667,595,131,131,131,86,12,86,13,86,609,131,131,131,131,86,86,86,625,86,669,86,86,182,129,86,5,694,104,86,86,86,86,131,131,86,86,386,171,86,86,86,345,86,324,86,589,86,213,36,131,131,131,131,131,86,86,86,86,104,131,131,131,141,290,80,677,86,86,86,267,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,667,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,515,86,86,33,136,669,86,711,515,86,86,550,640,86,104,708,515,86,159,372,717,86,86,444,515,86,86,663,37,86,563,460,86,390,624,702,131,131,131,131,389,59,708,86,86,341,208,708,635,295,69,108,431,508,100,190,131,131,131,131,131,131,131,131,86,86,86,649,516,660,131,131,86,86,86,218,631,708,131,131,131,131,131,131,131,131,131,131,86,86,341,575,238,514,131,131,86,86,86,218,291,708,307,131,86,86,306,367,708,131,131,131,86,378,697,86,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,615,253,86,86,86,292,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,104,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,69,86,341,553,549,86,307,86,86,645,275,455,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,708,131,131,131,131,131,131,86,86,86,86,86,86,667,460,86,86,86,86,86,86,86,86,86,86,86,86,717,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,667,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,171,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,104,86,667,459,131,131,131,131,131,131,86,458,225,86,86,86,516,549,11,390,405,86,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,460,44,218,197,711,515,131,131,131,131,664,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,307,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,308,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,640,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,118,307,104,286,591,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,549,86,86,681,86,86,75,185,314,582,86,358,496,474,86,104,131,86,86,86,86,146,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,171,86,640,131,131,131,131,131,131,131,131,246,503,689,339,674,81,258,415,439,128,562,366,414,246,503,689,583,222,557,316,636,665,186,355,95,670,246,503,689,339,674,557,258,415,439,186,355,95,670,246,503,689,446,644,536,652,331,532,335,440,274,421,297,570,74,425,364,425,606,552,403,509,134,365,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,218,218,218,498,218,218,577,627,551,497,572,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,553,354,236,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,296,455,131,131,456,243,103,86,41,459,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,9,276,158,716,393,564,383,489,401,654,210,654,131,131,131,640,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,650,86,86,86,86,86,86,717,667,563,563,563,86,549,102,686,133,246,605,86,448,86,86,207,307,131,131,131,641,86,177,611,445,373,194,584,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,308,307,171,86,86,86,86,86,86,86,717,86,86,86,86,86,460,131,131,650,86,86,86,694,708,86,86,694,86,458,131,131,131,131,131,131,667,694,289,650,667,131,131,86,640,131,131,664,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,171,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,460,86,86,86,86,86,86,86,86,86,86,86,86,86,458,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,640,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,466,203,149,429,94,432,160,687,539,63,237,283,192,248,348,259,427,526,396,676,254,468,487,212,327,623,49,633,322,493,434,688,357,361,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131]),r="صلى الله عليه وسلمجل جلالهキロメートルrad∕s2エスクードキログラムキロワットグラムトンクルゼイロサンチームパーセントピアストルファラッドブッシェルヘクタールマンションミリバールレントゲン′′′′1⁄10viii(10)(11)(12)(13)(14)(15)(16)(17)(18)(19)(20)∫∫∫∫(오전)(오후)アパートアルファアンペアイニングエーカーカラットカロリーキュリーギルダークローネサイクルシリングバーレルフィートポイントマイクロミクロンメガトンリットルルーブル株式会社kcalm∕s2c∕kgاكبرمحمدصلعمرسولریال1⁄41⁄23⁄4 ̈́ྲཱྀླཱྀ ̈͂ ̓̀ ̓́ ̓͂ ̔̀ ̔́ ̔͂ ̈̀‵‵‵a/ca/sc/oc/utelfax1⁄71⁄91⁄32⁄31⁄52⁄53⁄54⁄51⁄65⁄61⁄83⁄85⁄87⁄8xii0⁄3∮∮∮(1)(2)(3)(4)(5)(6)(7)(8)(9)(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)(z)::====(ᄀ)(ᄂ)(ᄃ)(ᄅ)(ᄆ)(ᄇ)(ᄉ)(ᄋ)(ᄌ)(ᄎ)(ᄏ)(ᄐ)(ᄑ)(ᄒ)(가)(나)(다)(라)(마)(바)(사)(아)(자)(차)(카)(타)(파)(하)(주)(一)(二)(三)(四)(五)(六)(七)(八)(九)(十)(月)(火)(水)(木)(金)(土)(日)(株)(有)(社)(名)(特)(財)(祝)(労)(代)(呼)(学)(監)(企)(資)(協)(祭)(休)(自)(至)pte10月11月12月ergltdアールインチウォンオンスオームカイリガロンガンマギニーケースコルナコーポセンチダースノットハイツパーツピクルフランペニヒヘルツペンスページベータボルトポンドホールホーンマイルマッハマルクヤードヤールユアンルピー10点11点12点13点14点15点16点17点18点19点20点21点22点23点24点hpabardm2dm3khzmhzghzthzmm2cm2km2mm3cm3km3kpampagpalogmilmolppmv∕ma∕m10日11日12日13日14日15日16日17日18日19日20日21日22日23日24日25日26日27日28日29日30日31日galffifflשּׁשּׂ ٌّ ٍّ َّ ُّ ِّ ّٰـَّـُّـِّتجمتحجتحمتخمتمجتمحتمخجمححميحمىسحجسجحسجىسمحسمجسممصححصممشحمشجيشمخشممضحىضخمطمحطممطميعجمعممعمىغممغميغمىفخمقمحقمملحملحيلحىلججلخملمحمحجمحيمجحمجممخممجخهمجهممنحمنحىنجمنجىنمينمىيممبخيتجيتجىتخيتخىتميتمىجميجحىجمىسخىصحيشحيضحيلجيلمييحييجييميمميقمينحيعميكمينجحمخيلجمكممجحيحجيمجيفميبحيسخينجيصلےقلے𝅘𝅥𝅮𝅘𝅥𝅯𝅘𝅥𝅰𝅘𝅥𝅱𝅘𝅥𝅲𝆹𝅥𝅮𝆺𝅥𝅮𝆹𝅥𝅯𝆺𝅥𝅯〔s〕ppv〔本〕〔三〕〔二〕〔安〕〔点〕〔打〕〔盗〕〔勝〕〔敗〕 ̄ ́ ̧ssi̇ijl·ʼndžljnjdz ̆ ̇ ̊ ̨ ̃ ̋ ιեւاٴوٴۇٴيٴक़ख़ग़ज़ड़ढ़फ़य़ড়ঢ়য়ਲ਼ਸ਼ਖ਼ਗ਼ਜ਼ਫ਼ଡ଼ଢ଼ําໍາຫນຫມགྷཌྷདྷབྷཛྷཀྵཱཱིུྲྀླྀྒྷྜྷྡྷྦྷྫྷྐྵaʾἀιἁιἂιἃιἄιἅιἆιἇιἠιἡιἢιἣιἤιἥιἦιἧιὠιὡιὢιὣιὤιὥιὦιὧιὰιαιάιᾶι ͂ὴιηιήιῆιὼιωιώιῶι ̳!! ̅???!!?rs°c°fnosmtmivix⫝̸ ゙ ゚よりコト333435참고주의363738394042444546474849503月4月5月6月7月8月9月hgevギガデシドルナノピコビルペソホンリラレムdaauovpciu平成昭和大正明治naμakakbmbgbpfnfμfμgmgμlmldlklfmnmμmpsnsμsmsnvμvkvpwnwμwmwkwkωmωbqcccddbgyhainkkktlnlxphprsrsvwbstմնմեմիվնմխיִײַשׁשׂאַאָאּבּגּדּהּוּזּטּיּךּכּלּמּנּסּףּפּצּקּרּתּוֹבֿכֿפֿאלئائەئوئۇئۆئۈئېئىئجئحئمئيبجبمبىبيتىتيثجثمثىثيخحضجضمطحظمغجفجفحفىفيقحقىقيكاكجكحكخكلكىكينخنىنيهجهىهييىذٰرٰىٰئرئزئنبزبنترتزتنثرثزثنمانرنزننيريزئخئهبهتهصخنههٰثهسهشهطىطيعىعيغىغيسىسيشىشيصىصيضىضيشخشرسرصرضراً ًـًـّ ْـْلآلألإ𝅗𝅥0,1,2,3,4,5,6,7,8,9,wzhvsdwcmcmddjほかココàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįĵķĺļľłńņňŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷÿźżɓƃƅɔƈɖɗƌǝəɛƒɠɣɩɨƙɯɲɵơƣƥʀƨʃƭʈưʊʋƴƶʒƹƽǎǐǒǔǖǘǚǜǟǡǣǥǧǩǫǭǯǵƕƿǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟƞȣȥȧȩȫȭȯȱȳⱥȼƚⱦɂƀʉʌɇɉɋɍɏɦɹɻʁʕͱͳʹͷ;ϳέίόύβγδεζθκλνξοπρστυφχψϊϋϗϙϛϝϟϡϣϥϧϩϫϭϯϸϻͻͼͽѐёђѓєѕіїјљњћќѝўџабвгдежзийклмнопрстуфхцчшщъыьэюяѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧԩԫԭԯաբգդզէըթժլծկհձղճյշոչպջռստրցփքօֆ་ⴧⴭნᏰᏱᏲᏳᏴᏵꙋɐɑᴂɜᴖᴗᴝᴥɒɕɟɡɥɪᵻʝɭᶅʟɱɰɳɴɸʂƫᴜʐʑḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿἐἑἒἓἔἕἰἱἲἳἴἵἶἷὀὁὂὃὄὅὑὓὕὗᾰᾱὲΐῐῑὶΰῠῡὺῥ`ὸ‐+−∑〈〉ⰰⰱⰲⰳⰴⰵⰶⰷⰸⰹⰺⰻⰼⰽⰾⰿⱀⱁⱂⱃⱄⱅⱆⱇⱈⱉⱊⱋⱌⱍⱎⱏⱐⱑⱒⱓⱔⱕⱖⱗⱘⱙⱚⱛⱜⱝⱞⱡɫᵽɽⱨⱪⱬⱳⱶȿɀⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣⳬⳮⳳⵡ母龟丨丶丿乙亅亠人儿入冂冖冫几凵刀力勹匕匚匸卜卩厂厶又口囗士夂夊夕女子宀寸小尢尸屮山巛工己巾干幺广廴廾弋弓彐彡彳心戈戶手支攴文斗斤方无曰欠止歹殳毋比毛氏气爪父爻爿片牙牛犬玄玉瓜瓦甘生用田疋疒癶白皮皿目矛矢石示禸禾穴立竹米糸缶网羊羽老而耒耳聿肉臣臼舌舛舟艮色艸虍虫血行衣襾見角言谷豆豕豸貝赤走足身車辛辰辵邑酉釆里長門阜隶隹雨靑非面革韋韭音頁風飛食首香馬骨高髟鬥鬯鬲鬼魚鳥鹵鹿麥麻黃黍黑黹黽鼎鼓鼠鼻齊齒龍龜龠.〒卄卅ᄁᆪᆬᆭᄄᆰᆱᆲᆳᆴᆵᄚᄈᄡᄊ짜ᅢᅣᅤᅥᅦᅧᅨᅩᅪᅫᅬᅭᅮᅯᅰᅱᅲᅳᅴᅵᄔᄕᇇᇈᇌᇎᇓᇗᇙᄜᇝᇟᄝᄞᄠᄢᄣᄧᄩᄫᄬᄭᄮᄯᄲᄶᅀᅇᅌᇱᇲᅗᅘᅙᆄᆅᆈᆑᆒᆔᆞᆡ上中下甲丙丁天地問幼箏우秘男適優印注項写左右医宗夜テヌモヨヰヱヲꙁꙃꙅꙇꙉꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꚙꚛꜣꜥꜧꜩꜫꜭꜯꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝺꝼᵹꝿꞁꞃꞅꞇꞌꞑꞓꞗꞙꞛꞝꞟꞡꞣꞥꞧꞩɬʞʇꭓꞵꞷꬷꭒᎠᎡᎢᎣᎤᎥᎦᎧᎨᎩᎪᎫᎬᎭᎮᎯᎰᎱᎲᎳᎴᎵᎶᎷᎸᎹᎺᎻᎼᎽᎾᎿᏀᏁᏂᏃᏄᏅᏆᏇᏈᏉᏊᏋᏌᏍᏎᏏᏐᏑᏒᏓᏔᏕᏖᏗᏘᏙᏚᏛᏜᏝᏞᏟᏠᏡᏢᏣᏤᏥᏦᏧᏨᏩᏪᏫᏬᏭᏮᏯ豈更賈滑串句契喇奈懶癩羅蘿螺裸邏樂洛烙珞落酪駱亂卵欄爛蘭鸞嵐濫藍襤拉臘蠟廊朗浪狼郎來冷勞擄櫓爐盧蘆虜路露魯鷺碌祿綠菉錄論壟弄籠聾牢磊賂雷壘屢樓淚漏累縷陋勒肋凜凌稜綾菱陵讀拏諾丹寧怒率異北磻便復不泌數索參塞省葉說殺沈拾若掠略亮兩凉梁糧良諒量勵呂廬旅濾礪閭驪麗黎曆歷轢年憐戀撚漣煉璉秊練聯輦蓮連鍊列劣咽烈裂廉念捻殮簾獵令囹嶺怜玲瑩羚聆鈴零靈領例禮醴隸惡了僚寮尿料燎療蓼遼暈阮劉杻柳流溜琉留硫紐類戮陸倫崙淪輪律慄栗隆利吏履易李梨泥理痢罹裏裡離匿溺吝燐璘藺隣鱗麟林淋臨笠粒狀炙識什茶刺切度拓糖宅洞暴輻降廓兀嗀塚晴凞猪益礼神祥福靖精蘒諸逸都飯飼館鶴郞隷侮僧免勉勤卑喝嘆器塀墨層悔慨憎懲敏既暑梅海渚漢煮爫琢碑祉祈祐祖禍禎穀突節縉繁署者臭艹著褐視謁謹賓贈辶難響頻恵𤋮舘並况全侀充冀勇勺啕喙嗢墳奄奔婢嬨廒廙彩徭惘慎愈慠戴揄搜摒敖望杖滛滋瀞瞧爵犯瑱甆画瘝瘟盛直睊着磌窱类絛缾荒華蝹襁覆調請諭變輸遲醙鉶陼韛頋鬒𢡊𢡄𣏕㮝䀘䀹𥉉𥳐𧻓齃龎עםٱٻپڀٺٿٹڤڦڄڃچڇڍڌڎڈژڑکگڳڱںڻۀہھۓڭۋۅۉ、〖〗—–_{}【】《》「」『』[]#&*-<>\\$%@ءؤة\"'^|~⦅⦆・ゥャ¢£¬¦¥₩│←↑→↓■○𐐨𐐩𐐪𐐫𐐬𐐭𐐮𐐯𐐰𐐱𐐲𐐳𐐴𐐵𐐶𐐷𐐸𐐹𐐺𐐻𐐼𐐽𐐾𐐿𐑀𐑁𐑂𐑃𐑄𐑅𐑆𐑇𐑈𐑉𐑊𐑋𐑌𐑍𐑎𐑏𐓘𐓙𐓚𐓛𐓜𐓝𐓞𐓟𐓠𐓡𐓢𐓣𐓤𐓥𐓦𐓧𐓨𐓩𐓪𐓫𐓬𐓭𐓮𐓯𐓰𐓱𐓲𐓳𐓴𐓵𐓶𐓷𐓸𐓹𐓺𐓻𐳀𐳁𐳂𐳃𐳄𐳅𐳆𐳇𐳈𐳉𐳊𐳋𐳌𐳍𐳎𐳏𐳐𐳑𐳒𐳓𐳔𐳕𐳖𐳗𐳘𐳙𐳚𐳛𐳜𐳝𐳞𐳟𐳠𐳡𐳢𐳣𐳤𐳥𐳦𐳧𐳨𐳩𐳪𐳫𐳬𐳭𐳮𐳯𐳰𐳱𐳲𑣀𑣁𑣂𑣃𑣄𑣅𑣆𑣇𑣈𑣉𑣊𑣋𑣌𑣍𑣎𑣏𑣐𑣑𑣒𑣓𑣔𑣕𑣖𑣗𑣘𑣙𑣚𑣛𑣜𑣝𑣞𑣟ıȷ∇∂𞤢𞤣𞤤𞤥𞤦𞤧𞤨𞤩𞤪𞤫𞤬𞤭𞤮𞤯𞤰𞤱𞤲𞤳𞤴𞤵𞤶𞤷𞤸𞤹𞤺𞤻𞤼𞤽𞤾𞤿𞥀𞥁𞥂𞥃ٮڡٯ字双多解交映無前後再新初終販声吹演投捕遊指禁空合満申割営配得可丽丸乁𠄢你侻倂偺備像㒞𠘺兔兤具𠔜㒹內𠕋冗冤仌冬𩇟刃㓟刻剆剷㔕包匆卉博即卽卿𠨬灰及叟𠭣叫叱吆咞吸呈周咢哶唐啓啣善喫喳嗂圖圗噑噴壮城埴堍型堲報墬𡓤売壷夆夢奢𡚨𡛪姬娛娧姘婦㛮嬈嬾𡧈寃寘寳𡬘寿将㞁屠峀岍𡷤嵃𡷦嵮嵫嵼巡巢㠯巽帨帽幩㡢𢆃㡼庰庳庶𪎒𢌱舁弢㣇𣊸𦇚形彫㣣徚忍志忹悁㤺㤜𢛔惇慈慌慺憲憤憯懞戛扝抱拔捐𢬌挽拼捨掃揤𢯱搢揅掩㨮摩摾撝摷㩬敬𣀊旣書晉㬙㬈㫤冒冕最暜肭䏙朡杞杓𣏃㭉柺枅桒𣑭梎栟椔楂榣槪檨𣚣櫛㰘次𣢧歔㱎歲殟殻𣪍𡴋𣫺汎𣲼沿泍汧洖派浩浸涅𣴞洴港湮㴳滇𣻑淹潮𣽞𣾎濆瀹瀛㶖灊災灷炭𠔥煅𤉣熜爨牐𤘈犀犕𤜵𤠔獺王㺬玥㺸瑇瑜璅瓊㼛甤𤰶甾𤲒𢆟瘐𤾡𤾸𥁄㿼䀈𥃳𥃲𥄙𥄳眞真瞋䁆䂖𥐝硎䃣𥘦𥚚𥛅秫䄯穊穏𥥼𥪧䈂𥮫篆築䈧𥲀糒䊠糨糣紀𥾆絣䌁緇縂繅䌴𦈨𦉇䍙𦋙罺𦌾羕翺𦓚𦔣聠𦖨聰𣍟䏕育脃䐋脾媵𦞧𦞵𣎓𣎜舄辞䑫芑芋芝劳花芳芽苦𦬼茝荣莭茣莽菧荓菊菌菜𦰶𦵫𦳕䔫蓱蓳蔖𧏊蕤𦼬䕝䕡𦾱𧃒䕫虐虧虩蚩蚈蜎蛢蜨蝫螆蟡蠁䗹衠𧙧裗裞䘵裺㒻𧢮𧥦䚾䛇誠𧲨貫賁贛起𧼯𠠄跋趼跰𠣞軔𨗒𨗭邔郱鄑𨜮鄛鈸鋗鋘鉼鏹鐕𨯺開䦕閷𨵷䧦雃嶲霣𩅅𩈚䩮䩶韠𩐊䪲𩒖頩𩖶飢䬳餩馧駂駾䯎𩬰鱀鳽䳎䳭鵧𪃎䳸𪄅𪈎𪊑䵖黾鼅鼏鼖𪘀";function n(r){return r>=196608?r>=917760&&r<=917999?18874368:0:t[e[r>>4]][15&r]}return{mapStr:r,mapChar:n}}))},ad25:function(t,e,r){var n=r("2aee"),i=r("11dc"),o=r("98e6"),a=r("f460"),s=r("83d5"),u=r("399f"),c=r("5291"),f=r("a958"),h=r("8707").Buffer;function l(t,e){var r=t.modulus.byteLength(),n=e.length,c=o("sha1").update(h.alloc(0)).digest(),f=c.length,l=2*f;if(n>r-l-2)throw new Error("message too long");var d=h.alloc(r-n-l-2),p=r-f-1,m=i(f),y=s(h.concat([c,d,h.alloc(1,1),e],p),a(m,p)),v=s(m,a(y,f));return new u(h.concat([h.alloc(1),v,y],r))}function d(t,e,r){var n,i=e.length,o=t.modulus.byteLength();if(i>o-11)throw new Error("message too long");return n=r?h.alloc(o-i-3,255):p(o-i-3),new u(h.concat([h.from([0,r?1:2]),n,h.alloc(1),e],o))}function p(t){var e,r=h.allocUnsafe(t),n=0,o=i(2*t),a=0;while(n=0)throw new Error("data too long for modulus")}return r?f(o,a):c(o,a)}},ad71:function(t,e,r){"use strict";(function(e,n){var i=r("966d");t.exports=A;var o,a=r("e3db");A.ReadableState=_;r("faa1").EventEmitter;var s=function(t,e){return t.listeners(e).length},u=r("429b"),c=r("8707").Buffer,f=e.Uint8Array||function(){};function h(t){return c.from(t)}function l(t){return c.isBuffer(t)||t instanceof f}var d=Object.create(r("3a7c"));d.inherits=r("3fb5");var p=r(2),m=void 0;m=p&&p.debuglog?p.debuglog("stream"):function(){};var y,v=r("5e1a"),b=r("4681");d.inherits(A,u);var g=["error","close","destroy","pause","resume"];function w(t,e,r){if("function"===typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}function _(t,e){o=o||r("b19a"),t=t||{};var n=e instanceof o;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,a=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new v,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.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(y||(y=r("7d72").StringDecoder),this.decoder=new y(t.encoding),this.encoding=t.encoding)}function A(t){if(o=o||r("b19a"),!(this instanceof A))return new A(t);this._readableState=new _(t,this),this.readable=!0,t&&("function"===typeof t.read&&(this._read=t.read),"function"===typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function E(t,e,r,n,i){var o,a=t._readableState;null===e?(a.reading=!1,T(t,a)):(i||(o=M(a,e)),o?t.emit("error",o):a.objectMode||e&&e.length>0?("string"===typeof e||a.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=h(e)),n?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):x(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):P(t,a)):x(t,a,e,!1))):n||(a.reading=!1));return k(a)}function x(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&U(t)),P(t,e)}function M(t,e){var r;return l(e)||"string"===typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function k(t){return!t.ended&&(t.needReadable||t.length=S?t=S:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function C(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=I(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t,e){if(!e.ended){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,U(t)}}function U(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(m("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(O,t):O(t))}function O(t){m("emit readable"),t.emit("readable"),D(t)}function P(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(R,t,e))}function R(t,e){var r=e.length;while(!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=q(t,e.buffer,e.decoder),r);var r}function q(t,e,r){var n;return to.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),t-=a,0===t){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}function z(t,e){var r=c.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;while(n=n.next){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),t-=a,0===t){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}function K(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(V,e,t))}function V(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function G(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return m("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?K(this):U(this),null;if(t=C(t,e),0===t&&e.ended)return 0===e.length&&K(this),null;var n,i=e.needReadable;return m("need readable",i),(0===e.length||e.length-t0?F(t,e):null,null===n?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&K(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},A.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t);break}o.pipesCount+=1,m("pipe count=%d opts=%j",o.pipesCount,e);var a=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr,u=a?f:_;function c(t,e){m("onunpipe"),t===r&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,d())}function f(){m("onend"),t.end()}o.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",c);var h=N(r);t.on("drain",h);var l=!1;function d(){m("cleanup"),t.removeListener("close",b),t.removeListener("finish",g),t.removeListener("drain",h),t.removeListener("error",v),t.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",_),r.removeListener("data",y),l=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||h()}var p=!1;function y(e){m("ondata"),p=!1;var n=t.write(e);!1!==n||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==G(o.pipes,t))&&!l&&(m("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function v(e){m("onerror",e),_(),t.removeListener("error",v),0===s(t,"error")&&t.emit("error",e)}function b(){t.removeListener("finish",g),_()}function g(){m("onfinish"),t.removeListener("close",b),_()}function _(){m("unpipe"),r.unpipe(t)}return r.on("data",y),w(t,"error",v),t.once("close",b),t.once("finish",g),t.emit("pipe",r),o.flowing||(m("pipe resume"),r.resume()),t},A.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;o0||o>0){var f=new i;f.update(c),f.update(t),e&&f.update(e),c=f.digest();var h=0;if(a>0){var l=s.length-a;h=Math.min(a,c.length),c.copy(s,l,0,h),a-=h}if(h0){var d=u.length-o,p=Math.min(o,c.length-h);c.copy(u,d,h,h+p),o-=p}}return c.fill(0),{key:s,iv:u}}t.exports=o},ae93:function(t,e,r){"use strict";var n,i,o,a=r("e163"),s=r("9112"),u=r("5135"),c=r("b622"),f=r("c430"),h=c("iterator"),l=!1,d=function(){return this};[].keys&&(o=[].keys(),"next"in o?(i=a(a(o)),i!==Object.prototype&&(n=i)):l=!0),void 0==n&&(n={}),f||u(n,h)||s(n,h,d),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:l}},aea0:function(t){t.exports=JSON.parse('{"name":"istanbul","comment":"HF targeted for December 2019 following the Constantinople/Petersburg HF","eip":{"url":"https://eips.ethereum.org/EIPS/eip-1679","status":"Draft"},"gasConfig":{},"gasPrices":{"blake2Round":{"v":1,"d":"Gas cost per round for the Blake2 F precompile"},"ecAdd":{"v":150,"d":"Gas costs for curve addition precompile"},"ecMul":{"v":6000,"d":"Gas costs for curve multiplication precompile"},"ecPairing":{"v":45000,"d":"Base gas costs for curve pairing precompile"},"ecPairingWord":{"v":34000,"d":"Gas costs regarding curve pairing precompile input length"},"txDataNonZero":{"v":16,"d":"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},"sstoreSentryGasEIP2200":{"v":2300,"d":"Minimum gas required to be present for an SSTORE call, not consumed"},"sstoreNoopGasEIP2200":{"v":800,"d":"Once per SSTORE operation if the value doesn\'t change"},"sstoreDirtyGasEIP2200":{"v":800,"d":"Once per SSTORE operation if a dirty value is changed"},"sstoreInitGasEIP2200":{"v":20000,"d":"Once per SSTORE operation from clean zero to non-zero"},"sstoreInitRefundEIP2200":{"v":19200,"d":"Once per SSTORE operation for resetting to the original zero value"},"sstoreCleanGasEIP2200":{"v":5000,"d":"Once per SSTORE operation from clean non-zero to something else"},"sstoreCleanRefundEIP2200":{"v":4200,"d":"Once per SSTORE operation for resetting to the original non-zero value"},"sstoreClearRefundEIP2200":{"v":15000,"d":"Once per SSTORE operation for clearing an originally existing storage slot"}},"vm":{},"pow":{},"casper":{},"sharding":{}}')},b041:function(t,e,r){"use strict";var n=r("00ee"),i=r("f5df");t.exports=n?{}.toString:function(){return"[object "+i(this)+"]"}},b19a:function(t,e,r){"use strict";var n=r("966d"),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var o=Object.create(r("3a7c"));o.inherits=r("3fb5");var a=r("ad71"),s=r("dc14");o.inherits(h,a);for(var u=i(s.prototype),c=0;c>>32-e}function m(t,e,r,n,i,o,a,s){return p(t+(e^r^n)+o+a|0,s)+i|0}function y(t,e,r,n,i,o,a,s){return p(t+(e&r|~e&n)+o+a|0,s)+i|0}function v(t,e,r,n,i,o,a,s){return p(t+((e|~r)^n)+o+a|0,s)+i|0}function b(t,e,r,n,i,o,a,s){return p(t+(e&n|r&~n)+o+a|0,s)+i|0}function g(t,e,r,n,i,o,a,s){return p(t+(e^(r|~n))+o+a|0,s)+i|0}i(d,o),d.prototype._update=function(){for(var t=a,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,d=0|this._e,w=0|this._a,_=0|this._b,A=0|this._c,E=0|this._d,x=0|this._e,M=0;M<80;M+=1){var k,S;M<16?(k=m(r,n,i,o,d,t[s[M]],h[0],c[M]),S=g(w,_,A,E,x,t[u[M]],l[0],f[M])):M<32?(k=y(r,n,i,o,d,t[s[M]],h[1],c[M]),S=b(w,_,A,E,x,t[u[M]],l[1],f[M])):M<48?(k=v(r,n,i,o,d,t[s[M]],h[2],c[M]),S=v(w,_,A,E,x,t[u[M]],l[2],f[M])):M<64?(k=b(r,n,i,o,d,t[s[M]],h[3],c[M]),S=y(w,_,A,E,x,t[u[M]],l[3],f[M])):(k=g(r,n,i,o,d,t[s[M]],h[4],c[M]),S=m(w,_,A,E,x,t[u[M]],l[4],f[M])),r=d,d=o,o=p(i,10),i=n,n=k,w=x,x=E,E=p(A,10),A=_,_=S}var I=this._b+i+E|0;this._b=this._c+o+x|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+A|0,this._a=I},d.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},t.exports=d},b622:function(t,e,r){var n=r("da84"),i=r("5692"),o=r("5135"),a=r("90e3"),s=r("4930"),u=r("fdbf"),c=i("wks"),f=n.Symbol,h=u?f:f&&f.withoutSetter||a;t.exports=function(t){return o(c,t)||(s&&o(f,t)?c[t]=f[t]:c[t]=h("Symbol."+t)),c[t]}},b639:function(t,e,r){"use strict";(function(t){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var n=r("1fb5"),i=r("9152"),o=r("e3db");function a(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"===typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),c.alloc(+t)}function w(t,e){if(c.isBuffer(t))return t.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!==typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(t).length;default:if(n)return Z(t).length;e=(""+e).toLowerCase(),n=!0}}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,r<=e)return"";t||(t="utf8");while(1)switch(t){case"hex":return j(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return N(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function A(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function E(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),r=+r,isNaN(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=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:x(t,e,r,n,i);if("number"===typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):x(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function x(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var h=!0,l=0;li&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(f=c);break;case 2:o=t[i+1],128===(192&o)&&(u=(31&c)<<6|63&o,u>127&&(f=u));break;case 3:o=t[i+1],a=t[i+2],128===(192&o)&&128===(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a,u>2047&&(u<55296||u>57343)&&(f=u));break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128===(192&o)&&128===(192&a)&&128===(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s,u>65535&&u<1114112&&(f=u))}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return R(n)}e.Buffer=c,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:a(),e.kMaxLength=s(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,r){return f(null,t,e,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,r){return l(null,t,e,r)},c.allocUnsafe=function(t){return d(null,t)},c.allocUnsafeSlow=function(t){return d(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},c.prototype.compare=function(t,e,r,n,i){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");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,a=r-e,s=Math.min(o,a),u=this.slice(n,i),f=t.slice(e,r),h=0;hi)&&(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 M(this,t,e,r);case"utf8":case"utf-8":return k(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return C(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function R(t){var e=t.length;if(e<=P)return String.fromCharCode.apply(String,t);var r="",n=0;while(nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function F(t,e,r,n,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function q(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function H(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function z(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 K(t,e,r,n,o){return o||z(t,e,r,4,34028234663852886e22,-34028234663852886e22),i.write(t,e,r,n,23,4),r+4}function V(t,e,r,n,o){return o||z(t,e,r,8,17976931348623157e292,-17976931348623157e292),i.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e0&&(i*=256))n+=this[t+--e]*i;return n},c.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);var n=this[t],i=1,o=0;while(++o=i&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||D(t,e,this.length);var n=e,i=1,o=this[t+--n];while(n>0&&(i*=256))o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;F(this,t,e,r,i,0)}var o=1,a=0;this[e]=255&t;while(++a=0&&(a*=256))this[e+o]=t/a&255;return e+r},c.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):q(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):q(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):H(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):H(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;this[e]=255&t;while(++o>0)-s&255;return e+r},c.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;this[e+o]=255&t;while(--o>=0&&(a*=256))t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):q(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):q(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):H(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):H(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,r){return K(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return K(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return V(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return V(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"===typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+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 J(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n)}return o}function Q(t){return n.toByteArray($(t))}function tt(t,e,r,n){for(var i=0;i=e.length||i>=t.length)break;e[i+r]=t[i]}return i}function et(t){return t!==t}}).call(this,r("c8ba"))},b671:function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0});var i=r("2330");e.secp256k1=i;var o=r("9a12"),a=r("399f");e.BN=a;var s=r("a3ca");e.rlp=s,Object.assign(e,o),n(r("ca96")),n(r("7001")),n(r("eb21")),n(r("b1ba")),n(r("40c9")),n(r("2fd2"))},b672:function(t,e,r){var n=r("8707").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,a=this._len,s=0;s=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")},t.exports=i},b692:function(t,e,r){(function(e){var n=r("98e6"),i=r("d485"),o=r("3fb5"),a=r("6fe7"),s=r("980c"),u=r("b4e8");function c(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function f(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){return new c(t)}function l(t){return new f(t)}Object.keys(u).forEach((function(t){u[t].id=new e(u[t].id,"hex"),u[t.toLowerCase()]=u[t]})),o(c,i.Writable),c.prototype._write=function(t,e,r){this._hash.update(t),r()},c.prototype.update=function(t,r){return"string"===typeof t&&(t=new e(t,r)),this._hash.update(t),this},c.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=a(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},o(f,i.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,r){return"string"===typeof t&&(t=new e(t,r)),this._hash.update(t),this},f.prototype.verify=function(t,r,n){"string"===typeof r&&(r=new e(r,n)),this.end();var i=this._hash.digest();return s(r,i,t,this._signType,this._tag)},t.exports={Sign:h,Verify:l,createSign:h,createVerify:l}}).call(this,r("b639").Buffer)},b73f:function(t,e,r){"use strict";var n=r("399f"),i=r("f3a3"),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,a=e.place;o>>3);t.push(128|r);while(--r)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var o=u(t,r);if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var a=u(t,r),c=t.slice(r.place,a+r.place);if(r.place+=a,2!==t[r.place++])return!1;var f=u(t,r);if(t.length!==f+r.place)return!1;var h=t.slice(r.place,f+r.place);return 0===c[0]&&128&c[1]&&(c=c.slice(1)),0===h[0]&&128&h[1]&&(h=h.slice(1)),this.r=new n(c),this.s=new n(h),this.recoveryParam=null,!0},a.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=c(e),r=c(r);while(!r[0]&&!(128&r[1]))r=r.slice(1);var n=[2];f(n,e.length),n=n.concat(e),n.push(2),f(n,r.length);var o=n.concat(r),a=[48];return f(a,o.length),a=a.concat(o),i.encode(a,t)}},b7a1:function(t,e,r){"use strict";var n=r("17fb"),i=r("d100"),o=r("2c0b"),a=r("5562"),s=r("12c4"),u=r("2222");function c(t){var e=this;this.ens=t,this.contract=t.checkNetwork().then((function(t){var r=new i(s,t);return r.setProvider(e.ens.eth.currentProvider),r}))}c.prototype.owner=function(t,e){var r=new a(!0);return this.contract.then((function(i){i.methods.owner(o.hash(t)).call().then((function(t){r.resolve(t),n.isFunction(e)&&e(t)})).catch((function(t){r.reject(t),n.isFunction(e)&&e(t)}))})),r.eventEmitter},c.prototype.resolver=function(t){var e=this;return this.contract.then((function(e){return e.methods.resolver(o.hash(t)).call()})).then((function(t){var r=new i(u,t);return r.setProvider(e.ens.eth.currentProvider),r}))},t.exports=c},b7d1:function(t,e,r){(function(e){function r(t,e){if(n("noDeprecation"))return t;var r=!1;function i(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return i}function n(t){try{if(!e.localStorage)return!1}catch(n){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=r}).call(this,r("c8ba"))},b837:function(t,e,r){var n=r("3fb5"),i=r("4fd1"),o=r("b672"),a=r("8707").Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.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},u.prototype._hash=function(){var t=a.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},t.exports=u},b9a8:function(t,e,r){"use strict";var n=r("399f"),i=r("6aa2"),o=r("f3a3"),a=r("0cbb"),s=r("fdac"),u=o.assert,c=r("bb34"),f=r("b73f");function h(t){if(!(this instanceof h))return new h(t);"string"===typeof t&&(u(a.hasOwnProperty(t),"Unknown curve "+t),t=a[t]),t instanceof a.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=h,h.prototype.keyPair=function(t){return new c(this,t)},h.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},h.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},h.prototype.genKeyPair=function(t){t||(t={});var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));do{var a=new n(e.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}while(1)},h.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},h.prototype.sign=function(t,e,r,o){"object"===typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),u=t.toArray("be",a),c=new i({hash:this.hash,entropy:s,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new n(1)),l=0;1;l++){var d=o.k?o.k(l):new n(c.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(h)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),y=m.umod(this.n);if(0!==y.cmpn(0)){var v=d.invm(this.n).mul(y.mul(e.getPrivate()).iadd(t));if(v=v.umod(this.n),0!==v.cmpn(0)){var b=(p.getY().isOdd()?1:0)|(0!==m.cmp(y)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),b^=1),new f({r:y,s:v,recoveryParam:b})}}}}}},h.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i),e=new f(e,"hex");var o=e.r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s=a.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(o).umod(this.n);if(!this.curve._maxwellTrick){var h=this.g.mulAdd(u,r.getPublic(),c);return!h.isInfinity()&&0===h.getX().umod(this.n).cmp(o)}h=this.g.jmulAdd(u,r.getPublic(),c);return!h.isInfinity()&&h.eqXToP(o)},h.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new f(e,i);var o=this.n,a=new n(t),s=e.r,c=e.s,h=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var d=e.r.invm(o),p=o.sub(a).mul(d).umod(o),m=c.mul(d).umod(o);return this.g.mulAdd(p,s,m)},h.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new f(e,n),null!==e.recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},bac2:function(t,e,r){var n={ECB:r("0145"),CBC:r("c119"),CFB:r("3505"),CFB8:r("62c9"),CFB1:r("5239"),OFB:r("5165"),CTR:r("6ade"),GCM:r("6ade")},i=r("e85f");for(var o in i)i[o].module=n[i[o].mode];t.exports=i},bb34:function(t,e,r){"use strict";var n=r("399f"),i=r("f3a3"),o=i.assert;function a(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=a,a.fromPublic=function(t,e,r){return e instanceof a?e:new a(t,{pub:e,pubEnc:r})},a.fromPrivate=function(t,e,r){return e instanceof a?e:new a(t,{priv:e,privEnc:r})},a.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(t,e){return"string"===typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},a.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?o(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||o(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},a.prototype.derive=function(t){return t.mul(this.priv).getX()},a.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},a.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},a.prototype.inspect=function(){return""}},bb44:function(t,e,r){"use strict";var n=r("c3c0"),i=r("edc9"),o=n.rotl32,a=n.sum32,s=n.sum32_3,u=n.sum32_4,c=i.BlockHash;function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function l(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(f,c),e.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],f=this.h[4],b=r,g=n,w=i,_=c,A=f,E=0;E<80;E++){var x=a(o(u(r,h(E,n,i,c),t[p[E]+e],l(E)),y[E]),f);r=f,f=c,c=o(i,10),i=n,n=x,x=a(o(u(b,h(79-E,g,w,_),t[m[E]+e],d(E)),v[E]),A),b=A,A=_,_=o(w,10),w=g,g=x}x=s(this.h[1],i,_),this.h[1]=s(this.h[2],c,A),this.h[2]=s(this.h[3],f,b),this.h[3]=s(this.h[4],r,g),this.h[4]=s(this.h[0],n,w),this.h[0]=x},f.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[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],m=[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],y=[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],v=[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]},bbaf:function(t,e,r){var n=r("17fb"),i=r("1131"),o=r("4e33").AbiCoder,a=new o((function(t,e){return!t.match(/^u?int/)||n.isArray(e)||n.isObject(e)&&"BN"===e.constructor.name?e:e.toString()}));function s(){}var u=function(){};u.prototype.encodeFunctionSignature=function(t){return n.isObject(t)&&(t=i._jsonInterfaceMethodToString(t)),i.sha3(t).slice(0,10)},u.prototype.encodeEventSignature=function(t){return n.isObject(t)&&(t=i._jsonInterfaceMethodToString(t)),i.sha3(t)},u.prototype.encodeParameter=function(t,e){return this.encodeParameters([t],[e])},u.prototype.encodeParameters=function(t,e){return a.encode(this.mapTypes(t),e.map((function(t){return i.isBN(t)||i.isBigNumber(t)?t.toString(10):t})))},u.prototype.mapTypes=function(t){var e=this,r=[];return t.forEach((function(t){if(e.isSimplifiedStructFormat(t)){var n=Object.keys(t)[0];r.push(Object.assign(e.mapStructNameAndType(n),{components:e.mapStructToCoderFormat(t[n])}))}else r.push(t)})),r},u.prototype.isSimplifiedStructFormat=function(t){return"object"===typeof t&&"undefined"===typeof t.components&&"undefined"===typeof t.name},u.prototype.mapStructNameAndType=function(t){var e="tuple";return t.indexOf("[]")>-1&&(e="tuple[]",t=t.slice(0,-2)),{type:e,name:t}},u.prototype.mapStructToCoderFormat=function(t){var e=this,r=[];return Object.keys(t).forEach((function(n){"object"!==typeof t[n]?r.push({name:n,type:t[n]}):r.push(Object.assign(e.mapStructNameAndType(n),{components:e.mapStructToCoderFormat(t[n])}))})),r},u.prototype.encodeFunctionCall=function(t,e){return this.encodeFunctionSignature(t)+this.encodeParameters(t.inputs,e).replace("0x","")},u.prototype.decodeParameter=function(t,e){return this.decodeParameters([t],e)[0]},u.prototype.decodeParameters=function(t,e){if(t.length>0&&(!e||"0x"===e||"0X"===e))throw new Error("Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.");var r=a.decode(this.mapTypes(t),"0x"+e.replace(/0x/i,"")),i=new s;return i.__length__=0,t.forEach((function(t,e){var o=r[i.__length__];o="0x"===o?null:o,i[e]=o,n.isObject(t)&&t.name&&(i[t.name]=o),i.__length__++})),i},u.prototype.decodeLog=function(t,e,r){var i=this;r=n.isArray(r)?r:[r],e=e||"";var o=[],a=[],u=0;t.forEach((function(t,e){t.indexed?(a[e]=["bool","int","uint","address","fixed","ufixed"].find((function(e){return-1!==t.type.indexOf(e)}))?i.decodeParameter(t.type,r[u]):r[u],u++):o[e]=t}));var c=e,f=c?this.decodeParameters(o,c):[],h=new s;return h.__length__=0,t.forEach((function(t,e){h[e]="string"===t.type?"":null,"undefined"!==typeof f[e]&&(h[e]=f[e]),"undefined"!==typeof a[e]&&(h[e]=a[e]),t.name&&(h[t.name]=h[e]),h.__length__++})),h};var c=new u;t.exports=c},bd9d:function(t,e){function r(t){var e,r=t.length;while(r--){if(e=t.readUInt8(r),255!==e){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}t.exports=r},be09:function(t,e,r){(function(e){var r;r="undefined"!==typeof window?window:"undefined"!==typeof e?e:"undefined"!==typeof self?self:{},t.exports=r}).call(this,r("c8ba"))},c04e:function(t,e,r){var n=r("861d");t.exports=function(t,e){if(!n(t))return t;var r,i;if(e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!n(i=r.call(t)))return i;if(!e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},c119:function(t,e,r){var n=r("8c8a");e.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},e.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},c24d:function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},c2ae:function(t,e,r){t.exports=r("e372").PassThrough},c3c0:function(t,e,r){"use strict";var n=r("da3e"),i=r("3fb5");function o(t,e){return 55296===(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320===(64512&t.charCodeAt(e+1)))}function a(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"===typeof t)if(e){if("hex"===e)for(t=t.replace(/[^a-z0-9]+/gi,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24;return e>>>0}function c(t,e){for(var r="",n=0;n>>0}return a}function d(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r}function p(t,e){return t>>>e|t<<32-e}function m(t,e){return t<>>32-e}function y(t,e){return t+e>>>0}function v(t,e,r){return t+e+r>>>0}function b(t,e,r,n){return t+e+r+n>>>0}function g(t,e,r,n,i){return t+e+r+n+i>>>0}function w(t,e,r,n){var i=t[e],o=t[e+1],a=n+o>>>0,s=(a>>0,t[e+1]=a}function _(t,e,r,n){var i=e+n>>>0,o=(i>>0}function A(t,e,r,n){var i=e+n;return i>>>0}function E(t,e,r,n,i,o,a,s){var u=0,c=e;c=c+n>>>0,u+=c>>0,u+=c>>0,u+=c>>0}function x(t,e,r,n,i,o,a,s){var u=e+n+o+s;return u>>>0}function M(t,e,r,n,i,o,a,s,u,c){var f=0,h=e;h=h+n>>>0,f+=h>>0,f+=h>>0,f+=h>>0,f+=h>>0}function k(t,e,r,n,i,o,a,s,u,c){var f=e+n+o+s+c;return f>>>0}function S(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}function I(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}function C(t,e,r){return t>>>r}function T(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}e.inherits=i,e.toArray=a,e.toHex=s,e.htonl=u,e.toHex32=c,e.zero2=f,e.zero8=h,e.join32=l,e.split32=d,e.rotr32=p,e.rotl32=m,e.sum32=y,e.sum32_3=v,e.sum32_4=b,e.sum32_5=g,e.sum64=w,e.sum64_hi=_,e.sum64_lo=A,e.sum64_4_hi=E,e.sum64_4_lo=x,e.sum64_5_hi=M,e.sum64_5_lo=k,e.rotr64_hi=S,e.rotr64_lo=I,e.shr64_hi=C,e.shr64_lo=T},c430:function(t,e){t.exports=!1},c486:function(t,e,r){const n=r("1c46"),{checkAndInit:i,smix:o}=r("8f3b");async function a(t,e,r,a,s,u,c,f){const{XY:h,V:l,B32:d,x:p,_X:m,B:y,tickCallback:v}=i(t,e,r,a,s,u,c);for(var b=0;bt._pos){var o=r.substr(t._pos);if("x-user-defined"===t._charset){for(var a=new n(o.length),s=0;st._pos&&(t.push(new n(new Uint8Array(c.result.slice(t._pos)))),t._pos=c.result.byteLength)},c.onload=function(){t.push(null)},c.readAsArrayBuffer(r);break}t._xhr.readyState===u.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,r("4362"),r("b639").Buffer,r("c8ba"))},c98c:function(t,e,r){"use strict";const n=r("e073"),i=r("92a9");t.exports=function(t){const e=n(t),r=i(t);return function(t,n){const i="string"===typeof t?t.toLowerCase():t;switch(i){case"keccak224":return new e(1152,448,null,224,n);case"keccak256":return new e(1088,512,null,256,n);case"keccak384":return new e(832,768,null,384,n);case"keccak512":return new e(576,1024,null,512,n);case"sha3-224":return new e(1152,448,6,224,n);case"sha3-256":return new e(1088,512,6,256,n);case"sha3-384":return new e(832,768,6,384,n);case"sha3-512":return new e(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+t)}}}},ca84:function(t,e,r){var n=r("5135"),i=r("fc6a"),o=r("4d64").indexOf,a=r("d012");t.exports=function(t,e){var r,s=i(t),u=0,c=[];for(r in s)!n(a,r)&&n(s,r)&&c.push(r);while(e.length>u)n(s,r=e[u++])&&(~o(c,r)||c.push(r));return c}},ca96:function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n=r("399f");e.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),e.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.from(e.KECCAK256_RLP_S,"hex")}).call(this,r("b639").Buffer)},cc12:function(t,e,r){var n=r("da84"),i=r("861d"),o=n.document,a=i(o)&&i(o.createElement);t.exports=function(t){return a?o.createElement(t):{}}},cca6:function(t,e,r){var n=r("23e7"),i=r("60da");n({target:"Object",stat:!0,forced:Object.assign!==i},{assign:i})},cd08:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r("399f")),o=r("948b"),a=r("6238"),s=r("3b2b"),u=r("4f1b");function c(t){"string"===typeof t&&t.match(/^0x[0-9A-Fa-f]{40}$/)||u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t}),t=t.toLowerCase();for(var e=t.substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=e[n].charCodeAt(0);r=o.arrayify(a.keccak256(r));for(var i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(15&r[i>>1])>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}var f=9007199254740991;function h(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}for(var l={},d=0;d<10;d++)l[String(d)]=String(d);for(d=0;d<26;d++)l[String.fromCharCode(65+d)]=String(10+d);var p=Math.floor(h(f));function m(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";var e="";t.split("").forEach((function(t){e+=l[t]}));while(e.length>=p){var r=e.substring(0,p);e=parseInt(r,10)%97+e.substring(r.length)}var n=String(98-parseInt(e,10)%97);while(n.length<2)n="0"+n;return n}function y(t){var e=null;if("string"!==typeof t&&u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=c(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&u.throwError("bad address checksum",u.INVALID_ARGUMENT,{arg:"address",value:t});else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){t.substring(2,4)!==m(t)&&u.throwError("bad icap checksum",u.INVALID_ARGUMENT,{arg:"address",value:t}),e=new i.default.BN(t.substring(4),36).toString(16);while(e.length<40)e="0"+e;e=c("0x"+e)}else u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:t});return e}function v(t){var e=new i.default.BN(y(t).substring(2),16).toString(36).toUpperCase();while(e.length<30)e="0"+e;return"XE"+m("XE00"+e)+e}function b(t){if(!t.from)throw new Error("missing from address");var e=t.nonce;return y("0x"+a.keccak256(s.encode([y(t.from),o.stripZeros(o.hexlify(e))])).substring(26))}e.getAddress=y,e.getIcapAddress=v,e.getContractAddress=b},cd10:function(t,e,r){var n=r("8707").Buffer;function i(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;var e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;var 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]))))))}function o(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");var 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)");var 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)}}function a(t,e){var r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");var o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=t.length,t.copy(o,4),o[4+r]=2,o[5+r]=e.length,e.copy(o,6+r),o}t.exports={check:i,decode:o,encode:a}},cd91:function(t){t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},cdf9:function(t,e,r){var n=r("825a"),i=r("861d"),o=r("f069");t.exports=function(t,e){if(n(t),i(e)&&e.constructor===t)return e;var r=o.f(t),a=r.resolve;return a(e),r.promise}},ce4e:function(t,e,r){var n=r("da84"),i=r("9112");t.exports=function(t,e){try{i(n,t,e)}catch(r){n[t]=e}return e}},cfbd:function(t,e,r){var n=r("3fb5"),i=r("7f7a"),o=i.base,a=i.bignum,s=i.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){o.Node.call(this,"der",t)}function f(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var n=s.tagClass[r>>6],i=0===(32&r);if(31===(31&r)){var o=r;r=0;while(128===(128&o)){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}else r&=31;var a=s.tag[r];return{cls:n,primitive:i,tag:r,tagStr:a}}function h(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0===(128&n))return n;var i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(var o=0;ot.indexed?r++:null),r>0&&t.topics.length!==r+1&&(e={anonymous:!0,inputs:[]})}var n=e.anonymous?t.topics:t.topics.slice(1);return r.returnValues=h.decodeLog(e.inputs,t.data,n),delete r.returnValues.__length__,r.event=e.name,r.signature=e.anonymous||!t.topics[0]?null:t.topics[0],r.raw={data:r.data,topics:r.topics},delete r.data,delete r.topics,r},l.prototype._encodeMethodABI=function(){var t=this._method.signature,e=this.arguments||[],r=!1,i=this._parent.options.jsonInterface.filter((function(e){return"constructor"===t&&e.type===t||(e.signature===t||e.signature===t.replace("0x","")||e.name===t)&&"function"===e.type})).map((function(t){var i=n.isArray(t.inputs)?t.inputs.length:0;if(i!==e.length)throw new Error("The number of arguments is not matching the methods required number. You need to pass "+i+" arguments.");return"function"===t.type&&(r=t.signature),n.isArray(t.inputs)?t.inputs:[]})).map((function(t){return h.encodeParameters(t,e).replace("0x","")}))[0]||"";if("constructor"===t){if(!this._deployData)throw new Error("The contract has no contract data option set. This is necessary to append the constructor parameters.");return this._deployData+i}var o=r?r+i:i;if(o)return o;throw new Error("Couldn't find a matching contract method named \""+this._method.name+'".')},l.prototype._decodeMethodReturn=function(t,e){if(!e)return null;e=e.length>=2?e.slice(2):e;var r=h.decodeParameters(t,e);return 1===r.__length__?r[0]:(delete r.__length__,r)},l.prototype.deploy=function(t,e){if(t=t||{},t.arguments=t.arguments||[],t=this._getOrSetDefaultOptions(t),!t.data)return a._fireError(new Error('No "data" specified in neither the given options, nor the default options.'),null,null,e);var r=n.find(this.options.jsonInterface,(function(t){return"constructor"===t.type}))||{};return r.signature="constructor",this._createTxObject.apply({method:r,parent:this,deployData:t.data,_ethAccounts:this.constructor._ethAccounts},t.arguments)},l.prototype._generateEventOptions=function(){var t=Array.prototype.slice.call(arguments),e=this._getCallback(t),r=n.isObject(t[t.length-1])?t.pop():{},i=n.isString(t[0])?t[0]:"allevents",o="allevents"===i.toLowerCase()?{name:"ALLEVENTS",jsonInterface:this.options.jsonInterface}:this.options.jsonInterface.find((function(t){return"event"===t.type&&(t.name===i||t.signature==="0x"+i.replace("0x",""))}));if(!o)throw new Error('Event "'+i+"\" doesn't exist in this contract.");if(!a.isAddress(this.options.address))throw new Error("This contract object doesn't have address set yet, please set an address first.");return{params:this._encodeEventABI(o,r),event:o,callback:e}},l.prototype.clone=function(){return new this.constructor(this.options.jsonInterface,this.options.address,this.options)},l.prototype.once=function(t,e,r){var i=Array.prototype.slice.call(arguments);if(r=this._getCallback(i),!r)throw new Error("Once requires a callback as the second parameter.");e&&delete e.fromBlock,this._on(t,e,(function(t,e,i){i.unsubscribe(),n.isFunction(r)&&r(t,e,i)}))},l.prototype._on=function(){var t=this._generateEventOptions.apply(this,arguments);this._checkListener("newListener",t.event.name,t.callback),this._checkListener("removeListener",t.event.name,t.callback);var e=new s({subscription:{params:1,inputFormatter:[u.inputLogFormatter],outputFormatter:this._decodeEventABI.bind(t.event),subscriptionHandler:function(t){t.removed?this.emit("changed",t):this.emit("data",t),n.isFunction(this.callback)&&this.callback(null,t,this)}},type:"eth",requestManager:this._requestManager});return e.subscribe("logs",t.params,t.callback||function(){}),e},l.prototype.getPastEvents=function(){var t=this._generateEventOptions.apply(this,arguments),e=new o({name:"getPastLogs",call:"eth_getLogs",params:1,inputFormatter:[u.inputLogFormatter],outputFormatter:this._decodeEventABI.bind(t.event)});e.setRequestManager(this._requestManager);var r=e.buildCall();return e=null,r(t.params,t.callback)},l.prototype._createTxObject=function(){var t=Array.prototype.slice.call(arguments),e={};if("function"===this.method.type&&(e.call=this.parent._executeMethod.bind(e,"call"),e.call.request=this.parent._executeMethod.bind(e,"call",!0)),e.send=this.parent._executeMethod.bind(e,"send"),e.send.request=this.parent._executeMethod.bind(e,"send",!0),e.encodeABI=this.parent._encodeMethodABI.bind(e),e.estimateGas=this.parent._executeMethod.bind(e,"estimate"),t&&this.method.inputs&&t.length!==this.method.inputs.length){if(this.nextMethod)return this.nextMethod.apply(null,t);throw c.InvalidNumberOfParams(t.length,this.method.inputs.length,this.method.name)}return e.arguments=t||[],e._method=this.method,e._parent=this.parent,e._ethAccounts=this.parent.constructor._ethAccounts||this._ethAccounts,this.deployData&&(e._deployData=this.deployData),e},l.prototype._processExecuteArguments=function(t,e){var r={};if(r.type=t.shift(),r.callback=this._parent._getCallback(t),"call"===r.type&&!0!==t[t.length-1]&&(n.isString(t[t.length-1])||isFinite(t[t.length-1]))&&(r.defaultBlock=t.pop()),r.options=n.isObject(t[t.length-1])?t.pop():{},r.generateRequest=!0===t[t.length-1]&&t.pop(),r.options=this._parent._getOrSetDefaultOptions(r.options),r.options.data=this.encodeABI(),!this._deployData&&!a.isAddress(this._parent.options.address))throw new Error("This contract object doesn't have address set yet, please set an address first.");return this._deployData||(r.options.to=this._parent.options.address),r.options.data?r:a._fireError(new Error("Couldn't find a matching contract method, or the number of parameters is wrong."),e.eventEmitter,e.reject,r.callback)},l.prototype._executeMethod=function(){var t=this,e=this._parent._processExecuteArguments.call(this,Array.prototype.slice.call(arguments),r),r=f("send"!==e.type),i=t.constructor._ethAccounts||t._ethAccounts;if(e.generateRequest){var s={params:[u.inputCallFormatter.call(this._parent,e.options)],callback:e.callback};return"call"===e.type?(s.params.push(u.inputDefaultBlockNumberFormatter.call(this._parent,e.defaultBlock)),s.method="eth_call",s.format=this._parent._decodeMethodReturn.bind(null,this._method.outputs)):s.method="eth_sendTransaction",s}switch(e.type){case"estimate":var c=new o({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[u.inputCallFormatter],outputFormatter:a.hexToNumber,requestManager:t._parent._requestManager,accounts:i,defaultAccount:t._parent.defaultAccount,defaultBlock:t._parent.defaultBlock}).createFunction();return c(e.options,e.callback);case"call":var l=new o({name:"call",call:"eth_call",params:2,inputFormatter:[u.inputCallFormatter,u.inputDefaultBlockNumberFormatter],outputFormatter:function(e){return t._parent._decodeMethodReturn(t._method.outputs,e)},requestManager:t._parent._requestManager,accounts:i,defaultAccount:t._parent.defaultAccount,defaultBlock:t._parent.defaultBlock,handleRevert:t._parent.handleRevert,abiCoder:h}).createFunction();return l(e.options,e.defaultBlock,e.callback);case"send":if(!a.isAddress(e.options.from))return a._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'),r.eventEmitter,r.reject,e.callback);if(n.isBoolean(this._method.payable)&&!this._method.payable&&e.options.value&&e.options.value>0)return a._fireError(new Error("Can not send value to non-payable contract method or constructor"),r.eventEmitter,r.reject,e.callback);var d={receiptFormatter:function(e){if(n.isArray(e.logs)){var r=n.map(e.logs,(function(e){return t._parent._decodeEventABI.call({name:"ALLEVENTS",jsonInterface:t._parent.options.jsonInterface},e)}));e.events={};var i=0;r.forEach((function(t){t.event?e.events[t.event]?Array.isArray(e.events[t.event])?e.events[t.event].push(t):e.events[t.event]=[e.events[t.event],t]:e.events[t.event]=t:(e.events[i]=t,i++)})),delete e.logs}return e},contractDeployFormatter:function(e){var r=t._parent.clone();return r.options.address=e.contractAddress,r}},p=new o({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[u.inputTransactionFormatter],requestManager:t._parent._requestManager,accounts:t.constructor._ethAccounts||t._ethAccounts,defaultAccount:t._parent.defaultAccount,defaultBlock:t._parent.defaultBlock,transactionBlockTimeout:t._parent.transactionBlockTimeout,transactionConfirmationBlocks:t._parent.transactionConfirmationBlocks,transactionPollingTimeout:t._parent.transactionPollingTimeout,defaultCommon:t._parent.defaultCommon,defaultChain:t._parent.defaultChain,defaultHardfork:t._parent.defaultHardfork,handleRevert:t._parent.handleRevert,extraFormatters:d,abiCoder:h}).createFunction();return p(e.options,e.callback)}},t.exports=l},d17b:function(t,e,r){t.exports=r("e372").Transform},d1c8:function(t,e,r){var n=r("3fb5");function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){var n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){var e,r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},d1e0:function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,i="~";function o(){}function a(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,r,n,o){if("function"!==typeof r)throw new TypeError("The listener must be a function");var s=new a(r,n||t,o),u=i?i+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function u(t,e){0===--t._eventsCount?t._events=new o:delete t._events[e]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),c.prototype.eventNames=function(){var t,e,r=[];if(0===this._eventsCount)return r;for(e in t=this._events)n.call(t,e)&&r.push(i?e.slice(1):e);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},c.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,a=new Array(o);ns?e=t(e):e.length=e&&n<=r?n-e+10:t})).join("")},s=function(t){var e,r=t;while(r.length>2)e=r.slice(0,9),r=parseInt(e,10)%97+r.slice(e.length);return parseInt(r,10)%97},u=function(t){this._iban=t};u.toAddress=function(t){if(t=new u(t),!t.isDirect())throw new Error("IBAN is indirect and can't be converted");return t.toAddress()},u.toIban=function(t){return u.fromAddress(t).toString()},u.fromAddress=function(t){if(!n.isAddress(t))throw new Error("Provided address is not a valid address: "+t);t=t.replace("0x","").replace("0X","");var e=new i(t,16),r=e.toString(36),a=o(r,15);return u.fromBban(a.toUpperCase())},u.fromBban=function(t){var e="XE",r=s(a(e+"00"+t)),n=("0"+(98-r)).slice(-2);return new u(e+n+t)},u.createIndirect=function(t){return u.fromBban("ETH"+t.institution+t.identifier)},u.isValid=function(t){var e=new u(t);return e.isValid()},u.prototype.isValid=function(){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban)&&1===s(a(this._iban))},u.prototype.isDirect=function(){return 34===this._iban.length||35===this._iban.length},u.prototype.isIndirect=function(){return 20===this._iban.length},u.prototype.checksum=function(){return this._iban.substr(2,2)},u.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},u.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},u.prototype.toAddress=function(){if(this.isDirect()){var t=this._iban.substr(4),e=new i(t,36);return n.toChecksumAddress(e.toString(16,20))}return""},u.prototype.toString=function(){return this._iban},t.exports=u},da84:function(t,e,r){(function(e){var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof e&&e)||Function("return this")()}).call(this,r("c8ba"))},dbaf:function(t,e,r){var n,i;(function(o,a){n=[r("1985"),r("abeb")],i=function(t,e){return a(t,e)}.apply(e,n),void 0===i||(t.exports=i)})(0,(function(t,e){function r(r,n,i){for(var o=[],a=t.ucs2.decode(r),s=0;s>23,l=f>>21&3,d=f>>5&65535,p=31&f,m=e.mapStr.substr(d,p);if(0===l||n&&1&h)throw new Error("Illegal char "+c);1===l?o.push(m):2===l?o.push(i?m:c):3===l&&o.push(c)}var y=o.join("").normalize("NFC");return y}function n(e,n,o){void 0===o&&(o=!1);var a=r(e,o,n),s=a.split(".");return s=s.map((function(e){return e.startsWith("xn--")?(e=t.decode(e.substring(4)),i(e,o,!1)):i(e,o,n),e})),s.join(".")}function i(t,n,i){if("-"===t[2]&&"-"===t[3])throw new Error("Failed to validate "+t);if(t.startsWith("-")||t.endsWith("-"))throw new Error("Failed to validate "+t);if(t.includes("."))throw new Error("Failed to validate "+t);if(r(t,n,i)!==t)throw new Error("Failed to validate "+t);var o=t.codePointAt(0);if(e.mapChar(o)&2<<23)throw new Error("Label contains illegal character: "+o)}function o(e,r){void 0===r&&(r={});var i,o=!("transitional"in r)||r.transitional,a="useStd3ASCII"in r&&r.useStd3ASCII,s="verifyDnsLength"in r&&r.verifyDnsLength,u=n(e,o,a).split("."),c=u.map(t.toASCII),f=c.join(".");if(s){if(f.length<1||f.length>253)throw new Error("DNS name has wrong length: "+f);for(i=0;i63)throw new Error("DNS label has wrong length: "+h)}}return f}function a(t,e){void 0===e&&(e={});var r="useStd3ASCII"in e&&e.useStd3ASCII;return n(t,!1,r)}return{toUnicode:a,toAscii:o}}))},dc14:function(t,e,r){"use strict";(function(e,n){var i=r("966d");function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){B(e,t)}}t.exports=g;var a,s=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?setImmediate:i.nextTick;g.WritableState=b;var u=Object.create(r("3a7c"));u.inherits=r("3fb5");var c={deprecate:r("b7d1")},f=r("429b"),h=r("8707").Buffer,l=n.Uint8Array||function(){};function d(t){return h.from(t)}function p(t){return h.isBuffer(t)||t instanceof l}var m,y=r("4681");function v(){}function b(t,e){a=a||r("b19a"),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,s=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){S(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function g(t){if(a=a||r("b19a"),!m.call(g,this)&&!(this instanceof a))return new g(t);this._writableState=new b(t,this),this.writable=!0,t&&("function"===typeof t.write&&(this._write=t.write),"function"===typeof t.writev&&(this._writev=t.writev),"function"===typeof t.destroy&&(this._destroy=t.destroy),"function"===typeof t.final&&(this._final=t.final)),f.call(this)}function w(t,e){var r=new Error("write after end");t.emit("error",r),i.nextTick(e,r)}function _(t,e,r,n){var o=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"===typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),i.nextTick(n,a),o=!1),o}function A(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!==typeof e||(e=h.from(e,r)),e}function E(t,e,r,n,i,o){if(!r){var a=A(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(t,e,r){var n=this._writableState;"function"===typeof t?(r=t,t=null,e=null):"function"===typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||N(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),g.prototype.destroy=y.destroy,g.prototype._undestroy=y.undestroy,g.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r("4362"),r("c8ba"))},dc60:function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},t(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r("b671"),o=r("b639"),a=r("661f"),s=function(t){function e(e,r){void 0===e&&(e={}),void 0===r&&(r={});var n=t.call(this,e,r)||this;Object.defineProperty(n,"from",{enumerable:!0,configurable:!0,get:function(){return n.getSenderAddress()},set:function(t){t&&(n._from=i.toBuffer(t))}});var o=e;return o.from&&(n.from=i.toBuffer(o.from)),n}return n(e,t),e.prototype.hash=function(e){if(void 0===e&&(e=!0),e&&this._from&&""!==this._from.toString("hex")){var r=o.Buffer.concat([this._from,this._from.slice(0,12)]);this.sign(r)}return t.prototype.hash.call(this,e)},e}(a.default);e.default=s},df75:function(t,e,r){var n=r("ca84"),i=r("7839");t.exports=Object.keys||function(t){return n(t,i)}},df7c:function(t,e,r){(function(t){function r(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t){"string"!==typeof t&&(t+="");var e,r=0,n=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){r=e+1;break}}else-1===n&&(i=!1,n=e+1);return-1===n?"":t.slice(r,n)}function i(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!n;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!==typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,n="/"===a.charAt(0))}return e=r(i(e.split("/"),(function(t){return!!t})),!n).join("/"),(n?"/":"")+e||"."},e.normalize=function(t){var n=e.isAbsolute(t),a="/"===o(t,-1);return t=r(i(t.split("/"),(function(t){return!!t})),!n).join("/"),t||n||(t="."),t&&a&&(t+="/"),(n?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(i(t,(function(t,e){if("string"!==typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},e.relative=function(t,r){function n(t){for(var e=0;e=0;r--)if(""!==t[r])break;return e>r?[]:t.slice(e,r-e+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var i=n(t.split("/")),o=n(r.split("/")),a=Math.min(i.length,o.length),s=a,u=0;u=1;--o)if(e=t.charCodeAt(o),47===e){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)},e.basename=function(t,e){var r=n(t);return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},e.extname=function(t){"string"!==typeof t&&(t+="");for(var e=-1,r=0,n=-1,i=!0,o=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s)-1===n&&(i=!1,n=a+1),46===s?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){r=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)};var o="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,r("4362"))},e073:function(t,e,r){"use strict";const n=r("97cc").Buffer,i=r("d485").Transform,o=r("3fb5");t.exports=function(t){function e(e,r,n,o,a){i.call(this,a),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=o,this._options=a,this._state=new t,this._state.initialize(e,r),this._finalized=!1}return o(e,i),e.prototype._transform=function(t,e,r){let n=null;try{this.update(t,e)}catch(i){n=i}r(n)},e.prototype._flush=function(t){let e=null;try{this.push(this.digest())}catch(r){e=r}t(e)},e.prototype.update=function(t,e){if(!n.isBuffer(t)&&"string"!==typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return n.isBuffer(t)||(t=n.from(t,e)),this._state.absorb(t),this},e.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return void 0!==t&&(e=e.toString(t)),this._resetState(),e},e.prototype._resetState=function(){return this._state.initialize(this._rate,this._capacity),this},e.prototype._clone=function(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t},e}},e07b:function(t,e,r){var n=r("5a76"),i=r("b5ca"),o=r("69f2"),a=r("7d2a"),s=r("9f9d"),u=r("8707").Buffer,c=u.alloc(128),f={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function h(t,e,r){var n=l(t),i="sha512"===t||"sha384"===t?128:64;e.length>i?e=n(e):e.length=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},e2aa:function(t,e){var r=function(t){return function(){return new Promise((function(e,r){var n,i=function(r){var n={},i=r.target.files.length,o=0;[].map.call(r.target.files,(function(r){var a=new FileReader;a.onload=function(a){var s=new Uint8Array(a.target.result);if("directory"===t){var u=r.webkitRelativePath;n[u.slice(u.indexOf("/")+1)]={type:"text/plain",data:s},++o===i&&e(n)}else if("file"===t){var c=r.webkitRelativePath;e({type:mimetype.lookup(c),data:s})}else e(s)},a.readAsArrayBuffer(r)}))};"directory"===t?(n=document.createElement("input"),n.addEventListener("change",i),n.type="file",n.webkitdirectory=!0,n.mozdirectory=!0,n.msdirectory=!0,n.odirectory=!0,n.directory=!0):(n=document.createElement("input"),n.addEventListener("change",i),n.type="file");var o=document.createEvent("MouseEvents");o.initEvent("click",!0,!1),n.dispatchEvent(o)}))}};t.exports={data:r("data"),file:r("file"),directory:r("directory")}},e2cc:function(t,e,r){var n=r("6eeb");t.exports=function(t,e,r){for(var i in e)n(t,i,e[i],r);return t}},e372:function(t,e,r){e=t.exports=r("ad71"),e.Stream=e,e.Readable=e,e.Writable=r("dc14"),e.Duplex=r("b19a"),e.Transform=r("27bf"),e.PassThrough=r("780f")},e3db:function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},e57b:function(t,e,r){const n=r("1c46"),{checkAndInit:i,smixSync:o}=r("8f3b");function a(t,e,r,a,s,u,c){const{XY:f,V:h,B32:l,x:d,_X:p,B:m,tickCallback:y}=i(t,e,r,a,s,u,c);for(var v=0;v=51&&/native code/.test(D))return!1;var e=D.resolve(1),r=function(t){t((function(){}),(function(){}))},n=e.constructor={};return n[R]=r,!(e.then((function(){}))instanceof r)})),rt=et||!A((function(t){D.all(t)["catch"]((function(){}))})),nt=function(t){var e;return!(!y(t)||"function"!=typeof(e=t.then))&&e},it=function(t,e,r){if(!e.notified){e.notified=!0;var n=e.reactions;M((function(){var i=e.value,o=e.state==J,a=0;while(n.length>a){var s,u,c,f=n[a++],h=o?f.ok:f.fail,l=f.resolve,d=f.reject,p=f.domain;try{h?(o||(e.rejection===tt&&ut(t,e),e.rejection=Q),!0===h?s=i:(p&&p.enter(),s=h(i),p&&(p.exit(),c=!0)),s===f.promise?d(F("Promise-chain cycle")):(u=nt(s))?u.call(s,l,d):l(s)):d(i)}catch(m){p&&!c&&p.exit(),d(m)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&at(t,e)}))}},ot=function(t,e,r){var n,i;$?(n=q.createEvent("Event"),n.promise=e,n.reason=r,n.initEvent(t,!1,!0),c.dispatchEvent(n)):n={promise:e,reason:r},(i=c["on"+t])?i(n):t===Y&&S("Unhandled promise rejection",r)},at=function(t,e){x.call(c,(function(){var r,n=e.value,i=st(e);if(i&&(r=C((function(){G?H.emit("unhandledRejection",n,t):ot(Y,t,n)})),e.rejection=G||st(e)?tt:Q,r.error))throw r.value}))},st=function(t){return t.rejection!==Q&&!t.parent},ut=function(t,e){x.call(c,(function(){G?H.emit("rejectionHandled",t):ot(W,t,e.value)}))},ct=function(t,e,r,n){return function(i){t(e,r,i,n)}},ft=function(t,e,r,n){e.done||(e.done=!0,n&&(e=n),e.value=r,e.state=X,it(t,e,!0))},ht=function(t,e,r,n){if(!e.done){e.done=!0,n&&(e=n);try{if(t===r)throw F("Promise can't be resolved itself");var i=nt(r);i?M((function(){var n={done:!1};try{i.call(r,ct(ht,t,n,e),ct(ft,t,n,e))}catch(o){ft(t,n,o,e)}})):(e.value=r,e.state=J,it(t,e,!1))}catch(o){ft(t,{done:!1},o,e)}}};et&&(D=function(t){b(this,D,N),v(t),n.call(this);var e=B(this);try{t(ct(ht,this,e),ct(ft,this,e))}catch(r){ft(this,e,r)}},n=function(t){j(this,{type:N,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:Z,value:void 0})},n.prototype=d(D.prototype,{then:function(t,e){var r=L(this),n=K(E(this,D));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=G?H.domain:void 0,r.parent=!0,r.reactions.push(n),r.state!=Z&&it(this,r,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new n,e=B(t);this.promise=t,this.resolve=ct(ht,t,e),this.reject=ct(ft,t,e)},I.f=K=function(t){return t===D||t===o?new i(t):V(t)},u||"function"!=typeof h||(a=h.prototype.then,l(h.prototype,"then",(function(t,e){var r=this;return new D((function(t,e){a.call(r,t,e)})).then(t,e)}),{unsafe:!0}),"function"==typeof z&&s({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return k(D,z.apply(c,arguments))}}))),s({global:!0,wrap:!0,forced:et},{Promise:D}),p(D,N,!1,!0),m(N),o=f(N),s({target:N,stat:!0,forced:et},{reject:function(t){var e=K(this);return e.reject.call(void 0,t),e.promise}}),s({target:N,stat:!0,forced:u||et},{resolve:function(t){return k(u&&this===o?D:this,t)}}),s({target:N,stat:!0,forced:rt},{all:function(t){var e=this,r=K(e),n=r.resolve,i=r.reject,o=C((function(){var r=v(e.resolve),o=[],a=0,s=1;_(t,(function(t){var u=a++,c=!1;o.push(void 0),s++,r.call(e,t).then((function(t){c||(c=!0,o[u]=t,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(t){var e=this,r=K(e),n=r.reject,i=C((function(){var i=v(e.resolve);_(t,(function(t){i.call(e,t).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}})},e85f:function(t){t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},e870:function(t,e,r){(function(e){var n=r("17fb"),i=r("399f"),o=r("a6b6"),a=r("f1dd"),s=r("7d96"),u=r("1455"),c=function(t){return i.isBN(t)},f=function(t){return t&&t.constructor&&"BigNumber"===t.constructor.name},h=function(t){try{return o.apply(null,arguments)}catch(e){throw new Error(e+' Given value: "'+t+'"')}},l=function(t){return"0x"+h(t).toTwos(256).toString(16,64)},d=function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(t)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(t))||p(t))},p=function(t){t=t.replace(/^0x/i,"");for(var e=R(t.toLowerCase()).replace(/^0x/i,""),r=0;r<40;r++)if(parseInt(e[r],16)>7&&t[r].toUpperCase()!==t[r]||parseInt(e[r],16)<=7&&t[r].toLowerCase()!==t[r])return!1;return!0},m=function(t,e,r){var n=/^0x/i.test(t)||"number"===typeof t;t=t.toString(16).replace(/^0x/i,"");var i=e-t.length+1>=0?e-t.length+1:0;return(n?"0x":"")+new Array(i).join(r||"0")+t},y=function(t,e,r){var n=/^0x/i.test(t)||"number"===typeof t;t=t.toString(16).replace(/^0x/i,"");var i=e-t.length+1>=0?e-t.length+1:0;return(n?"0x":"")+t+new Array(i).join(r||"0")},v=function(t){t=a.encode(t);var e="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(var r=0;r>>4).toString(16)),e.push((15&t[r]).toString(16));return"0x"+e.join("")},E=function(t){if(t=t.toString(16),!M(t))throw new Error('Given value "'+t+'" is not a valid hex string.');t=t.replace(/^0x/i,"");for(var e=[],r=0;r=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"===typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,s+=24,s>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,s+=24,s>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-o&4194303,o+=24,o>=26&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,c=0,f=r;f1&&0===this.words[this.length-1])this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;i=0|t.words[p],o=0|e.words[d],a=i*o+h,f+=a/67108864|0,h=67108863&a}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(t=t||10,e=0|e||1,16===t||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,r=0!==o||a!==this.length-1?c[6-u.length]+u+r:u+r,i+=2,i>=26&&(i-=26,a--)}0!==o&&(r=o.toString(16)+r);while(r.length%e!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var l=f[t],d=h[t];r="";var p=this.clone();p.negative=0;while(!p.isZero()){var m=p.modn(d).toString(t);p=p.idivn(d),r=p.isZero()?m+r:c[l-m.length]+m+r}this.isZero()&&(r="0"+r);while(r.length%e!==0)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,m=d>>>13,y=0|a[2],v=8191&y,b=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,A=0|a[4],E=8191&A,x=A>>>13,M=0|a[5],k=8191&M,S=M>>>13,I=0|a[6],C=8191&I,T=I>>>13,U=0|a[7],O=8191&U,P=U>>>13,R=0|a[8],N=8191&R,B=R>>>13,j=0|a[9],L=8191&j,D=j>>>13,F=0|s[0],q=8191&F,H=F>>>13,z=0|s[1],K=8191&z,V=z>>>13,G=0|s[2],$=8191&G,Y=G>>>13,W=0|s[3],Z=8191&W,J=W>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,q),i=Math.imul(h,H),i=i+Math.imul(l,q)|0,o=Math.imul(l,H);var yt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,q),i=Math.imul(p,H),i=i+Math.imul(m,q)|0,o=Math.imul(m,H),n=n+Math.imul(h,K)|0,i=i+Math.imul(h,V)|0,i=i+Math.imul(l,K)|0,o=o+Math.imul(l,V)|0;var vt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,q),i=Math.imul(v,H),i=i+Math.imul(b,q)|0,o=Math.imul(b,H),n=n+Math.imul(p,K)|0,i=i+Math.imul(p,V)|0,i=i+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,Y)|0,i=i+Math.imul(l,$)|0,o=o+Math.imul(l,Y)|0;var bt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(w,q),i=Math.imul(w,H),i=i+Math.imul(_,q)|0,o=Math.imul(_,H),n=n+Math.imul(v,K)|0,i=i+Math.imul(v,V)|0,i=i+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,Y)|0,i=i+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0,n=n+Math.imul(h,Z)|0,i=i+Math.imul(h,J)|0,i=i+Math.imul(l,Z)|0,o=o+Math.imul(l,J)|0;var gt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(E,q),i=Math.imul(E,H),i=i+Math.imul(x,q)|0,o=Math.imul(x,H),n=n+Math.imul(w,K)|0,i=i+Math.imul(w,V)|0,i=i+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(v,$)|0,i=i+Math.imul(v,Y)|0,i=i+Math.imul(b,$)|0,o=o+Math.imul(b,Y)|0,n=n+Math.imul(p,Z)|0,i=i+Math.imul(p,J)|0,i=i+Math.imul(m,Z)|0,o=o+Math.imul(m,J)|0,n=n+Math.imul(h,Q)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(l,Q)|0,o=o+Math.imul(l,tt)|0;var wt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,q),i=Math.imul(k,H),i=i+Math.imul(S,q)|0,o=Math.imul(S,H),n=n+Math.imul(E,K)|0,i=i+Math.imul(E,V)|0,i=i+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(w,$)|0,i=i+Math.imul(w,Y)|0,i=i+Math.imul(_,$)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(v,Z)|0,i=i+Math.imul(v,J)|0,i=i+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(l,rt)|0,o=o+Math.imul(l,nt)|0;var _t=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,q),i=Math.imul(C,H),i=i+Math.imul(T,q)|0,o=Math.imul(T,H),n=n+Math.imul(k,K)|0,i=i+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,o=o+Math.imul(S,V)|0,n=n+Math.imul(E,$)|0,i=i+Math.imul(E,Y)|0,i=i+Math.imul(x,$)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(w,Z)|0,i=i+Math.imul(w,J)|0,i=i+Math.imul(_,Z)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(v,Q)|0,i=i+Math.imul(v,tt)|0,i=i+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0,n=n+Math.imul(h,ot)|0,i=i+Math.imul(h,at)|0,i=i+Math.imul(l,ot)|0,o=o+Math.imul(l,at)|0;var At=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(O,q),i=Math.imul(O,H),i=i+Math.imul(P,q)|0,o=Math.imul(P,H),n=n+Math.imul(C,K)|0,i=i+Math.imul(C,V)|0,i=i+Math.imul(T,K)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(k,$)|0,i=i+Math.imul(k,Y)|0,i=i+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(E,Z)|0,i=i+Math.imul(E,J)|0,i=i+Math.imul(x,Z)|0,o=o+Math.imul(x,J)|0,n=n+Math.imul(w,Q)|0,i=i+Math.imul(w,tt)|0,i=i+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=i+Math.imul(v,nt)|0,i=i+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(p,ot)|0,i=i+Math.imul(p,at)|0,i=i+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0,n=n+Math.imul(h,ut)|0,i=i+Math.imul(h,ct)|0,i=i+Math.imul(l,ut)|0,o=o+Math.imul(l,ct)|0;var Et=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,q),i=Math.imul(N,H),i=i+Math.imul(B,q)|0,o=Math.imul(B,H),n=n+Math.imul(O,K)|0,i=i+Math.imul(O,V)|0,i=i+Math.imul(P,K)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(C,$)|0,i=i+Math.imul(C,Y)|0,i=i+Math.imul(T,$)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(k,Z)|0,i=i+Math.imul(k,J)|0,i=i+Math.imul(S,Z)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(E,Q)|0,i=i+Math.imul(E,tt)|0,i=i+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(w,rt)|0,i=i+Math.imul(w,nt)|0,i=i+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(v,ot)|0,i=i+Math.imul(v,at)|0,i=i+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(p,ut)|0,i=i+Math.imul(p,ct)|0,i=i+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,lt)|0,i=i+Math.imul(l,ht)|0,o=o+Math.imul(l,lt)|0;var xt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,q),i=Math.imul(L,H),i=i+Math.imul(D,q)|0,o=Math.imul(D,H),n=n+Math.imul(N,K)|0,i=i+Math.imul(N,V)|0,i=i+Math.imul(B,K)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(O,$)|0,i=i+Math.imul(O,Y)|0,i=i+Math.imul(P,$)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(C,Z)|0,i=i+Math.imul(C,J)|0,i=i+Math.imul(T,Z)|0,o=o+Math.imul(T,J)|0,n=n+Math.imul(k,Q)|0,i=i+Math.imul(k,tt)|0,i=i+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,i=i+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(w,ot)|0,i=i+Math.imul(w,at)|0,i=i+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(v,ut)|0,i=i+Math.imul(v,ct)|0,i=i+Math.imul(b,ut)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,lt)|0,i=i+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,mt)|0,i=i+Math.imul(l,pt)|0,o=o+Math.imul(l,mt)|0;var Mt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,K),i=Math.imul(L,V),i=i+Math.imul(D,K)|0,o=Math.imul(D,V),n=n+Math.imul(N,$)|0,i=i+Math.imul(N,Y)|0,i=i+Math.imul(B,$)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(O,Z)|0,i=i+Math.imul(O,J)|0,i=i+Math.imul(P,Z)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(C,Q)|0,i=i+Math.imul(C,tt)|0,i=i+Math.imul(T,Q)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,i=i+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(E,ot)|0,i=i+Math.imul(E,at)|0,i=i+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,n=n+Math.imul(w,ut)|0,i=i+Math.imul(w,ct)|0,i=i+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,n=n+Math.imul(v,ht)|0,i=i+Math.imul(v,lt)|0,i=i+Math.imul(b,ht)|0,o=o+Math.imul(b,lt)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,mt)|0,i=i+Math.imul(m,pt)|0,o=o+Math.imul(m,mt)|0;var kt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(L,$),i=Math.imul(L,Y),i=i+Math.imul(D,$)|0,o=Math.imul(D,Y),n=n+Math.imul(N,Z)|0,i=i+Math.imul(N,J)|0,i=i+Math.imul(B,Z)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(O,Q)|0,i=i+Math.imul(O,tt)|0,i=i+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,i=i+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(k,ot)|0,i=i+Math.imul(k,at)|0,i=i+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,n=n+Math.imul(E,ut)|0,i=i+Math.imul(E,ct)|0,i=i+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(w,ht)|0,i=i+Math.imul(w,lt)|0,i=i+Math.imul(_,ht)|0,o=o+Math.imul(_,lt)|0,n=n+Math.imul(v,pt)|0,i=i+Math.imul(v,mt)|0,i=i+Math.imul(b,pt)|0,o=o+Math.imul(b,mt)|0;var St=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,Z),i=Math.imul(L,J),i=i+Math.imul(D,Z)|0,o=Math.imul(D,J),n=n+Math.imul(N,Q)|0,i=i+Math.imul(N,tt)|0,i=i+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(O,rt)|0,i=i+Math.imul(O,nt)|0,i=i+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(C,ot)|0,i=i+Math.imul(C,at)|0,i=i+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(k,ut)|0,i=i+Math.imul(k,ct)|0,i=i+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,n=n+Math.imul(E,ht)|0,i=i+Math.imul(E,lt)|0,i=i+Math.imul(x,ht)|0,o=o+Math.imul(x,lt)|0,n=n+Math.imul(w,pt)|0,i=i+Math.imul(w,mt)|0,i=i+Math.imul(_,pt)|0,o=o+Math.imul(_,mt)|0;var It=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(L,Q),i=Math.imul(L,tt),i=i+Math.imul(D,Q)|0,o=Math.imul(D,tt),n=n+Math.imul(N,rt)|0,i=i+Math.imul(N,nt)|0,i=i+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(O,ot)|0,i=i+Math.imul(O,at)|0,i=i+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(C,ut)|0,i=i+Math.imul(C,ct)|0,i=i+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(k,ht)|0,i=i+Math.imul(k,lt)|0,i=i+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0,n=n+Math.imul(E,pt)|0,i=i+Math.imul(E,mt)|0,i=i+Math.imul(x,pt)|0,o=o+Math.imul(x,mt)|0;var Ct=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(L,rt),i=Math.imul(L,nt),i=i+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(N,ot)|0,i=i+Math.imul(N,at)|0,i=i+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(O,ut)|0,i=i+Math.imul(O,ct)|0,i=i+Math.imul(P,ut)|0,o=o+Math.imul(P,ct)|0,n=n+Math.imul(C,ht)|0,i=i+Math.imul(C,lt)|0,i=i+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0,n=n+Math.imul(k,pt)|0,i=i+Math.imul(k,mt)|0,i=i+Math.imul(S,pt)|0,o=o+Math.imul(S,mt)|0;var Tt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,ot),i=Math.imul(L,at),i=i+Math.imul(D,ot)|0,o=Math.imul(D,at),n=n+Math.imul(N,ut)|0,i=i+Math.imul(N,ct)|0,i=i+Math.imul(B,ut)|0,o=o+Math.imul(B,ct)|0,n=n+Math.imul(O,ht)|0,i=i+Math.imul(O,lt)|0,i=i+Math.imul(P,ht)|0,o=o+Math.imul(P,lt)|0,n=n+Math.imul(C,pt)|0,i=i+Math.imul(C,mt)|0,i=i+Math.imul(T,pt)|0,o=o+Math.imul(T,mt)|0;var Ut=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,n=Math.imul(L,ut),i=Math.imul(L,ct),i=i+Math.imul(D,ut)|0,o=Math.imul(D,ct),n=n+Math.imul(N,ht)|0,i=i+Math.imul(N,lt)|0,i=i+Math.imul(B,ht)|0,o=o+Math.imul(B,lt)|0,n=n+Math.imul(O,pt)|0,i=i+Math.imul(O,mt)|0,i=i+Math.imul(P,pt)|0,o=o+Math.imul(P,mt)|0;var Ot=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,ht),i=Math.imul(L,lt),i=i+Math.imul(D,ht)|0,o=Math.imul(D,lt),n=n+Math.imul(N,pt)|0,i=i+Math.imul(N,mt)|0,i=i+Math.imul(B,pt)|0,o=o+Math.imul(B,mt)|0;var Pt=(c+n|0)+((8191&i)<<13)|0;c=(o+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(L,pt),i=Math.imul(L,mt),i=i+Math.imul(D,pt)|0,o=Math.imul(D,mt);var Rt=(c+n|0)+((8191&i)<<13)|0;return c=(o+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=yt,u[1]=vt,u[2]=bt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=At,u[7]=Et,u[8]=xt,u[9]=Mt,u[10]=kt,u[11]=St,u[12]=It,u[13]=Ct,u[14]=Tt,u[15]=Ut,u[16]=Ot,u[17]=Pt,u[18]=Rt,0!==c&&(u[19]=c,r.length++),r};function m(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0,i+=a>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}function y(t,e,r){var n=new v;return n.mulp(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?m(this,t,e):y(this,t,e),r},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=l(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,a=0|i.words[i.length-1],s=this._countBits(a);r=26-s,0!==r&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var u,c=n.length-i.length;if("mod"!==e){u=new o(null),u.length=c+1,u.words=new Array(u.length);for(var f=0;f=0;l--){var d=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,l);while(0!==n.negative)d--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);u&&(u.words[l]=d)}return u&&u.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:u||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;while(e.isEven()&&r.isEven())e.iushrn(1),r.iushrn(1),++c;var f=r.clone(),h=e.clone();while(!e.isZero()){for(var l=0,d=1;0===(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0){e.iushrn(l);while(l-- >0)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1)}for(var p=0,m=1;0===(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0){r.iushrn(p);while(p-- >0)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1)}e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();var i,a=new o(1),s=new o(0),u=r.clone();while(e.cmpn(1)>0&&r.cmpn(1)>0){for(var c=0,f=1;0===(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0){e.iushrn(c);while(c-- >0)a.isOdd()&&a.iadd(u),a.iushrn(1)}for(var h=0,l=1;0===(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0){r.iushrn(h);while(h-- >0)s.isOdd()&&s.iadd(u),s.iushrn(1)}e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return i=0===e.cmpn(1)?a:s,i.cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);do{while(e.isEven())e.iushrn(1);while(r.isEven())r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}while(1);return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new x(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(w,g),w.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},x.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}var i=this.m.subn(1),a=0;while(!i.isZero()&&0===i.andln(1))a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();f=new o(2*f*f).toRed(this);while(0!==this.pow(f,c).cmp(u))f.redIAdd(u);var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;while(0!==d.cmp(s)){for(var m=d,y=0;0!==m.cmp(s);y++)m=m.redSqr();n(y=0;i--){for(var f=e.words[i],h=c-1;h>=0;h--){var l=f>>h&1;a!==n[0]&&(a=this.sqr(a)),0!==l||0!==s?(s<<=1,s|=l,u++,(u===r||0===i&&0===h)&&(a=this.mul(a,n[s]),u=0,s=0)):u=0}c=26}return a},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,x),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}})(t,this)}).call(this,r("62e4")(t))},e95a:function(t,e,r){var n=r("b622"),i=r("3f8c"),o=n("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||a[o]===t)}},ea53:function(t,e,r){"use strict";var n=r("399f"),i=r("f3a3"),o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<=u;e--)c=(c<<1)+n[e];a.push(c)}for(var f=this.jpoint(null,null,null),h=this.jpoint(null,null,null),l=i;l>0;l--){for(u=0;u=0;c--){for(e=0;c>=0&&0===a[c];c--)e++;if(c>=0&&e++,u=u.dblp(e),c<0)break;var f=a[c];s(0!==f),u="affine"===t.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var s=this._wnafT1,u=this._wnafT2,c=this._wnafT3,f=0,h=0;h=1;h-=2){var p=h-1,m=h;if(1===s[p]&&1===s[m]){var y=[e[p],null,null,e[m]];0===e[p].y.cmp(e[m].y)?(y[1]=e[p].add(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg())):0===e[p].y.cmp(e[m].y.redNeg())?(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].add(e[m].neg())):(y[1]=e[p].toJ().mixedAdd(e[m]),y[2]=e[p].toJ().mixedAdd(e[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],b=a(r[p],r[m]);f=Math.max(b[0].length,f),c[p]=new Array(f),c[m]=new Array(f);for(var g=0;g=0;h--){var x=0;while(h>=0){var M=!0;for(g=0;g=0&&x++,A=A.dblp(x),h<0)break;for(g=0;g0?l=u[g][k-1>>1]:k<0&&(l=u[g][-k-1>>1].neg()),A="affine"===l.type?A.mixedAdd(l):A.add(l))}}for(h=0;h=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i{const e=t=>t.length%2===0?t:"0"+t,r=t=>e(t.toString(16)),n=(t,e)=>t<56?r(e+t):r(e+r(t).length/2+55)+r(t),i=t=>{if("string"===typeof t){const e=t.slice(2),r=2!=e.length||e>="80"?n(e.length/2,128):"";return r+e}{const e=t.map(i).join(""),r=n(e.length/2,192);return r+e}};return"0x"+i(t)},n=t=>{let e=2;const r=()=>{if(e>=t.length)throw"";const r=t.slice(e,e+2);return r<"80"?(e+=2,"0x"+r):r<"c0"?i():o()},n=()=>{const r=parseInt(t.slice(e,e+=2),16)%64;return r<56?r:parseInt(t.slice(e,e+=2*(r-55)),16)},i=()=>{const r=n();return"0x"+t.slice(e,e+=2*r)},o=()=>{const t=2*n()+e;let i=[];while(e=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o0&&(p=setTimeout((function(){if(!h){h=!0,d.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",a(t)}}),t.timeout)),d.setRequestHeader)for(c in b)b.hasOwnProperty(c)&&d.setRequestHeader(c,b[c]);else if(t.headers&&!u(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(d.responseType=t.responseType),"beforeSend"in t&&"function"===typeof t.beforeSend&&t.beforeSend(d),d.send(v||null),d}function l(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(r){}return null}function d(){}t.exports=f,t.exports.default=f,f.XMLHttpRequest=n.XMLHttpRequest||d,f.XDomainRequest="withCredentials"in new f.XMLHttpRequest?f.XMLHttpRequest:n.XDomainRequest,s(["get","put","post","patch","head","delete"],(function(t){f["delete"===t?"del":t]=function(e,r,n){return r=c(e,r,n),r.method=t.toUpperCase(),h(r)}}))},ef3a:function(t,e,r){var n=r("7f7a"),i=r("3fb5"),o=e;function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}o.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){var e;try{e=r("0706").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(n){e=function(t){this._initNamed(t)}}return i(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(n.decoders[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n.encoders[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},ef84:function(t,e,r){"use strict";var n,i=null;try{n=Function("return this")()}catch(o){n=window}"undefined"!==typeof n.ethereumProvider?i=n.ethereumProvider:"undefined"!==typeof n.web3&&n.web3.currentProvider&&(n.web3.currentProvider.sendAsync&&(n.web3.currentProvider.send=n.web3.currentProvider.sendAsync,delete n.web3.currentProvider.sendAsync),!n.web3.currentProvider.on&&n.web3.currentProvider.connection&&"ipcProviderWrapper"===n.web3.currentProvider.connection.constructor.name&&(n.web3.currentProvider.on=function(t,e){if("function"!==typeof e)throw new Error("The second parameter callback must be a function.");switch(t){case"data":this.connection.on("data",(function(t){var r="";t=t.toString();try{r=JSON.parse(t)}catch(o){return e(new Error("Couldn't parse response data"+t))}r.id||-1===r.method.indexOf("_subscription")||e(null,r)}));break;default:this.connection.on(t,e);break}}),i=n.web3.currentProvider),t.exports=i},f069:function(t,e,r){"use strict";var n=r("1c0b"),i=function(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=n(e),this.reject=n(r)};t.exports.f=function(t){return new i(t)}},f1dd:function(t,e,r){(function(t){var e,r,n,i=String.fromCharCode;function o(t){var e,r,n=[],i=0,o=t.length;while(i=55296&&e<=56319&&i65535&&(e-=65536,o+=i(e>>>10&1023|55296),e=56320|1023&e),o+=i(e);return o}function s(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function u(t,e){return i(t>>e&63|128)}function c(t){if(0==(4294967168&t))return i(t);var e="";return 0==(4294965248&t)?e=i(t>>6&31|192):0==(4294901760&t)?(s(t),e=i(t>>12&15|224),e+=u(t,6)):0==(4292870144&t)&&(e=i(t>>18&7|240),e+=u(t,12),e+=u(t,6)),e+=i(63&t|128),e}function f(t){var e,r=o(t),n=r.length,i=-1,a="";while(++i=r)throw Error("Invalid byte index");var t=255&e[n];if(n++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(){var t,i,o,a,u;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(t=255&e[n],n++,0==(128&t))return t;if(192==(224&t)){if(i=h(),u=(31&t)<<6|i,u>=128)return u;throw Error("Invalid continuation byte")}if(224==(240&t)){if(i=h(),o=h(),u=(15&t)<<12|i<<6|o,u>=2048)return s(u),u;throw Error("Invalid continuation byte")}if(240==(248&t)&&(i=h(),o=h(),a=h(),u=(7&t)<<18|i<<12|o<<6|a,u>=65536&&u<=1114111))return u;throw Error("Invalid UTF-8 detected")}function d(t){e=o(t),r=e.length,n=0;var i,s=[];while(!1!==(i=l()))s.push(i);return a(s)}t.version="3.0.0",t.encode=f,t.decode=d})(e)},f1ee:function(t,e,r){"use strict";var n=r("176c"),i=r("3c21");t.exports={packageInit:function(t,e){if(e=Array.prototype.slice.call(e),!t)throw new Error('You need to instantiate using the "new" keyword.');Object.defineProperty(t,"currentProvider",{get:function(){return t._provider},set:function(e){return t.setProvider(e)},enumerable:!0,configurable:!0}),e[0]&&e[0]._requestManager?t._requestManager=new n.Manager(e[0].currentProvider):(t._requestManager=new n.Manager,t._requestManager.setProvider(e[0],e[1])),t.givenProvider=n.Manager.givenProvider,t.providers=n.Manager.providers,t._provider=t._requestManager.provider,t.setProvider||(t.setProvider=function(e,r){return t._requestManager.setProvider(e,r),t._provider=t._requestManager.provider,!0}),t.BatchRequest=n.BatchManager.bind(null,t._requestManager),t.extend=i(t)},addProviders:function(t){t.givenProvider=n.Manager.givenProvider,t.providers=n.Manager.providers}}},f21d:function(t){t.exports=JSON.parse('{"name":"mainnet","chainId":1,"networkId":1,"comment":"The Ethereum main chain","url":"https://ethstats.net/","genesis":{"hash":"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3","timestamp":null,"gasLimit":5000,"difficulty":17179869184,"nonce":"0x0000000000000042","extraData":"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa","stateRoot":"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"},"hardforks":[{"name":"chainstart","block":0,"consensus":"pow","finality":null},{"name":"homestead","block":1150000,"consensus":"pow","finality":null},{"name":"dao","block":1920000,"consensus":"pow","finality":null},{"name":"tangerineWhistle","block":2463000,"consensus":"pow","finality":null},{"name":"spuriousDragon","block":2675000,"consensus":"pow","finality":null},{"name":"byzantium","block":4370000,"consensus":"pow","finality":null},{"name":"constantinople","block":7280000,"consensus":"pow","finality":null},{"name":"petersburg","block":7280000,"consensus":"pow","finality":null},{"name":"istanbul","block":9069000,"consensus":"pow","finality":null},{"name":"muirGlacier","block":9200000,"consensus":"pow","finality":null}],"bootstrapNodes":[{"ip":"13.93.211.84","port":30303,"id":"3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99","location":"US-WEST","comment":"Go Bootnode"},{"ip":"191.235.84.50","port":30303,"id":"78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d","location":"BR","comment":"Go Bootnode"},{"ip":"13.75.154.138","port":30303,"id":"158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6","location":"AU","comment":"Go Bootnode"},{"ip":"52.74.57.123","port":30303,"id":"1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082","location":"SG","comment":"Go Bootnode"}]}')},f234:function(t,e,r){"use strict";var n="%[a-f0-9]{2}",i=new RegExp(n,"gi"),o=new RegExp("("+n+")+","gi");function a(t,e){try{return decodeURIComponent(t.join(""))}catch(i){}if(1===t.length)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],a(r),a(n))}function s(t){try{return decodeURIComponent(t)}catch(n){for(var e=t.match(i),r=1;r(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n}function u(t,e){var r=[[],[]];t=t.clone(),e=e.clone();var n=0,i=0;while(t.cmpn(-n)>0||e.cmpn(-i)>0){var o,a,s=t.andln(3)+n&3,u=e.andln(3)+i&3;if(3===s&&(s=-1),3===u&&(u=-1),0===(1&s))o=0;else{var c=t.andln(7)+n&7;o=3!==c&&5!==c||2!==u?s:-s}if(r[0].push(o),0===(1&u))a=0;else{c=e.andln(7)+i&7;a=3!==c&&5!==c||2!==s?u:-u}r[1].push(a),2*n===o+1&&(n=1-n),2*i===a+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}function c(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}}function f(t){return"string"===typeof t?n.toArray(t,"hex"):t}function h(t){return new i(t,"hex","le")}n.assert=o,n.toArray=a.toArray,n.zero2=a.zero2,n.toHex=a.toHex,n.encode=a.encode,n.getNAF=s,n.getJSF=u,n.cachedProperty=c,n.parseBytes=f,n.intFromLE=h},f460:function(t,e,r){var n=r("98e6"),i=r("8707").Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){var r,a=i.alloc(0),s=0;while(a.length>>32-e}function c(t,e,r,n,i,o,a){return u(t+(e&r|~e&n)+i+o|0,a)+e|0}function f(t,e,r,n,i,o,a){return u(t+(e&n|r&~n)+i+o|0,a)+e|0}function h(t,e,r,n,i,o,a){return u(t+(e^r^n)+i+o|0,a)+e|0}function l(t,e,r,n,i,o,a){return u(t+(r^(e|~n))+i+o|0,a)+e|0}n(s,i),s.prototype._update=function(){for(var t=a,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;r=c(r,n,i,o,t[0],3614090360,7),o=c(o,r,n,i,t[1],3905402710,12),i=c(i,o,r,n,t[2],606105819,17),n=c(n,i,o,r,t[3],3250441966,22),r=c(r,n,i,o,t[4],4118548399,7),o=c(o,r,n,i,t[5],1200080426,12),i=c(i,o,r,n,t[6],2821735955,17),n=c(n,i,o,r,t[7],4249261313,22),r=c(r,n,i,o,t[8],1770035416,7),o=c(o,r,n,i,t[9],2336552879,12),i=c(i,o,r,n,t[10],4294925233,17),n=c(n,i,o,r,t[11],2304563134,22),r=c(r,n,i,o,t[12],1804603682,7),o=c(o,r,n,i,t[13],4254626195,12),i=c(i,o,r,n,t[14],2792965006,17),n=c(n,i,o,r,t[15],1236535329,22),r=f(r,n,i,o,t[1],4129170786,5),o=f(o,r,n,i,t[6],3225465664,9),i=f(i,o,r,n,t[11],643717713,14),n=f(n,i,o,r,t[0],3921069994,20),r=f(r,n,i,o,t[5],3593408605,5),o=f(o,r,n,i,t[10],38016083,9),i=f(i,o,r,n,t[15],3634488961,14),n=f(n,i,o,r,t[4],3889429448,20),r=f(r,n,i,o,t[9],568446438,5),o=f(o,r,n,i,t[14],3275163606,9),i=f(i,o,r,n,t[3],4107603335,14),n=f(n,i,o,r,t[8],1163531501,20),r=f(r,n,i,o,t[13],2850285829,5),o=f(o,r,n,i,t[2],4243563512,9),i=f(i,o,r,n,t[7],1735328473,14),n=f(n,i,o,r,t[12],2368359562,20),r=h(r,n,i,o,t[5],4294588738,4),o=h(o,r,n,i,t[8],2272392833,11),i=h(i,o,r,n,t[11],1839030562,16),n=h(n,i,o,r,t[14],4259657740,23),r=h(r,n,i,o,t[1],2763975236,4),o=h(o,r,n,i,t[4],1272893353,11),i=h(i,o,r,n,t[7],4139469664,16),n=h(n,i,o,r,t[10],3200236656,23),r=h(r,n,i,o,t[13],681279174,4),o=h(o,r,n,i,t[0],3936430074,11),i=h(i,o,r,n,t[3],3572445317,16),n=h(n,i,o,r,t[6],76029189,23),r=h(r,n,i,o,t[9],3654602809,4),o=h(o,r,n,i,t[12],3873151461,11),i=h(i,o,r,n,t[15],530742520,16),n=h(n,i,o,r,t[2],3299628645,23),r=l(r,n,i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,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},s.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},t.exports=s},f5df:function(t,e,r){var n=r("00ee"),i=r("c6b6"),o=r("b622"),a=o("toStringTag"),s="Arguments"==i(function(){return arguments}()),u=function(t,e){try{return t[e]}catch(r){}};t.exports=n?i:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=u(e=Object(t),a))?r:s?i(e):"Object"==(n=i(e))&&"function"==typeof e.callee?"Arguments":n}},f5e1:function(t,e,r){var n=r("33a0"),i=r("9850");function o(t,e,r){var o=e&&r||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null),t=t||{};var a=t.random||(t.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,e)for(var s=0;s<16;++s)e[o+s]=a[s];return e||i(a)}t.exports=o},f654:function(t,e,r){"use strict";(function(e){var n=r("320c"); +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i=0;c--)if(f[c]!==h[c])return!1;for(c=f.length-1;c>=0;c--)if(s=f[c],!w(t[s],e[s],r,n))return!1;return!0}function E(t,e,r){w(t,e,!0)&&b(t,e,r,"notDeepStrictEqual",E)}function x(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(r){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function M(t){var e;try{t()}catch(r){e=r}return e}function k(t,e,r,n){var i;if("function"!==typeof e)throw new TypeError('"block" argument must be a function');"string"===typeof r&&(n=r,r=null),i=M(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&b(i,r,"Missing expected exception"+n);var o="string"===typeof n,s=!t&&a.isError(i),u=!t&&i&&!r;if((s&&o&&x(i,r)||u)&&b(i,r,"Got unwanted exception"+n),t&&i&&r&&!x(i,r)||!t&&i)throw i}function S(t,e){t||b(t,!0,e,"==",S)}l.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=v(this),this.generatedMessage=!0);var e=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=p(e),o=n.indexOf("\n"+i);if(o>=0){var a=n.indexOf("\n",o+1);n=n.substring(a+1)}this.stack=n}}},a.inherits(l.AssertionError,Error),l.fail=b,l.ok=g,l.equal=function(t,e,r){t!=e&&b(t,e,r,"==",l.equal)},l.notEqual=function(t,e,r){t==e&&b(t,e,r,"!=",l.notEqual)},l.deepEqual=function(t,e,r){w(t,e,!1)||b(t,e,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(t,e,r){w(t,e,!0)||b(t,e,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(t,e,r){w(t,e,!1)&&b(t,e,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=E,l.strictEqual=function(t,e,r){t!==e&&b(t,e,r,"===",l.strictEqual)},l.notStrictEqual=function(t,e,r){t===e&&b(t,e,r,"!==",l.notStrictEqual)},l.throws=function(t,e,r){k(!0,t,e,r)},l.doesNotThrow=function(t,e,r){k(!1,t,e,r)},l.ifError=function(t){if(t)throw t},l.strict=n(S,l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var I=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,r("c8ba"))},f772:function(t,e,r){var n=r("5692"),i=r("90e3"),o=n("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},f8c1:function(t){t.exports=JSON.parse('{"COMPRESSED_TYPE_INVALID":"compressed should be a boolean","EC_PRIVATE_KEY_TYPE_INVALID":"private key should be a Buffer","EC_PRIVATE_KEY_LENGTH_INVALID":"private key length is invalid","EC_PRIVATE_KEY_RANGE_INVALID":"private key range is invalid","EC_PRIVATE_KEY_TWEAK_ADD_FAIL":"tweak out of range or resulting private key is invalid","EC_PRIVATE_KEY_TWEAK_MUL_FAIL":"tweak out of range","EC_PRIVATE_KEY_EXPORT_DER_FAIL":"couldn\'t export to DER format","EC_PRIVATE_KEY_IMPORT_DER_FAIL":"couldn\'t import from DER format","EC_PUBLIC_KEYS_TYPE_INVALID":"public keys should be an Array","EC_PUBLIC_KEYS_LENGTH_INVALID":"public keys Array should have at least 1 element","EC_PUBLIC_KEY_TYPE_INVALID":"public key should be a Buffer","EC_PUBLIC_KEY_LENGTH_INVALID":"public key length is invalid","EC_PUBLIC_KEY_PARSE_FAIL":"the public key could not be parsed or is invalid","EC_PUBLIC_KEY_CREATE_FAIL":"private was invalid, try again","EC_PUBLIC_KEY_TWEAK_ADD_FAIL":"tweak out of range or resulting public key is invalid","EC_PUBLIC_KEY_TWEAK_MUL_FAIL":"tweak out of range","EC_PUBLIC_KEY_COMBINE_FAIL":"the sum of the public keys is not valid","ECDH_FAIL":"scalar was invalid (zero or overflow)","ECDSA_SIGNATURE_TYPE_INVALID":"signature should be a Buffer","ECDSA_SIGNATURE_LENGTH_INVALID":"signature length is invalid","ECDSA_SIGNATURE_PARSE_FAIL":"couldn\'t parse signature","ECDSA_SIGNATURE_PARSE_DER_FAIL":"couldn\'t parse DER signature","ECDSA_SIGNATURE_SERIALIZE_DER_FAIL":"couldn\'t serialize signature to DER format","ECDSA_SIGN_FAIL":"nonce generation function failed or private key is invalid","ECDSA_RECOVER_FAIL":"couldn\'t recover public key from signature","MSG32_TYPE_INVALID":"message should be a Buffer","MSG32_LENGTH_INVALID":"message length is invalid","OPTIONS_TYPE_INVALID":"options should be an Object","OPTIONS_DATA_TYPE_INVALID":"options.data should be a Buffer","OPTIONS_DATA_LENGTH_INVALID":"options.data length is invalid","OPTIONS_NONCEFN_TYPE_INVALID":"options.noncefn should be a Function","RECOVERY_ID_TYPE_INVALID":"recovery should be a Number","RECOVERY_ID_VALUE_INVALID":"recovery should have value between -1 and 4","TWEAK_TYPE_INVALID":"tweak should be a Buffer","TWEAK_LENGTH_INVALID":"tweak length is invalid"}')},f908:function(t,e,r){"use strict";var n=r("5562"),i=r("2c0b"),o=r("17fb");function a(t){this.registry=t}a.prototype.method=function(t,e,r,n){return{call:this.call.bind({ensName:t,methodName:e,methodArguments:r,callback:n,parent:this}),send:this.send.bind({ensName:t,methodName:e,methodArguments:r,callback:n,parent:this})}},a.prototype.call=function(t){var e=this,r=new n,i=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((function(n){e.parent.handleCall(r,n.methods[e.methodName],i,t)})).catch((function(t){r.reject(t)})),r.eventEmitter},a.prototype.send=function(t,e){var r=this,i=new n,o=this.parent.prepareArguments(this.ensName,this.methodArguments);return this.parent.registry.resolver(this.ensName).then((function(n){r.parent.handleSend(i,n.methods[r.methodName],o,t,e)})).catch((function(t){i.reject(t)})),i.eventEmitter},a.prototype.handleCall=function(t,e,r,n){return e.apply(this,r).call().then((function(e){t.resolve(e),o.isFunction(n)&&n(e)})).catch((function(e){t.reject(e),o.isFunction(n)&&n(e)})),t},a.prototype.handleSend=function(t,e,r,n,i){return e.apply(this,r).send(n).on("transactionHash",(function(e){t.eventEmitter.emit("transactionHash",e)})).on("confirmation",(function(e,r){t.eventEmitter.emit("confirmation",e,r)})).on("receipt",(function(e){t.eventEmitter.emit("receipt",e),t.resolve(e),o.isFunction(i)&&i(e)})).on("error",(function(e){t.eventEmitter.emit("error",e),t.reject(e),o.isFunction(i)&&i(e)})),t},a.prototype.prepareArguments=function(t,e){var r=i.hash(t);return e.length>0?(e.unshift(r),e):[r]},t.exports=a},f9a0:function(t,e){function r(t,e,r){var n=e.toLowerCase();t[e]||t[n]||(t[e]=r)}t.exports=r},f9e1:function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(Error);e.SecurityError=i;var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(Error);e.InvalidStateError=o;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(Error);e.NetworkError=a;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(Error);e.SyntaxError=s},faa1: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)};function a(t){console&&console.warn&&console.warn(t)}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)}t.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function f(t){if("function"!==typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function l(t,e,r,n){var i,o,s;if(f(r),o=t._events,void 0===o?(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=h(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a(u)}return t}function d(){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)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function m(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?g(i):v(i,i.length)}function y(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 v(t,e){for(var r=new Array(e),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"===typeof u)o(u,this,e);else{var c=u.length,f=v(u,c);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():b(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,a||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(r=this._events,void 0===r)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=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return m(this,t,!0)},u.prototype.rawListeners=function(t){return m(this,t,!1)},u.listenerCount=function(t,e){return"function"===typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},fb6d:function(t){t.exports=JSON.parse('{"name":"chainstart","comment":"Start of the Ethereum main chain","eip":{"url":"","status":""},"status":"","gasConfig":{"minGasLimit":{"v":5000,"d":"Minimum the gas limit may ever be"},"gasLimitBoundDivisor":{"v":1024,"d":"The bound divisor of the gas limit, used in update calculations"}},"gasPrices":{"base":{"v":2,"d":"Gas base cost, used e.g. for ChainID opcode (Istanbul)"},"tierStep":{"v":[0,2,3,5,8,10,20],"d":"Once per operation, for a selection of them"},"exp":{"v":10,"d":"Once per EXP instuction"},"expByte":{"v":10,"d":"Times ceil(log256(exponent)) for the EXP instruction"},"sha3":{"v":30,"d":"Once per SHA3 operation"},"sha3Word":{"v":6,"d":"Once per word of the SHA3 operation\'s data"},"sload":{"v":50,"d":"Once per SLOAD operation"},"sstoreSet":{"v":20000,"d":"Once per SSTORE operation if the zeroness changes from zero"},"sstoreReset":{"v":5000,"d":"Once per SSTORE operation if the zeroness does not change from zero"},"sstoreRefund":{"v":15000,"d":"Once per SSTORE operation if the zeroness changes to zero"},"jumpdest":{"v":1,"d":"Refunded gas, once per SSTORE operation if the zeroness changes to zero"},"log":{"v":375,"d":"Per LOG* operation"},"logData":{"v":8,"d":"Per byte in a LOG* operation\'s data"},"logTopic":{"v":375,"d":"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"},"create":{"v":32000,"d":"Once per CREATE operation & contract-creation transaction"},"call":{"v":40,"d":"Once per CALL operation & message call transaction"},"callStipend":{"v":2300,"d":"Free gas given at beginning of call"},"callValueTransfer":{"v":9000,"d":"Paid for CALL when the value transfor is non-zero"},"callNewAccount":{"v":25000,"d":"Paid for CALL when the destination address didn\'t exist prior"},"selfdestructRefund":{"v":24000,"d":"Refunded following a selfdestruct operation"},"memory":{"v":3,"d":"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"},"quadCoeffDiv":{"v":512,"d":"Divisor for the quadratic particle of the memory cost equation"},"createData":{"v":200,"d":""},"tx":{"v":21000,"d":"Per transaction. NOTE: Not payable on data of calls between transactions"},"txCreation":{"v":32000,"d":"The cost of creating a contract via tx"},"txDataZero":{"v":4,"d":"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"},"txDataNonZero":{"v":68,"d":"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},"copy":{"v":3,"d":"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"},"ecRecover":{"v":3000,"d":""},"sha256":{"v":60,"d":""},"sha256Word":{"v":12,"d":""},"ripemd160":{"v":600,"d":""},"ripemd160Word":{"v":120,"d":""},"identity":{"v":15,"d":""},"identityWord":{"v":3,"d":""}},"vm":{"stackLimit":{"v":1024,"d":"Maximum size of VM stack allowed"},"callCreateDepth":{"v":1024,"d":"Maximum depth of call/create stack"},"maxExtraDataSize":{"v":32,"d":"Maximum size extra data may be after Genesis"}},"pow":{"minimumDifficulty":{"v":131072,"d":"The minimum that the difficulty may ever be"},"difficultyBoundDivisor":{"v":2048,"d":"The bound divisor of the difficulty, used in the update calculations"},"durationLimit":{"v":13,"d":"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"},"epochDuration":{"v":30000,"d":"Duration between proof-of-work epochs"},"timebombPeriod":{"v":100000,"d":"Exponential difficulty timebomb period"},"minerReward":{"v":"5000000000000000000","d":"the amount a miner get rewarded for mining a block"}},"casper":{},"sharding":{}}')},fc6a:function(t,e,r){var n=r("44ad"),i=r("1d80");t.exports=function(t){return n(i(t))}},fda6:function(t,e,r){var n=r("8947"),i=r("4228"),o=r("e85f");function a(){return Object.keys(o)}e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=a},fdac:function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r 0; count--) {\n inputOff += this._buffer(data, inputOff);\n outputOff += this._flushBuffer(out, outputOff);\n }\n\n // Buffer rest of the input\n inputOff += this._buffer(data, inputOff);\n\n return out;\n};\n\nCipher.prototype.final = function final(buffer) {\n var first;\n if (buffer)\n first = this.update(buffer);\n\n var last;\n if (this.type === 'encrypt')\n last = this._finalEncrypt();\n else\n last = this._finalDecrypt();\n\n if (first)\n return first.concat(last);\n else\n return last;\n};\n\nCipher.prototype._pad = function _pad(buffer, off) {\n if (off === 0)\n return false;\n\n while (off < buffer.length)\n buffer[off++] = 0;\n\n return true;\n};\n\nCipher.prototype._finalEncrypt = function _finalEncrypt() {\n if (!this._pad(this.buffer, this.bufferOff))\n return [];\n\n var out = new Array(this.blockSize);\n this._update(this.buffer, 0, out, 0);\n return out;\n};\n\nCipher.prototype._unpad = function _unpad(buffer) {\n return buffer;\n};\n\nCipher.prototype._finalDecrypt = function _finalDecrypt() {\n assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');\n var out = new Array(this.blockSize);\n this._flushBuffer(out, 0);\n\n return this._unpad(out);\n};\n","var constants = exports;\n\n// Helper\nconstants._reverse = function reverse(map) {\n var res = {};\n\n Object.keys(map).forEach(function(key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key)\n key = key | 0;\n\n var value = map[key];\n res[value] = key;\n });\n\n return res;\n};\n\nconstants.der = require('./der');\n","var aFunction = require('../internals/a-function');\n\n// optional / simple context binding\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 0: return function () {\n return fn.call(that);\n };\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.chains = {\n names: {\n '1': 'mainnet',\n '3': 'ropsten',\n '4': 'rinkeby',\n '42': 'kovan',\n '6284': 'goerli',\n },\n mainnet: require('./mainnet.json'),\n ropsten: require('./ropsten.json'),\n rinkeby: require('./rinkeby.json'),\n kovan: require('./kovan.json'),\n goerli: require('./goerli.json'),\n};\n//# sourceMappingURL=index.js.map","var DESCRIPTORS = require('../internals/descriptors');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPrimitive = require('../internals/to-primitive');\nvar has = require('../internals/has');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\nvar nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return nativeGetOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);\n};\n","var indexOf = function (xs, item) {\n if (xs.indexOf) return xs.indexOf(item);\n else for (var i = 0; i < xs.length; i++) {\n if (xs[i] === item) return i;\n }\n return -1;\n};\nvar Object_keys = function (obj) {\n if (Object.keys) return Object.keys(obj)\n else {\n var res = [];\n for (var key in obj) res.push(key)\n return res;\n }\n};\n\nvar forEach = function (xs, fn) {\n if (xs.forEach) return xs.forEach(fn)\n else for (var i = 0; i < xs.length; i++) {\n fn(xs[i], i, xs);\n }\n};\n\nvar defineProp = (function() {\n try {\n Object.defineProperty({}, '_', {});\n return function(obj, name, value) {\n Object.defineProperty(obj, name, {\n writable: true,\n enumerable: false,\n configurable: true,\n value: value\n })\n };\n } catch(e) {\n return function(obj, name, value) {\n obj[name] = value;\n };\n }\n}());\n\nvar globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',\n'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',\n'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',\n'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',\n'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];\n\nfunction Context() {}\nContext.prototype = {};\n\nvar Script = exports.Script = function NodeScript (code) {\n if (!(this instanceof Script)) return new Script(code);\n this.code = code;\n};\n\nScript.prototype.runInContext = function (context) {\n if (!(context instanceof Context)) {\n throw new TypeError(\"needs a 'context' argument.\");\n }\n \n var iframe = document.createElement('iframe');\n if (!iframe.style) iframe.style = {};\n iframe.style.display = 'none';\n \n document.body.appendChild(iframe);\n \n var win = iframe.contentWindow;\n var wEval = win.eval, wExecScript = win.execScript;\n\n if (!wEval && wExecScript) {\n // win.eval() magically appears when this is called in IE:\n wExecScript.call(win, 'null');\n wEval = win.eval;\n }\n \n forEach(Object_keys(context), function (key) {\n win[key] = context[key];\n });\n forEach(globals, function (key) {\n if (context[key]) {\n win[key] = context[key];\n }\n });\n \n var winKeys = Object_keys(win);\n\n var res = wEval.call(win, this.code);\n \n forEach(Object_keys(win), function (key) {\n // Avoid copying circular objects like `top` and `window` by only\n // updating existing context properties or new properties in the `win`\n // that was only introduced after the eval.\n if (key in context || indexOf(winKeys, key) === -1) {\n context[key] = win[key];\n }\n });\n\n forEach(globals, function (key) {\n if (!(key in context)) {\n defineProp(context, key, win[key]);\n }\n });\n \n document.body.removeChild(iframe);\n \n return res;\n};\n\nScript.prototype.runInThisContext = function () {\n return eval(this.code); // maybe...\n};\n\nScript.prototype.runInNewContext = function (context) {\n var ctx = Script.createContext(context);\n var res = this.runInContext(ctx);\n\n if (context) {\n forEach(Object_keys(ctx), function (key) {\n context[key] = ctx[key];\n });\n }\n\n return res;\n};\n\nforEach(Object_keys(Script.prototype), function (name) {\n exports[name] = Script[name] = function (code) {\n var s = Script(code);\n return s[name].apply(s, [].slice.call(arguments, 1));\n };\n});\n\nexports.isContext = function (context) {\n return context instanceof Context;\n};\n\nexports.createScript = function (code) {\n return exports.Script(code);\n};\n\nexports.createContext = Script.createContext = function (context) {\n var copy = new Context();\n if(typeof context === 'object') {\n forEach(Object_keys(context), function (key) {\n copy[key] = context[key];\n });\n }\n return copy;\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar SHA256 = require('./256');\n\nfunction SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224();\n\n SHA256.call(this);\n this.h = [\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,\n 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];\n}\nutils.inherits(SHA224, SHA256);\nmodule.exports = SHA224;\n\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 7), 'big');\n else\n return utils.split32(this.h.slice(0, 7), 'big');\n};\n\n","/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined\n * in FIPS PUB 180-1\n * This source code is derived from sha1.js of the same repository.\n * The difference between SHA-0 and SHA-1 is just a bitwise rotate left\n * operation was added.\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0\n]\n\nvar W = new Array(80)\n\nfunction Sha () {\n this.init()\n this._w = W\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha, Hash)\n\nSha.prototype.init = function () {\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n\n return this\n}\n\nfunction rotl5 (num) {\n return (num << 5) | (num >>> 27)\n}\n\nfunction rotl30 (num) {\n return (num << 30) | (num >>> 2)\n}\n\nfunction ft (s, b, c, d) {\n if (s === 0) return (b & c) | ((~b) & d)\n if (s === 2) return (b & c) | (b & d) | (c & d)\n return b ^ c ^ d\n}\n\nSha.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20)\n var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0\n\n e = d\n d = c\n c = rotl30(b)\n b = a\n a = t\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n}\n\nSha.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20)\n\n H.writeInt32BE(this._a | 0, 0)\n H.writeInt32BE(this._b | 0, 4)\n H.writeInt32BE(this._c | 0, 8)\n H.writeInt32BE(this._d | 0, 12)\n H.writeInt32BE(this._e | 0, 16)\n\n return H\n}\n\nmodule.exports = Sha\n","module.exports = require('./lib/_stream_duplex.js');\n","var aes = require('./aes')\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('cipher-base')\nvar inherits = require('inherits')\n\nfunction StreamCipher (mode, key, iv, decrypt) {\n Transform.call(this)\n\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._cache = Buffer.allocUnsafe(0)\n this._secCache = Buffer.allocUnsafe(0)\n this._decrypt = decrypt\n this._mode = mode\n}\n\ninherits(StreamCipher, Transform)\n\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt)\n}\n\nStreamCipher.prototype._final = function () {\n this._cipher.scrub()\n}\n\nmodule.exports = StreamCipher\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","exports['des-ecb'] = {\n key: 8,\n iv: 0\n}\nexports['des-cbc'] = exports.des = {\n key: 8,\n iv: 8\n}\nexports['des-ede3-cbc'] = exports.des3 = {\n key: 24,\n iv: 8\n}\nexports['des-ede3'] = {\n key: 24,\n iv: 0\n}\nexports['des-ede-cbc'] = {\n key: 16,\n iv: 8\n}\nexports['des-ede'] = {\n key: 16,\n iv: 0\n}\n","const Bytes = require(\"./bytes\");\nconst Nat = require(\"./nat\");\nconst elliptic = require(\"elliptic\");\nconst rlp = require(\"./rlp\");\nconst secp256k1 = new elliptic.ec(\"secp256k1\"); // eslint-disable-line\nconst { keccak256, keccak256s } = require(\"./hash\");\n\nconst create = entropy => {\n const innerHex = keccak256(Bytes.concat(Bytes.random(32), entropy || Bytes.random(32)));\n const middleHex = Bytes.concat(Bytes.concat(Bytes.random(32), innerHex), Bytes.random(32));\n const outerHex = keccak256(middleHex);\n return fromPrivate(outerHex);\n};\n\nconst toChecksum = address => {\n const addressHash = keccak256s(address.slice(2));\n let checksumAddress = \"0x\";\n for (let i = 0; i < 40; i++) checksumAddress += parseInt(addressHash[i + 2], 16) > 7 ? address[i + 2].toUpperCase() : address[i + 2];\n return checksumAddress;\n};\n\nconst fromPrivate = privateKey => {\n const buffer = new Buffer(privateKey.slice(2), \"hex\");\n const ecKey = secp256k1.keyFromPrivate(buffer);\n const publicKey = \"0x\" + ecKey.getPublic(false, 'hex').slice(2);\n const publicHash = keccak256(publicKey);\n const address = toChecksum(\"0x\" + publicHash.slice(-40));\n return {\n address: address,\n privateKey: privateKey\n };\n};\n\nconst encodeSignature = ([v, r, s]) => Bytes.flatten([r, s, v]);\n\nconst decodeSignature = hex => [Bytes.slice(64, Bytes.length(hex), hex), Bytes.slice(0, 32, hex), Bytes.slice(32, 64, hex)];\n\nconst makeSigner = addToV => (hash, privateKey) => {\n const signature = secp256k1.keyFromPrivate(new Buffer(privateKey.slice(2), \"hex\")).sign(new Buffer(hash.slice(2), \"hex\"), { canonical: true });\n return encodeSignature([Nat.fromString(Bytes.fromNumber(addToV + signature.recoveryParam)), Bytes.pad(32, Bytes.fromNat(\"0x\" + signature.r.toString(16))), Bytes.pad(32, Bytes.fromNat(\"0x\" + signature.s.toString(16)))]);\n};\n\nconst sign = makeSigner(27); // v=27|28 instead of 0|1...\n\nconst recover = (hash, signature) => {\n const vals = decodeSignature(signature);\n const vrs = { v: Bytes.toNumber(vals[0]), r: vals[1].slice(2), s: vals[2].slice(2) };\n const ecPublicKey = secp256k1.recoverPubKey(new Buffer(hash.slice(2), \"hex\"), vrs, vrs.v < 2 ? vrs.v : 1 - vrs.v % 2); // because odd vals mean v=0... sadly that means v=0 means v=1... I hate that\n const publicKey = \"0x\" + ecPublicKey.encode(\"hex\", false).slice(2);\n const publicHash = keccak256(publicKey);\n const address = toChecksum(\"0x\" + publicHash.slice(-40));\n return address;\n};\n\nmodule.exports = {\n create,\n toChecksum,\n fromPrivate,\n sign,\n makeSigner,\n recover,\n encodeSignature,\n decodeSignature\n};","'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar curve = require('./curve');\nvar utils = require('./utils');\n\nvar assert = utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new curve.edwards(options);\n else\n this.curve = new curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve\n });\n return curve;\n }\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'\n ]\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'\n ]\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'\n ]\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'\n ]\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650'\n ]\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9'\n ]\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658'\n ]\n});\n\nvar pre;\ntry {\n pre = require('./precomputed/secp256k1');\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3'\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15'\n }\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre\n ]\n});\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thank's IE8 for his funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nvar proto = {};\n\nfunction CBCState(iv) {\n assert.equal(iv.length, 8, 'Invalid IV length');\n\n this.iv = new Array(8);\n for (var i = 0; i < this.iv.length; i++)\n this.iv[i] = iv[i];\n}\n\nfunction instantiate(Base) {\n function CBC(options) {\n Base.call(this, options);\n this._cbcInit();\n }\n inherits(CBC, Base);\n\n var keys = Object.keys(proto);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n CBC.prototype[key] = proto[key];\n }\n\n CBC.create = function create(options) {\n return new CBC(options);\n };\n\n return CBC;\n}\n\nexports.instantiate = instantiate;\n\nproto._cbcInit = function _cbcInit() {\n var state = new CBCState(this.options.iv);\n this._cbcState = state;\n};\n\nproto._update = function _update(inp, inOff, out, outOff) {\n var state = this._cbcState;\n var superProto = this.constructor.super_.prototype;\n\n var iv = state.iv;\n if (this.type === 'encrypt') {\n for (var i = 0; i < this.blockSize; i++)\n iv[i] ^= inp[inOff + i];\n\n superProto._update.call(this, iv, 0, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++)\n iv[i] = out[outOff + i];\n } else {\n superProto._update.call(this, inp, inOff, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++)\n out[outOff + i] ^= iv[i];\n\n for (var i = 0; i < this.blockSize; i++)\n iv[i] = inp[inOff + i];\n }\n};\n","module.exports = getResponse\nfunction getResponse (opt, resp) {\n if (!resp) return null\n return {\n statusCode: resp.statusCode,\n headers: resp.headers,\n method: opt.method,\n url: opt.url,\n // the XHR object in browser, http response in Node\n rawRequest: resp.rawRequest ? resp.rawRequest : resp\n }\n}\n","var parseKeys = require('parse-asn1')\nvar mgf = require('./mgf')\nvar xor = require('./xor')\nvar BN = require('bn.js')\nvar crt = require('browserify-rsa')\nvar createHash = require('create-hash')\nvar withPublic = require('./withPublic')\nvar Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function privateDecrypt (privateKey, enc, reverse) {\n var padding\n if (privateKey.padding) {\n padding = privateKey.padding\n } else if (reverse) {\n padding = 1\n } else {\n padding = 4\n }\n\n var key = parseKeys(privateKey)\n var k = key.modulus.byteLength()\n if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {\n throw new Error('decryption error')\n }\n var msg\n if (reverse) {\n msg = withPublic(new BN(enc), key)\n } else {\n msg = crt(enc, key)\n }\n var zBuffer = Buffer.alloc(k - msg.length)\n msg = Buffer.concat([zBuffer, msg], k)\n if (padding === 4) {\n return oaep(key, msg)\n } else if (padding === 1) {\n return pkcs1(key, msg, reverse)\n } else if (padding === 3) {\n return msg\n } else {\n throw new Error('unknown padding')\n }\n}\n\nfunction oaep (key, msg) {\n var k = key.modulus.byteLength()\n var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()\n var hLen = iHash.length\n if (msg[0] !== 0) {\n throw new Error('decryption error')\n }\n var maskedSeed = msg.slice(1, hLen + 1)\n var maskedDb = msg.slice(hLen + 1)\n var seed = xor(maskedSeed, mgf(maskedDb, hLen))\n var db = xor(maskedDb, mgf(seed, k - hLen - 1))\n if (compare(iHash, db.slice(0, hLen))) {\n throw new Error('decryption error')\n }\n var i = hLen\n while (db[i] === 0) {\n i++\n }\n if (db[i++] !== 1) {\n throw new Error('decryption error')\n }\n return db.slice(i)\n}\n\nfunction pkcs1 (key, msg, reverse) {\n var p1 = msg.slice(0, 2)\n var i = 2\n var status = 0\n while (msg[i++] !== 0) {\n if (i >= msg.length) {\n status++\n break\n }\n }\n var ps = msg.slice(2, i - 1)\n\n if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {\n status++\n }\n if (ps.length < 8) {\n status++\n }\n if (status) {\n throw new Error('decryption error')\n }\n return msg.slice(i)\n}\nfunction compare (a, b) {\n a = Buffer.from(a)\n b = Buffer.from(b)\n var dif = 0\n var len = a.length\n if (a.length !== b.length) {\n dif++\n len = Math.min(a.length, b.length)\n }\n var i = -1\n while (++i < len) {\n dif += (a[i] ^ b[i])\n }\n return dif\n}\n","/**\r\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\r\n *\r\n * @version 0.5.7\r\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\r\n * @copyright Chen, Yi-Cyuan 2015-2016\r\n * @license MIT\r\n */\r\n/*jslint bitwise: true */\r\n(function () {\r\n 'use strict';\r\n\r\n var root = typeof window === 'object' ? window : {};\r\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\r\n if (NODE_JS) {\r\n root = global;\r\n }\r\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module === 'object' && module.exports;\r\n var HEX_CHARS = '0123456789abcdef'.split('');\r\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\r\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\r\n var PADDING = [6, 1536, 393216, 100663296];\r\n var SHIFT = [0, 8, 16, 24];\r\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\r\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\r\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\r\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\r\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\r\n var BITS = [224, 256, 384, 512];\r\n var SHAKE_BITS = [128, 256];\r\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array'];\r\n\r\n var createOutputMethod = function (bits, padding, outputType) {\r\n return function (message) {\r\n return new Keccak(bits, padding, bits).update(message)[outputType]();\r\n };\r\n };\r\n\r\n var createShakeOutputMethod = function (bits, padding, outputType) {\r\n return function (message, outputBits) {\r\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\r\n };\r\n };\r\n\r\n var createMethod = function (bits, padding) {\r\n var method = createOutputMethod(bits, padding, 'hex');\r\n method.create = function () {\r\n return new Keccak(bits, padding, bits);\r\n };\r\n method.update = function (message) {\r\n return method.create().update(message);\r\n };\r\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\r\n var type = OUTPUT_TYPES[i];\r\n method[type] = createOutputMethod(bits, padding, type);\r\n }\r\n return method;\r\n };\r\n\r\n var createShakeMethod = function (bits, padding) {\r\n var method = createShakeOutputMethod(bits, padding, 'hex');\r\n method.create = function (outputBits) {\r\n return new Keccak(bits, padding, outputBits);\r\n };\r\n method.update = function (message, outputBits) {\r\n return method.create(outputBits).update(message);\r\n };\r\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\r\n var type = OUTPUT_TYPES[i];\r\n method[type] = createShakeOutputMethod(bits, padding, type);\r\n }\r\n return method;\r\n };\r\n\r\n var algorithms = [\r\n {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod},\r\n {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod},\r\n {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod}\r\n ];\r\n\r\n var methods = {}, methodNames = [];\r\n\r\n for (var i = 0; i < algorithms.length; ++i) {\r\n var algorithm = algorithms[i];\r\n var bits = algorithm.bits;\r\n for (var j = 0; j < bits.length; ++j) {\r\n var methodName = algorithm.name +'_' + bits[j];\r\n methodNames.push(methodName);\r\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\r\n }\r\n }\r\n\r\n function Keccak(bits, padding, outputBits) {\r\n this.blocks = [];\r\n this.s = [];\r\n this.padding = padding;\r\n this.outputBits = outputBits;\r\n this.reset = true;\r\n this.block = 0;\r\n this.start = 0;\r\n this.blockCount = (1600 - (bits << 1)) >> 5;\r\n this.byteCount = this.blockCount << 2;\r\n this.outputBlocks = outputBits >> 5;\r\n this.extraBytes = (outputBits & 31) >> 3;\r\n\r\n for (var i = 0; i < 50; ++i) {\r\n this.s[i] = 0;\r\n }\r\n }\r\n\r\n Keccak.prototype.update = function (message) {\r\n var notString = typeof message !== 'string';\r\n if (notString && message.constructor === ArrayBuffer) {\r\n message = new Uint8Array(message);\r\n }\r\n var length = message.length, blocks = this.blocks, byteCount = this.byteCount,\r\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\r\n\r\n while (index < length) {\r\n if (this.reset) {\r\n this.reset = false;\r\n blocks[0] = this.block;\r\n for (i = 1; i < blockCount + 1; ++i) {\r\n blocks[i] = 0;\r\n }\r\n }\r\n if (notString) {\r\n for (i = this.start; index < length && i < byteCount; ++index) {\r\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\r\n }\r\n } else {\r\n for (i = this.start; index < length && i < byteCount; ++index) {\r\n code = message.charCodeAt(index);\r\n if (code < 0x80) {\r\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\r\n } else if (code < 0x800) {\r\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n } else if (code < 0xd800 || code >= 0xe000) {\r\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n } else {\r\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\r\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n }\r\n }\r\n }\r\n this.lastByteIndex = i;\r\n if (i >= byteCount) {\r\n this.start = i - byteCount;\r\n this.block = blocks[blockCount];\r\n for (i = 0; i < blockCount; ++i) {\r\n s[i] ^= blocks[i];\r\n }\r\n f(s);\r\n this.reset = true;\r\n } else {\r\n this.start = i;\r\n }\r\n }\r\n return this;\r\n };\r\n\r\n Keccak.prototype.finalize = function () {\r\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\r\n blocks[i >> 2] |= this.padding[i & 3];\r\n if (this.lastByteIndex === this.byteCount) {\r\n blocks[0] = blocks[blockCount];\r\n for (i = 1; i < blockCount + 1; ++i) {\r\n blocks[i] = 0;\r\n }\r\n }\r\n blocks[blockCount - 1] |= 0x80000000;\r\n for (i = 0; i < blockCount; ++i) {\r\n s[i] ^= blocks[i];\r\n }\r\n f(s);\r\n };\r\n\r\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var hex = '', block;\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n block = s[i];\r\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\r\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\r\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\r\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n i = 0;\r\n }\r\n }\r\n if (extraBytes) {\r\n block = s[i];\r\n if (extraBytes > 0) {\r\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\r\n }\r\n if (extraBytes > 1) {\r\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\r\n }\r\n if (extraBytes > 2) {\r\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\r\n }\r\n }\r\n return hex;\r\n };\r\n\r\n Keccak.prototype.arrayBuffer = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var bytes = this.outputBits >> 3;\r\n var buffer;\r\n if (extraBytes) {\r\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\r\n } else {\r\n buffer = new ArrayBuffer(bytes);\r\n }\r\n var array = new Uint32Array(buffer);\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n array[j] = s[i];\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n }\r\n }\r\n if (extraBytes) {\r\n array[i] = s[i];\r\n buffer = buffer.slice(0, bytes);\r\n }\r\n return buffer;\r\n };\r\n\r\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\r\n\r\n Keccak.prototype.digest = Keccak.prototype.array = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var array = [], offset, block;\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n offset = j << 2;\r\n block = s[i];\r\n array[offset] = block & 0xFF;\r\n array[offset + 1] = (block >> 8) & 0xFF;\r\n array[offset + 2] = (block >> 16) & 0xFF;\r\n array[offset + 3] = (block >> 24) & 0xFF;\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n }\r\n }\r\n if (extraBytes) {\r\n offset = j << 2;\r\n block = s[i];\r\n if (extraBytes > 0) {\r\n array[offset] = block & 0xFF;\r\n }\r\n if (extraBytes > 1) {\r\n array[offset + 1] = (block >> 8) & 0xFF;\r\n }\r\n if (extraBytes > 2) {\r\n array[offset + 2] = (block >> 16) & 0xFF;\r\n }\r\n }\r\n return array;\r\n };\r\n\r\n var f = function (s) {\r\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\r\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\r\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\r\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\r\n for (n = 0; n < 48; n += 2) {\r\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\r\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\r\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\r\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\r\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\r\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\r\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\r\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\r\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\r\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\r\n\r\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\r\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\r\n s[0] ^= h;\r\n s[1] ^= l;\r\n s[10] ^= h;\r\n s[11] ^= l;\r\n s[20] ^= h;\r\n s[21] ^= l;\r\n s[30] ^= h;\r\n s[31] ^= l;\r\n s[40] ^= h;\r\n s[41] ^= l;\r\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\r\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\r\n s[2] ^= h;\r\n s[3] ^= l;\r\n s[12] ^= h;\r\n s[13] ^= l;\r\n s[22] ^= h;\r\n s[23] ^= l;\r\n s[32] ^= h;\r\n s[33] ^= l;\r\n s[42] ^= h;\r\n s[43] ^= l;\r\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\r\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\r\n s[4] ^= h;\r\n s[5] ^= l;\r\n s[14] ^= h;\r\n s[15] ^= l;\r\n s[24] ^= h;\r\n s[25] ^= l;\r\n s[34] ^= h;\r\n s[35] ^= l;\r\n s[44] ^= h;\r\n s[45] ^= l;\r\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\r\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\r\n s[6] ^= h;\r\n s[7] ^= l;\r\n s[16] ^= h;\r\n s[17] ^= l;\r\n s[26] ^= h;\r\n s[27] ^= l;\r\n s[36] ^= h;\r\n s[37] ^= l;\r\n s[46] ^= h;\r\n s[47] ^= l;\r\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\r\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\r\n s[8] ^= h;\r\n s[9] ^= l;\r\n s[18] ^= h;\r\n s[19] ^= l;\r\n s[28] ^= h;\r\n s[29] ^= l;\r\n s[38] ^= h;\r\n s[39] ^= l;\r\n s[48] ^= h;\r\n s[49] ^= l;\r\n\r\n b0 = s[0];\r\n b1 = s[1];\r\n b32 = (s[11] << 4) | (s[10] >>> 28);\r\n b33 = (s[10] << 4) | (s[11] >>> 28);\r\n b14 = (s[20] << 3) | (s[21] >>> 29);\r\n b15 = (s[21] << 3) | (s[20] >>> 29);\r\n b46 = (s[31] << 9) | (s[30] >>> 23);\r\n b47 = (s[30] << 9) | (s[31] >>> 23);\r\n b28 = (s[40] << 18) | (s[41] >>> 14);\r\n b29 = (s[41] << 18) | (s[40] >>> 14);\r\n b20 = (s[2] << 1) | (s[3] >>> 31);\r\n b21 = (s[3] << 1) | (s[2] >>> 31);\r\n b2 = (s[13] << 12) | (s[12] >>> 20);\r\n b3 = (s[12] << 12) | (s[13] >>> 20);\r\n b34 = (s[22] << 10) | (s[23] >>> 22);\r\n b35 = (s[23] << 10) | (s[22] >>> 22);\r\n b16 = (s[33] << 13) | (s[32] >>> 19);\r\n b17 = (s[32] << 13) | (s[33] >>> 19);\r\n b48 = (s[42] << 2) | (s[43] >>> 30);\r\n b49 = (s[43] << 2) | (s[42] >>> 30);\r\n b40 = (s[5] << 30) | (s[4] >>> 2);\r\n b41 = (s[4] << 30) | (s[5] >>> 2);\r\n b22 = (s[14] << 6) | (s[15] >>> 26);\r\n b23 = (s[15] << 6) | (s[14] >>> 26);\r\n b4 = (s[25] << 11) | (s[24] >>> 21);\r\n b5 = (s[24] << 11) | (s[25] >>> 21);\r\n b36 = (s[34] << 15) | (s[35] >>> 17);\r\n b37 = (s[35] << 15) | (s[34] >>> 17);\r\n b18 = (s[45] << 29) | (s[44] >>> 3);\r\n b19 = (s[44] << 29) | (s[45] >>> 3);\r\n b10 = (s[6] << 28) | (s[7] >>> 4);\r\n b11 = (s[7] << 28) | (s[6] >>> 4);\r\n b42 = (s[17] << 23) | (s[16] >>> 9);\r\n b43 = (s[16] << 23) | (s[17] >>> 9);\r\n b24 = (s[26] << 25) | (s[27] >>> 7);\r\n b25 = (s[27] << 25) | (s[26] >>> 7);\r\n b6 = (s[36] << 21) | (s[37] >>> 11);\r\n b7 = (s[37] << 21) | (s[36] >>> 11);\r\n b38 = (s[47] << 24) | (s[46] >>> 8);\r\n b39 = (s[46] << 24) | (s[47] >>> 8);\r\n b30 = (s[8] << 27) | (s[9] >>> 5);\r\n b31 = (s[9] << 27) | (s[8] >>> 5);\r\n b12 = (s[18] << 20) | (s[19] >>> 12);\r\n b13 = (s[19] << 20) | (s[18] >>> 12);\r\n b44 = (s[29] << 7) | (s[28] >>> 25);\r\n b45 = (s[28] << 7) | (s[29] >>> 25);\r\n b26 = (s[38] << 8) | (s[39] >>> 24);\r\n b27 = (s[39] << 8) | (s[38] >>> 24);\r\n b8 = (s[48] << 14) | (s[49] >>> 18);\r\n b9 = (s[49] << 14) | (s[48] >>> 18);\r\n\r\n s[0] = b0 ^ (~b2 & b4);\r\n s[1] = b1 ^ (~b3 & b5);\r\n s[10] = b10 ^ (~b12 & b14);\r\n s[11] = b11 ^ (~b13 & b15);\r\n s[20] = b20 ^ (~b22 & b24);\r\n s[21] = b21 ^ (~b23 & b25);\r\n s[30] = b30 ^ (~b32 & b34);\r\n s[31] = b31 ^ (~b33 & b35);\r\n s[40] = b40 ^ (~b42 & b44);\r\n s[41] = b41 ^ (~b43 & b45);\r\n s[2] = b2 ^ (~b4 & b6);\r\n s[3] = b3 ^ (~b5 & b7);\r\n s[12] = b12 ^ (~b14 & b16);\r\n s[13] = b13 ^ (~b15 & b17);\r\n s[22] = b22 ^ (~b24 & b26);\r\n s[23] = b23 ^ (~b25 & b27);\r\n s[32] = b32 ^ (~b34 & b36);\r\n s[33] = b33 ^ (~b35 & b37);\r\n s[42] = b42 ^ (~b44 & b46);\r\n s[43] = b43 ^ (~b45 & b47);\r\n s[4] = b4 ^ (~b6 & b8);\r\n s[5] = b5 ^ (~b7 & b9);\r\n s[14] = b14 ^ (~b16 & b18);\r\n s[15] = b15 ^ (~b17 & b19);\r\n s[24] = b24 ^ (~b26 & b28);\r\n s[25] = b25 ^ (~b27 & b29);\r\n s[34] = b34 ^ (~b36 & b38);\r\n s[35] = b35 ^ (~b37 & b39);\r\n s[44] = b44 ^ (~b46 & b48);\r\n s[45] = b45 ^ (~b47 & b49);\r\n s[6] = b6 ^ (~b8 & b0);\r\n s[7] = b7 ^ (~b9 & b1);\r\n s[16] = b16 ^ (~b18 & b10);\r\n s[17] = b17 ^ (~b19 & b11);\r\n s[26] = b26 ^ (~b28 & b20);\r\n s[27] = b27 ^ (~b29 & b21);\r\n s[36] = b36 ^ (~b38 & b30);\r\n s[37] = b37 ^ (~b39 & b31);\r\n s[46] = b46 ^ (~b48 & b40);\r\n s[47] = b47 ^ (~b49 & b41);\r\n s[8] = b8 ^ (~b0 & b2);\r\n s[9] = b9 ^ (~b1 & b3);\r\n s[18] = b18 ^ (~b10 & b12);\r\n s[19] = b19 ^ (~b11 & b13);\r\n s[28] = b28 ^ (~b20 & b22);\r\n s[29] = b29 ^ (~b21 & b23);\r\n s[38] = b38 ^ (~b30 & b32);\r\n s[39] = b39 ^ (~b31 & b33);\r\n s[48] = b48 ^ (~b40 & b42);\r\n s[49] = b49 ^ (~b41 & b43);\r\n\r\n s[0] ^= RC[n];\r\n s[1] ^= RC[n + 1];\r\n }\r\n };\r\n\r\n if (COMMON_JS) {\r\n module.exports = methods;\r\n } else {\r\n for (var i = 0; i < methodNames.length; ++i) {\r\n root[methodNames[i]] = methods[methodNames[i]];\r\n }\r\n }\r\n})();\r\n","/*\n This file is part of web3.js.\n\n web3.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n web3.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with web3.js. If not, see .\n */\n/**\n * @file utils.js\n * @author Marek Kotewicz \n * @author Fabian Vogelsteller \n * @date 2017\n */\n\n\nvar _ = require('underscore');\nvar ethjsUnit = require('ethjs-unit');\nvar utils = require('./utils.js');\nvar soliditySha3 = require('./soliditySha3.js');\nvar randombytes = require('randombytes');\n\n\n\n/**\n * Fires an error in an event emitter and callback and returns the eventemitter\n *\n * @method _fireError\n * @param {Object} error a string, a error, or an object with {message, data}\n * @param {Object} emitter\n * @param {Function} reject\n * @param {Function} callback\n * @param {any} optionalData\n * @return {Object} the emitter\n */\nvar _fireError = function (error, emitter, reject, callback, optionalData) {\n /*jshint maxcomplexity: 10 */\n\n // add data if given\n if(_.isObject(error) && !(error instanceof Error) && error.data) {\n if(_.isObject(error.data) || _.isArray(error.data)) {\n error.data = JSON.stringify(error.data, null, 2);\n }\n\n error = error.message +\"\\n\"+ error.data;\n }\n\n if(_.isString(error)) {\n error = new Error(error);\n }\n\n if (_.isFunction(callback)) {\n callback(error, optionalData);\n }\n if (_.isFunction(reject)) {\n // suppress uncatched error if an error listener is present\n // OR suppress uncatched error if an callback listener is present\n if (\n emitter &&\n (_.isFunction(emitter.listeners) &&\n emitter.listeners('error').length) || _.isFunction(callback)\n ) {\n emitter.catch(function(){});\n }\n // reject later, to be able to return emitter\n setTimeout(function () {\n reject(error);\n }, 1);\n }\n\n if(emitter && _.isFunction(emitter.emit)) {\n // emit later, to be able to return emitter\n setTimeout(function () {\n emitter.emit('error', error, optionalData);\n emitter.removeAllListeners();\n }, 1);\n }\n\n return emitter;\n};\n\n/**\n * Should be used to create full function/event name from json abi\n *\n * @method _jsonInterfaceMethodToString\n * @param {Object} json\n * @return {String} full function/event name\n */\nvar _jsonInterfaceMethodToString = function (json) {\n if (_.isObject(json) && json.name && json.name.indexOf('(') !== -1) {\n return json.name;\n }\n\n return json.name + '(' + _flattenTypes(false, json.inputs).join(',') + ')';\n};\n\n\n/**\n * Should be used to flatten json abi inputs/outputs into an array of type-representing-strings\n *\n * @method _flattenTypes\n * @param {bool} includeTuple\n * @param {Object} puts\n * @return {Array} parameters as strings\n */\nvar _flattenTypes = function(includeTuple, puts)\n{\n // console.log(\"entered _flattenTypes. inputs/outputs: \" + puts)\n var types = [];\n\n puts.forEach(function(param) {\n if (typeof param.components === 'object') {\n if (param.type.substring(0, 5) !== 'tuple') {\n throw new Error('components found but type is not tuple; report on GitHub');\n }\n var suffix = '';\n var arrayBracket = param.type.indexOf('[');\n if (arrayBracket >= 0) { suffix = param.type.substring(arrayBracket); }\n var result = _flattenTypes(includeTuple, param.components);\n // console.log(\"result should have things: \" + result)\n if(_.isArray(result) && includeTuple) {\n // console.log(\"include tuple word, and its an array. joining...: \" + result.types)\n types.push('tuple(' + result.join(',') + ')' + suffix);\n }\n else if(!includeTuple) {\n // console.log(\"don't include tuple, but its an array. joining...: \" + result)\n types.push('(' + result.join(',') + ')' + suffix);\n }\n else {\n // console.log(\"its a single type within a tuple: \" + result.types)\n types.push('(' + result + ')');\n }\n } else {\n // console.log(\"its a type and not directly in a tuple: \" + param.type)\n types.push(param.type);\n }\n });\n\n return types;\n};\n\n\n/**\n * Returns a random hex string by the given bytes size\n *\n * @param {Number} size\n * @returns {string}\n */\nvar randomHex = function(size) {\n return '0x' + randombytes(size).toString('hex');\n};\n\n/**\n * Should be called to get ascii from it's hex representation\n *\n * @method hexToAscii\n * @param {String} hex\n * @returns {String} ascii string representation of hex value\n */\nvar hexToAscii = function(hex) {\n if (!utils.isHexStrict(hex))\n throw new Error('The parameter must be a valid HEX string.');\n\n var str = \"\";\n var i = 0, l = hex.length;\n if (hex.substring(0, 2) === '0x') {\n i = 2;\n }\n for (; i < l; i+=2) {\n var code = parseInt(hex.substr(i, 2), 16);\n str += String.fromCharCode(code);\n }\n\n return str;\n};\n\n/**\n * Should be called to get hex representation (prefixed by 0x) of ascii string\n *\n * @method asciiToHex\n * @param {String} str\n * @returns {String} hex representation of input string\n */\nvar asciiToHex = function(str) {\n if(!str)\n return \"0x00\";\n var hex = \"\";\n for(var i = 0; i < str.length; i++) {\n var code = str.charCodeAt(i);\n var n = code.toString(16);\n hex += n.length < 2 ? '0' + n : n;\n }\n\n return \"0x\" + hex;\n};\n\n\n\n/**\n * Returns value of unit in Wei\n *\n * @method getUnitValue\n * @param {String} unit the unit to convert to, default ether\n * @returns {BN} value of the unit (in Wei)\n * @throws error if the unit is not correct:w\n */\nvar getUnitValue = function (unit) {\n unit = unit ? unit.toLowerCase() : 'ether';\n if (!ethjsUnit.unitMap[unit]) {\n throw new Error('This unit \"'+ unit +'\" doesn\\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2));\n }\n return unit;\n};\n\n/**\n * Takes a number of wei and converts it to any other ether unit.\n *\n * Possible units are:\n * SI Short SI Full Effigy Other\n * - kwei femtoether babbage\n * - mwei picoether lovelace\n * - gwei nanoether shannon nano\n * - -- microether szabo micro\n * - -- milliether finney milli\n * - ether -- --\n * - kether -- grand\n * - mether\n * - gether\n * - tether\n *\n * @method fromWei\n * @param {Number|String} number can be a number, number string or a HEX of a decimal\n * @param {String} unit the unit to convert to, default ether\n * @return {String|Object} When given a BN object it returns one as well, otherwise a number\n */\nvar fromWei = function(number, unit) {\n unit = getUnitValue(unit);\n\n if(!utils.isBN(number) && !_.isString(number)) {\n throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.');\n }\n\n return utils.isBN(number) ? ethjsUnit.fromWei(number, unit) : ethjsUnit.fromWei(number, unit).toString(10);\n};\n\n/**\n * Takes a number of a unit and converts it to wei.\n *\n * Possible units are:\n * SI Short SI Full Effigy Other\n * - kwei femtoether babbage\n * - mwei picoether lovelace\n * - gwei nanoether shannon nano\n * - -- microether szabo micro\n * - -- microether szabo micro\n * - -- milliether finney milli\n * - ether -- --\n * - kether -- grand\n * - mether\n * - gether\n * - tether\n *\n * @method toWei\n * @param {Number|String|BN} number can be a number, number string or a HEX of a decimal\n * @param {String} unit the unit to convert from, default ether\n * @return {String|Object} When given a BN object it returns one as well, otherwise a number\n */\nvar toWei = function(number, unit) {\n unit = getUnitValue(unit);\n\n if(!utils.isBN(number) && !_.isString(number)) {\n throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.');\n }\n\n return utils.isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10);\n};\n\n\n\n\n/**\n * Converts to a checksum address\n *\n * @method toChecksumAddress\n * @param {String} address the given HEX address\n * @return {String}\n */\nvar toChecksumAddress = function (address) {\n if (typeof address === 'undefined') return '';\n\n if(!/^(0x)?[0-9a-f]{40}$/i.test(address))\n throw new Error('Given address \"'+ address +'\" is not a valid Ethereum address.');\n\n\n\n address = address.toLowerCase().replace(/^0x/i,'');\n var addressHash = utils.sha3(address).replace(/^0x/i,'');\n var checksumAddress = '0x';\n\n for (var i = 0; i < address.length; i++ ) {\n // If ith character is 9 to f then make it uppercase\n if (parseInt(addressHash[i], 16) > 7) {\n checksumAddress += address[i].toUpperCase();\n } else {\n checksumAddress += address[i];\n }\n }\n return checksumAddress;\n};\n\nmodule.exports = {\n _fireError: _fireError,\n _jsonInterfaceMethodToString: _jsonInterfaceMethodToString,\n _flattenTypes: _flattenTypes,\n // extractDisplayName: extractDisplayName,\n // extractTypeName: extractTypeName,\n randomHex: randomHex,\n _: _,\n BN: utils.BN,\n isBN: utils.isBN,\n isBigNumber: utils.isBigNumber,\n isHex: utils.isHex,\n isHexStrict: utils.isHexStrict,\n sha3: utils.sha3,\n sha3Raw: utils.sha3Raw,\n keccak256: utils.sha3,\n soliditySha3: soliditySha3.soliditySha3,\n soliditySha3Raw: soliditySha3.soliditySha3Raw,\n isAddress: utils.isAddress,\n checkAddressChecksum: utils.checkAddressChecksum,\n toChecksumAddress: toChecksumAddress,\n toHex: utils.toHex,\n toBN: utils.toBN,\n\n bytesToHex: utils.bytesToHex,\n hexToBytes: utils.hexToBytes,\n\n hexToNumberString: utils.hexToNumberString,\n\n hexToNumber: utils.hexToNumber,\n toDecimal: utils.hexToNumber, // alias\n\n numberToHex: utils.numberToHex,\n fromDecimal: utils.numberToHex, // alias\n\n hexToUtf8: utils.hexToUtf8,\n hexToString: utils.hexToUtf8,\n toUtf8: utils.hexToUtf8,\n\n utf8ToHex: utils.utf8ToHex,\n stringToHex: utils.utf8ToHex,\n fromUtf8: utils.utf8ToHex,\n\n hexToAscii: hexToAscii,\n toAscii: hexToAscii,\n asciiToHex: asciiToHex,\n fromAscii: asciiToHex,\n\n unitMap: ethjsUnit.unitMap,\n toWei: toWei,\n fromWei: fromWei,\n\n padLeft: utils.leftPad,\n leftPad: utils.leftPad,\n padRight: utils.rightPad,\n rightPad: utils.rightPad,\n toTwosComplement: utils.toTwosComplement,\n\n    isBloom: utils.isBloom,\n    isUserEthereumAddressInBloom: utils.isUserEthereumAddressInBloom,\n    isContractAddressInBloom: utils.isContractAddressInBloom,\n    isTopic: utils.isTopic,\n    isTopicInBloom: utils.isTopicInBloom,\n    isInBloom: utils.isInBloom\n};\n","module.exports = require('./browser/algorithms.json')\n","'use strict'\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nvar MAX_BYTES = 65536\n\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nvar MAX_UINT32 = 4294967295\n\nfunction oldBrowser () {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11')\n}\n\nvar Buffer = require('safe-buffer').Buffer\nvar crypto = global.crypto || global.msCrypto\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes\n} else {\n module.exports = oldBrowser\n}\n\nfunction randomBytes (size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n\n var bytes = Buffer.allocUnsafe(size)\n\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes)\n })\n }\n\n return bytes\n}\n","\"use strict\";\n\nvar REGISTRY = [\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"resolver\",\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"owner\",\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"label\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"owner\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"setSubnodeOwner\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"ttl\",\n \"type\": \"uint64\"\n }\n ],\n \"name\": \"setTTL\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"ttl\",\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint64\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"resolver\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"setResolver\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"owner\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"setOwner\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"owner\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"Transfer\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": true,\n \"name\": \"label\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"owner\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"NewOwner\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"resolver\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"NewResolver\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"ttl\",\n \"type\": \"uint64\"\n }\n ],\n \"name\": \"NewTTL\",\n \"type\": \"event\"\n }\n];\n\nmodule.exports = REGISTRY;\n","'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar shaCommon = require('./common');\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_5 = utils.sum32_5;\nvar ft_1 = shaCommon.ft_1;\nvar BlockHash = common.BlockHash;\n\nvar sha1_K = [\n 0x5A827999, 0x6ED9EBA1,\n 0x8F1BBCDC, 0xCA62C1D6\n];\n\nfunction SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1();\n\n BlockHash.call(this);\n this.h = [\n 0x67452301, 0xefcdab89, 0x98badcfe,\n 0x10325476, 0xc3d2e1f0 ];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nmodule.exports = SHA1;\n\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n\n for(; i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n\n for (i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n};\n\nSHA1.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nconst utils_1 = require(\"./utils\");\r\n/**\r\n * Returns true if the bloom is a valid bloom\r\n * @param bloom The bloom\r\n */\r\nfunction isBloom(bloom) {\r\n if (typeof bloom !== 'string') {\r\n return false;\r\n }\r\n if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) {\r\n return false;\r\n }\r\n if (/^(0x)?[0-9a-f]{512}$/.test(bloom) ||\r\n /^(0x)?[0-9A-F]{512}$/.test(bloom)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nexports.isBloom = isBloom;\r\n/**\r\n * Returns true if the value is part of the given bloom\r\n * note: false positives are possible.\r\n * @param bloom encoded bloom\r\n * @param value The value\r\n */\r\nfunction isInBloom(bloom, value) {\r\n if (typeof value === 'object' && value.constructor === Uint8Array) {\r\n value = utils_1.bytesToHex(value);\r\n }\r\n const hash = utils_1.keccak256(value).replace('0x', '');\r\n for (let i = 0; i < 12; i += 4) {\r\n // calculate bit position in bloom filter that must be active\r\n const bitpos = ((parseInt(hash.substr(i, 2), 16) << 8) +\r\n parseInt(hash.substr(i + 2, 2), 16)) &\r\n 2047;\r\n // test if bitpos in bloom is active\r\n const code = codePointToInt(bloom.charCodeAt(bloom.length - 1 - Math.floor(bitpos / 4)));\r\n const offset = 1 << bitpos % 4;\r\n if ((code & offset) !== offset) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\nexports.isInBloom = isInBloom;\r\n/**\r\n * Code points to int\r\n * @param codePoint The code point\r\n */\r\nfunction codePointToInt(codePoint) {\r\n if (codePoint >= 48 && codePoint <= 57) {\r\n /* ['0'..'9'] -> [0..9] */\r\n return codePoint - 48;\r\n }\r\n if (codePoint >= 65 && codePoint <= 70) {\r\n /* ['A'..'F'] -> [10..15] */\r\n return codePoint - 55;\r\n }\r\n if (codePoint >= 97 && codePoint <= 102) {\r\n /* ['a'..'f'] -> [10..15] */\r\n return codePoint - 87;\r\n }\r\n throw new Error('invalid bloom');\r\n}\r\n/**\r\n * Returns true if the ethereum users address is part of the given bloom.\r\n * note: false positives are possible.\r\n * @param bloom encoded bloom\r\n * @param address the address to test\r\n */\r\nfunction isUserEthereumAddressInBloom(bloom, ethereumAddress) {\r\n if (!isBloom(bloom)) {\r\n throw new Error('Invalid bloom given');\r\n }\r\n if (!isAddress(ethereumAddress)) {\r\n throw new Error(`Invalid ethereum address given: \"${ethereumAddress}\"`);\r\n }\r\n // you have to pad the ethereum address to 32 bytes\r\n // else the bloom filter does not work\r\n // this is only if your matching the USERS\r\n // ethereum address. Contract address do not need this\r\n // hence why we have 2 methods\r\n // (0x is not in the 2nd parameter of padleft so 64 chars is fine)\r\n const address = utils_1.padLeft(ethereumAddress, 64);\r\n return isInBloom(bloom, address);\r\n}\r\nexports.isUserEthereumAddressInBloom = isUserEthereumAddressInBloom;\r\n/**\r\n * Returns true if the contract address is part of the given bloom.\r\n * note: false positives are possible.\r\n * @param bloom encoded bloom\r\n * @param contractAddress the contract address to test\r\n */\r\nfunction isContractAddressInBloom(bloom, contractAddress) {\r\n if (!isBloom(bloom)) {\r\n throw new Error('Invalid bloom given');\r\n }\r\n if (!isAddress(contractAddress)) {\r\n throw new Error(`Invalid contract address given: \"${contractAddress}\"`);\r\n }\r\n return isInBloom(bloom, contractAddress);\r\n}\r\nexports.isContractAddressInBloom = isContractAddressInBloom;\r\n/**\r\n * Returns true if the topic is part of the given bloom.\r\n * note: false positives are possible.\r\n * @param bloom encoded bloom\r\n * @param topic the topic encoded hex\r\n */\r\nfunction isTopicInBloom(bloom, topic) {\r\n if (!isBloom(bloom)) {\r\n throw new Error('Invalid bloom given');\r\n }\r\n if (!isTopic(topic)) {\r\n throw new Error('Invalid topic');\r\n }\r\n return isInBloom(bloom, topic);\r\n}\r\nexports.isTopicInBloom = isTopicInBloom;\r\n/**\r\n * Checks if its a valid topic\r\n * @param topic encoded hex topic\r\n */\r\nfunction isTopic(topic) {\r\n if (typeof topic !== 'string') {\r\n return false;\r\n }\r\n if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) {\r\n return false;\r\n }\r\n else if (/^(0x)?[0-9a-f]{64}$/.test(topic) ||\r\n /^(0x)?[0-9A-F]{64}$/.test(topic)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nexports.isTopic = isTopic;\r\n/**\r\n * Is valid address\r\n * @param address The address\r\n */\r\nfunction isAddress(address) {\r\n if (typeof address !== 'string') {\r\n return false;\r\n }\r\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\r\n return true;\r\n }\r\n if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nexports.isAddress = isAddress;\r\n","'use strict';\n\nexports.utils = require('./des/utils');\nexports.Cipher = require('./des/cipher');\nexports.DES = require('./des/des');\nexports.CBC = require('./des/cbc');\nexports.EDE = require('./des/ede');\n","/*\n This file is part of web3.js.\n\n web3.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n web3.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with web3.js. If not, see .\n*/\n/**\n * @file formatters.js\n * @author Fabian Vogelsteller \n * @author Marek Kotewicz \n * @date 2017\n */\n\n\"use strict\";\n\nvar _ = require('underscore');\nvar utils = require('web3-utils');\nvar Iban = require('web3-eth-iban');\n\n\n/**\n * Will format the given storage key array values to hex strings.\n *\n * @method inputStorageKeysFormatter\n *\n * @param {Array} keys\n *\n * @returns {Array}\n */\nvar inputStorageKeysFormatter = function (keys) {\n return keys.map(utils.numberToHex);\n};\n\n/**\n * Will format the given proof response from the node.\n *\n * @method outputProofFormatter\n *\n * @param {object} proof\n *\n * @returns {object}\n */\nvar outputProofFormatter = function (proof) {\n proof.address = utils.toChecksumAddress(proof.address);\n proof.nonce = utils.hexToNumberString(proof.nonce);\n proof.balance = utils.hexToNumberString(proof.balance);\n\n return proof;\n};\n\n/**\n * Should the format output to a big number\n *\n * @method outputBigNumberFormatter\n *\n * @param {String|Number|BigNumber|BN} number\n *\n * @returns {BN} object\n */\nvar outputBigNumberFormatter = function (number) {\n return utils.toBN(number).toString(10);\n};\n\n/**\n * Returns true if the given blockNumber is 'latest', 'pending', or 'earliest.\n *\n * @method isPredefinedBlockNumber\n *\n * @param {String} blockNumber\n *\n * @returns {Boolean}\n */\nvar isPredefinedBlockNumber = function (blockNumber) {\n return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest';\n};\n\n/**\n * Returns the given block number as hex string or does return the defaultBlock property of the current module\n *\n * @method inputDefaultBlockNumberFormatter\n *\n * @param {String|Number|BN|BigNumber} blockNumber\n *\n * @returns {String}\n */\nvar inputDefaultBlockNumberFormatter = function (blockNumber) {\n if (this && (blockNumber === undefined || blockNumber === null)) {\n return inputBlockNumberFormatter(this.defaultBlock);\n }\n\n return inputBlockNumberFormatter(blockNumber);\n};\n\n/**\n * Returns the given block number as hex string or the predefined block number 'latest', 'pending', 'earliest', 'genesis'\n *\n * @param {String|Number|BN|BigNumber} blockNumber\n *\n * @returns {String}\n */\nvar inputBlockNumberFormatter = function (blockNumber) {\n if (blockNumber === undefined) {\n return undefined;\n }\n\n if (isPredefinedBlockNumber(blockNumber)) {\n return blockNumber;\n }\n\n if (blockNumber === 'genesis') {\n return '0x0';\n }\n\n return (utils.isHexStrict(blockNumber)) ? ((_.isString(blockNumber)) ? blockNumber.toLowerCase() : blockNumber) : utils.numberToHex(blockNumber);\n};\n\n/**\n * Formats the input of a transaction and converts all values to HEX\n *\n * @method _txInputFormatter\n * @param {Object} transaction options\n * @returns object\n */\nvar _txInputFormatter = function (options) {\n\n if (options.to) { // it might be contract creation\n options.to = inputAddressFormatter(options.to);\n }\n\n if (options.data && options.input) {\n throw new Error('You can\\'t have \"data\" and \"input\" as properties of transactions at the same time, please use either \"data\" or \"input\" instead.');\n }\n\n if (!options.data && options.input) {\n options.data = options.input;\n delete options.input;\n }\n\n if (options.data && !utils.isHex(options.data)) {\n throw new Error('The data field must be HEX encoded data.');\n }\n\n // allow both\n if (options.gas || options.gasLimit) {\n options.gas = options.gas || options.gasLimit;\n }\n\n ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {\n return options[key] !== undefined;\n }).forEach(function (key) {\n options[key] = utils.numberToHex(options[key]);\n });\n\n return options;\n};\n\n/**\n * Formats the input of a transaction and converts all values to HEX\n *\n * @method inputCallFormatter\n * @param {Object} transaction options\n * @returns object\n */\nvar inputCallFormatter = function (options) {\n\n options = _txInputFormatter(options);\n\n var from = options.from || (this ? this.defaultAccount : null);\n\n if (from) {\n options.from = inputAddressFormatter(from);\n }\n\n\n return options;\n};\n\n/**\n * Formats the input of a transaction and converts all values to HEX\n *\n * @method inputTransactionFormatter\n * @param {Object} options\n * @returns object\n */\nvar inputTransactionFormatter = function (options) {\n\n options = _txInputFormatter(options);\n\n // check from, only if not number, or object\n if (!_.isNumber(options.from) && !_.isObject(options.from)) {\n options.from = options.from || (this ? this.defaultAccount : null);\n\n if (!options.from && !_.isNumber(options.from)) {\n throw new Error('The send transactions \"from\" field must be defined!');\n }\n\n options.from = inputAddressFormatter(options.from);\n }\n\n return options;\n};\n\n/**\n * Hex encodes the data passed to eth_sign and personal_sign\n *\n * @method inputSignFormatter\n * @param {String} data\n * @returns {String}\n */\nvar inputSignFormatter = function (data) {\n return (utils.isHexStrict(data)) ? data : utils.utf8ToHex(data);\n};\n\n/**\n * Formats the output of a transaction to its proper values\n *\n * @method outputTransactionFormatter\n * @param {Object} tx\n * @returns {Object}\n */\nvar outputTransactionFormatter = function (tx) {\n if (tx.blockNumber !== null)\n tx.blockNumber = utils.hexToNumber(tx.blockNumber);\n if (tx.transactionIndex !== null)\n tx.transactionIndex = utils.hexToNumber(tx.transactionIndex);\n tx.nonce = utils.hexToNumber(tx.nonce);\n tx.gas = utils.hexToNumber(tx.gas);\n tx.gasPrice = outputBigNumberFormatter(tx.gasPrice);\n tx.value = outputBigNumberFormatter(tx.value);\n\n if (tx.to && utils.isAddress(tx.to)) { // tx.to could be `0x0` or `null` while contract creation\n tx.to = utils.toChecksumAddress(tx.to);\n } else {\n tx.to = null; // set to `null` if invalid address\n }\n\n if (tx.from) {\n tx.from = utils.toChecksumAddress(tx.from);\n }\n\n return tx;\n};\n\n/**\n * Formats the output of a transaction receipt to its proper values\n *\n * @method outputTransactionReceiptFormatter\n * @param {Object} receipt\n * @returns {Object}\n */\nvar outputTransactionReceiptFormatter = function (receipt) {\n if (typeof receipt !== 'object') {\n throw new Error('Received receipt is invalid: ' + receipt);\n }\n\n if (receipt.blockNumber !== null)\n receipt.blockNumber = utils.hexToNumber(receipt.blockNumber);\n if (receipt.transactionIndex !== null)\n receipt.transactionIndex = utils.hexToNumber(receipt.transactionIndex);\n receipt.cumulativeGasUsed = utils.hexToNumber(receipt.cumulativeGasUsed);\n receipt.gasUsed = utils.hexToNumber(receipt.gasUsed);\n\n if (_.isArray(receipt.logs)) {\n receipt.logs = receipt.logs.map(outputLogFormatter);\n }\n\n if (receipt.contractAddress) {\n receipt.contractAddress = utils.toChecksumAddress(receipt.contractAddress);\n }\n\n if (typeof receipt.status !== 'undefined' && receipt.status !== null) {\n receipt.status = Boolean(parseInt(receipt.status));\n }\n\n return receipt;\n};\n\n/**\n * Formats the output of a block to its proper values\n *\n * @method outputBlockFormatter\n * @param {Object} block\n * @returns {Object}\n */\nvar outputBlockFormatter = function (block) {\n\n // transform to number\n block.gasLimit = utils.hexToNumber(block.gasLimit);\n block.gasUsed = utils.hexToNumber(block.gasUsed);\n block.size = utils.hexToNumber(block.size);\n block.timestamp = utils.hexToNumber(block.timestamp);\n if (block.number !== null)\n block.number = utils.hexToNumber(block.number);\n\n if (block.difficulty)\n block.difficulty = outputBigNumberFormatter(block.difficulty);\n if (block.totalDifficulty)\n block.totalDifficulty = outputBigNumberFormatter(block.totalDifficulty);\n\n if (_.isArray(block.transactions)) {\n block.transactions.forEach(function (item) {\n if (!_.isString(item))\n return outputTransactionFormatter(item);\n });\n }\n\n if (block.miner)\n block.miner = utils.toChecksumAddress(block.miner);\n\n return block;\n};\n\n/**\n * Formats the input of a log\n *\n * @method inputLogFormatter\n * @param {Object} log object\n * @returns {Object} log\n */\nvar inputLogFormatter = function (options) {\n var toTopic = function (value) {\n\n if (value === null || typeof value === 'undefined')\n return null;\n\n value = String(value);\n\n if (value.indexOf('0x') === 0)\n return value;\n else\n return utils.fromUtf8(value);\n };\n\n if (options.fromBlock || options.fromBlock === 0)\n options.fromBlock = inputBlockNumberFormatter(options.fromBlock);\n\n if (options.toBlock || options.toBlock === 0)\n options.toBlock = inputBlockNumberFormatter(options.toBlock);\n\n\n // make sure topics, get converted to hex\n options.topics = options.topics || [];\n options.topics = options.topics.map(function (topic) {\n return (_.isArray(topic)) ? topic.map(toTopic) : toTopic(topic);\n });\n\n toTopic = null;\n\n if (options.address) {\n options.address = (_.isArray(options.address)) ? options.address.map(function (addr) {\n return inputAddressFormatter(addr);\n }) : inputAddressFormatter(options.address);\n }\n\n return options;\n};\n\n/**\n * Formats the output of a log\n *\n * @method outputLogFormatter\n * @param {Object} log object\n * @returns {Object} log\n */\nvar outputLogFormatter = function (log) {\n\n // generate a custom log id\n if (typeof log.blockHash === 'string' &&\n typeof log.transactionHash === 'string' &&\n typeof log.logIndex === 'string') {\n var shaId = utils.sha3(log.blockHash.replace('0x', '') + log.transactionHash.replace('0x', '') + log.logIndex.replace('0x', ''));\n log.id = 'log_' + shaId.replace('0x', '').substr(0, 8);\n } else if (!log.id) {\n log.id = null;\n }\n\n if (log.blockNumber !== null)\n log.blockNumber = utils.hexToNumber(log.blockNumber);\n if (log.transactionIndex !== null)\n log.transactionIndex = utils.hexToNumber(log.transactionIndex);\n if (log.logIndex !== null)\n log.logIndex = utils.hexToNumber(log.logIndex);\n\n if (log.address) {\n log.address = utils.toChecksumAddress(log.address);\n }\n\n return log;\n};\n\n/**\n * Formats the input of a whisper post and converts all values to HEX\n *\n * @method inputPostFormatter\n * @param {Object} transaction object\n * @returns {Object}\n */\nvar inputPostFormatter = function (post) {\n\n // post.payload = utils.toHex(post.payload);\n\n if (post.ttl)\n post.ttl = utils.numberToHex(post.ttl);\n if (post.workToProve)\n post.workToProve = utils.numberToHex(post.workToProve);\n if (post.priority)\n post.priority = utils.numberToHex(post.priority);\n\n // fallback\n if (!_.isArray(post.topics)) {\n post.topics = post.topics ? [post.topics] : [];\n }\n\n // format the following options\n post.topics = post.topics.map(function (topic) {\n // convert only if not hex\n return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic);\n });\n\n return post;\n};\n\n/**\n * Formats the output of a received post message\n *\n * @method outputPostFormatter\n * @param {Object}\n * @returns {Object}\n */\nvar outputPostFormatter = function (post) {\n\n post.expiry = utils.hexToNumber(post.expiry);\n post.sent = utils.hexToNumber(post.sent);\n post.ttl = utils.hexToNumber(post.ttl);\n post.workProved = utils.hexToNumber(post.workProved);\n // post.payloadRaw = post.payload;\n // post.payload = utils.hexToAscii(post.payload);\n\n // if (utils.isJson(post.payload)) {\n // post.payload = JSON.parse(post.payload);\n // }\n\n // format the following options\n if (!post.topics) {\n post.topics = [];\n }\n post.topics = post.topics.map(function (topic) {\n return utils.toUtf8(topic);\n });\n\n return post;\n};\n\nvar inputAddressFormatter = function (address) {\n var iban = new Iban(address);\n if (iban.isValid() && iban.isDirect()) {\n return iban.toAddress().toLowerCase();\n } else if (utils.isAddress(address)) {\n return '0x' + address.toLowerCase().replace('0x', '');\n }\n throw new Error('Provided address \"' + address + '\" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can\\'t be converted.');\n};\n\n\nvar outputSyncingFormatter = function (result) {\n\n result.startingBlock = utils.hexToNumber(result.startingBlock);\n result.currentBlock = utils.hexToNumber(result.currentBlock);\n result.highestBlock = utils.hexToNumber(result.highestBlock);\n if (result.knownStates) {\n result.knownStates = utils.hexToNumber(result.knownStates);\n result.pulledStates = utils.hexToNumber(result.pulledStates);\n }\n\n return result;\n};\n\nmodule.exports = {\n inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,\n inputBlockNumberFormatter: inputBlockNumberFormatter,\n inputCallFormatter: inputCallFormatter,\n inputTransactionFormatter: inputTransactionFormatter,\n inputAddressFormatter: inputAddressFormatter,\n inputPostFormatter: inputPostFormatter,\n inputLogFormatter: inputLogFormatter,\n inputSignFormatter: inputSignFormatter,\n inputStorageKeysFormatter: inputStorageKeysFormatter,\n outputProofFormatter: outputProofFormatter,\n outputBigNumberFormatter: outputBigNumberFormatter,\n outputTransactionFormatter: outputTransactionFormatter,\n outputTransactionReceiptFormatter: outputTransactionReceiptFormatter,\n outputBlockFormatter: outputBlockFormatter,\n outputLogFormatter: outputLogFormatter,\n outputPostFormatter: outputPostFormatter,\n outputSyncingFormatter: outputSyncingFormatter\n};\n\n","/*\n This file is part of web3.js.\n\n web3.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n web3.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with web3.js. If not, see .\n*/\n/**\n * @file index.js\n * @author Fabian Vogelsteller \n * @date 2017\n */\n\n\"use strict\";\n\n\nvar _ = require('underscore');\nvar errors = require('web3-core-helpers').errors;\nvar Jsonrpc = require('./jsonrpc.js');\nvar BatchManager = require('./batch.js');\nvar givenProvider = require('./givenProvider.js');\n\n\n\n /**\n * It's responsible for passing messages to providers\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 1 second\n * Singleton\n */\nvar RequestManager = function RequestManager(provider) {\n this.provider = null;\n this.providers = RequestManager.providers;\n\n this.setProvider(provider);\n this.subscriptions = {};\n};\n\n\n\nRequestManager.givenProvider = givenProvider;\n\nRequestManager.providers = {\n WebsocketProvider: require('web3-providers-ws'),\n HttpProvider: require('web3-providers-http'),\n IpcProvider: require('web3-providers-ipc')\n};\n\n\n\n/**\n * Should be used to set provider of request manager\n *\n * @method setProvider\n * @param {Object} p\n */\nRequestManager.prototype.setProvider = function (p, net) {\n var _this = this;\n\n // autodetect provider\n if(p && typeof p === 'string' && this.providers) {\n\n // HTTP\n if(/^http(s)?:\\/\\//i.test(p)) {\n p = new this.providers.HttpProvider(p);\n\n // WS\n } else if(/^ws(s)?:\\/\\//i.test(p)) {\n p = new this.providers.WebsocketProvider(p);\n\n // IPC\n } else if(p && typeof net === 'object' && typeof net.connect === 'function') {\n p = new this.providers.IpcProvider(p, net);\n\n } else if(p) {\n throw new Error('Can\\'t autodetect provider for \"'+ p +'\"');\n }\n }\n\n // reset the old one before changing, if still connected\n if(this.provider && this.provider.connected)\n this.clearSubscriptions();\n\n\n this.provider = p || null;\n\n // listen to incoming notifications\n if(this.provider && this.provider.on) {\n this.provider.on('data', function requestManagerNotification(result, deprecatedResult){\n result = result || deprecatedResult; // this is for possible old providers, which may had the error first handler\n\n // check for result.method, to prevent old providers errors to pass as result\n if(result.method && _this.subscriptions[result.params.subscription] && _this.subscriptions[result.params.subscription].callback) {\n _this.subscriptions[result.params.subscription].callback(null, result.params.result);\n }\n });\n // TODO add error, end, timeout, connect??\n // this.provider.on('error', function requestManagerNotification(result){\n // Object.keys(_this.subscriptions).forEach(function(id){\n // if(_this.subscriptions[id].callback)\n // _this.subscriptions[id].callback(err);\n // });\n // }\n }\n};\n\n\n/**\n * Should be used to asynchronously send request\n *\n * @method sendAsync\n * @param {Object} data\n * @param {Function} callback\n */\nRequestManager.prototype.send = function (data, callback) {\n callback = callback || function(){};\n\n if (!this.provider) {\n return callback(errors.InvalidProvider());\n }\n\n var payload = Jsonrpc.toPayload(data.method, data.params);\n this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](payload, function (err, result) {\n if(result && result.id && payload.id !== result.id) return callback(new Error('Wrong response id \"'+ result.id +'\" (expected: \"'+ payload.id +'\") in '+ JSON.stringify(payload)));\n\n if (err) {\n return callback(err);\n }\n\n if (result && result.error) {\n return callback(errors.ErrorResponse(result));\n }\n\n if (!Jsonrpc.isValidResponse(result)) {\n return callback(errors.InvalidResponse(result));\n }\n\n callback(null, result.result);\n });\n};\n\n/**\n * Should be called to asynchronously send batch request\n *\n * @method sendBatch\n * @param {Array} batch data\n * @param {Function} callback\n */\nRequestManager.prototype.sendBatch = function (data, callback) {\n if (!this.provider) {\n return callback(errors.InvalidProvider());\n }\n\n var payload = Jsonrpc.toBatchPayload(data);\n this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](payload, function (err, results) {\n if (err) {\n return callback(err);\n }\n\n if (!_.isArray(results)) {\n return callback(errors.InvalidResponse(results));\n }\n\n callback(null, results);\n });\n};\n\n\n/**\n * Waits for notifications\n *\n * @method addSubscription\n * @param {String} id the subscription id\n * @param {String} name the subscription name\n * @param {String} type the subscription namespace (eth, personal, etc)\n * @param {Function} callback the callback to call for incoming notifications\n */\nRequestManager.prototype.addSubscription = function (id, name, type, callback) {\n if(this.provider.on) {\n this.subscriptions[id] = {\n callback: callback,\n type: type,\n name: name\n };\n\n } else {\n throw new Error('The provider doesn\\'t support subscriptions: '+ this.provider.constructor.name);\n }\n};\n\n/**\n * Waits for notifications\n *\n * @method removeSubscription\n * @param {String} id the subscription id\n * @param {Function} callback fired once the subscription is removed\n */\nRequestManager.prototype.removeSubscription = function (id, callback) {\n var _this = this;\n\n if(this.subscriptions[id]) {\n\n this.send({\n method: this.subscriptions[id].type + '_unsubscribe',\n params: [id]\n }, callback);\n\n // remove subscription\n delete _this.subscriptions[id];\n }\n};\n\n/**\n * Should be called to reset the subscriptions\n *\n * @method reset\n */\nRequestManager.prototype.clearSubscriptions = function (keepIsSyncing) {\n var _this = this;\n\n\n if (this.subscriptions) {\n // uninstall all subscriptions\n Object.keys(this.subscriptions).forEach(function(id){\n if(!keepIsSyncing || _this.subscriptions[id].name !== 'syncing')\n _this.removeSubscription(id);\n });\n }\n\n\n // reset notification callbacks etc.\n if(this.provider.reset)\n this.provider.reset();\n};\n\nmodule.exports = {\n Manager: RequestManager,\n BatchManager: BatchManager\n};\n","// Underscore.js 1.9.1\n// http://underscorejs.org\n// (c) 2009-2018 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// Underscore may be freely distributed under the MIT license.\n\n(function() {\n\n // Baseline setup\n // --------------\n\n // Establish the root object, `window` (`self`) in the browser, `global`\n // on the server, or `this` in some virtual machines. We use `self`\n // instead of `window` for `WebWorker` support.\n var root = typeof self == 'object' && self.self === self && self ||\n typeof global == 'object' && global.global === global && global ||\n this ||\n {};\n\n // Save the previous value of the `_` variable.\n var previousUnderscore = root._;\n\n // Save bytes in the minified (but not gzipped) version:\n var ArrayProto = Array.prototype, ObjProto = Object.prototype;\n var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;\n\n // Create quick reference variables for speed access to core prototypes.\n var push = ArrayProto.push,\n slice = ArrayProto.slice,\n toString = ObjProto.toString,\n hasOwnProperty = ObjProto.hasOwnProperty;\n\n // All **ECMAScript 5** native function implementations that we hope to use\n // are declared here.\n var nativeIsArray = Array.isArray,\n nativeKeys = Object.keys,\n nativeCreate = Object.create;\n\n // Naked function reference for surrogate-prototype-swapping.\n var Ctor = function(){};\n\n // Create a safe reference to the Underscore object for use below.\n var _ = function(obj) {\n if (obj instanceof _) return obj;\n if (!(this instanceof _)) return new _(obj);\n this._wrapped = obj;\n };\n\n // Export the Underscore object for **Node.js**, with\n // backwards-compatibility for their old module API. If we're in\n // the browser, add `_` as a global object.\n // (`nodeType` is checked to ensure that `module`\n // and `exports` are not HTML elements.)\n if (typeof exports != 'undefined' && !exports.nodeType) {\n if (typeof module != 'undefined' && !module.nodeType && module.exports) {\n exports = module.exports = _;\n }\n exports._ = _;\n } else {\n root._ = _;\n }\n\n // Current version.\n _.VERSION = '1.9.1';\n\n // Internal function that returns an efficient (for current engines) version\n // of the passed-in callback, to be repeatedly applied in other Underscore\n // functions.\n var optimizeCb = function(func, context, argCount) {\n if (context === void 0) return func;\n switch (argCount == null ? 3 : argCount) {\n case 1: return function(value) {\n return func.call(context, value);\n };\n // The 2-argument case is omitted because we’re not using it.\n case 3: return function(value, index, collection) {\n return func.call(context, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(context, accumulator, value, index, collection);\n };\n }\n return function() {\n return func.apply(context, arguments);\n };\n };\n\n var builtinIteratee;\n\n // An internal function to generate callbacks that can be applied to each\n // element in a collection, returning the desired result — either `identity`,\n // an arbitrary callback, a property matcher, or a property accessor.\n var cb = function(value, context, argCount) {\n if (_.iteratee !== builtinIteratee) return _.iteratee(value, context);\n if (value == null) return _.identity;\n if (_.isFunction(value)) return optimizeCb(value, context, argCount);\n if (_.isObject(value) && !_.isArray(value)) return _.matcher(value);\n return _.property(value);\n };\n\n // External wrapper for our callback generator. Users may customize\n // `_.iteratee` if they want additional predicate/iteratee shorthand styles.\n // This abstraction hides the internal-only argCount argument.\n _.iteratee = builtinIteratee = function(value, context) {\n return cb(value, context, Infinity);\n };\n\n // Some functions take a variable number of arguments, or a few expected\n // arguments at the beginning and then a variable number of values to operate\n // on. This helper accumulates all remaining arguments past the function’s\n // argument length (or an explicit `startIndex`), into an array that becomes\n // the last argument. Similar to ES6’s \"rest parameter\".\n var restArguments = function(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0),\n rest = Array(length),\n index = 0;\n for (; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n case 2: return func.call(this, arguments[0], arguments[1], rest);\n }\n var args = Array(startIndex + 1);\n for (index = 0; index < startIndex; index++) {\n args[index] = arguments[index];\n }\n args[startIndex] = rest;\n return func.apply(this, args);\n };\n };\n\n // An internal function for creating a new object that inherits from another.\n var baseCreate = function(prototype) {\n if (!_.isObject(prototype)) return {};\n if (nativeCreate) return nativeCreate(prototype);\n Ctor.prototype = prototype;\n var result = new Ctor;\n Ctor.prototype = null;\n return result;\n };\n\n var shallowProperty = function(key) {\n return function(obj) {\n return obj == null ? void 0 : obj[key];\n };\n };\n\n var has = function(obj, path) {\n return obj != null && hasOwnProperty.call(obj, path);\n }\n\n var deepGet = function(obj, path) {\n var length = path.length;\n for (var i = 0; i < length; i++) {\n if (obj == null) return void 0;\n obj = obj[path[i]];\n }\n return length ? obj : void 0;\n };\n\n // Helper for collection methods to determine whether a collection\n // should be iterated as an array or as an object.\n // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength\n // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094\n var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;\n var getLength = shallowProperty('length');\n var isArrayLike = function(collection) {\n var length = getLength(collection);\n return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;\n };\n\n // Collection Functions\n // --------------------\n\n // The cornerstone, an `each` implementation, aka `forEach`.\n // Handles raw objects in addition to array-likes. Treats all\n // sparse array-likes as if they were dense.\n _.each = _.forEach = function(obj, iteratee, context) {\n iteratee = optimizeCb(iteratee, context);\n var i, length;\n if (isArrayLike(obj)) {\n for (i = 0, length = obj.length; i < length; i++) {\n iteratee(obj[i], i, obj);\n }\n } else {\n var keys = _.keys(obj);\n for (i = 0, length = keys.length; i < length; i++) {\n iteratee(obj[keys[i]], keys[i], obj);\n }\n }\n return obj;\n };\n\n // Return the results of applying the iteratee to each element.\n _.map = _.collect = function(obj, iteratee, context) {\n iteratee = cb(iteratee, context);\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length,\n results = Array(length);\n for (var index = 0; index < length; index++) {\n var currentKey = keys ? keys[index] : index;\n results[index] = iteratee(obj[currentKey], currentKey, obj);\n }\n return results;\n };\n\n // Create a reducing function iterating left or right.\n var createReduce = function(dir) {\n // Wrap code that reassigns argument variables in a separate function than\n // the one that accesses `arguments.length` to avoid a perf hit. (#1991)\n var reducer = function(obj, iteratee, memo, initial) {\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length,\n index = dir > 0 ? 0 : length - 1;\n if (!initial) {\n memo = obj[keys ? keys[index] : index];\n index += dir;\n }\n for (; index >= 0 && index < length; index += dir) {\n var currentKey = keys ? keys[index] : index;\n memo = iteratee(memo, obj[currentKey], currentKey, obj);\n }\n return memo;\n };\n\n return function(obj, iteratee, memo, context) {\n var initial = arguments.length >= 3;\n return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial);\n };\n };\n\n // **Reduce** builds up a single result from a list of values, aka `inject`,\n // or `foldl`.\n _.reduce = _.foldl = _.inject = createReduce(1);\n\n // The right-associative version of reduce, also known as `foldr`.\n _.reduceRight = _.foldr = createReduce(-1);\n\n // Return the first value which passes a truth test. Aliased as `detect`.\n _.find = _.detect = function(obj, predicate, context) {\n var keyFinder = isArrayLike(obj) ? _.findIndex : _.findKey;\n var key = keyFinder(obj, predicate, context);\n if (key !== void 0 && key !== -1) return obj[key];\n };\n\n // Return all the elements that pass a truth test.\n // Aliased as `select`.\n _.filter = _.select = function(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n _.each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n };\n\n // Return all the elements for which a truth test fails.\n _.reject = function(obj, predicate, context) {\n return _.filter(obj, _.negate(cb(predicate)), context);\n };\n\n // Determine whether all of the elements match a truth test.\n // Aliased as `all`.\n _.every = _.all = function(obj, predicate, context) {\n predicate = cb(predicate, context);\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length;\n for (var index = 0; index < length; index++) {\n var currentKey = keys ? keys[index] : index;\n if (!predicate(obj[currentKey], currentKey, obj)) return false;\n }\n return true;\n };\n\n // Determine if at least one element in the object matches a truth test.\n // Aliased as `any`.\n _.some = _.any = function(obj, predicate, context) {\n predicate = cb(predicate, context);\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length;\n for (var index = 0; index < length; index++) {\n var currentKey = keys ? keys[index] : index;\n if (predicate(obj[currentKey], currentKey, obj)) return true;\n }\n return false;\n };\n\n // Determine if the array or object contains a given item (using `===`).\n // Aliased as `includes` and `include`.\n _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {\n if (!isArrayLike(obj)) obj = _.values(obj);\n if (typeof fromIndex != 'number' || guard) fromIndex = 0;\n return _.indexOf(obj, item, fromIndex) >= 0;\n };\n\n // Invoke a method (with arguments) on every item in a collection.\n _.invoke = restArguments(function(obj, path, args) {\n var contextPath, func;\n if (_.isFunction(path)) {\n func = path;\n } else if (_.isArray(path)) {\n contextPath = path.slice(0, -1);\n path = path[path.length - 1];\n }\n return _.map(obj, function(context) {\n var method = func;\n if (!method) {\n if (contextPath && contextPath.length) {\n context = deepGet(context, contextPath);\n }\n if (context == null) return void 0;\n method = context[path];\n }\n return method == null ? method : method.apply(context, args);\n });\n });\n\n // Convenience version of a common use case of `map`: fetching a property.\n _.pluck = function(obj, key) {\n return _.map(obj, _.property(key));\n };\n\n // Convenience version of a common use case of `filter`: selecting only objects\n // containing specific `key:value` pairs.\n _.where = function(obj, attrs) {\n return _.filter(obj, _.matcher(attrs));\n };\n\n // Convenience version of a common use case of `find`: getting the first object\n // containing specific `key:value` pairs.\n _.findWhere = function(obj, attrs) {\n return _.find(obj, _.matcher(attrs));\n };\n\n // Return the maximum element (or element-based computation).\n _.max = function(obj, iteratee, context) {\n var result = -Infinity, lastComputed = -Infinity,\n value, computed;\n if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {\n obj = isArrayLike(obj) ? obj : _.values(obj);\n for (var i = 0, length = obj.length; i < length; i++) {\n value = obj[i];\n if (value != null && value > result) {\n result = value;\n }\n }\n } else {\n iteratee = cb(iteratee, context);\n _.each(obj, function(v, index, list) {\n computed = iteratee(v, index, list);\n if (computed > lastComputed || computed === -Infinity && result === -Infinity) {\n result = v;\n lastComputed = computed;\n }\n });\n }\n return result;\n };\n\n // Return the minimum element (or element-based computation).\n _.min = function(obj, iteratee, context) {\n var result = Infinity, lastComputed = Infinity,\n value, computed;\n if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {\n obj = isArrayLike(obj) ? obj : _.values(obj);\n for (var i = 0, length = obj.length; i < length; i++) {\n value = obj[i];\n if (value != null && value < result) {\n result = value;\n }\n }\n } else {\n iteratee = cb(iteratee, context);\n _.each(obj, function(v, index, list) {\n computed = iteratee(v, index, list);\n if (computed < lastComputed || computed === Infinity && result === Infinity) {\n result = v;\n lastComputed = computed;\n }\n });\n }\n return result;\n };\n\n // Shuffle a collection.\n _.shuffle = function(obj) {\n return _.sample(obj, Infinity);\n };\n\n // Sample **n** random values from a collection using the modern version of the\n // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).\n // If **n** is not specified, returns a single random element.\n // The internal `guard` argument allows it to work with `map`.\n _.sample = function(obj, n, guard) {\n if (n == null || guard) {\n if (!isArrayLike(obj)) obj = _.values(obj);\n return obj[_.random(obj.length - 1)];\n }\n var sample = isArrayLike(obj) ? _.clone(obj) : _.values(obj);\n var length = getLength(sample);\n n = Math.max(Math.min(n, length), 0);\n var last = length - 1;\n for (var index = 0; index < n; index++) {\n var rand = _.random(index, last);\n var temp = sample[index];\n sample[index] = sample[rand];\n sample[rand] = temp;\n }\n return sample.slice(0, n);\n };\n\n // Sort the object's values by a criterion produced by an iteratee.\n _.sortBy = function(obj, iteratee, context) {\n var index = 0;\n iteratee = cb(iteratee, context);\n return _.pluck(_.map(obj, function(value, key, list) {\n return {\n value: value,\n index: index++,\n criteria: iteratee(value, key, list)\n };\n }).sort(function(left, right) {\n var a = left.criteria;\n var b = right.criteria;\n if (a !== b) {\n if (a > b || a === void 0) return 1;\n if (a < b || b === void 0) return -1;\n }\n return left.index - right.index;\n }), 'value');\n };\n\n // An internal function used for aggregate \"group by\" operations.\n var group = function(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = cb(iteratee, context);\n _.each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n };\n\n // Groups the object's values by a criterion. Pass either a string attribute\n // to group by, or a function that returns the criterion.\n _.groupBy = group(function(result, value, key) {\n if (has(result, key)) result[key].push(value); else result[key] = [value];\n });\n\n // Indexes the object's values by a criterion, similar to `groupBy`, but for\n // when you know that your index values will be unique.\n _.indexBy = group(function(result, value, key) {\n result[key] = value;\n });\n\n // Counts instances of an object that group by a certain criterion. Pass\n // either a string attribute to count by, or a function that returns the\n // criterion.\n _.countBy = group(function(result, value, key) {\n if (has(result, key)) result[key]++; else result[key] = 1;\n });\n\n var reStrSymbol = /[^\\ud800-\\udfff]|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff]/g;\n // Safely create a real, live array from anything iterable.\n _.toArray = function(obj) {\n if (!obj) return [];\n if (_.isArray(obj)) return slice.call(obj);\n if (_.isString(obj)) {\n // Keep surrogate pair characters together\n return obj.match(reStrSymbol);\n }\n if (isArrayLike(obj)) return _.map(obj, _.identity);\n return _.values(obj);\n };\n\n // Return the number of elements in an object.\n _.size = function(obj) {\n if (obj == null) return 0;\n return isArrayLike(obj) ? obj.length : _.keys(obj).length;\n };\n\n // Split a collection into two arrays: one whose elements all satisfy the given\n // predicate, and one whose elements all do not satisfy the predicate.\n _.partition = group(function(result, value, pass) {\n result[pass ? 0 : 1].push(value);\n }, true);\n\n // Array Functions\n // ---------------\n\n // Get the first element of an array. Passing **n** will return the first N\n // values in the array. Aliased as `head` and `take`. The **guard** check\n // allows it to work with `_.map`.\n _.first = _.head = _.take = function(array, n, guard) {\n if (array == null || array.length < 1) return n == null ? void 0 : [];\n if (n == null || guard) return array[0];\n return _.initial(array, array.length - n);\n };\n\n // Returns everything but the last entry of the array. Especially useful on\n // the arguments object. Passing **n** will return all the values in\n // the array, excluding the last N.\n _.initial = function(array, n, guard) {\n return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));\n };\n\n // Get the last element of an array. Passing **n** will return the last N\n // values in the array.\n _.last = function(array, n, guard) {\n if (array == null || array.length < 1) return n == null ? void 0 : [];\n if (n == null || guard) return array[array.length - 1];\n return _.rest(array, Math.max(0, array.length - n));\n };\n\n // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.\n // Especially useful on the arguments object. Passing an **n** will return\n // the rest N values in the array.\n _.rest = _.tail = _.drop = function(array, n, guard) {\n return slice.call(array, n == null || guard ? 1 : n);\n };\n\n // Trim out all falsy values from an array.\n _.compact = function(array) {\n return _.filter(array, Boolean);\n };\n\n // Internal implementation of a recursive `flatten` function.\n var flatten = function(input, shallow, strict, output) {\n output = output || [];\n var idx = output.length;\n for (var i = 0, length = getLength(input); i < length; i++) {\n var value = input[i];\n if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {\n // Flatten current level of array or arguments object.\n if (shallow) {\n var j = 0, len = value.length;\n while (j < len) output[idx++] = value[j++];\n } else {\n flatten(value, shallow, strict, output);\n idx = output.length;\n }\n } else if (!strict) {\n output[idx++] = value;\n }\n }\n return output;\n };\n\n // Flatten out an array, either recursively (by default), or just one level.\n _.flatten = function(array, shallow) {\n return flatten(array, shallow, false);\n };\n\n // Return a version of the array that does not contain the specified value(s).\n _.without = restArguments(function(array, otherArrays) {\n return _.difference(array, otherArrays);\n });\n\n // Produce a duplicate-free version of the array. If the array has already\n // been sorted, you have the option of using a faster algorithm.\n // The faster algorithm will not work with an iteratee if the iteratee\n // is not a one-to-one function, so providing an iteratee will disable\n // the faster algorithm.\n // Aliased as `unique`.\n _.uniq = _.unique = function(array, isSorted, iteratee, context) {\n if (!_.isBoolean(isSorted)) {\n context = iteratee;\n iteratee = isSorted;\n isSorted = false;\n }\n if (iteratee != null) iteratee = cb(iteratee, context);\n var result = [];\n var seen = [];\n for (var i = 0, length = getLength(array); i < length; i++) {\n var value = array[i],\n computed = iteratee ? iteratee(value, i, array) : value;\n if (isSorted && !iteratee) {\n if (!i || seen !== computed) result.push(value);\n seen = computed;\n } else if (iteratee) {\n if (!_.contains(seen, computed)) {\n seen.push(computed);\n result.push(value);\n }\n } else if (!_.contains(result, value)) {\n result.push(value);\n }\n }\n return result;\n };\n\n // Produce an array that contains the union: each distinct element from all of\n // the passed-in arrays.\n _.union = restArguments(function(arrays) {\n return _.uniq(flatten(arrays, true, true));\n });\n\n // Produce an array that contains every item shared between all the\n // passed-in arrays.\n _.intersection = function(array) {\n var result = [];\n var argsLength = arguments.length;\n for (var i = 0, length = getLength(array); i < length; i++) {\n var item = array[i];\n if (_.contains(result, item)) continue;\n var j;\n for (j = 1; j < argsLength; j++) {\n if (!_.contains(arguments[j], item)) break;\n }\n if (j === argsLength) result.push(item);\n }\n return result;\n };\n\n // Take the difference between one array and a number of other arrays.\n // Only the elements present in just the first array will remain.\n _.difference = restArguments(function(array, rest) {\n rest = flatten(rest, true, true);\n return _.filter(array, function(value){\n return !_.contains(rest, value);\n });\n });\n\n // Complement of _.zip. Unzip accepts an array of arrays and groups\n // each array's elements on shared indices.\n _.unzip = function(array) {\n var length = array && _.max(array, getLength).length || 0;\n var result = Array(length);\n\n for (var index = 0; index < length; index++) {\n result[index] = _.pluck(array, index);\n }\n return result;\n };\n\n // Zip together multiple lists into a single array -- elements that share\n // an index go together.\n _.zip = restArguments(_.unzip);\n\n // Converts lists into objects. Pass either a single array of `[key, value]`\n // pairs, or two parallel arrays of the same length -- one of keys, and one of\n // the corresponding values. Passing by pairs is the reverse of _.pairs.\n _.object = function(list, values) {\n var result = {};\n for (var i = 0, length = getLength(list); i < length; i++) {\n if (values) {\n result[list[i]] = values[i];\n } else {\n result[list[i][0]] = list[i][1];\n }\n }\n return result;\n };\n\n // Generator function to create the findIndex and findLastIndex functions.\n var createPredicateIndexFinder = function(dir) {\n return function(array, predicate, context) {\n predicate = cb(predicate, context);\n var length = getLength(array);\n var index = dir > 0 ? 0 : length - 1;\n for (; index >= 0 && index < length; index += dir) {\n if (predicate(array[index], index, array)) return index;\n }\n return -1;\n };\n };\n\n // Returns the first index on an array-like that passes a predicate test.\n _.findIndex = createPredicateIndexFinder(1);\n _.findLastIndex = createPredicateIndexFinder(-1);\n\n // Use a comparator function to figure out the smallest index at which\n // an object should be inserted so as to maintain order. Uses binary search.\n _.sortedIndex = function(array, obj, iteratee, context) {\n iteratee = cb(iteratee, context, 1);\n var value = iteratee(obj);\n var low = 0, high = getLength(array);\n while (low < high) {\n var mid = Math.floor((low + high) / 2);\n if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;\n }\n return low;\n };\n\n // Generator function to create the indexOf and lastIndexOf functions.\n var createIndexFinder = function(dir, predicateFind, sortedIndex) {\n return function(array, item, idx) {\n var i = 0, length = getLength(array);\n if (typeof idx == 'number') {\n if (dir > 0) {\n i = idx >= 0 ? idx : Math.max(idx + length, i);\n } else {\n length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;\n }\n } else if (sortedIndex && idx && length) {\n idx = sortedIndex(array, item);\n return array[idx] === item ? idx : -1;\n }\n if (item !== item) {\n idx = predicateFind(slice.call(array, i, length), _.isNaN);\n return idx >= 0 ? idx + i : -1;\n }\n for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {\n if (array[idx] === item) return idx;\n }\n return -1;\n };\n };\n\n // Return the position of the first occurrence of an item in an array,\n // or -1 if the item is not included in the array.\n // If the array is large and already in sort order, pass `true`\n // for **isSorted** to use binary search.\n _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);\n _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);\n\n // Generate an integer Array containing an arithmetic progression. A port of\n // the native Python `range()` function. See\n // [the Python documentation](http://docs.python.org/library/functions.html#range).\n _.range = function(start, stop, step) {\n if (stop == null) {\n stop = start || 0;\n start = 0;\n }\n if (!step) {\n step = stop < start ? -1 : 1;\n }\n\n var length = Math.max(Math.ceil((stop - start) / step), 0);\n var range = Array(length);\n\n for (var idx = 0; idx < length; idx++, start += step) {\n range[idx] = start;\n }\n\n return range;\n };\n\n // Chunk a single array into multiple arrays, each containing `count` or fewer\n // items.\n _.chunk = function(array, count) {\n if (count == null || count < 1) return [];\n var result = [];\n var i = 0, length = array.length;\n while (i < length) {\n result.push(slice.call(array, i, i += count));\n }\n return result;\n };\n\n // Function (ahem) Functions\n // ------------------\n\n // Determines whether to execute a function as a constructor\n // or a normal function with the provided arguments.\n var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {\n if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);\n var self = baseCreate(sourceFunc.prototype);\n var result = sourceFunc.apply(self, args);\n if (_.isObject(result)) return result;\n return self;\n };\n\n // Create a function bound to a given object (assigning `this`, and arguments,\n // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if\n // available.\n _.bind = restArguments(function(func, context, args) {\n if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');\n var bound = restArguments(function(callArgs) {\n return executeBound(func, bound, context, this, args.concat(callArgs));\n });\n return bound;\n });\n\n // Partially apply a function by creating a version that has had some of its\n // arguments pre-filled, without changing its dynamic `this` context. _ acts\n // as a placeholder by default, allowing any combination of arguments to be\n // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.\n _.partial = restArguments(function(func, boundArgs) {\n var placeholder = _.partial.placeholder;\n var bound = function() {\n var position = 0, length = boundArgs.length;\n var args = Array(length);\n for (var i = 0; i < length; i++) {\n args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];\n }\n while (position < arguments.length) args.push(arguments[position++]);\n return executeBound(func, bound, this, this, args);\n };\n return bound;\n });\n\n _.partial.placeholder = _;\n\n // Bind a number of an object's methods to that object. Remaining arguments\n // are the method names to be bound. Useful for ensuring that all callbacks\n // defined on an object belong to it.\n _.bindAll = restArguments(function(obj, keys) {\n keys = flatten(keys, false, false);\n var index = keys.length;\n if (index < 1) throw new Error('bindAll must be passed function names');\n while (index--) {\n var key = keys[index];\n obj[key] = _.bind(obj[key], obj);\n }\n });\n\n // Memoize an expensive function by storing its results.\n _.memoize = function(func, hasher) {\n var memoize = function(key) {\n var cache = memoize.cache;\n var address = '' + (hasher ? hasher.apply(this, arguments) : key);\n if (!has(cache, address)) cache[address] = func.apply(this, arguments);\n return cache[address];\n };\n memoize.cache = {};\n return memoize;\n };\n\n // Delays a function for the given number of milliseconds, and then calls\n // it with the arguments supplied.\n _.delay = restArguments(function(func, wait, args) {\n return setTimeout(function() {\n return func.apply(null, args);\n }, wait);\n });\n\n // Defers a function, scheduling it to run after the current call stack has\n // cleared.\n _.defer = _.partial(_.delay, _, 1);\n\n // Returns a function, that, when invoked, will only be triggered at most once\n // during a given window of time. Normally, the throttled function will run\n // as much as it can, without ever going more than once per `wait` duration;\n // but if you'd like to disable the execution on the leading edge, pass\n // `{leading: false}`. To disable execution on the trailing edge, ditto.\n _.throttle = function(func, wait, options) {\n var timeout, context, args, result;\n var previous = 0;\n if (!options) options = {};\n\n var later = function() {\n previous = options.leading === false ? 0 : _.now();\n timeout = null;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n };\n\n var throttled = function() {\n var now = _.now();\n if (!previous && options.leading === false) previous = now;\n var remaining = wait - (now - previous);\n context = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n\n throttled.cancel = function() {\n clearTimeout(timeout);\n previous = 0;\n timeout = context = args = null;\n };\n\n return throttled;\n };\n\n // Returns a function, that, as long as it continues to be invoked, will not\n // be triggered. The function will be called after it stops being called for\n // N milliseconds. If `immediate` is passed, trigger the function on the\n // leading edge, instead of the trailing.\n _.debounce = function(func, wait, immediate) {\n var timeout, result;\n\n var later = function(context, args) {\n timeout = null;\n if (args) result = func.apply(context, args);\n };\n\n var debounced = restArguments(function(args) {\n if (timeout) clearTimeout(timeout);\n if (immediate) {\n var callNow = !timeout;\n timeout = setTimeout(later, wait);\n if (callNow) result = func.apply(this, args);\n } else {\n timeout = _.delay(later, wait, this, args);\n }\n\n return result;\n });\n\n debounced.cancel = function() {\n clearTimeout(timeout);\n timeout = null;\n };\n\n return debounced;\n };\n\n // Returns the first function passed as an argument to the second,\n // allowing you to adjust arguments, run code before and after, and\n // conditionally execute the original function.\n _.wrap = function(func, wrapper) {\n return _.partial(wrapper, func);\n };\n\n // Returns a negated version of the passed-in predicate.\n _.negate = function(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n };\n };\n\n // Returns a function that is the composition of a list of functions, each\n // consuming the return value of the function that follows.\n _.compose = function() {\n var args = arguments;\n var start = args.length - 1;\n return function() {\n var i = start;\n var result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n };\n\n // Returns a function that will only be executed on and after the Nth call.\n _.after = function(times, func) {\n return function() {\n if (--times < 1) {\n return func.apply(this, arguments);\n }\n };\n };\n\n // Returns a function that will only be executed up to (but not including) the Nth call.\n _.before = function(times, func) {\n var memo;\n return function() {\n if (--times > 0) {\n memo = func.apply(this, arguments);\n }\n if (times <= 1) func = null;\n return memo;\n };\n };\n\n // Returns a function that will be executed at most one time, no matter how\n // often you call it. Useful for lazy initialization.\n _.once = _.partial(_.before, 2);\n\n _.restArguments = restArguments;\n\n // Object Functions\n // ----------------\n\n // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.\n var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');\n var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',\n 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];\n\n var collectNonEnumProps = function(obj, keys) {\n var nonEnumIdx = nonEnumerableProps.length;\n var constructor = obj.constructor;\n var proto = _.isFunction(constructor) && constructor.prototype || ObjProto;\n\n // Constructor is a special case.\n var prop = 'constructor';\n if (has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);\n\n while (nonEnumIdx--) {\n prop = nonEnumerableProps[nonEnumIdx];\n if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {\n keys.push(prop);\n }\n }\n };\n\n // Retrieve the names of an object's own properties.\n // Delegates to **ECMAScript 5**'s native `Object.keys`.\n _.keys = function(obj) {\n if (!_.isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n };\n\n // Retrieve all the property names of an object.\n _.allKeys = function(obj) {\n if (!_.isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n };\n\n // Retrieve the values of an object's properties.\n _.values = function(obj) {\n var keys = _.keys(obj);\n var length = keys.length;\n var values = Array(length);\n for (var i = 0; i < length; i++) {\n values[i] = obj[keys[i]];\n }\n return values;\n };\n\n // Returns the results of applying the iteratee to each element of the object.\n // In contrast to _.map it returns an object.\n _.mapObject = function(obj, iteratee, context) {\n iteratee = cb(iteratee, context);\n var keys = _.keys(obj),\n length = keys.length,\n results = {};\n for (var index = 0; index < length; index++) {\n var currentKey = keys[index];\n results[currentKey] = iteratee(obj[currentKey], currentKey, obj);\n }\n return results;\n };\n\n // Convert an object into a list of `[key, value]` pairs.\n // The opposite of _.object.\n _.pairs = function(obj) {\n var keys = _.keys(obj);\n var length = keys.length;\n var pairs = Array(length);\n for (var i = 0; i < length; i++) {\n pairs[i] = [keys[i], obj[keys[i]]];\n }\n return pairs;\n };\n\n // Invert the keys and values of an object. The values must be serializable.\n _.invert = function(obj) {\n var result = {};\n var keys = _.keys(obj);\n for (var i = 0, length = keys.length; i < length; i++) {\n result[obj[keys[i]]] = keys[i];\n }\n return result;\n };\n\n // Return a sorted list of the function names available on the object.\n // Aliased as `methods`.\n _.functions = _.methods = function(obj) {\n var names = [];\n for (var key in obj) {\n if (_.isFunction(obj[key])) names.push(key);\n }\n return names.sort();\n };\n\n // An internal function for creating assigner functions.\n var createAssigner = function(keysFunc, defaults) {\n return function(obj) {\n var length = arguments.length;\n if (defaults) obj = Object(obj);\n if (length < 2 || obj == null) return obj;\n for (var index = 1; index < length; index++) {\n var source = arguments[index],\n keys = keysFunc(source),\n l = keys.length;\n for (var i = 0; i < l; i++) {\n var key = keys[i];\n if (!defaults || obj[key] === void 0) obj[key] = source[key];\n }\n }\n return obj;\n };\n };\n\n // Extend a given object with all the properties in passed-in object(s).\n _.extend = createAssigner(_.allKeys);\n\n // Assigns a given object with all the own properties in the passed-in object(s).\n // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)\n _.extendOwn = _.assign = createAssigner(_.keys);\n\n // Returns the first key on an object that passes a predicate test.\n _.findKey = function(obj, predicate, context) {\n predicate = cb(predicate, context);\n var keys = _.keys(obj), key;\n for (var i = 0, length = keys.length; i < length; i++) {\n key = keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n };\n\n // Internal pick helper function to determine if `obj` has key `key`.\n var keyInObj = function(value, key, obj) {\n return key in obj;\n };\n\n // Return a copy of the object only containing the whitelisted properties.\n _.pick = restArguments(function(obj, keys) {\n var result = {}, iteratee = keys[0];\n if (obj == null) return result;\n if (_.isFunction(iteratee)) {\n if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);\n keys = _.allKeys(obj);\n } else {\n iteratee = keyInObj;\n keys = flatten(keys, false, false);\n obj = Object(obj);\n }\n for (var i = 0, length = keys.length; i < length; i++) {\n var key = keys[i];\n var value = obj[key];\n if (iteratee(value, key, obj)) result[key] = value;\n }\n return result;\n });\n\n // Return a copy of the object without the blacklisted properties.\n _.omit = restArguments(function(obj, keys) {\n var iteratee = keys[0], context;\n if (_.isFunction(iteratee)) {\n iteratee = _.negate(iteratee);\n if (keys.length > 1) context = keys[1];\n } else {\n keys = _.map(flatten(keys, false, false), String);\n iteratee = function(value, key) {\n return !_.contains(keys, key);\n };\n }\n return _.pick(obj, iteratee, context);\n });\n\n // Fill in a given object with default properties.\n _.defaults = createAssigner(_.allKeys, true);\n\n // Creates an object that inherits from the given prototype object.\n // If additional properties are provided then they will be added to the\n // created object.\n _.create = function(prototype, props) {\n var result = baseCreate(prototype);\n if (props) _.extendOwn(result, props);\n return result;\n };\n\n // Create a (shallow-cloned) duplicate of an object.\n _.clone = function(obj) {\n if (!_.isObject(obj)) return obj;\n return _.isArray(obj) ? obj.slice() : _.extend({}, obj);\n };\n\n // Invokes interceptor with the obj, and then returns obj.\n // The primary purpose of this method is to \"tap into\" a method chain, in\n // order to perform operations on intermediate results within the chain.\n _.tap = function(obj, interceptor) {\n interceptor(obj);\n return obj;\n };\n\n // Returns whether an object has a given set of `key:value` pairs.\n _.isMatch = function(object, attrs) {\n var keys = _.keys(attrs), length = keys.length;\n if (object == null) return !length;\n var obj = Object(object);\n for (var i = 0; i < length; i++) {\n var key = keys[i];\n if (attrs[key] !== obj[key] || !(key in obj)) return false;\n }\n return true;\n };\n\n\n // Internal recursive comparison function for `isEqual`.\n var eq, deepEq;\n eq = function(a, b, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) return a !== 0 || 1 / a === 1 / b;\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) return false;\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) return b !== b;\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;\n return deepEq(a, b, aStack, bStack);\n };\n\n // Internal recursive comparison function for `isEqual`.\n deepEq = function(a, b, aStack, bStack) {\n // Unwrap any wrapped objects.\n if (a instanceof _) a = a._wrapped;\n if (b instanceof _) b = b._wrapped;\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) return false;\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case '[object RegExp]':\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case '[object String]':\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return '' + a === '' + b;\n case '[object Number]':\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) return +b !== +b;\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case '[object Date]':\n case '[object Boolean]':\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case '[object Symbol]':\n return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);\n }\n\n var areArrays = className === '[object Array]';\n if (!areArrays) {\n if (typeof a != 'object' || typeof b != 'object') return false;\n\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor, bCtor = b.constructor;\n if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&\n _.isFunction(bCtor) && bCtor instanceof bCtor)\n && ('constructor' in a && 'constructor' in b)) {\n return false;\n }\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) return bStack[length] === b;\n }\n\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) return false;\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], aStack, bStack)) return false;\n }\n } else {\n // Deep compare objects.\n var keys = _.keys(a), key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (_.keys(b).length !== length) return false;\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n };\n\n // Perform a deep comparison to check if two objects are equal.\n _.isEqual = function(a, b) {\n return eq(a, b);\n };\n\n // Is a given array, string, or object empty?\n // An \"empty\" object has no enumerable own-properties.\n _.isEmpty = function(obj) {\n if (obj == null) return true;\n if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;\n return _.keys(obj).length === 0;\n };\n\n // Is a given value a DOM element?\n _.isElement = function(obj) {\n return !!(obj && obj.nodeType === 1);\n };\n\n // Is a given value an array?\n // Delegates to ECMA5's native Array.isArray\n _.isArray = nativeIsArray || function(obj) {\n return toString.call(obj) === '[object Array]';\n };\n\n // Is a given variable an object?\n _.isObject = function(obj) {\n var type = typeof obj;\n return type === 'function' || type === 'object' && !!obj;\n };\n\n // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError, isMap, isWeakMap, isSet, isWeakSet.\n _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error', 'Symbol', 'Map', 'WeakMap', 'Set', 'WeakSet'], function(name) {\n _['is' + name] = function(obj) {\n return toString.call(obj) === '[object ' + name + ']';\n };\n });\n\n // Define a fallback version of the method in browsers (ahem, IE < 9), where\n // there isn't any inspectable \"Arguments\" type.\n if (!_.isArguments(arguments)) {\n _.isArguments = function(obj) {\n return has(obj, 'callee');\n };\n }\n\n // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,\n // IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).\n var nodelist = root.document && root.document.childNodes;\n if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {\n _.isFunction = function(obj) {\n return typeof obj == 'function' || false;\n };\n }\n\n // Is a given object a finite number?\n _.isFinite = function(obj) {\n return !_.isSymbol(obj) && isFinite(obj) && !isNaN(parseFloat(obj));\n };\n\n // Is the given value `NaN`?\n _.isNaN = function(obj) {\n return _.isNumber(obj) && isNaN(obj);\n };\n\n // Is a given value a boolean?\n _.isBoolean = function(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n };\n\n // Is a given value equal to null?\n _.isNull = function(obj) {\n return obj === null;\n };\n\n // Is a given variable undefined?\n _.isUndefined = function(obj) {\n return obj === void 0;\n };\n\n // Shortcut function for checking if an object has a given property directly\n // on itself (in other words, not on a prototype).\n _.has = function(obj, path) {\n if (!_.isArray(path)) {\n return has(obj, path);\n }\n var length = path.length;\n for (var i = 0; i < length; i++) {\n var key = path[i];\n if (obj == null || !hasOwnProperty.call(obj, key)) {\n return false;\n }\n obj = obj[key];\n }\n return !!length;\n };\n\n // Utility Functions\n // -----------------\n\n // Run Underscore.js in *noConflict* mode, returning the `_` variable to its\n // previous owner. Returns a reference to the Underscore object.\n _.noConflict = function() {\n root._ = previousUnderscore;\n return this;\n };\n\n // Keep the identity function around for default iteratees.\n _.identity = function(value) {\n return value;\n };\n\n // Predicate-generating functions. Often useful outside of Underscore.\n _.constant = function(value) {\n return function() {\n return value;\n };\n };\n\n _.noop = function(){};\n\n // Creates a function that, when passed an object, will traverse that object’s\n // properties down the given `path`, specified as an array of keys or indexes.\n _.property = function(path) {\n if (!_.isArray(path)) {\n return shallowProperty(path);\n }\n return function(obj) {\n return deepGet(obj, path);\n };\n };\n\n // Generates a function for a given object that returns a given property.\n _.propertyOf = function(obj) {\n if (obj == null) {\n return function(){};\n }\n return function(path) {\n return !_.isArray(path) ? obj[path] : deepGet(obj, path);\n };\n };\n\n // Returns a predicate for checking whether an object has a given set of\n // `key:value` pairs.\n _.matcher = _.matches = function(attrs) {\n attrs = _.extendOwn({}, attrs);\n return function(obj) {\n return _.isMatch(obj, attrs);\n };\n };\n\n // Run a function **n** times.\n _.times = function(n, iteratee, context) {\n var accum = Array(Math.max(0, n));\n iteratee = optimizeCb(iteratee, context, 1);\n for (var i = 0; i < n; i++) accum[i] = iteratee(i);\n return accum;\n };\n\n // Return a random integer between min and max (inclusive).\n _.random = function(min, max) {\n if (max == null) {\n max = min;\n min = 0;\n }\n return min + Math.floor(Math.random() * (max - min + 1));\n };\n\n // A (possibly faster) way to get the current timestamp as an integer.\n _.now = Date.now || function() {\n return new Date().getTime();\n };\n\n // List of HTML entities for escaping.\n var escapeMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n };\n var unescapeMap = _.invert(escapeMap);\n\n // Functions for escaping and unescaping strings to/from HTML interpolation.\n var createEscaper = function(map) {\n var escaper = function(match) {\n return map[match];\n };\n // Regexes for identifying a key that needs to be escaped.\n var source = '(?:' + _.keys(map).join('|') + ')';\n var testRegexp = RegExp(source);\n var replaceRegexp = RegExp(source, 'g');\n return function(string) {\n string = string == null ? '' : '' + string;\n return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;\n };\n };\n _.escape = createEscaper(escapeMap);\n _.unescape = createEscaper(unescapeMap);\n\n // Traverses the children of `obj` along `path`. If a child is a function, it\n // is invoked with its parent as context. Returns the value of the final\n // child, or `fallback` if any child is undefined.\n _.result = function(obj, path, fallback) {\n if (!_.isArray(path)) path = [path];\n var length = path.length;\n if (!length) {\n return _.isFunction(fallback) ? fallback.call(obj) : fallback;\n }\n for (var i = 0; i < length; i++) {\n var prop = obj == null ? void 0 : obj[path[i]];\n if (prop === void 0) {\n prop = fallback;\n i = length; // Ensure we don't continue iterating.\n }\n obj = _.isFunction(prop) ? prop.call(obj) : prop;\n }\n return obj;\n };\n\n // Generate a unique integer id (unique within the entire client session).\n // Useful for temporary DOM ids.\n var idCounter = 0;\n _.uniqueId = function(prefix) {\n var id = ++idCounter + '';\n return prefix ? prefix + id : id;\n };\n\n // By default, Underscore uses ERB-style template delimiters, change the\n // following template settings to use alternative delimiters.\n _.templateSettings = {\n evaluate: /<%([\\s\\S]+?)%>/g,\n interpolate: /<%=([\\s\\S]+?)%>/g,\n escape: /<%-([\\s\\S]+?)%>/g\n };\n\n // When customizing `templateSettings`, if you don't want to define an\n // interpolation, evaluation or escaping regex, we need one that is\n // guaranteed not to match.\n var noMatch = /(.)^/;\n\n // Certain characters need to be escaped so that they can be put into a\n // string literal.\n var escapes = {\n \"'\": \"'\",\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n var escapeRegExp = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\n var escapeChar = function(match) {\n return '\\\\' + escapes[match];\n };\n\n // JavaScript micro-templating, similar to John Resig's implementation.\n // Underscore templating handles arbitrary delimiters, preserves whitespace,\n // and correctly escapes quotes within interpolated code.\n // NB: `oldSettings` only exists for backwards compatibility.\n _.template = function(text, settings, oldSettings) {\n if (!settings && oldSettings) settings = oldSettings;\n settings = _.defaults({}, settings, _.templateSettings);\n\n // Combine delimiters into one regular expression via alternation.\n var matcher = RegExp([\n (settings.escape || noMatch).source,\n (settings.interpolate || noMatch).source,\n (settings.evaluate || noMatch).source\n ].join('|') + '|$', 'g');\n\n // Compile the template source, escaping string literals appropriately.\n var index = 0;\n var source = \"__p+='\";\n text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {\n source += text.slice(index, offset).replace(escapeRegExp, escapeChar);\n index = offset + match.length;\n\n if (escape) {\n source += \"'+\\n((__t=(\" + escape + \"))==null?'':_.escape(__t))+\\n'\";\n } else if (interpolate) {\n source += \"'+\\n((__t=(\" + interpolate + \"))==null?'':__t)+\\n'\";\n } else if (evaluate) {\n source += \"';\\n\" + evaluate + \"\\n__p+='\";\n }\n\n // Adobe VMs need the match returned to produce the correct offset.\n return match;\n });\n source += \"';\\n\";\n\n // If a variable is not specified, place data values in local scope.\n if (!settings.variable) source = 'with(obj||{}){\\n' + source + '}\\n';\n\n source = \"var __t,__p='',__j=Array.prototype.join,\" +\n \"print=function(){__p+=__j.call(arguments,'');};\\n\" +\n source + 'return __p;\\n';\n\n var render;\n try {\n render = new Function(settings.variable || 'obj', '_', source);\n } catch (e) {\n e.source = source;\n throw e;\n }\n\n var template = function(data) {\n return render.call(this, data, _);\n };\n\n // Provide the compiled source as a convenience for precompilation.\n var argument = settings.variable || 'obj';\n template.source = 'function(' + argument + '){\\n' + source + '}';\n\n return template;\n };\n\n // Add a \"chain\" function. Start chaining a wrapped Underscore object.\n _.chain = function(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n };\n\n // OOP\n // ---------------\n // If Underscore is called as a function, it returns a wrapped object that\n // can be used OO-style. This wrapper holds altered versions of all the\n // underscore functions. Wrapped objects may be chained.\n\n // Helper function to continue chaining intermediate results.\n var chainResult = function(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n };\n\n // Add your own custom functions to the Underscore object.\n _.mixin = function(obj) {\n _.each(_.functions(obj), function(name) {\n var func = _[name] = obj[name];\n _.prototype[name] = function() {\n var args = [this._wrapped];\n push.apply(args, arguments);\n return chainResult(this, func.apply(_, args));\n };\n });\n return _;\n };\n\n // Add all of the Underscore functions to the wrapper object.\n _.mixin(_);\n\n // Add all mutator Array functions to the wrapper.\n _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {\n var method = ArrayProto[name];\n _.prototype[name] = function() {\n var obj = this._wrapped;\n method.apply(obj, arguments);\n if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];\n return chainResult(this, obj);\n };\n });\n\n // Add all accessor Array functions to the wrapper.\n _.each(['concat', 'join', 'slice'], function(name) {\n var method = ArrayProto[name];\n _.prototype[name] = function() {\n return chainResult(this, method.apply(this._wrapped, arguments));\n };\n });\n\n // Extracts the result from a wrapped and chained object.\n _.prototype.value = function() {\n return this._wrapped;\n };\n\n // Provide unwrapping proxy for some methods used in engine operations\n // such as arithmetic and JSON stringification.\n _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;\n\n _.prototype.toString = function() {\n return String(this._wrapped);\n };\n\n // AMD registration happens at the end for compatibility with AMD loaders\n // that may not enforce next-turn semantics on modules. Even though general\n // practice for AMD registration is to be anonymous, underscore registers\n // as a named module because, like jQuery, it is a base library that is\n // popular enough to be bundled in a third party lib, but not be part of\n // an AMD load request. Those cases could generate an error when an\n // anonymous define() is called outside of a loader request.\n if (typeof define == 'function' && define.amd) {\n define('underscore', [], function() {\n return _;\n });\n }\n}());\n","'use strict'\nvar Buffer = require('safe-buffer').Buffer\nvar createHash = require('create-hash')\nvar BN = require('bn.js')\nvar EC = require('elliptic').ec\n\nvar messages = require('../messages.json')\n\nvar ec = new EC('secp256k1')\nvar ecparams = ec.curve\n\nfunction loadCompressedPublicKey (first, xBuffer) {\n var x = new BN(xBuffer)\n\n // overflow\n if (x.cmp(ecparams.p) >= 0) return null\n x = x.toRed(ecparams.red)\n\n // compute corresponding Y\n var y = x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt()\n if ((first === 0x03) !== y.isOdd()) y = y.redNeg()\n\n return ec.keyPair({ pub: { x: x, y: y } })\n}\n\nfunction loadUncompressedPublicKey (first, xBuffer, yBuffer) {\n var x = new BN(xBuffer)\n var y = new BN(yBuffer)\n\n // overflow\n if (x.cmp(ecparams.p) >= 0 || y.cmp(ecparams.p) >= 0) return null\n\n x = x.toRed(ecparams.red)\n y = y.toRed(ecparams.red)\n\n // is odd flag\n if ((first === 0x06 || first === 0x07) && y.isOdd() !== (first === 0x07)) return null\n\n // x*x*x + b = y*y\n var x3 = x.redSqr().redIMul(x)\n if (!y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()) return null\n\n return ec.keyPair({ pub: { x: x, y: y } })\n}\n\nfunction loadPublicKey (publicKey) {\n var first = publicKey[0]\n switch (first) {\n case 0x02:\n case 0x03:\n if (publicKey.length !== 33) return null\n return loadCompressedPublicKey(first, publicKey.slice(1, 33))\n case 0x04:\n case 0x06:\n case 0x07:\n if (publicKey.length !== 65) return null\n return loadUncompressedPublicKey(first, publicKey.slice(1, 33), publicKey.slice(33, 65))\n default:\n return null\n }\n}\n\nexports.privateKeyVerify = function (privateKey) {\n var bn = new BN(privateKey)\n return bn.cmp(ecparams.n) < 0 && !bn.isZero()\n}\n\nexports.privateKeyExport = function (privateKey, compressed) {\n var d = new BN(privateKey)\n if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.EC_PRIVATE_KEY_EXPORT_DER_FAIL)\n\n return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed, true))\n}\n\nexports.privateKeyNegate = function (privateKey) {\n var bn = new BN(privateKey)\n return bn.isZero() ? Buffer.alloc(32) : ecparams.n.sub(bn).umod(ecparams.n).toArrayLike(Buffer, 'be', 32)\n}\n\nexports.privateKeyModInverse = function (privateKey) {\n var bn = new BN(privateKey)\n if (bn.cmp(ecparams.n) >= 0 || bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_RANGE_INVALID)\n\n return bn.invm(ecparams.n).toArrayLike(Buffer, 'be', 32)\n}\n\nexports.privateKeyTweakAdd = function (privateKey, tweak) {\n var bn = new BN(tweak)\n if (bn.cmp(ecparams.n) >= 0) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL)\n\n bn.iadd(new BN(privateKey))\n if (bn.cmp(ecparams.n) >= 0) bn.isub(ecparams.n)\n if (bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL)\n\n return bn.toArrayLike(Buffer, 'be', 32)\n}\n\nexports.privateKeyTweakMul = function (privateKey, tweak) {\n var bn = new BN(tweak)\n if (bn.cmp(ecparams.n) >= 0 || bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_MUL_FAIL)\n\n bn.imul(new BN(privateKey))\n if (bn.cmp(ecparams.n)) bn = bn.umod(ecparams.n)\n\n return bn.toArrayLike(Buffer, 'be', 32)\n}\n\nexports.publicKeyCreate = function (privateKey, compressed) {\n var d = new BN(privateKey)\n if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.EC_PUBLIC_KEY_CREATE_FAIL)\n\n return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed, true))\n}\n\nexports.publicKeyConvert = function (publicKey, compressed) {\n var pair = loadPublicKey(publicKey)\n if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)\n\n return Buffer.from(pair.getPublic(compressed, true))\n}\n\nexports.publicKeyVerify = function (publicKey) {\n return loadPublicKey(publicKey) !== null\n}\n\nexports.publicKeyTweakAdd = function (publicKey, tweak, compressed) {\n var pair = loadPublicKey(publicKey)\n if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)\n\n tweak = new BN(tweak)\n if (tweak.cmp(ecparams.n) >= 0) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL)\n\n var point = ecparams.g.mul(tweak).add(pair.pub)\n if (point.isInfinity()) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL)\n\n return Buffer.from(point.encode(true, compressed))\n}\n\nexports.publicKeyTweakMul = function (publicKey, tweak, compressed) {\n var pair = loadPublicKey(publicKey)\n if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)\n\n tweak = new BN(tweak)\n if (tweak.cmp(ecparams.n) >= 0 || tweak.isZero()) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_MUL_FAIL)\n\n return Buffer.from(pair.pub.mul(tweak).encode(true, compressed))\n}\n\nexports.publicKeyCombine = function (publicKeys, compressed) {\n var pairs = new Array(publicKeys.length)\n for (var i = 0; i < publicKeys.length; ++i) {\n pairs[i] = loadPublicKey(publicKeys[i])\n if (pairs[i] === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)\n }\n\n var point = pairs[0].pub\n for (var j = 1; j < pairs.length; ++j) point = point.add(pairs[j].pub)\n if (point.isInfinity()) throw new Error(messages.EC_PUBLIC_KEY_COMBINE_FAIL)\n\n return Buffer.from(point.encode(true, compressed))\n}\n\nexports.signatureNormalize = function (signature) {\n var r = new BN(signature.slice(0, 32))\n var s = new BN(signature.slice(32, 64))\n if (r.cmp(ecparams.n) >= 0 || s.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)\n\n var result = Buffer.from(signature)\n if (s.cmp(ec.nh) === 1) ecparams.n.sub(s).toArrayLike(Buffer, 'be', 32).copy(result, 32)\n\n return result\n}\n\nexports.signatureExport = function (signature) {\n var r = signature.slice(0, 32)\n var s = signature.slice(32, 64)\n if (new BN(r).cmp(ecparams.n) >= 0 || new BN(s).cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)\n\n return { r: r, s: s }\n}\n\nexports.signatureImport = function (sigObj) {\n var r = new BN(sigObj.r)\n if (r.cmp(ecparams.n) >= 0) r = new BN(0)\n\n var s = new BN(sigObj.s)\n if (s.cmp(ecparams.n) >= 0) s = new BN(0)\n\n return Buffer.concat([\n r.toArrayLike(Buffer, 'be', 32),\n s.toArrayLike(Buffer, 'be', 32)\n ])\n}\n\nexports.sign = function (message, privateKey, noncefn, data) {\n if (typeof noncefn === 'function') {\n var getNonce = noncefn\n noncefn = function (counter) {\n var nonce = getNonce(message, privateKey, null, data, counter)\n if (!Buffer.isBuffer(nonce) || nonce.length !== 32) throw new Error(messages.ECDSA_SIGN_FAIL)\n\n return new BN(nonce)\n }\n }\n\n var d = new BN(privateKey)\n if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.ECDSA_SIGN_FAIL)\n\n var result = ec.sign(message, privateKey, { canonical: true, k: noncefn, pers: data })\n return {\n signature: Buffer.concat([\n result.r.toArrayLike(Buffer, 'be', 32),\n result.s.toArrayLike(Buffer, 'be', 32)\n ]),\n recovery: result.recoveryParam\n }\n}\n\nexports.verify = function (message, signature, publicKey) {\n var sigObj = { r: signature.slice(0, 32), s: signature.slice(32, 64) }\n\n var sigr = new BN(sigObj.r)\n var sigs = new BN(sigObj.s)\n if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)\n if (sigs.cmp(ec.nh) === 1 || sigr.isZero() || sigs.isZero()) return false\n\n var pair = loadPublicKey(publicKey)\n if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)\n\n return ec.verify(message, sigObj, { x: pair.pub.x, y: pair.pub.y })\n}\n\nexports.recover = function (message, signature, recovery, compressed) {\n var sigObj = { r: signature.slice(0, 32), s: signature.slice(32, 64) }\n\n var sigr = new BN(sigObj.r)\n var sigs = new BN(sigObj.s)\n if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)\n\n try {\n if (sigr.isZero() || sigs.isZero()) throw new Error()\n\n var point = ec.recoverPubKey(message, sigObj, recovery)\n return Buffer.from(point.encode(true, compressed))\n } catch (err) {\n throw new Error(messages.ECDSA_RECOVER_FAIL)\n }\n}\n\nexports.ecdh = function (publicKey, privateKey) {\n var shared = exports.ecdhUnsafe(publicKey, privateKey, true)\n return createHash('sha256').update(shared).digest()\n}\n\nexports.ecdhUnsafe = function (publicKey, privateKey, compressed) {\n var pair = loadPublicKey(publicKey)\n if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)\n\n var scalar = new BN(privateKey)\n if (scalar.cmp(ecparams.n) >= 0 || scalar.isZero()) throw new Error(messages.ECDH_FAIL)\n\n return Buffer.from(pair.pub.mul(scalar).encode(true, compressed))\n}\n","/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","module.exports = function (it, Constructor, name) {\n if (!(it instanceof Constructor)) {\n throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');\n } return it;\n};\n","'use strict'\nvar inherits = require('inherits')\nvar Legacy = require('./legacy')\nvar Base = require('cipher-base')\nvar Buffer = require('safe-buffer').Buffer\nvar md5 = require('create-hash/md5')\nvar RIPEMD160 = require('ripemd160')\n\nvar sha = require('sha.js')\n\nvar ZEROS = Buffer.alloc(128)\n\nfunction Hmac (alg, key) {\n Base.call(this, 'digest')\n if (typeof key === 'string') {\n key = Buffer.from(key)\n }\n\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n this._alg = alg\n this._key = key\n if (key.length > blocksize) {\n var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n key = hash.update(key).digest()\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize)\n var opad = this._opad = Buffer.allocUnsafe(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n this._hash.update(ipad)\n}\n\ninherits(Hmac, Base)\n\nHmac.prototype._update = function (data) {\n this._hash.update(data)\n}\n\nHmac.prototype._final = function () {\n var h = this._hash.digest()\n var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)\n return hash.update(this._opad).update(h).digest()\n}\n\nmodule.exports = function createHmac (alg, key) {\n alg = alg.toLowerCase()\n if (alg === 'rmd160' || alg === 'ripemd160') {\n return new Hmac('rmd160', key)\n }\n if (alg === 'md5') {\n return new Legacy(md5, key)\n }\n return new Hmac(alg, key)\n}\n","'use strict'\nvar Buffer = require('safe-buffer').Buffer\nvar bip66 = require('bip66')\n\nvar EC_PRIVKEY_EXPORT_DER_COMPRESSED = Buffer.from([\n // begin\n 0x30, 0x81, 0xd3, 0x02, 0x01, 0x01, 0x04, 0x20,\n // private key\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // middle\n 0xa0, 0x81, 0x85, 0x30, 0x81, 0x82, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48,\n 0xcE, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xfE, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04,\n 0x21, 0x02, 0x79, 0xbE, 0x66, 0x7E, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xcE, 0x87,\n 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xcE, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8,\n 0x17, 0x98, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xfE, 0xba, 0xaE, 0xdc, 0xE6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5E,\n 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0xa1, 0x24, 0x03, 0x22, 0x00,\n // public key\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00\n])\n\nvar EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED = Buffer.from([\n // begin\n 0x30, 0x82, 0x01, 0x13, 0x02, 0x01, 0x01, 0x04, 0x20,\n // private key\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // middle\n 0xa0, 0x81, 0xa5, 0x30, 0x81, 0xa2, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48,\n 0xcE, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xfE, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04,\n 0x41, 0x04, 0x79, 0xbE, 0x66, 0x7E, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xcE, 0x87,\n 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xcE, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8,\n 0x17, 0x98, 0x48, 0x3a, 0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0E, 0x11,\n 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10,\n 0xd4, 0xb8, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xfE, 0xba, 0xaE, 0xdc, 0xE6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5E,\n 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0xa1, 0x44, 0x03, 0x42, 0x00,\n // public key\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00\n])\n\nexports.privateKeyExport = function (privateKey, publicKey, compressed) {\n var result = Buffer.from(compressed ? EC_PRIVKEY_EXPORT_DER_COMPRESSED : EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED)\n privateKey.copy(result, compressed ? 8 : 9)\n publicKey.copy(result, compressed ? 181 : 214)\n return result\n}\n\nexports.privateKeyImport = function (privateKey) {\n var length = privateKey.length\n\n // sequence header\n var index = 0\n if (length < index + 1 || privateKey[index] !== 0x30) return\n index += 1\n\n // sequence length constructor\n if (length < index + 1 || !(privateKey[index] & 0x80)) return\n\n var lenb = privateKey[index] & 0x7f\n index += 1\n if (lenb < 1 || lenb > 2) return\n if (length < index + lenb) return\n\n // sequence length\n var len = privateKey[index + lenb - 1] | (lenb > 1 ? privateKey[index + lenb - 2] << 8 : 0)\n index += lenb\n if (length < index + len) return\n\n // sequence element 0: version number (=1)\n if (length < index + 3 ||\n privateKey[index] !== 0x02 ||\n privateKey[index + 1] !== 0x01 ||\n privateKey[index + 2] !== 0x01) {\n return\n }\n index += 3\n\n // sequence element 1: octet string, up to 32 bytes\n if (length < index + 2 ||\n privateKey[index] !== 0x04 ||\n privateKey[index + 1] > 0x20 ||\n length < index + 2 + privateKey[index + 1]) {\n return\n }\n\n return privateKey.slice(index + 2, index + 2 + privateKey[index + 1])\n}\n\nexports.signatureExport = function (sigObj) {\n var r = Buffer.concat([Buffer.from([0]), sigObj.r])\n for (var lenR = 33, posR = 0; lenR > 1 && r[posR] === 0x00 && !(r[posR + 1] & 0x80); --lenR, ++posR);\n\n var s = Buffer.concat([Buffer.from([0]), sigObj.s])\n for (var lenS = 33, posS = 0; lenS > 1 && s[posS] === 0x00 && !(s[posS + 1] & 0x80); --lenS, ++posS);\n\n return bip66.encode(r.slice(posR), s.slice(posS))\n}\n\nexports.signatureImport = function (sig) {\n var r = Buffer.alloc(32, 0)\n var s = Buffer.alloc(32, 0)\n\n try {\n var sigObj = bip66.decode(sig)\n if (sigObj.r.length === 33 && sigObj.r[0] === 0x00) sigObj.r = sigObj.r.slice(1)\n if (sigObj.r.length > 32) throw new Error('R length is too long')\n if (sigObj.s.length === 33 && sigObj.s[0] === 0x00) sigObj.s = sigObj.s.slice(1)\n if (sigObj.s.length > 32) throw new Error('S length is too long')\n } catch (err) {\n return\n }\n\n sigObj.r.copy(r, 32 - sigObj.r.length)\n sigObj.s.copy(s, 32 - sigObj.s.length)\n\n return { r: r, s: s }\n}\n\nexports.signatureImportLax = function (sig) {\n var r = Buffer.alloc(32, 0)\n var s = Buffer.alloc(32, 0)\n\n var length = sig.length\n var index = 0\n\n // sequence tag byte\n if (sig[index++] !== 0x30) return\n\n // sequence length byte\n var lenbyte = sig[index++]\n if (lenbyte & 0x80) {\n index += lenbyte - 0x80\n if (index > length) return\n }\n\n // sequence tag byte for r\n if (sig[index++] !== 0x02) return\n\n // length for r\n var rlen = sig[index++]\n if (rlen & 0x80) {\n lenbyte = rlen - 0x80\n if (index + lenbyte > length) return\n for (; lenbyte > 0 && sig[index] === 0x00; index += 1, lenbyte -= 1);\n for (rlen = 0; lenbyte > 0; index += 1, lenbyte -= 1) rlen = (rlen << 8) + sig[index]\n }\n if (rlen > length - index) return\n var rindex = index\n index += rlen\n\n // sequence tag byte for s\n if (sig[index++] !== 0x02) return\n\n // length for s\n var slen = sig[index++]\n if (slen & 0x80) {\n lenbyte = slen - 0x80\n if (index + lenbyte > length) return\n for (; lenbyte > 0 && sig[index] === 0x00; index += 1, lenbyte -= 1);\n for (slen = 0; lenbyte > 0; index += 1, lenbyte -= 1) slen = (slen << 8) + sig[index]\n }\n if (slen > length - index) return\n var sindex = index\n index += slen\n\n // ignore leading zeros in r\n for (; rlen > 0 && sig[rindex] === 0x00; rlen -= 1, rindex += 1);\n // copy r value\n if (rlen > 32) return\n var rvalue = sig.slice(rindex, rindex + rlen)\n rvalue.copy(r, 32 - rvalue.length)\n\n // ignore leading zeros in s\n for (; slen > 0 && sig[sindex] === 0x00; slen -= 1, sindex += 1);\n // copy s value\n if (slen > 32) return\n var svalue = sig.slice(sindex, sindex + slen)\n svalue.copy(s, 32 - svalue.length)\n\n return { r: r, s: s }\n}\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","module.exports = function (it) {\n if (typeof it != 'function') {\n throw TypeError(String(it) + ' is not a function');\n } return it;\n};\n","'use strict'\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')\nexports.createHash = exports.Hash = require('create-hash')\nexports.createHmac = exports.Hmac = require('create-hmac')\n\nvar algos = require('browserify-sign/algos')\nvar algoKeys = Object.keys(algos)\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)\nexports.getHashes = function () {\n return hashes\n}\n\nvar p = require('pbkdf2')\nexports.pbkdf2 = p.pbkdf2\nexports.pbkdf2Sync = p.pbkdf2Sync\n\nvar aes = require('browserify-cipher')\n\nexports.Cipher = aes.Cipher\nexports.createCipher = aes.createCipher\nexports.Cipheriv = aes.Cipheriv\nexports.createCipheriv = aes.createCipheriv\nexports.Decipher = aes.Decipher\nexports.createDecipher = aes.createDecipher\nexports.Decipheriv = aes.Decipheriv\nexports.createDecipheriv = aes.createDecipheriv\nexports.getCiphers = aes.getCiphers\nexports.listCiphers = aes.listCiphers\n\nvar dh = require('diffie-hellman')\n\nexports.DiffieHellmanGroup = dh.DiffieHellmanGroup\nexports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup\nexports.getDiffieHellman = dh.getDiffieHellman\nexports.createDiffieHellman = dh.createDiffieHellman\nexports.DiffieHellman = dh.DiffieHellman\n\nvar sign = require('browserify-sign')\n\nexports.createSign = sign.createSign\nexports.Sign = sign.Sign\nexports.createVerify = sign.createVerify\nexports.Verify = sign.Verify\n\nexports.createECDH = require('create-ecdh')\n\nvar publicEncrypt = require('public-encrypt')\n\nexports.publicEncrypt = publicEncrypt.publicEncrypt\nexports.privateEncrypt = publicEncrypt.privateEncrypt\nexports.publicDecrypt = publicEncrypt.publicDecrypt\nexports.privateDecrypt = publicEncrypt.privateDecrypt\n\n// the least I can do is make error messages for the rest of the node.js/crypto api.\n// ;[\n// 'createCredentials'\n// ].forEach(function (name) {\n// exports[name] = function () {\n// throw new Error([\n// 'sorry, ' + name + ' is not implemented yet',\n// 'we accept pull requests',\n// 'https://github.com/crypto-browserify/crypto-browserify'\n// ].join('\\n'))\n// }\n// })\n\nvar rf = require('randomfill')\n\nexports.randomFill = rf.randomFill\nexports.randomFillSync = rf.randomFillSync\n\nexports.createCredentials = function () {\n throw new Error([\n 'sorry, createCredentials is not implemented yet',\n 'we accept pull requests',\n 'https://github.com/crypto-browserify/crypto-browserify'\n ].join('\\n'))\n}\n\nexports.constants = {\n 'DH_CHECK_P_NOT_SAFE_PRIME': 2,\n 'DH_CHECK_P_NOT_PRIME': 1,\n 'DH_UNABLE_TO_CHECK_GENERATOR': 4,\n 'DH_NOT_SUITABLE_GENERATOR': 8,\n 'NPN_ENABLED': 1,\n 'ALPN_ENABLED': 1,\n 'RSA_PKCS1_PADDING': 1,\n 'RSA_SSLV23_PADDING': 2,\n 'RSA_NO_PADDING': 3,\n 'RSA_PKCS1_OAEP_PADDING': 4,\n 'RSA_X931_PADDING': 5,\n 'RSA_PKCS1_PSS_PADDING': 6,\n 'POINT_CONVERSION_COMPRESSED': 2,\n 'POINT_CONVERSION_UNCOMPRESSED': 4,\n 'POINT_CONVERSION_HYBRID': 6\n}\n","/**\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\n *\n * @version 0.8.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var INPUT_ERROR = 'input is invalid type';\n var FINALIZE_ERROR = 'finalize already called';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA3_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = global;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module === 'object' && module.exports;\n var AMD = typeof define === 'function' && define.amd;\n var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\n var CSHAKE_PADDING = [4, 1024, 262144, 67108864];\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\n var PADDING = [6, 1536, 393216, 100663296];\n var SHIFT = [0, 8, 16, 24];\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n var BITS = [224, 256, 384, 512];\n var SHAKE_BITS = [128, 256];\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];\n var CSHAKE_BYTEPAD = {\n '128': 168,\n '256': 136\n };\n\n if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n\n if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n\n var createOutputMethod = function (bits, padding, outputType) {\n return function (message) {\n return new Keccak(bits, padding, bits).update(message)[outputType]();\n };\n };\n\n var createShakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits) {\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\n };\n };\n\n var createCshakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits, n, s) {\n return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();\n };\n };\n\n var createKmacOutputMethod = function (bits, padding, outputType) {\n return function (key, message, outputBits, s) {\n return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();\n };\n };\n\n var createOutputMethods = function (method, createMethod, bits, padding) {\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createMethod(bits, padding, type);\n }\n return method;\n };\n\n var createMethod = function (bits, padding) {\n var method = createOutputMethod(bits, padding, 'hex');\n method.create = function () {\n return new Keccak(bits, padding, bits);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n return createOutputMethods(method, createOutputMethod, bits, padding);\n };\n\n var createShakeMethod = function (bits, padding) {\n var method = createShakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits) {\n return new Keccak(bits, padding, outputBits);\n };\n method.update = function (message, outputBits) {\n return method.create(outputBits).update(message);\n };\n return createOutputMethods(method, createShakeOutputMethod, bits, padding);\n };\n\n var createCshakeMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createCshakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits, n, s) {\n if (!n && !s) {\n return methods['shake' + bits].create(outputBits);\n } else {\n return new Keccak(bits, padding, outputBits).bytepad([n, s], w);\n }\n };\n method.update = function (message, outputBits, n, s) {\n return method.create(outputBits, n, s).update(message);\n };\n return createOutputMethods(method, createCshakeOutputMethod, bits, padding);\n };\n\n var createKmacMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createKmacOutputMethod(bits, padding, 'hex');\n method.create = function (key, outputBits, s) {\n return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);\n };\n method.update = function (key, message, outputBits, s) {\n return method.create(key, outputBits, s).update(message);\n };\n return createOutputMethods(method, createKmacOutputMethod, bits, padding);\n };\n\n var algorithms = [\n { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },\n { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },\n { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },\n { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },\n { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }\n ];\n\n var methods = {}, methodNames = [];\n\n for (var i = 0; i < algorithms.length; ++i) {\n var algorithm = algorithms[i];\n var bits = algorithm.bits;\n for (var j = 0; j < bits.length; ++j) {\n var methodName = algorithm.name + '_' + bits[j];\n methodNames.push(methodName);\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\n if (algorithm.name !== 'sha3') {\n var newMethodName = algorithm.name + bits[j];\n methodNames.push(newMethodName);\n methods[newMethodName] = methods[methodName];\n }\n }\n }\n\n function Keccak(bits, padding, outputBits) {\n this.blocks = [];\n this.s = [];\n this.padding = padding;\n this.outputBits = outputBits;\n this.reset = true;\n this.finalized = false;\n this.block = 0;\n this.start = 0;\n this.blockCount = (1600 - (bits << 1)) >> 5;\n this.byteCount = this.blockCount << 2;\n this.outputBlocks = outputBits >> 5;\n this.extraBytes = (outputBits & 31) >> 3;\n\n for (var i = 0; i < 50; ++i) {\n this.s[i] = 0;\n }\n }\n\n Keccak.prototype.update = function (message) {\n if (this.finalized) {\n throw new Error(FINALIZE_ERROR);\n }\n var notString, type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var blocks = this.blocks, byteCount = this.byteCount, length = message.length,\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\n\n while (index < length) {\n if (this.reset) {\n this.reset = false;\n blocks[0] = this.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (notString) {\n for (i = this.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n this.lastByteIndex = i;\n if (i >= byteCount) {\n this.start = i - byteCount;\n this.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n this.reset = true;\n } else {\n this.start = i;\n }\n }\n return this;\n };\n\n Keccak.prototype.encode = function (x, right) {\n var o = x & 255, n = 1;\n var bytes = [o];\n x = x >> 8;\n o = x & 255;\n while (o > 0) {\n bytes.unshift(o);\n x = x >> 8;\n o = x & 255;\n ++n;\n }\n if (right) {\n bytes.push(n);\n } else {\n bytes.unshift(n);\n }\n this.update(bytes);\n return bytes.length;\n };\n\n Keccak.prototype.encodeString = function (str) {\n var notString, type = typeof str;\n if (type !== 'string') {\n if (type === 'object') {\n if (str === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {\n str = new Uint8Array(str);\n } else if (!Array.isArray(str)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var bytes = 0, length = str.length;\n if (notString) {\n bytes = length;\n } else {\n for (var i = 0; i < str.length; ++i) {\n var code = str.charCodeAt(i);\n if (code < 0x80) {\n bytes += 1;\n } else if (code < 0x800) {\n bytes += 2;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes += 3;\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));\n bytes += 4;\n }\n }\n }\n bytes += this.encode(bytes * 8);\n this.update(str);\n return bytes;\n };\n\n Keccak.prototype.bytepad = function (strs, w) {\n var bytes = this.encode(w);\n for (var i = 0; i < strs.length; ++i) {\n bytes += this.encodeString(strs[i]);\n }\n var paddingBytes = w - bytes % w;\n var zeros = [];\n zeros.length = paddingBytes;\n this.update(zeros);\n return this;\n };\n\n Keccak.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\n blocks[i >> 2] |= this.padding[i & 3];\n if (this.lastByteIndex === this.byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n };\n\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var hex = '', block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n if (extraBytes) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\n if (extraBytes > 1) {\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\n }\n if (extraBytes > 2) {\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\n }\n }\n return hex;\n };\n\n Keccak.prototype.arrayBuffer = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var bytes = this.outputBits >> 3;\n var buffer;\n if (extraBytes) {\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\n } else {\n buffer = new ArrayBuffer(bytes);\n }\n var array = new Uint32Array(buffer);\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n array[j] = s[i];\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n array[i] = s[i];\n buffer = buffer.slice(0, bytes);\n }\n return buffer;\n };\n\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\n\n Keccak.prototype.digest = Keccak.prototype.array = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var array = [], offset, block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n array[offset + 1] = (block >> 8) & 0xFF;\n array[offset + 2] = (block >> 16) & 0xFF;\n array[offset + 3] = (block >> 24) & 0xFF;\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n if (extraBytes > 1) {\n array[offset + 1] = (block >> 8) & 0xFF;\n }\n if (extraBytes > 2) {\n array[offset + 2] = (block >> 16) & 0xFF;\n }\n }\n return array;\n };\n\n function Kmac(bits, padding, outputBits) {\n Keccak.call(this, bits, padding, outputBits);\n }\n\n Kmac.prototype = new Keccak();\n\n Kmac.prototype.finalize = function () {\n this.encode(this.outputBits, true);\n return Keccak.prototype.finalize.call(this);\n };\n\n var f = function (s) {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n };\n\n if (COMMON_JS) {\n module.exports = methods;\n } else {\n for (i = 0; i < methodNames.length; ++i) {\n root[methodNames[i]] = methods[methodNames[i]];\n }\n if (AMD) {\n define(function () {\n return methods;\n });\n }\n }\n})();\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR] = function () {\n return this;\n };\n // eslint-disable-next-line no-throw-literal\n Array.from(iteratorWithReturn, function () { throw 2; });\n} catch (error) { /* empty */ }\n\nmodule.exports = function (exec, SKIP_CLOSING) {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n};\n","var userAgent = require('../internals/engine-user-agent');\n\nmodule.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);\n","const generate = (num, fn) => {\n let a = [];\n for (var i = 0; i < num; ++i) a.push(fn(i));\n return a;\n};\n\nconst replicate = (num, val) => generate(num, () => val);\n\nconst concat = (a, b) => a.concat(b);\n\nconst flatten = a => {\n let r = [];\n for (let j = 0, J = a.length; j < J; ++j) for (let i = 0, I = a[j].length; i < I; ++i) r.push(a[j][i]);\n return r;\n};\n\nconst chunksOf = (n, a) => {\n let b = [];\n for (let i = 0, l = a.length; i < l; i += n) b.push(a.slice(i, i + n));\n return b;\n};\n\nmodule.exports = {\n generate,\n replicate,\n concat,\n flatten,\n chunksOf\n};","// `RequireObjectCoercible` abstract operation\n// https://tc39.github.io/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","var CipherBase = require('cipher-base')\nvar des = require('des.js')\nvar inherits = require('inherits')\nvar Buffer = require('safe-buffer').Buffer\n\nvar modes = {\n 'des-ede3-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede3': des.EDE,\n 'des-ede-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede': des.EDE,\n 'des-cbc': des.CBC.instantiate(des.DES),\n 'des-ecb': des.DES\n}\nmodes.des = modes['des-cbc']\nmodes.des3 = modes['des-ede3-cbc']\nmodule.exports = DES\ninherits(DES, CipherBase)\nfunction DES (opts) {\n CipherBase.call(this)\n var modeName = opts.mode.toLowerCase()\n var mode = modes[modeName]\n var type\n if (opts.decrypt) {\n type = 'decrypt'\n } else {\n type = 'encrypt'\n }\n var key = opts.key\n if (!Buffer.isBuffer(key)) {\n key = Buffer.from(key)\n }\n if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {\n key = Buffer.concat([key, key.slice(0, 8)])\n }\n var iv = opts.iv\n if (!Buffer.isBuffer(iv)) {\n iv = Buffer.from(iv)\n }\n this._des = mode.create({\n key: key,\n iv: iv,\n type: type\n })\n}\nDES.prototype._update = function (data) {\n return Buffer.from(this._des.update(data))\n}\nDES.prototype._final = function () {\n return Buffer.from(this._des.final())\n}\n","// This was ported from https://github.com/emn178/js-sha3, with some minor\n// modifications and pruning. It is licensed under MIT:\n//\n// Copyright 2015-2016 Chen, Yi-Cyuan\n// \n// Permission is hereby granted, free of charge, to any person obtaining\n// a copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to\n// the following conditions:\n// \n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nconst HEX_CHARS = '0123456789abcdef'.split('');\nconst KECCAK_PADDING = [1, 256, 65536, 16777216];\nconst SHIFT = [0, 8, 16, 24];\nconst RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n\nconst Keccak = bits => ({\n blocks: [],\n reset: true,\n block: 0,\n start: 0,\n blockCount: 1600 - (bits << 1) >> 5,\n outputBlocks: bits >> 5,\n s: (s => [].concat(s, s, s, s, s))([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n});\n\nconst update = (state, message) => {\n var length = message.length,\n blocks = state.blocks,\n byteCount = state.blockCount << 2,\n blockCount = state.blockCount,\n outputBlocks = state.outputBlocks,\n s = state.s,\n index = 0,\n i,\n code;\n\n // update\n while (index < length) {\n if (state.reset) {\n state.reset = false;\n blocks[0] = state.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (typeof message !== \"string\") {\n for (i = state.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = state.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | code >> 6) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | code >> 12) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + ((code & 0x3ff) << 10 | message.charCodeAt(++index) & 0x3ff);\n blocks[i >> 2] |= (0xf0 | code >> 18) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code >> 12 & 0x3f) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];\n }\n }\n }\n state.lastByteIndex = i;\n if (i >= byteCount) {\n state.start = i - byteCount;\n state.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n state.reset = true;\n } else {\n state.start = i;\n }\n }\n\n // finalize\n i = state.lastByteIndex;\n blocks[i >> 2] |= KECCAK_PADDING[i & 3];\n if (state.lastByteIndex === byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n\n // toString\n var hex = '',\n i = 0,\n j = 0,\n block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[block >> 4 & 0x0F] + HEX_CHARS[block & 0x0F] + HEX_CHARS[block >> 12 & 0x0F] + HEX_CHARS[block >> 8 & 0x0F] + HEX_CHARS[block >> 20 & 0x0F] + HEX_CHARS[block >> 16 & 0x0F] + HEX_CHARS[block >> 28 & 0x0F] + HEX_CHARS[block >> 24 & 0x0F];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n return \"0x\" + hex;\n};\n\nconst f = s => {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ (c2 << 1 | c3 >>> 31);\n l = c9 ^ (c3 << 1 | c2 >>> 31);\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ (c4 << 1 | c5 >>> 31);\n l = c1 ^ (c5 << 1 | c4 >>> 31);\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ (c6 << 1 | c7 >>> 31);\n l = c3 ^ (c7 << 1 | c6 >>> 31);\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ (c8 << 1 | c9 >>> 31);\n l = c5 ^ (c9 << 1 | c8 >>> 31);\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ (c0 << 1 | c1 >>> 31);\n l = c7 ^ (c1 << 1 | c0 >>> 31);\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = s[11] << 4 | s[10] >>> 28;\n b33 = s[10] << 4 | s[11] >>> 28;\n b14 = s[20] << 3 | s[21] >>> 29;\n b15 = s[21] << 3 | s[20] >>> 29;\n b46 = s[31] << 9 | s[30] >>> 23;\n b47 = s[30] << 9 | s[31] >>> 23;\n b28 = s[40] << 18 | s[41] >>> 14;\n b29 = s[41] << 18 | s[40] >>> 14;\n b20 = s[2] << 1 | s[3] >>> 31;\n b21 = s[3] << 1 | s[2] >>> 31;\n b2 = s[13] << 12 | s[12] >>> 20;\n b3 = s[12] << 12 | s[13] >>> 20;\n b34 = s[22] << 10 | s[23] >>> 22;\n b35 = s[23] << 10 | s[22] >>> 22;\n b16 = s[33] << 13 | s[32] >>> 19;\n b17 = s[32] << 13 | s[33] >>> 19;\n b48 = s[42] << 2 | s[43] >>> 30;\n b49 = s[43] << 2 | s[42] >>> 30;\n b40 = s[5] << 30 | s[4] >>> 2;\n b41 = s[4] << 30 | s[5] >>> 2;\n b22 = s[14] << 6 | s[15] >>> 26;\n b23 = s[15] << 6 | s[14] >>> 26;\n b4 = s[25] << 11 | s[24] >>> 21;\n b5 = s[24] << 11 | s[25] >>> 21;\n b36 = s[34] << 15 | s[35] >>> 17;\n b37 = s[35] << 15 | s[34] >>> 17;\n b18 = s[45] << 29 | s[44] >>> 3;\n b19 = s[44] << 29 | s[45] >>> 3;\n b10 = s[6] << 28 | s[7] >>> 4;\n b11 = s[7] << 28 | s[6] >>> 4;\n b42 = s[17] << 23 | s[16] >>> 9;\n b43 = s[16] << 23 | s[17] >>> 9;\n b24 = s[26] << 25 | s[27] >>> 7;\n b25 = s[27] << 25 | s[26] >>> 7;\n b6 = s[36] << 21 | s[37] >>> 11;\n b7 = s[37] << 21 | s[36] >>> 11;\n b38 = s[47] << 24 | s[46] >>> 8;\n b39 = s[46] << 24 | s[47] >>> 8;\n b30 = s[8] << 27 | s[9] >>> 5;\n b31 = s[9] << 27 | s[8] >>> 5;\n b12 = s[18] << 20 | s[19] >>> 12;\n b13 = s[19] << 20 | s[18] >>> 12;\n b44 = s[29] << 7 | s[28] >>> 25;\n b45 = s[28] << 7 | s[29] >>> 25;\n b26 = s[38] << 8 | s[39] >>> 24;\n b27 = s[39] << 8 | s[38] >>> 24;\n b8 = s[48] << 14 | s[49] >>> 18;\n b9 = s[49] << 14 | s[48] >>> 18;\n\n s[0] = b0 ^ ~b2 & b4;\n s[1] = b1 ^ ~b3 & b5;\n s[10] = b10 ^ ~b12 & b14;\n s[11] = b11 ^ ~b13 & b15;\n s[20] = b20 ^ ~b22 & b24;\n s[21] = b21 ^ ~b23 & b25;\n s[30] = b30 ^ ~b32 & b34;\n s[31] = b31 ^ ~b33 & b35;\n s[40] = b40 ^ ~b42 & b44;\n s[41] = b41 ^ ~b43 & b45;\n s[2] = b2 ^ ~b4 & b6;\n s[3] = b3 ^ ~b5 & b7;\n s[12] = b12 ^ ~b14 & b16;\n s[13] = b13 ^ ~b15 & b17;\n s[22] = b22 ^ ~b24 & b26;\n s[23] = b23 ^ ~b25 & b27;\n s[32] = b32 ^ ~b34 & b36;\n s[33] = b33 ^ ~b35 & b37;\n s[42] = b42 ^ ~b44 & b46;\n s[43] = b43 ^ ~b45 & b47;\n s[4] = b4 ^ ~b6 & b8;\n s[5] = b5 ^ ~b7 & b9;\n s[14] = b14 ^ ~b16 & b18;\n s[15] = b15 ^ ~b17 & b19;\n s[24] = b24 ^ ~b26 & b28;\n s[25] = b25 ^ ~b27 & b29;\n s[34] = b34 ^ ~b36 & b38;\n s[35] = b35 ^ ~b37 & b39;\n s[44] = b44 ^ ~b46 & b48;\n s[45] = b45 ^ ~b47 & b49;\n s[6] = b6 ^ ~b8 & b0;\n s[7] = b7 ^ ~b9 & b1;\n s[16] = b16 ^ ~b18 & b10;\n s[17] = b17 ^ ~b19 & b11;\n s[26] = b26 ^ ~b28 & b20;\n s[27] = b27 ^ ~b29 & b21;\n s[36] = b36 ^ ~b38 & b30;\n s[37] = b37 ^ ~b39 & b31;\n s[46] = b46 ^ ~b48 & b40;\n s[47] = b47 ^ ~b49 & b41;\n s[8] = b8 ^ ~b0 & b2;\n s[9] = b9 ^ ~b1 & b3;\n s[18] = b18 ^ ~b10 & b12;\n s[19] = b19 ^ ~b11 & b13;\n s[28] = b28 ^ ~b20 & b22;\n s[29] = b29 ^ ~b21 & b23;\n s[38] = b38 ^ ~b30 & b32;\n s[39] = b39 ^ ~b31 & b33;\n s[48] = b48 ^ ~b40 & b42;\n s[49] = b49 ^ ~b41 & b43;\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n};\n\nconst keccak = bits => str => {\n var msg;\n if (str.slice(0, 2) === \"0x\") {\n msg = [];\n for (var i = 2, l = str.length; i < l; i += 2) msg.push(parseInt(str.slice(i, i + 2), 16));\n } else {\n msg = str;\n }\n return update(Keccak(bits, bits), msg);\n};\n\nmodule.exports = {\n keccak256: keccak(256),\n keccak512: keccak(512),\n keccak256s: keccak(256),\n keccak512s: keccak(512)\n};","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*\n This file is part of web3.js.\n\n web3.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n web3.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with web3.js. If not, see .\n */\n/**\n * @file index.js\n * @author Fabian Vogelsteller \n * @date 2017\n */\n\n\"use strict\";\n\nvar _ = require('underscore');\nvar core = require('web3-core');\nvar helpers = require('web3-core-helpers');\nvar Subscriptions = require('web3-core-subscriptions').subscriptions;\nvar Method = require('web3-core-method');\nvar utils = require('web3-utils');\nvar Net = require('web3-net');\n\nvar ENS = require('web3-eth-ens');\nvar Personal = require('web3-eth-personal');\nvar BaseContract = require('web3-eth-contract');\nvar Iban = require('web3-eth-iban');\nvar Accounts = require('web3-eth-accounts');\nvar abi = require('web3-eth-abi');\n\nvar getNetworkType = require('./getNetworkType.js');\nvar formatter = helpers.formatters;\n\n\nvar blockCall = function (args) {\n return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? \"eth_getBlockByHash\" : \"eth_getBlockByNumber\";\n};\n\nvar transactionFromBlockCall = function (args) {\n return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';\n};\n\nvar uncleCall = function (args) {\n return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';\n};\n\nvar getBlockTransactionCountCall = function (args) {\n return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber';\n};\n\nvar uncleCountCall = function (args) {\n return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber';\n};\n\n\nvar Eth = function Eth() {\n var _this = this;\n\n // sets _requestmanager\n core.packageInit(this, arguments);\n\n // overwrite setProvider\n var setProvider = this.setProvider;\n this.setProvider = function () {\n setProvider.apply(_this, arguments);\n _this.net.setProvider.apply(_this, arguments);\n _this.personal.setProvider.apply(_this, arguments);\n _this.accounts.setProvider.apply(_this, arguments);\n _this.Contract.setProvider(_this.currentProvider, _this.accounts);\n };\n\n\n var handleRevert = false;\n var defaultAccount = null;\n var defaultBlock = 'latest';\n var transactionBlockTimeout = 50;\n var transactionConfirmationBlocks = 24;\n var transactionPollingTimeout = 750;\n var defaultChain, defaultHardfork, defaultCommon;\n\n Object.defineProperty(this, 'handleRevert', {\n get: function () {\n return handleRevert;\n },\n set: function (val) {\n handleRevert = val;\n\n // also set on the Contract object\n _this.Contract.handleRevert = handleRevert;\n\n // update handleRevert\n methods.forEach(function(method) {\n method.handleRevert = handleRevert;\n });\n },\n enumerable: true\n });\n Object.defineProperty(this, 'defaultCommon', {\n get: function () {\n return defaultCommon;\n },\n set: function (val) {\n defaultCommon = val;\n\n // also set on the Contract object\n _this.Contract.defaultCommon = defaultCommon;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.defaultCommon = defaultCommon;\n });\n },\n enumerable: true\n });\n Object.defineProperty(this, 'defaultHardfork', {\n get: function () {\n return defaultHardfork;\n },\n set: function (val) {\n defaultHardfork = val;\n\n // also set on the Contract object\n _this.Contract.defaultHardfork = defaultHardfork;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.defaultHardfork = defaultHardfork;\n });\n },\n enumerable: true\n });\n Object.defineProperty(this, 'defaultChain', {\n get: function () {\n return defaultChain;\n },\n set: function (val) {\n defaultChain = val;\n\n // also set on the Contract object\n _this.Contract.defaultChain = defaultChain;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.defaultChain = defaultChain;\n });\n },\n enumerable: true\n });\n Object.defineProperty(this, 'transactionPollingTimeout', {\n get: function () {\n return transactionPollingTimeout;\n },\n set: function (val) {\n transactionPollingTimeout = val;\n\n // also set on the Contract object\n _this.Contract.transactionPollingTimeout = transactionPollingTimeout;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.transactionPollingTimeout = transactionPollingTimeout;\n });\n },\n enumerable: true\n });\n Object.defineProperty(this, 'transactionConfirmationBlocks', {\n get: function () {\n return transactionConfirmationBlocks;\n },\n set: function (val) {\n transactionConfirmationBlocks = val;\n\n // also set on the Contract object\n _this.Contract.transactionConfirmationBlocks = transactionConfirmationBlocks;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.transactionConfirmationBlocks = transactionConfirmationBlocks;\n });\n },\n enumerable: true\n });\n Object.defineProperty(this, 'transactionBlockTimeout', {\n get: function () {\n return transactionBlockTimeout;\n },\n set: function (val) {\n transactionBlockTimeout = val;\n\n // also set on the Contract object\n _this.Contract.transactionBlockTimeout = transactionBlockTimeout;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.transactionBlockTimeout = transactionBlockTimeout;\n });\n },\n enumerable: true\n });\n Object.defineProperty(this, 'defaultAccount', {\n get: function () {\n return defaultAccount;\n },\n set: function (val) {\n if(val) {\n defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val));\n }\n\n // also set on the Contract object\n _this.Contract.defaultAccount = defaultAccount;\n _this.personal.defaultAccount = defaultAccount;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.defaultAccount = defaultAccount;\n });\n\n return val;\n },\n enumerable: true\n });\n Object.defineProperty(this, 'defaultBlock', {\n get: function () {\n return defaultBlock;\n },\n set: function (val) {\n defaultBlock = val;\n // also set on the Contract object\n _this.Contract.defaultBlock = defaultBlock;\n _this.personal.defaultBlock = defaultBlock;\n\n // update defaultBlock\n methods.forEach(function(method) {\n method.defaultBlock = defaultBlock;\n });\n\n return val;\n },\n enumerable: true\n });\n\n\n this.clearSubscriptions = _this._requestManager.clearSubscriptions;\n\n // add net\n this.net = new Net(this.currentProvider);\n // add chain detection\n this.net.getNetworkType = getNetworkType.bind(this);\n\n // add accounts\n this.accounts = new Accounts(this.currentProvider);\n\n // add personal\n this.personal = new Personal(this.currentProvider);\n this.personal.defaultAccount = this.defaultAccount;\n\n // create a proxy Contract type for this instance, as a Contract's provider\n // is stored as a class member rather than an instance variable. If we do\n // not create this proxy type, changing the provider in one instance of\n // web3-eth would subsequently change the provider for _all_ contract\n // instances!\n var self = this;\n var Contract = function Contract() {\n BaseContract.apply(this, arguments);\n\n // when Eth.setProvider is called, call packageInit\n // on all contract instances instantiated via this Eth\n // instances. This will update the currentProvider for\n // the contract instances\n var _this = this;\n var setProvider = self.setProvider;\n self.setProvider = function() {\n setProvider.apply(self, arguments);\n core.packageInit(_this, [self.currentProvider]);\n };\n };\n\n Contract.setProvider = function() {\n BaseContract.setProvider.apply(this, arguments);\n };\n\n // make our proxy Contract inherit from web3-eth-contract so that it has all\n // the right functionality and so that instanceof and friends work properly\n Contract.prototype = Object.create(BaseContract.prototype);\n Contract.prototype.constructor = Contract;\n\n // add contract\n this.Contract = Contract;\n this.Contract.defaultAccount = this.defaultAccount;\n this.Contract.defaultBlock = this.defaultBlock;\n this.Contract.transactionBlockTimeout = this.transactionBlockTimeout;\n this.Contract.transactionConfirmationBlocks = this.transactionConfirmationBlocks;\n this.Contract.transactionPollingTimeout = this.transactionPollingTimeout;\n this.Contract.handleRevert = this.handleRevert;\n this.Contract.setProvider(this.currentProvider, this.accounts);\n\n // add IBAN\n this.Iban = Iban;\n\n // add ABI\n this.abi = abi;\n\n // add ENS\n this.ens = new ENS(this);\n\n var methods = [\n new Method({\n name: 'getNodeInfo',\n call: 'web3_clientVersion'\n }),\n new Method({\n name: 'getProtocolVersion',\n call: 'eth_protocolVersion',\n params: 0\n }),\n new Method({\n name: 'getCoinbase',\n call: 'eth_coinbase',\n params: 0\n }),\n new Method({\n name: 'isMining',\n call: 'eth_mining',\n params: 0\n }),\n new Method({\n name: 'getHashrate',\n call: 'eth_hashrate',\n params: 0,\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'isSyncing',\n call: 'eth_syncing',\n params: 0,\n outputFormatter: formatter.outputSyncingFormatter\n }),\n new Method({\n name: 'getGasPrice',\n call: 'eth_gasPrice',\n params: 0,\n outputFormatter: formatter.outputBigNumberFormatter\n }),\n new Method({\n name: 'getAccounts',\n call: 'eth_accounts',\n params: 0,\n outputFormatter: utils.toChecksumAddress\n }),\n new Method({\n name: 'getBlockNumber',\n call: 'eth_blockNumber',\n params: 0,\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'getBalance',\n call: 'eth_getBalance',\n params: 2,\n inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter],\n outputFormatter: formatter.outputBigNumberFormatter\n }),\n new Method({\n name: 'getStorageAt',\n call: 'eth_getStorageAt',\n params: 3,\n inputFormatter: [formatter.inputAddressFormatter, utils.numberToHex, formatter.inputDefaultBlockNumberFormatter]\n }),\n new Method({\n name: 'getCode',\n call: 'eth_getCode',\n params: 2,\n inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter]\n }),\n new Method({\n name: 'getBlock',\n call: blockCall,\n params: 2,\n inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { return !!val; }],\n outputFormatter: formatter.outputBlockFormatter\n }),\n new Method({\n name: 'getUncle',\n call: uncleCall,\n params: 2,\n inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex],\n outputFormatter: formatter.outputBlockFormatter,\n\n }),\n new Method({\n name: 'getBlockTransactionCount',\n call: getBlockTransactionCountCall,\n params: 1,\n inputFormatter: [formatter.inputBlockNumberFormatter],\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'getBlockUncleCount',\n call: uncleCountCall,\n params: 1,\n inputFormatter: [formatter.inputBlockNumberFormatter],\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'getTransaction',\n call: 'eth_getTransactionByHash',\n params: 1,\n inputFormatter: [null],\n outputFormatter: formatter.outputTransactionFormatter\n }),\n new Method({\n name: 'getTransactionFromBlock',\n call: transactionFromBlockCall,\n params: 2,\n inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex],\n outputFormatter: formatter.outputTransactionFormatter\n }),\n new Method({\n name: 'getTransactionReceipt',\n call: 'eth_getTransactionReceipt',\n params: 1,\n inputFormatter: [null],\n outputFormatter: formatter.outputTransactionReceiptFormatter\n }),\n new Method({\n name: 'getTransactionCount',\n call: 'eth_getTransactionCount',\n params: 2,\n inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter],\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'sendSignedTransaction',\n call: 'eth_sendRawTransaction',\n params: 1,\n inputFormatter: [null]\n }),\n new Method({\n name: 'signTransaction',\n call: 'eth_signTransaction',\n params: 1,\n inputFormatter: [formatter.inputTransactionFormatter]\n }),\n new Method({\n name: 'sendTransaction',\n call: 'eth_sendTransaction',\n params: 1,\n inputFormatter: [formatter.inputTransactionFormatter],\n abiCoder: abi\n }),\n new Method({\n name: 'sign',\n call: 'eth_sign',\n params: 2,\n inputFormatter: [formatter.inputSignFormatter, formatter.inputAddressFormatter],\n transformPayload: function (payload) {\n payload.params.reverse();\n return payload;\n }\n }),\n new Method({\n name: 'call',\n call: 'eth_call',\n params: 2,\n inputFormatter: [formatter.inputCallFormatter, formatter.inputDefaultBlockNumberFormatter],\n abiCoder: abi\n }),\n new Method({\n name: 'estimateGas',\n call: 'eth_estimateGas',\n params: 1,\n inputFormatter: [formatter.inputCallFormatter],\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'submitWork',\n call: 'eth_submitWork',\n params: 3\n }),\n new Method({\n name: 'getWork',\n call: 'eth_getWork',\n params: 0\n }),\n new Method({\n name: 'getPastLogs',\n call: 'eth_getLogs',\n params: 1,\n inputFormatter: [formatter.inputLogFormatter],\n outputFormatter: formatter.outputLogFormatter\n }),\n new Method({\n name: 'getChainId',\n call: 'eth_chainId',\n params: 0,\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'requestAccounts',\n call: 'eth_requestAccounts',\n params: 0,\n outputFormatter: utils.toChecksumAddress\n }),\n new Method({\n name: 'getProof',\n call: 'eth_getProof',\n params: 3,\n inputFormatter: [formatter.inputAddressFormatter, formatter.inputStorageKeysFormatter, formatter.inputDefaultBlockNumberFormatter],\n outputFormatter: formatter.outputProofFormatter\n }),\n new Method({\n name: 'getPendingTransactions',\n call: 'eth_pendingTransactions',\n params: 0,\n outputFormatter: formatter.outputTransactionFormatter\n }),\n\n // subscriptions\n new Subscriptions({\n name: 'subscribe',\n type: 'eth',\n subscriptions: {\n 'newBlockHeaders': {\n // TODO rename on RPC side?\n subscriptionName: 'newHeads', // replace subscription with this name\n params: 0,\n outputFormatter: formatter.outputBlockFormatter\n },\n 'pendingTransactions': {\n subscriptionName: 'newPendingTransactions', // replace subscription with this name\n params: 0\n },\n 'logs': {\n params: 1,\n inputFormatter: [formatter.inputLogFormatter],\n outputFormatter: formatter.outputLogFormatter,\n // DUBLICATE, also in web3-eth-contract\n subscriptionHandler: function (output) {\n if(output.removed) {\n this.emit('changed', output);\n } else {\n this.emit('data', output);\n }\n\n if (_.isFunction(this.callback)) {\n this.callback(null, output, this);\n }\n }\n },\n 'syncing': {\n params: 0,\n outputFormatter: formatter.outputSyncingFormatter,\n subscriptionHandler: function (output) {\n var _this = this;\n\n // fire TRUE at start\n if(this._isSyncing !== true) {\n this._isSyncing = true;\n this.emit('changed', _this._isSyncing);\n\n if (_.isFunction(this.callback)) {\n this.callback(null, _this._isSyncing, this);\n }\n\n setTimeout(function () {\n _this.emit('data', output);\n\n if (_.isFunction(_this.callback)) {\n _this.callback(null, output, _this);\n }\n }, 0);\n\n // fire sync status\n } else {\n this.emit('data', output);\n if (_.isFunction(_this.callback)) {\n this.callback(null, output, this);\n }\n\n // wait for some time before fireing the FALSE\n clearTimeout(this._isSyncingTimeout);\n this._isSyncingTimeout = setTimeout(function () {\n if(output.currentBlock > output.highestBlock - 200) {\n _this._isSyncing = false;\n _this.emit('changed', _this._isSyncing);\n\n if (_.isFunction(_this.callback)) {\n _this.callback(null, _this._isSyncing, _this);\n }\n }\n }, 500);\n }\n }\n }\n }\n })\n ];\n\n methods.forEach(function(method) {\n method.attachToObject(_this);\n method.setRequestManager(_this._requestManager, _this.accounts); // second param means is eth.accounts (necessary for wallet signing)\n method.defaultBlock = _this.defaultBlock;\n method.defaultAccount = _this.defaultAccount;\n method.transactionBlockTimeout = _this.transactionBlockTimeout;\n method.transactionConfirmationBlocks = _this.transactionConfirmationBlocks;\n method.transactionPollingTimeout = _this.transactionPollingTimeout;\n method.handleRevert = _this.handleRevert;\n });\n\n};\n\ncore.addProviders(Eth);\n\n\nmodule.exports = Eth;\n\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nvar Cipher = require('./cipher');\nvar DES = require('./des');\n\nfunction EDEState(type, key) {\n assert.equal(key.length, 24, 'Invalid key length');\n\n var k1 = key.slice(0, 8);\n var k2 = key.slice(8, 16);\n var k3 = key.slice(16, 24);\n\n if (type === 'encrypt') {\n this.ciphers = [\n DES.create({ type: 'encrypt', key: k1 }),\n DES.create({ type: 'decrypt', key: k2 }),\n DES.create({ type: 'encrypt', key: k3 })\n ];\n } else {\n this.ciphers = [\n DES.create({ type: 'decrypt', key: k3 }),\n DES.create({ type: 'encrypt', key: k2 }),\n DES.create({ type: 'decrypt', key: k1 })\n ];\n }\n}\n\nfunction EDE(options) {\n Cipher.call(this, options);\n\n var state = new EDEState(this.type, this.options.key);\n this._edeState = state;\n}\ninherits(EDE, Cipher);\n\nmodule.exports = EDE;\n\nEDE.create = function create(options) {\n return new EDE(options);\n};\n\nEDE.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._edeState;\n\n state.ciphers[0]._update(inp, inOff, out, outOff);\n state.ciphers[1]._update(out, outOff, out, outOff);\n state.ciphers[2]._update(out, outOff, out, outOff);\n};\n\nEDE.prototype._pad = DES.prototype._pad;\nEDE.prototype._unpad = DES.prototype._unpad;\n","var checkParameters = require('./precondition')\nvar defaultEncoding = require('./default-encoding')\nvar sync = require('./sync')\nvar Buffer = require('safe-buffer').Buffer\n\nvar ZERO_BUF\nvar subtle = global.crypto && global.crypto.subtle\nvar toBrowser = {\n 'sha': 'SHA-1',\n 'sha-1': 'SHA-1',\n 'sha1': 'SHA-1',\n 'sha256': 'SHA-256',\n 'sha-256': 'SHA-256',\n 'sha384': 'SHA-384',\n 'sha-384': 'SHA-384',\n 'sha-512': 'SHA-512',\n 'sha512': 'SHA-512'\n}\nvar checks = []\nfunction checkNative (algo) {\n if (global.process && !global.process.browser) {\n return Promise.resolve(false)\n }\n if (!subtle || !subtle.importKey || !subtle.deriveBits) {\n return Promise.resolve(false)\n }\n if (checks[algo] !== undefined) {\n return checks[algo]\n }\n ZERO_BUF = ZERO_BUF || Buffer.alloc(8)\n var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)\n .then(function () {\n return true\n }).catch(function () {\n return false\n })\n checks[algo] = prom\n return prom\n}\n\nfunction browserPbkdf2 (password, salt, iterations, length, algo) {\n return subtle.importKey(\n 'raw', password, {name: 'PBKDF2'}, false, ['deriveBits']\n ).then(function (key) {\n return subtle.deriveBits({\n name: 'PBKDF2',\n salt: salt,\n iterations: iterations,\n hash: {\n name: algo\n }\n }, key, length << 3)\n }).then(function (res) {\n return Buffer.from(res)\n })\n}\n\nfunction resolvePromise (promise, callback) {\n promise.then(function (out) {\n process.nextTick(function () {\n callback(null, out)\n })\n }, function (e) {\n process.nextTick(function () {\n callback(e)\n })\n })\n}\nmodule.exports = function (password, salt, iterations, keylen, digest, callback) {\n if (typeof digest === 'function') {\n callback = digest\n digest = undefined\n }\n\n digest = digest || 'sha1'\n var algo = toBrowser[digest.toLowerCase()]\n\n if (!algo || typeof global.Promise !== 'function') {\n return process.nextTick(function () {\n var out\n try {\n out = sync(password, salt, iterations, keylen, digest)\n } catch (e) {\n return callback(e)\n }\n callback(null, out)\n })\n }\n\n checkParameters(password, salt, iterations, keylen)\n if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')\n if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding)\n if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding)\n\n resolvePromise(checkNative(algo).then(function (resp) {\n if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)\n\n return sync(password, salt, iterations, keylen, digest)\n }), callback)\n}\n","/*\n This file is part of web3.js.\n\n web3.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n web3.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with web3.js. If not, see .\n */\n/**\n * @file soliditySha3.js\n * @author Fabian Vogelsteller \n * @date 2017\n */\n\nvar _ = require('underscore');\nvar BN = require('bn.js');\nvar utils = require('./utils.js');\n\n\nvar _elementaryName = function (name) {\n /*jshint maxcomplexity:false */\n\n if (name.startsWith('int[')) {\n return 'int256' + name.slice(3);\n } else if (name === 'int') {\n return 'int256';\n } else if (name.startsWith('uint[')) {\n return 'uint256' + name.slice(4);\n } else if (name === 'uint') {\n return 'uint256';\n } else if (name.startsWith('fixed[')) {\n return 'fixed128x128' + name.slice(5);\n } else if (name === 'fixed') {\n return 'fixed128x128';\n } else if (name.startsWith('ufixed[')) {\n return 'ufixed128x128' + name.slice(6);\n } else if (name === 'ufixed') {\n return 'ufixed128x128';\n }\n return name;\n};\n\n// Parse N from type\nvar _parseTypeN = function (type) {\n var typesize = /^\\D+(\\d+).*$/.exec(type);\n return typesize ? parseInt(typesize[1], 10) : null;\n};\n\n// Parse N from type[]\nvar _parseTypeNArray = function (type) {\n var arraySize = /^\\D+\\d*\\[(\\d+)\\]$/.exec(type);\n return arraySize ? parseInt(arraySize[1], 10) : null;\n};\n\nvar _parseNumber = function (arg) {\n var type = typeof arg;\n if (type === 'string') {\n if (utils.isHexStrict(arg)) {\n return new BN(arg.replace(/0x/i,''), 16);\n } else {\n return new BN(arg, 10);\n }\n } else if (type === 'number') {\n return new BN(arg);\n } else if (utils.isBigNumber(arg)) {\n return new BN(arg.toString(10));\n } else if (utils.isBN(arg)) {\n return arg;\n } else {\n throw new Error(arg +' is not a number');\n }\n};\n\nvar _solidityPack = function (type, value, arraySize) {\n /*jshint maxcomplexity:false */\n\n var size, num;\n type = _elementaryName(type);\n\n\n if (type === 'bytes') {\n\n if (value.replace(/^0x/i,'').length % 2 !== 0) {\n throw new Error('Invalid bytes characters '+ value.length);\n }\n\n return value;\n } else if (type === 'string') {\n return utils.utf8ToHex(value);\n } else if (type === 'bool') {\n return value ? '01' : '00';\n } else if (type.startsWith('address')) {\n if(arraySize) {\n size = 64;\n } else {\n size = 40;\n }\n\n if(!utils.isAddress(value)) {\n throw new Error(value +' is not a valid address, or the checksum is invalid.');\n }\n\n return utils.leftPad(value.toLowerCase(), size);\n }\n\n size = _parseTypeN(type);\n\n if (type.startsWith('bytes')) {\n\n if(!size) {\n throw new Error('bytes[] not yet supported in solidity');\n }\n\n // must be 32 byte slices when in an array\n if(arraySize) {\n size = 32;\n }\n\n if (size < 1 || size > 32 || size < value.replace(/^0x/i,'').length / 2 ) {\n throw new Error('Invalid bytes' + size +' for '+ value);\n }\n\n return utils.rightPad(value, size * 2);\n } else if (type.startsWith('uint')) {\n\n if ((size % 8) || (size < 8) || (size > 256)) {\n throw new Error('Invalid uint'+size+' size');\n }\n\n num = _parseNumber(value);\n if (num.bitLength() > size) {\n throw new Error('Supplied uint exceeds width: ' + size + ' vs ' + num.bitLength());\n }\n\n if(num.lt(new BN(0))) {\n throw new Error('Supplied uint '+ num.toString() +' is negative');\n }\n\n return size ? utils.leftPad(num.toString('hex'), size/8 * 2) : num;\n } else if (type.startsWith('int')) {\n\n if ((size % 8) || (size < 8) || (size > 256)) {\n throw new Error('Invalid int'+size+' size');\n }\n\n num = _parseNumber(value);\n if (num.bitLength() > size) {\n throw new Error('Supplied int exceeds width: ' + size + ' vs ' + num.bitLength());\n }\n\n if(num.lt(new BN(0))) {\n return num.toTwos(size).toString('hex');\n } else {\n return size ? utils.leftPad(num.toString('hex'), size/8 * 2) : num;\n }\n\n } else {\n // FIXME: support all other types\n throw new Error('Unsupported or invalid type: ' + type);\n }\n};\n\n\nvar _processSoliditySha3Args = function (arg) {\n /*jshint maxcomplexity:false */\n\n if(_.isArray(arg)) {\n throw new Error('Autodetection of array types is not supported.');\n }\n\n var type, value = '';\n var hexArg, arraySize;\n\n // if type is given\n if (_.isObject(arg) && (arg.hasOwnProperty('v') || arg.hasOwnProperty('t') || arg.hasOwnProperty('value') || arg.hasOwnProperty('type'))) {\n type = arg.hasOwnProperty('t') ? arg.t : arg.type;\n value = arg.hasOwnProperty('v') ? arg.v : arg.value;\n\n // otherwise try to guess the type\n } else {\n\n type = utils.toHex(arg, true);\n value = utils.toHex(arg);\n\n if (!type.startsWith('int') && !type.startsWith('uint')) {\n type = 'bytes';\n }\n }\n\n if ((type.startsWith('int') || type.startsWith('uint')) && typeof value === 'string' && !/^(-)?0x/i.test(value)) {\n value = new BN(value);\n }\n\n // get the array size\n if(_.isArray(value)) {\n arraySize = _parseTypeNArray(type);\n if(arraySize && value.length !== arraySize) {\n throw new Error(type +' is not matching the given array '+ JSON.stringify(value));\n } else {\n arraySize = value.length;\n }\n }\n\n\n if (_.isArray(value)) {\n hexArg = value.map(function (val) {\n return _solidityPack(type, val, arraySize).toString('hex').replace('0x','');\n });\n return hexArg.join('');\n } else {\n hexArg = _solidityPack(type, value, arraySize);\n return hexArg.toString('hex').replace('0x','');\n }\n\n};\n\n/**\n * Hashes solidity values to a sha3 hash using keccak 256\n *\n * @method soliditySha3\n * @return {Object} the sha3\n */\nvar soliditySha3 = function () {\n /*jshint maxcomplexity:false */\n\n var args = Array.prototype.slice.call(arguments);\n\n var hexArgs = _.map(args, _processSoliditySha3Args);\n\n // console.log(args, hexArgs);\n // console.log('0x'+ hexArgs.join(''));\n\n return utils.sha3('0x'+ hexArgs.join(''));\n};\n\n/**\n * Hashes solidity values to a sha3 hash using keccak 256 but does return the hash of value `null` instead of `null`\n *\n * @method soliditySha3Raw\n * @return {Object} the sha3\n */\nvar soliditySha3Raw = function () {\n return utils.sha3Raw('0x'+ _.map(Array.prototype.slice.call(arguments), _processSoliditySha3Args).join(''));\n};\n\n\nmodule.exports = {\n soliditySha3: soliditySha3,\n soliditySha3Raw: soliditySha3Raw\n};\n","var decoders = exports;\n\ndecoders.der = require('./der');\ndecoders.pem = require('./pem');\n","'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n","\"use strict\";\n\nvar RESOLVER = [\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"interfaceID\",\n \"type\": \"bytes4\"\n }\n ],\n \"name\": \"supportsInterface\",\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"contentTypes\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"ABI\",\n \"outputs\": [\n {\n \"name\": \"contentType\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"data\",\n \"type\": \"bytes\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"hash\",\n \"type\": \"bytes\"\n }\n ],\n \"name\": \"setMultihash\",\n \"outputs\": [],\n \"payable\": false,\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"multihash\",\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bytes\"\n }\n ],\n \"payable\": false,\n \"stateMutability\": \"view\",\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"x\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"y\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"setPubkey\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"content\",\n \"outputs\": [\n {\n \"name\": \"ret\",\n \"type\": \"bytes32\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"addr\",\n \"outputs\": [\n {\n \"name\": \"ret\",\n \"type\": \"address\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"contentType\",\n \"type\": \"uint256\"\n },\n {\n \"name\": \"data\",\n \"type\": \"bytes\"\n }\n ],\n \"name\": \"setABI\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"name\",\n \"outputs\": [\n {\n \"name\": \"ret\",\n \"type\": \"string\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"name\",\n \"type\": \"string\"\n }\n ],\n \"name\": \"setName\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"hash\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"setContent\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": true,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"pubkey\",\n \"outputs\": [\n {\n \"name\": \"x\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"y\",\n \"type\": \"bytes32\"\n }\n ],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"constant\": false,\n \"inputs\": [\n {\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"name\": \"addr\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"setAddr\",\n \"outputs\": [],\n \"payable\": false,\n \"type\": \"function\"\n },\n {\n \"inputs\": [\n {\n \"name\": \"ensAddr\",\n \"type\": \"address\"\n }\n ],\n \"payable\": false,\n \"type\": \"constructor\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"a\",\n \"type\": \"address\"\n }\n ],\n \"name\": \"AddrChanged\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"hash\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"ContentChanged\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"name\",\n \"type\": \"string\"\n }\n ],\n \"name\": \"NameChanged\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": true,\n \"name\": \"contentType\",\n \"type\": \"uint256\"\n }\n ],\n \"name\": \"ABIChanged\",\n \"type\": \"event\"\n },\n {\n \"anonymous\": false,\n \"inputs\": [\n {\n \"indexed\": true,\n \"name\": \"node\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"x\",\n \"type\": \"bytes32\"\n },\n {\n \"indexed\": false,\n \"name\": \"y\",\n \"type\": \"bytes32\"\n }\n ],\n \"name\": \"PubkeyChanged\",\n \"type\": \"event\"\n }\n];\n\nmodule.exports = RESOLVER;\n","/*\n This file is part of web3.js.\n\n web3.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n web3.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with web3.js. If not, see .\n */\n/**\n * @file accounts.js\n * @author Fabian Vogelsteller \n * @date 2017\n */\n\n'use strict';\n\nvar _ = require('underscore');\nvar core = require('web3-core');\nvar Method = require('web3-core-method');\nvar Promise = require('any-promise');\nvar Account = require('eth-lib/lib/account');\nvar Hash = require('eth-lib/lib/hash');\nvar RLP = require('eth-lib/lib/rlp');// jshint ignore:line\nvar Bytes = require('eth-lib/lib/bytes');// jshint ignore:line\nvar cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto');\nvar scrypt = require('@web3-js/scrypt-shim');\nvar uuid = require('uuid');\nvar utils = require('web3-utils');\nvar helpers = require('web3-core-helpers');\nvar Transaction = require('ethereumjs-tx').Transaction;\nvar Common = require('ethereumjs-common').default;\n\n\nvar isNot = function(value) {\n return (_.isUndefined(value) || _.isNull(value));\n};\n\nvar Accounts = function Accounts() {\n var _this = this;\n\n // sets _requestmanager\n core.packageInit(this, arguments);\n\n // remove unecessary core functions\n delete this.BatchRequest;\n delete this.extend;\n\n var _ethereumCall = [\n new Method({\n name: 'getNetworkId',\n call: 'net_version',\n params: 0,\n outputFormatter: parseInt\n }),\n new Method({\n name: 'getChainId',\n call: 'eth_chainId',\n params: 0,\n outputFormatter: utils.hexToNumber\n }),\n new Method({\n name: 'getGasPrice',\n call: 'eth_gasPrice',\n params: 0\n }),\n new Method({\n name: 'getTransactionCount',\n call: 'eth_getTransactionCount',\n params: 2,\n inputFormatter: [function(address) {\n if (utils.isAddress(address)) {\n return address;\n } else {\n throw new Error('Address ' + address + ' is not a valid address to get the \"transactionCount\".');\n }\n }, function() {\n return 'latest';\n }]\n })\n ];\n // attach methods to this._ethereumCall\n this._ethereumCall = {};\n _.each(_ethereumCall, function(method) {\n method.attachToObject(_this._ethereumCall);\n method.setRequestManager(_this._requestManager);\n });\n\n\n this.wallet = new Wallet(this);\n};\n\nAccounts.prototype._addAccountFunctions = function(account) {\n var _this = this;\n\n // add sign functions\n account.signTransaction = function signTransaction(tx, callback) {\n return _this.signTransaction(tx, account.privateKey, callback);\n };\n account.sign = function sign(data) {\n return _this.sign(data, account.privateKey);\n };\n\n account.encrypt = function encrypt(password, options) {\n return _this.encrypt(account.privateKey, password, options);\n };\n\n\n return account;\n};\n\nAccounts.prototype.create = function create(entropy) {\n return this._addAccountFunctions(Account.create(entropy || utils.randomHex(32)));\n};\n\nAccounts.prototype.privateKeyToAccount = function privateKeyToAccount(privateKey) {\n return this._addAccountFunctions(Account.fromPrivate(privateKey));\n};\n\nAccounts.prototype.signTransaction = function signTransaction(tx, privateKey, callback) {\n var _this = this,\n error = false,\n transactionOptions = {},\n hasTxSigningOptions = !!(tx && ((tx.chain && tx.hardfork) || tx.common));\n\n callback = callback || function() {\n };\n\n if (!tx) {\n error = new Error('No transaction object given!');\n\n callback(error);\n return Promise.reject(error);\n }\n\n function signed(tx) {\n if (tx.common && (tx.chain && tx.hardfork)) {\n error = new Error(\n 'Please provide the ethereumjs-common object or the chain and hardfork property but not all together.'\n );\n }\n\n if ((tx.chain && !tx.hardfork) || (tx.hardfork && !tx.chain)) {\n error = new Error(\n 'When specifying chain and hardfork, both values must be defined. ' +\n 'Received \"chain\": ' + tx.chain + ', \"hardfork\": ' + tx.hardfork\n );\n }\n\n if (!tx.gas && !tx.gasLimit) {\n error = new Error('\"gas\" is missing');\n }\n\n if (tx.nonce < 0 ||\n tx.gas < 0 ||\n tx.gasPrice < 0 ||\n tx.chainId < 0) {\n error = new Error('Gas, gasPrice, nonce or chainId is lower than 0');\n }\n\n if (error) {\n callback(error);\n return Promise.reject(error);\n }\n\n try {\n var transaction = helpers.formatters.inputCallFormatter(_.clone(tx));\n transaction.to = transaction.to || '0x';\n transaction.data = transaction.data || '0x';\n transaction.value = transaction.value || '0x';\n transaction.chainId = utils.numberToHex(transaction.chainId);\n\n // Because tx has no ethereumjs-tx signing options we use fetched vals.\n if (!hasTxSigningOptions) {\n transactionOptions.common = Common.forCustomChain(\n 'mainnet',\n {\n name: 'custom-network',\n networkId: transaction.networkId,\n chainId: transaction.chainId\n },\n 'petersburg'\n );\n\n delete transaction.networkId;\n } else {\n if (transaction.common) {\n transactionOptions.common = Common.forCustomChain(\n transaction.common.baseChain || 'mainnet',\n {\n name: transaction.common.customChain.name || 'custom-network',\n networkId: transaction.common.customChain.networkId,\n chainId: transaction.common.customChain.chainId\n },\n transaction.common.hardfork || 'petersburg'\n );\n\n delete transaction.common;\n }\n\n if (transaction.chain) {\n transactionOptions.chain = transaction.chain;\n delete transaction.chain;\n }\n\n if (transaction.hardfork) {\n transactionOptions.hardfork = transaction.hardfork;\n delete transaction.hardfork;\n }\n }\n\n if (privateKey.startsWith('0x')) {\n privateKey = privateKey.substring(2);\n }\n\n var ethTx = new Transaction(transaction, transactionOptions);\n\n ethTx.sign(Buffer.from(privateKey, 'hex'));\n\n var validationResult = ethTx.validate(true);\n\n if (validationResult !== '') {\n throw new Error('Signer Error: ' + validationResult);\n }\n\n var rlpEncoded = ethTx.serialize().toString('hex');\n var rawTransaction = '0x' + rlpEncoded;\n var transactionHash = utils.keccak256(rawTransaction);\n\n var result = {\n messageHash: '0x' + Buffer.from(ethTx.hash(false)).toString('hex'),\n v: '0x' + Buffer.from(ethTx.v).toString('hex'),\n r: '0x' + Buffer.from(ethTx.r).toString('hex'),\n s: '0x' + Buffer.from(ethTx.s).toString('hex'),\n rawTransaction: rawTransaction,\n transactionHash: transactionHash\n };\n\n callback(null, result);\n return result;\n\n } catch (e) {\n callback(e);\n return Promise.reject(e);\n }\n }\n\n\n // Resolve immediately if nonce, chainId, price and signing options are provided\n if (tx.nonce !== undefined && tx.chainId !== undefined && tx.gasPrice !== undefined && hasTxSigningOptions) {\n return Promise.resolve(signed(tx));\n }\n\n // Otherwise, get the missing info from the Ethereum Node\n return Promise.all([\n isNot(tx.chainId) ? _this._ethereumCall.getChainId() : tx.chainId,\n isNot(tx.gasPrice) ? _this._ethereumCall.getGasPrice() : tx.gasPrice,\n isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce,\n isNot(hasTxSigningOptions) ? _this._ethereumCall.getNetworkId() : 1\n ]).then(function(args) {\n if (isNot(args[0]) || isNot(args[1]) || isNot(args[2]) || isNot(args[3])) {\n throw new Error('One of the values \"chainId\", \"networkId\", \"gasPrice\", or \"nonce\" couldn\\'t be fetched: ' + JSON.stringify(args));\n }\n return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2], networkId: args[3]}));\n });\n};\n\n/* jshint ignore:start */\nAccounts.prototype.recoverTransaction = function recoverTransaction(rawTx) {\n var values = RLP.decode(rawTx);\n var signature = Account.encodeSignature(values.slice(6, 9));\n var recovery = Bytes.toNumber(values[6]);\n var extraData = recovery < 35 ? [] : [Bytes.fromNumber((recovery - 35) >> 1), '0x', '0x'];\n var signingData = values.slice(0, 6).concat(extraData);\n var signingDataHex = RLP.encode(signingData);\n return Account.recover(Hash.keccak256(signingDataHex), signature);\n};\n/* jshint ignore:end */\n\nAccounts.prototype.hashMessage = function hashMessage(data) {\n var message = utils.isHexStrict(data) ? utils.hexToBytes(data) : data;\n var messageBuffer = Buffer.from(message);\n var preamble = '\\x19Ethereum Signed Message:\\n' + message.length;\n var preambleBuffer = Buffer.from(preamble);\n var ethMessage = Buffer.concat([preambleBuffer, messageBuffer]);\n return Hash.keccak256s(ethMessage);\n};\n\nAccounts.prototype.sign = function sign(data, privateKey) {\n var hash = this.hashMessage(data);\n var signature = Account.sign(hash, privateKey);\n var vrs = Account.decodeSignature(signature);\n return {\n message: data,\n messageHash: hash,\n v: vrs[0],\n r: vrs[1],\n s: vrs[2],\n signature: signature\n };\n};\n\nAccounts.prototype.recover = function recover(message, signature, preFixed) {\n var args = [].slice.apply(arguments);\n\n\n if (_.isObject(message)) {\n return this.recover(message.messageHash, Account.encodeSignature([message.v, message.r, message.s]), true);\n }\n\n if (!preFixed) {\n message = this.hashMessage(message);\n }\n\n if (args.length >= 4) {\n preFixed = args.slice(-1)[0];\n preFixed = _.isBoolean(preFixed) ? !!preFixed : false;\n\n return this.recover(message, Account.encodeSignature(args.slice(1, 4)), preFixed); // v, r, s\n }\n return Account.recover(message, signature);\n};\n\n// Taken from https://github.com/ethereumjs/ethereumjs-wallet\nAccounts.prototype.decrypt = function(v3Keystore, password, nonStrict) {\n /* jshint maxcomplexity: 10 */\n\n if (!_.isString(password)) {\n throw new Error('No password given.');\n }\n\n var json = (_.isObject(v3Keystore)) ? v3Keystore : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore);\n\n if (json.version !== 3) {\n throw new Error('Not a valid V3 wallet');\n }\n\n var derivedKey;\n var kdfparams;\n if (json.crypto.kdf === 'scrypt') {\n kdfparams = json.crypto.kdfparams;\n\n // FIXME: support progress reporting callback\n derivedKey = scrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);\n } else if (json.crypto.kdf === 'pbkdf2') {\n kdfparams = json.crypto.kdfparams;\n\n if (kdfparams.prf !== 'hmac-sha256') {\n throw new Error('Unsupported parameters to PBKDF2');\n }\n\n derivedKey = cryp.pbkdf2Sync(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256');\n } else {\n throw new Error('Unsupported key derivation scheme');\n }\n\n var ciphertext = Buffer.from(json.crypto.ciphertext, 'hex');\n\n var mac = utils.sha3(Buffer.concat([derivedKey.slice(16, 32), ciphertext])).replace('0x', '');\n if (mac !== json.crypto.mac) {\n throw new Error('Key derivation failed - possibly wrong password');\n }\n\n var decipher = cryp.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), Buffer.from(json.crypto.cipherparams.iv, 'hex'));\n var seed = '0x' + Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('hex');\n\n return this.privateKeyToAccount(seed);\n};\n\nAccounts.prototype.encrypt = function(privateKey, password, options) {\n /* jshint maxcomplexity: 20 */\n var account = this.privateKeyToAccount(privateKey);\n\n options = options || {};\n var salt = options.salt || cryp.randomBytes(32);\n var iv = options.iv || cryp.randomBytes(16);\n\n var derivedKey;\n var kdf = options.kdf || 'scrypt';\n var kdfparams = {\n dklen: options.dklen || 32,\n salt: salt.toString('hex')\n };\n\n if (kdf === 'pbkdf2') {\n kdfparams.c = options.c || 262144;\n kdfparams.prf = 'hmac-sha256';\n derivedKey = cryp.pbkdf2Sync(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256');\n } else if (kdf === 'scrypt') {\n // FIXME: support progress reporting callback\n kdfparams.n = options.n || 8192; // 2048 4096 8192 16384\n kdfparams.r = options.r || 8;\n kdfparams.p = options.p || 1;\n derivedKey = scrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);\n } else {\n throw new Error('Unsupported kdf');\n }\n\n var cipher = cryp.createCipheriv(options.cipher || 'aes-128-ctr', derivedKey.slice(0, 16), iv);\n if (!cipher) {\n throw new Error('Unsupported cipher');\n }\n\n var ciphertext = Buffer.concat([cipher.update(Buffer.from(account.privateKey.replace('0x', ''), 'hex')), cipher.final()]);\n\n var mac = utils.sha3(Buffer.concat([derivedKey.slice(16, 32), Buffer.from(ciphertext, 'hex')])).replace('0x', '');\n\n return {\n version: 3,\n id: uuid.v4({random: options.uuid || cryp.randomBytes(16)}),\n address: account.address.toLowerCase().replace('0x', ''),\n crypto: {\n ciphertext: ciphertext.toString('hex'),\n cipherparams: {\n iv: iv.toString('hex')\n },\n cipher: options.cipher || 'aes-128-ctr',\n kdf: kdf,\n kdfparams: kdfparams,\n mac: mac.toString('hex')\n }\n };\n};\n\n\n// Note: this is trying to follow closely the specs on\n// http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html\n\nfunction Wallet(accounts) {\n this._accounts = accounts;\n this.length = 0;\n this.defaultKeyName = 'web3js_wallet';\n}\n\nWallet.prototype._findSafeIndex = function(pointer) {\n pointer = pointer || 0;\n if (_.has(this, pointer)) {\n return this._findSafeIndex(pointer + 1);\n } else {\n return pointer;\n }\n};\n\nWallet.prototype._currentIndexes = function() {\n var keys = Object.keys(this);\n var indexes = keys\n .map(function(key) {\n return parseInt(key);\n })\n .filter(function(n) {\n return (n < 9e20);\n });\n\n return indexes;\n};\n\nWallet.prototype.create = function(numberOfAccounts, entropy) {\n for (var i = 0; i < numberOfAccounts; ++i) {\n this.add(this._accounts.create(entropy).privateKey);\n }\n return this;\n};\n\nWallet.prototype.add = function(account) {\n\n if (_.isString(account)) {\n account = this._accounts.privateKeyToAccount(account);\n }\n if (!this[account.address]) {\n account = this._accounts.privateKeyToAccount(account.privateKey);\n account.index = this._findSafeIndex();\n\n this[account.index] = account;\n this[account.address] = account;\n this[account.address.toLowerCase()] = account;\n\n this.length++;\n\n return account;\n } else {\n return this[account.address];\n }\n};\n\nWallet.prototype.remove = function(addressOrIndex) {\n var account = this[addressOrIndex];\n\n if (account && account.address) {\n // address\n this[account.address].privateKey = null;\n delete this[account.address];\n // address lowercase\n this[account.address.toLowerCase()].privateKey = null;\n delete this[account.address.toLowerCase()];\n // index\n this[account.index].privateKey = null;\n delete this[account.index];\n\n this.length--;\n\n return true;\n } else {\n return false;\n }\n};\n\nWallet.prototype.clear = function() {\n var _this = this;\n var indexes = this._currentIndexes();\n\n indexes.forEach(function(index) {\n _this.remove(index);\n });\n\n return this;\n};\n\nWallet.prototype.encrypt = function(password, options) {\n var _this = this;\n var indexes = this._currentIndexes();\n\n var accounts = indexes.map(function(index) {\n return _this[index].encrypt(password, options);\n });\n\n return accounts;\n};\n\n\nWallet.prototype.decrypt = function(encryptedWallet, password) {\n var _this = this;\n\n encryptedWallet.forEach(function(keystore) {\n var account = _this._accounts.decrypt(keystore, password);\n\n if (account) {\n _this.add(account);\n } else {\n throw new Error('Couldn\\'t decrypt accounts. Password wrong?');\n }\n });\n\n return this;\n};\n\nWallet.prototype.save = function(password, keyName) {\n localStorage.setItem(keyName || this.defaultKeyName, JSON.stringify(this.encrypt(password)));\n\n return true;\n};\n\nWallet.prototype.load = function(password, keyName) {\n var keystore = localStorage.getItem(keyName || this.defaultKeyName);\n\n if (keystore) {\n try {\n keystore = JSON.parse(keystore);\n } catch (e) {\n\n }\n }\n\n return this.decrypt(keystore || [], password);\n};\n\nif (!storageAvailable('localStorage')) {\n delete Wallet.prototype.save;\n delete Wallet.prototype.load;\n}\n\n/**\n * Checks whether a storage type is available or not\n * For more info on how this works, please refer to MDN documentation\n * https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#Feature-detecting_localStorage\n *\n * @method storageAvailable\n * @param {String} type the type of storage ('localStorage', 'sessionStorage')\n * @returns {Boolean} a boolean indicating whether the specified storage is available or not\n */\nfunction storageAvailable(type) {\n var storage;\n try {\n storage = window[type];\n var x = '__storage_test__';\n storage.setItem(x, x);\n storage.removeItem(x);\n return true;\n } catch (e) {\n return e && (\n // everything except Firefox\n e.code === 22 ||\n // Firefox\n e.code === 1014 ||\n // test name field too, because code might not be present\n // everything except Firefox\n e.name === 'QuotaExceededError' ||\n // Firefox\n e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&\n // acknowledge QuotaExceededError only if there's something already stored\n (storage && storage.length !== 0);\n }\n}\n\n\nmodule.exports = Accounts;\n","var anObject = require('../internals/an-object');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar toLength = require('../internals/to-length');\nvar bind = require('../internals/function-bind-context');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {\n var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);\n var iterator, iterFn, index, length, result, next, step;\n\n if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (typeof iterFn != 'function') throw TypeError('Target is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = toLength(iterable.length); length > index; index++) {\n result = AS_ENTRIES\n ? boundFunction(anObject(step = iterable[index])[0], step[1])\n : boundFunction(iterable[index]);\n if (result && result instanceof Result) return result;\n } return new Result(false);\n }\n iterator = iterFn.call(iterable);\n }\n\n next = iterator.next;\n while (!(step = next.call(iterator)).done) {\n result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);\n if (typeof result == 'object' && result && result instanceof Result) return result;\n } return new Result(false);\n};\n\niterate.stop = function (result) {\n return new Result(true, result);\n};\n","'use strict'\nmodule.exports = require('./lib')(require('./lib/elliptic'))\n","var toInteger = require('../internals/to-integer');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toInteger(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar setGlobal = require('../internals/set-global');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n};\n","'use strict'\nconst Buffer = require('safe-buffer').Buffer\nconst keccakState = require('./keccak-state-unroll')\n\nfunction Keccak () {\n // much faster than `new Array(50)`\n this.state = [\n 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0\n ]\n\n this.blockSize = null\n this.count = 0\n this.squeezing = false\n}\n\nKeccak.prototype.initialize = function (rate, capacity) {\n for (let i = 0; i < 50; ++i) this.state[i] = 0\n this.blockSize = rate / 8\n this.count = 0\n this.squeezing = false\n}\n\nKeccak.prototype.absorb = function (data) {\n for (let i = 0; i < data.length; ++i) {\n this.state[~~(this.count / 4)] ^= data[i] << (8 * (this.count % 4))\n this.count += 1\n if (this.count === this.blockSize) {\n keccakState.p1600(this.state)\n this.count = 0\n }\n }\n}\n\nKeccak.prototype.absorbLastFewBits = function (bits) {\n this.state[~~(this.count / 4)] ^= bits << (8 * (this.count % 4))\n if ((bits & 0x80) !== 0 && this.count === (this.blockSize - 1)) keccakState.p1600(this.state)\n this.state[~~((this.blockSize - 1) / 4)] ^= 0x80 << (8 * ((this.blockSize - 1) % 4))\n keccakState.p1600(this.state)\n this.count = 0\n this.squeezing = true\n}\n\nKeccak.prototype.squeeze = function (length) {\n if (!this.squeezing) this.absorbLastFewBits(0x01)\n\n const output = Buffer.alloc(length)\n for (var i = 0; i < length; ++i) {\n output[i] = (this.state[~~(this.count / 4)] >>> (8 * (this.count % 4))) & 0xff\n this.count += 1\n if (this.count === this.blockSize) {\n keccakState.p1600(this.state)\n this.count = 0\n }\n }\n\n return output\n}\n\nKeccak.prototype.copy = function (dest) {\n for (let i = 0; i < 50; ++i) dest.state[i] = this.state[i]\n dest.blockSize = this.blockSize\n dest.count = this.count\n dest.squeezing = this.squeezing\n}\n\nmodule.exports = Keccak\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.github.io/ecma262/#sec-object.getownpropertynames\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","var http = require('http')\nvar url = require('url')\n\nvar https = module.exports\n\nfor (var key in http) {\n if (http.hasOwnProperty(key)) https[key] = http[key]\n}\n\nhttps.request = function (params, cb) {\n params = validateParams(params)\n return http.request.call(this, params, cb)\n}\n\nhttps.get = function (params, cb) {\n params = validateParams(params)\n return http.get.call(this, params, cb)\n}\n\nfunction validateParams (params) {\n if (typeof params === 'string') {\n params = url.parse(params)\n }\n if (!params.protocol) {\n params.protocol = 'https:'\n }\n if (params.protocol !== 'https:') {\n throw new Error('Protocol \"' + params.protocol + '\" not supported. Expected \"https:\"')\n }\n return params\n}\n","var request = require('xhr-request')\n\nmodule.exports = function (url, options) {\n return new Promise(function (resolve, reject) {\n request(url, options, function (err, data) {\n if (err) reject(err);\n else resolve(data);\n });\n });\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar definePropertyModule = require('../internals/object-define-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n var defineProperty = definePropertyModule.f;\n\n if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {\n defineProperty(Constructor, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n }\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n\n return stream.push(null);\n}","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"./bytes\");\nvar UnicodeNormalizationForm;\n(function (UnicodeNormalizationForm) {\n UnicodeNormalizationForm[\"current\"] = \"\";\n UnicodeNormalizationForm[\"NFC\"] = \"NFC\";\n UnicodeNormalizationForm[\"NFD\"] = \"NFD\";\n UnicodeNormalizationForm[\"NFKC\"] = \"NFKC\";\n UnicodeNormalizationForm[\"NFKD\"] = \"NFKD\";\n})(UnicodeNormalizationForm = exports.UnicodeNormalizationForm || (exports.UnicodeNormalizationForm = {}));\n;\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nfunction toUtf8Bytes(str, form) {\n if (form === void 0) { form = UnicodeNormalizationForm.current; }\n if (form != UnicodeNormalizationForm.current) {\n str = str.normalize(form);\n }\n var result = [];\n var offset = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 128) {\n result[offset++] = c;\n }\n else if (c < 2048) {\n result[offset++] = (c >> 6) | 192;\n result[offset++] = (c & 63) | 128;\n }\n else if (((c & 0xFC00) == 0xD800) && (i + 1) < str.length && ((str.charCodeAt(i + 1) & 0xFC00) == 0xDC00)) {\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF);\n result[offset++] = (c >> 18) | 240;\n result[offset++] = ((c >> 12) & 63) | 128;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n }\n else {\n result[offset++] = (c >> 12) | 224;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n }\n }\n return bytes_1.arrayify(result);\n}\nexports.toUtf8Bytes = toUtf8Bytes;\n;\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction toUtf8String(bytes) {\n bytes = bytes_1.arrayify(bytes);\n var result = '';\n var i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n var c = bytes[i++];\n if (c >> 7 == 0) {\n // 0xxx xxxx\n result += String.fromCharCode(c);\n continue;\n }\n // Invalid starting byte\n if (c >> 6 == 0x02) {\n continue;\n }\n // Multibyte; how many bytes left for thus character?\n var extraLength = null;\n if (c >> 5 == 0x06) {\n extraLength = 1;\n }\n else if (c >> 4 == 0x0e) {\n extraLength = 2;\n }\n else if (c >> 3 == 0x1e) {\n extraLength = 3;\n }\n else if (c >> 2 == 0x3e) {\n extraLength = 4;\n }\n else if (c >> 1 == 0x7e) {\n extraLength = 5;\n }\n else {\n continue;\n }\n // Do we have enough bytes in our data?\n if (i + extraLength > bytes.length) {\n // If there is an invalid unprocessed byte, try to continue\n for (; i < bytes.length; i++) {\n if (bytes[i] >> 6 != 0x02) {\n break;\n }\n }\n if (i != bytes.length)\n continue;\n // All leftover bytes are valid.\n return result;\n }\n // Remove the UTF-8 prefix from the char (res)\n var res = c & ((1 << (8 - extraLength - 1)) - 1);\n var count;\n for (count = 0; count < extraLength; count++) {\n var nextChar = bytes[i++];\n // Is the char valid multibyte part?\n if (nextChar >> 6 != 0x02) {\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n }\n if (count != extraLength) {\n i--;\n continue;\n }\n if (res <= 0xffff) {\n result += String.fromCharCode(res);\n continue;\n }\n res -= 0x10000;\n result += String.fromCharCode(((res >> 10) & 0x3ff) + 0xd800, (res & 0x3ff) + 0xdc00);\n }\n return result;\n}\nexports.toUtf8String = toUtf8String;\n","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","var asn1 = require('./asn1')\nvar aesid = require('./aesid.json')\nvar fixProc = require('./fixProc')\nvar ciphers = require('browserify-aes')\nvar compat = require('pbkdf2')\nvar Buffer = require('safe-buffer').Buffer\nmodule.exports = parseKeys\n\nfunction parseKeys (buffer) {\n var password\n if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {\n password = buffer.passphrase\n buffer = buffer.key\n }\n if (typeof buffer === 'string') {\n buffer = Buffer.from(buffer)\n }\n\n var stripped = fixProc(buffer, password)\n\n var type = stripped.tag\n var data = stripped.data\n var subtype, ndata\n switch (type) {\n case 'CERTIFICATE':\n ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo\n // falls through\n case 'PUBLIC KEY':\n if (!ndata) {\n ndata = asn1.PublicKey.decode(data, 'der')\n }\n subtype = ndata.algorithm.algorithm.join('.')\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')\n case '1.2.840.10045.2.1':\n ndata.subjectPrivateKey = ndata.subjectPublicKey\n return {\n type: 'ec',\n data: ndata\n }\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')\n return {\n type: 'dsa',\n data: ndata.algorithm.params\n }\n default: throw new Error('unknown key id ' + subtype)\n }\n throw new Error('unknown key type ' + type)\n case 'ENCRYPTED PRIVATE KEY':\n data = asn1.EncryptedPrivateKey.decode(data, 'der')\n data = decrypt(data, password)\n // falls through\n case 'PRIVATE KEY':\n ndata = asn1.PrivateKey.decode(data, 'der')\n subtype = ndata.algorithm.algorithm.join('.')\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')\n case '1.2.840.10045.2.1':\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey\n }\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')\n return {\n type: 'dsa',\n params: ndata.algorithm.params\n }\n default: throw new Error('unknown key id ' + subtype)\n }\n throw new Error('unknown key type ' + type)\n case 'RSA PUBLIC KEY':\n return asn1.RSAPublicKey.decode(data, 'der')\n case 'RSA PRIVATE KEY':\n return asn1.RSAPrivateKey.decode(data, 'der')\n case 'DSA PRIVATE KEY':\n return {\n type: 'dsa',\n params: asn1.DSAPrivateKey.decode(data, 'der')\n }\n case 'EC PRIVATE KEY':\n data = asn1.ECPrivateKey.decode(data, 'der')\n return {\n curve: data.parameters.value,\n privateKey: data.privateKey\n }\n default: throw new Error('unknown key type ' + type)\n }\n}\nparseKeys.signature = asn1.signature\nfunction decrypt (data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt\n var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)\n var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]\n var iv = data.algorithm.decrypt.cipher.iv\n var cipherText = data.subjectPrivateKey\n var keylen = parseInt(algo.split('-')[1], 10) / 8\n var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')\n var cipher = ciphers.createDecipheriv(algo, key, iv)\n var out = []\n out.push(cipher.update(cipherText))\n out.push(cipher.final())\n return Buffer.concat(out)\n}\n","/*!\n * Vue.js v2.6.11\n * (c) 2014-2019 Evan You\n * Released under the MIT License.\n */\n/* */\n\nvar emptyObject = Object.freeze({});\n\n// These helpers produce better VM code in JS engines due to their\n// explicitness and function inlining.\nfunction isUndef (v) {\n return v === undefined || v === null\n}\n\nfunction isDef (v) {\n return v !== undefined && v !== null\n}\n\nfunction isTrue (v) {\n return v === true\n}\n\nfunction isFalse (v) {\n return v === false\n}\n\n/**\n * Check if value is primitive.\n */\nfunction isPrimitive (value) {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n // $flow-disable-line\n typeof value === 'symbol' ||\n typeof value === 'boolean'\n )\n}\n\n/**\n * Quick object check - this is primarily used to tell\n * Objects from primitive values when we know the value\n * is a JSON-compliant type.\n */\nfunction isObject (obj) {\n return obj !== null && typeof obj === 'object'\n}\n\n/**\n * Get the raw type string of a value, e.g., [object Object].\n */\nvar _toString = Object.prototype.toString;\n\nfunction toRawType (value) {\n return _toString.call(value).slice(8, -1)\n}\n\n/**\n * Strict object type check. Only returns true\n * for plain JavaScript objects.\n */\nfunction isPlainObject (obj) {\n return _toString.call(obj) === '[object Object]'\n}\n\nfunction isRegExp (v) {\n return _toString.call(v) === '[object RegExp]'\n}\n\n/**\n * Check if val is a valid array index.\n */\nfunction isValidArrayIndex (val) {\n var n = parseFloat(String(val));\n return n >= 0 && Math.floor(n) === n && isFinite(val)\n}\n\nfunction isPromise (val) {\n return (\n isDef(val) &&\n typeof val.then === 'function' &&\n typeof val.catch === 'function'\n )\n}\n\n/**\n * Convert a value to a string that is actually rendered.\n */\nfunction toString (val) {\n return val == null\n ? ''\n : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)\n ? JSON.stringify(val, null, 2)\n : String(val)\n}\n\n/**\n * Convert an input value to a number for persistence.\n * If the conversion fails, return original string.\n */\nfunction toNumber (val) {\n var n = parseFloat(val);\n return isNaN(n) ? val : n\n}\n\n/**\n * Make a map and return a function for checking if a key\n * is in that map.\n */\nfunction makeMap (\n str,\n expectsLowerCase\n) {\n var map = Object.create(null);\n var list = str.split(',');\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase\n ? function (val) { return map[val.toLowerCase()]; }\n : function (val) { return map[val]; }\n}\n\n/**\n * Check if a tag is a built-in tag.\n */\nvar isBuiltInTag = makeMap('slot,component', true);\n\n/**\n * Check if an attribute is a reserved attribute.\n */\nvar isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');\n\n/**\n * Remove an item from an array.\n */\nfunction remove (arr, item) {\n if (arr.length) {\n var index = arr.indexOf(item);\n if (index > -1) {\n return arr.splice(index, 1)\n }\n }\n}\n\n/**\n * Check whether an object has the property.\n */\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nfunction hasOwn (obj, key) {\n return hasOwnProperty.call(obj, key)\n}\n\n/**\n * Create a cached version of a pure function.\n */\nfunction cached (fn) {\n var cache = Object.create(null);\n return (function cachedFn (str) {\n var hit = cache[str];\n return hit || (cache[str] = fn(str))\n })\n}\n\n/**\n * Camelize a hyphen-delimited string.\n */\nvar camelizeRE = /-(\\w)/g;\nvar camelize = cached(function (str) {\n return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })\n});\n\n/**\n * Capitalize a string.\n */\nvar capitalize = cached(function (str) {\n return str.charAt(0).toUpperCase() + str.slice(1)\n});\n\n/**\n * Hyphenate a camelCase string.\n */\nvar hyphenateRE = /\\B([A-Z])/g;\nvar hyphenate = cached(function (str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase()\n});\n\n/**\n * Simple bind polyfill for environments that do not support it,\n * e.g., PhantomJS 1.x. Technically, we don't need this anymore\n * since native bind is now performant enough in most browsers.\n * But removing it would mean breaking code that was able to run in\n * PhantomJS 1.x, so this must be kept for backward compatibility.\n */\n\n/* istanbul ignore next */\nfunction polyfillBind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n\n boundFn._length = fn.length;\n return boundFn\n}\n\nfunction nativeBind (fn, ctx) {\n return fn.bind(ctx)\n}\n\nvar bind = Function.prototype.bind\n ? nativeBind\n : polyfillBind;\n\n/**\n * Convert an Array-like object to a real Array.\n */\nfunction toArray (list, start) {\n start = start || 0;\n var i = list.length - start;\n var ret = new Array(i);\n while (i--) {\n ret[i] = list[i + start];\n }\n return ret\n}\n\n/**\n * Mix properties into target object.\n */\nfunction extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}\n\n/**\n * Merge an Array of Objects into a single Object.\n */\nfunction toObject (arr) {\n var res = {};\n for (var i = 0; i < arr.length; i++) {\n if (arr[i]) {\n extend(res, arr[i]);\n }\n }\n return res\n}\n\n/* eslint-disable no-unused-vars */\n\n/**\n * Perform no operation.\n * Stubbing args to make Flow happy without leaving useless transpiled code\n * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).\n */\nfunction noop (a, b, c) {}\n\n/**\n * Always return false.\n */\nvar no = function (a, b, c) { return false; };\n\n/* eslint-enable no-unused-vars */\n\n/**\n * Return the same value.\n */\nvar identity = function (_) { return _; };\n\n/**\n * Check if two values are loosely equal - that is,\n * if they are plain objects, do they have the same shape?\n */\nfunction looseEqual (a, b) {\n if (a === b) { return true }\n var isObjectA = isObject(a);\n var isObjectB = isObject(b);\n if (isObjectA && isObjectB) {\n try {\n var isArrayA = Array.isArray(a);\n var isArrayB = Array.isArray(b);\n if (isArrayA && isArrayB) {\n return a.length === b.length && a.every(function (e, i) {\n return looseEqual(e, b[i])\n })\n } else if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime()\n } else if (!isArrayA && !isArrayB) {\n var keysA = Object.keys(a);\n var keysB = Object.keys(b);\n return keysA.length === keysB.length && keysA.every(function (key) {\n return looseEqual(a[key], b[key])\n })\n } else {\n /* istanbul ignore next */\n return false\n }\n } catch (e) {\n /* istanbul ignore next */\n return false\n }\n } else if (!isObjectA && !isObjectB) {\n return String(a) === String(b)\n } else {\n return false\n }\n}\n\n/**\n * Return the first index at which a loosely equal value can be\n * found in the array (if value is a plain object, the array must\n * contain an object of the same shape), or -1 if it is not present.\n */\nfunction looseIndexOf (arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val)) { return i }\n }\n return -1\n}\n\n/**\n * Ensure a function is called only once.\n */\nfunction once (fn) {\n var called = false;\n return function () {\n if (!called) {\n called = true;\n fn.apply(this, arguments);\n }\n }\n}\n\nvar SSR_ATTR = 'data-server-rendered';\n\nvar ASSET_TYPES = [\n 'component',\n 'directive',\n 'filter'\n];\n\nvar LIFECYCLE_HOOKS = [\n 'beforeCreate',\n 'created',\n 'beforeMount',\n 'mounted',\n 'beforeUpdate',\n 'updated',\n 'beforeDestroy',\n 'destroyed',\n 'activated',\n 'deactivated',\n 'errorCaptured',\n 'serverPrefetch'\n];\n\n/* */\n\n\n\nvar config = ({\n /**\n * Option merge strategies (used in core/util/options)\n */\n // $flow-disable-line\n optionMergeStrategies: Object.create(null),\n\n /**\n * Whether to suppress warnings.\n */\n silent: false,\n\n /**\n * Show production mode tip message on boot?\n */\n productionTip: process.env.NODE_ENV !== 'production',\n\n /**\n * Whether to enable devtools\n */\n devtools: process.env.NODE_ENV !== 'production',\n\n /**\n * Whether to record perf\n */\n performance: false,\n\n /**\n * Error handler for watcher errors\n */\n errorHandler: null,\n\n /**\n * Warn handler for watcher warns\n */\n warnHandler: null,\n\n /**\n * Ignore certain custom elements\n */\n ignoredElements: [],\n\n /**\n * Custom user key aliases for v-on\n */\n // $flow-disable-line\n keyCodes: Object.create(null),\n\n /**\n * Check if a tag is reserved so that it cannot be registered as a\n * component. This is platform-dependent and may be overwritten.\n */\n isReservedTag: no,\n\n /**\n * Check if an attribute is reserved so that it cannot be used as a component\n * prop. This is platform-dependent and may be overwritten.\n */\n isReservedAttr: no,\n\n /**\n * Check if a tag is an unknown element.\n * Platform-dependent.\n */\n isUnknownElement: no,\n\n /**\n * Get the namespace of an element\n */\n getTagNamespace: noop,\n\n /**\n * Parse the real tag name for the specific platform.\n */\n parsePlatformTagName: identity,\n\n /**\n * Check if an attribute must be bound using property, e.g. value\n * Platform-dependent.\n */\n mustUseProp: no,\n\n /**\n * Perform updates asynchronously. Intended to be used by Vue Test Utils\n * This will significantly reduce performance if set to false.\n */\n async: true,\n\n /**\n * Exposed for legacy reasons\n */\n _lifecycleHooks: LIFECYCLE_HOOKS\n});\n\n/* */\n\n/**\n * unicode letters used for parsing html tags, component names and property paths.\n * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname\n * skipping \\u10000-\\uEFFFF due to it freezing up PhantomJS\n */\nvar unicodeRegExp = /a-zA-Z\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD/;\n\n/**\n * Check if a string starts with $ or _\n */\nfunction isReserved (str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F\n}\n\n/**\n * Define a property.\n */\nfunction def (obj, key, val, enumerable) {\n Object.defineProperty(obj, key, {\n value: val,\n enumerable: !!enumerable,\n writable: true,\n configurable: true\n });\n}\n\n/**\n * Parse simple path.\n */\nvar bailRE = new RegExp((\"[^\" + (unicodeRegExp.source) + \".$_\\\\d]\"));\nfunction parsePath (path) {\n if (bailRE.test(path)) {\n return\n }\n var segments = path.split('.');\n return function (obj) {\n for (var i = 0; i < segments.length; i++) {\n if (!obj) { return }\n obj = obj[segments[i]];\n }\n return obj\n }\n}\n\n/* */\n\n// can we use __proto__?\nvar hasProto = '__proto__' in {};\n\n// Browser environment sniffing\nvar inBrowser = typeof window !== 'undefined';\nvar inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;\nvar weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();\nvar UA = inBrowser && window.navigator.userAgent.toLowerCase();\nvar isIE = UA && /msie|trident/.test(UA);\nvar isIE9 = UA && UA.indexOf('msie 9.0') > 0;\nvar isEdge = UA && UA.indexOf('edge/') > 0;\nvar isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');\nvar isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');\nvar isChrome = UA && /chrome\\/\\d+/.test(UA) && !isEdge;\nvar isPhantomJS = UA && /phantomjs/.test(UA);\nvar isFF = UA && UA.match(/firefox\\/(\\d+)/);\n\n// Firefox has a \"watch\" function on Object.prototype...\nvar nativeWatch = ({}).watch;\n\nvar supportsPassive = false;\nif (inBrowser) {\n try {\n var opts = {};\n Object.defineProperty(opts, 'passive', ({\n get: function get () {\n /* istanbul ignore next */\n supportsPassive = true;\n }\n })); // https://github.com/facebook/flow/issues/285\n window.addEventListener('test-passive', null, opts);\n } catch (e) {}\n}\n\n// this needs to be lazy-evaled because vue may be required before\n// vue-server-renderer can set VUE_ENV\nvar _isServer;\nvar isServerRendering = function () {\n if (_isServer === undefined) {\n /* istanbul ignore if */\n if (!inBrowser && !inWeex && typeof global !== 'undefined') {\n // detect presence of vue-server-renderer and avoid\n // Webpack shimming the process\n _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';\n } else {\n _isServer = false;\n }\n }\n return _isServer\n};\n\n// detect devtools\nvar devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;\n\n/* istanbul ignore next */\nfunction isNative (Ctor) {\n return typeof Ctor === 'function' && /native code/.test(Ctor.toString())\n}\n\nvar hasSymbol =\n typeof Symbol !== 'undefined' && isNative(Symbol) &&\n typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);\n\nvar _Set;\n/* istanbul ignore if */ // $flow-disable-line\nif (typeof Set !== 'undefined' && isNative(Set)) {\n // use native Set when available.\n _Set = Set;\n} else {\n // a non-standard Set polyfill that only works with primitive keys.\n _Set = /*@__PURE__*/(function () {\n function Set () {\n this.set = Object.create(null);\n }\n Set.prototype.has = function has (key) {\n return this.set[key] === true\n };\n Set.prototype.add = function add (key) {\n this.set[key] = true;\n };\n Set.prototype.clear = function clear () {\n this.set = Object.create(null);\n };\n\n return Set;\n }());\n}\n\n/* */\n\nvar warn = noop;\nvar tip = noop;\nvar generateComponentTrace = (noop); // work around flow check\nvar formatComponentName = (noop);\n\nif (process.env.NODE_ENV !== 'production') {\n var hasConsole = typeof console !== 'undefined';\n var classifyRE = /(?:^|[-_])(\\w)/g;\n var classify = function (str) { return str\n .replace(classifyRE, function (c) { return c.toUpperCase(); })\n .replace(/[-_]/g, ''); };\n\n warn = function (msg, vm) {\n var trace = vm ? generateComponentTrace(vm) : '';\n\n if (config.warnHandler) {\n config.warnHandler.call(null, msg, vm, trace);\n } else if (hasConsole && (!config.silent)) {\n console.error((\"[Vue warn]: \" + msg + trace));\n }\n };\n\n tip = function (msg, vm) {\n if (hasConsole && (!config.silent)) {\n console.warn(\"[Vue tip]: \" + msg + (\n vm ? generateComponentTrace(vm) : ''\n ));\n }\n };\n\n formatComponentName = function (vm, includeFile) {\n if (vm.$root === vm) {\n return ''\n }\n var options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options || vm.constructor.options\n : vm;\n var name = options.name || options._componentTag;\n var file = options.__file;\n if (!name && file) {\n var match = file.match(/([^/\\\\]+)\\.vue$/);\n name = match && match[1];\n }\n\n return (\n (name ? (\"<\" + (classify(name)) + \">\") : \"\") +\n (file && includeFile !== false ? (\" at \" + file) : '')\n )\n };\n\n var repeat = function (str, n) {\n var res = '';\n while (n) {\n if (n % 2 === 1) { res += str; }\n if (n > 1) { str += str; }\n n >>= 1;\n }\n return res\n };\n\n generateComponentTrace = function (vm) {\n if (vm._isVue && vm.$parent) {\n var tree = [];\n var currentRecursiveSequence = 0;\n while (vm) {\n if (tree.length > 0) {\n var last = tree[tree.length - 1];\n if (last.constructor === vm.constructor) {\n currentRecursiveSequence++;\n vm = vm.$parent;\n continue\n } else if (currentRecursiveSequence > 0) {\n tree[tree.length - 1] = [last, currentRecursiveSequence];\n currentRecursiveSequence = 0;\n }\n }\n tree.push(vm);\n vm = vm.$parent;\n }\n return '\\n\\nfound in\\n\\n' + tree\n .map(function (vm, i) { return (\"\" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)\n ? ((formatComponentName(vm[0])) + \"... (\" + (vm[1]) + \" recursive calls)\")\n : formatComponentName(vm))); })\n .join('\\n')\n } else {\n return (\"\\n\\n(found in \" + (formatComponentName(vm)) + \")\")\n }\n };\n}\n\n/* */\n\nvar uid = 0;\n\n/**\n * A dep is an observable that can have multiple\n * directives subscribing to it.\n */\nvar Dep = function Dep () {\n this.id = uid++;\n this.subs = [];\n};\n\nDep.prototype.addSub = function addSub (sub) {\n this.subs.push(sub);\n};\n\nDep.prototype.removeSub = function removeSub (sub) {\n remove(this.subs, sub);\n};\n\nDep.prototype.depend = function depend () {\n if (Dep.target) {\n Dep.target.addDep(this);\n }\n};\n\nDep.prototype.notify = function notify () {\n // stabilize the subscriber list first\n var subs = this.subs.slice();\n if (process.env.NODE_ENV !== 'production' && !config.async) {\n // subs aren't sorted in scheduler if not running async\n // we need to sort them now to make sure they fire in correct\n // order\n subs.sort(function (a, b) { return a.id - b.id; });\n }\n for (var i = 0, l = subs.length; i < l; i++) {\n subs[i].update();\n }\n};\n\n// The current target watcher being evaluated.\n// This is globally unique because only one watcher\n// can be evaluated at a time.\nDep.target = null;\nvar targetStack = [];\n\nfunction pushTarget (target) {\n targetStack.push(target);\n Dep.target = target;\n}\n\nfunction popTarget () {\n targetStack.pop();\n Dep.target = targetStack[targetStack.length - 1];\n}\n\n/* */\n\nvar VNode = function VNode (\n tag,\n data,\n children,\n text,\n elm,\n context,\n componentOptions,\n asyncFactory\n) {\n this.tag = tag;\n this.data = data;\n this.children = children;\n this.text = text;\n this.elm = elm;\n this.ns = undefined;\n this.context = context;\n this.fnContext = undefined;\n this.fnOptions = undefined;\n this.fnScopeId = undefined;\n this.key = data && data.key;\n this.componentOptions = componentOptions;\n this.componentInstance = undefined;\n this.parent = undefined;\n this.raw = false;\n this.isStatic = false;\n this.isRootInsert = true;\n this.isComment = false;\n this.isCloned = false;\n this.isOnce = false;\n this.asyncFactory = asyncFactory;\n this.asyncMeta = undefined;\n this.isAsyncPlaceholder = false;\n};\n\nvar prototypeAccessors = { child: { configurable: true } };\n\n// DEPRECATED: alias for componentInstance for backwards compat.\n/* istanbul ignore next */\nprototypeAccessors.child.get = function () {\n return this.componentInstance\n};\n\nObject.defineProperties( VNode.prototype, prototypeAccessors );\n\nvar createEmptyVNode = function (text) {\n if ( text === void 0 ) text = '';\n\n var node = new VNode();\n node.text = text;\n node.isComment = true;\n return node\n};\n\nfunction createTextVNode (val) {\n return new VNode(undefined, undefined, undefined, String(val))\n}\n\n// optimized shallow clone\n// used for static nodes and slot nodes because they may be reused across\n// multiple renders, cloning them avoids errors when DOM manipulations rely\n// on their elm reference.\nfunction cloneVNode (vnode) {\n var cloned = new VNode(\n vnode.tag,\n vnode.data,\n // #7975\n // clone children array to avoid mutating original in case of cloning\n // a child.\n vnode.children && vnode.children.slice(),\n vnode.text,\n vnode.elm,\n vnode.context,\n vnode.componentOptions,\n vnode.asyncFactory\n );\n cloned.ns = vnode.ns;\n cloned.isStatic = vnode.isStatic;\n cloned.key = vnode.key;\n cloned.isComment = vnode.isComment;\n cloned.fnContext = vnode.fnContext;\n cloned.fnOptions = vnode.fnOptions;\n cloned.fnScopeId = vnode.fnScopeId;\n cloned.asyncMeta = vnode.asyncMeta;\n cloned.isCloned = true;\n return cloned\n}\n\n/*\n * not type checking this file because flow doesn't play well with\n * dynamically accessing methods on Array prototype\n */\n\nvar arrayProto = Array.prototype;\nvar arrayMethods = Object.create(arrayProto);\n\nvar methodsToPatch = [\n 'push',\n 'pop',\n 'shift',\n 'unshift',\n 'splice',\n 'sort',\n 'reverse'\n];\n\n/**\n * Intercept mutating methods and emit events\n */\nmethodsToPatch.forEach(function (method) {\n // cache original method\n var original = arrayProto[method];\n def(arrayMethods, method, function mutator () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var result = original.apply(this, args);\n var ob = this.__ob__;\n var inserted;\n switch (method) {\n case 'push':\n case 'unshift':\n inserted = args;\n break\n case 'splice':\n inserted = args.slice(2);\n break\n }\n if (inserted) { ob.observeArray(inserted); }\n // notify change\n ob.dep.notify();\n return result\n });\n});\n\n/* */\n\nvar arrayKeys = Object.getOwnPropertyNames(arrayMethods);\n\n/**\n * In some cases we may want to disable observation inside a component's\n * update computation.\n */\nvar shouldObserve = true;\n\nfunction toggleObserving (value) {\n shouldObserve = value;\n}\n\n/**\n * Observer class that is attached to each observed\n * object. Once attached, the observer converts the target\n * object's property keys into getter/setters that\n * collect dependencies and dispatch updates.\n */\nvar Observer = function Observer (value) {\n this.value = value;\n this.dep = new Dep();\n this.vmCount = 0;\n def(value, '__ob__', this);\n if (Array.isArray(value)) {\n if (hasProto) {\n protoAugment(value, arrayMethods);\n } else {\n copyAugment(value, arrayMethods, arrayKeys);\n }\n this.observeArray(value);\n } else {\n this.walk(value);\n }\n};\n\n/**\n * Walk through all properties and convert them into\n * getter/setters. This method should only be called when\n * value type is Object.\n */\nObserver.prototype.walk = function walk (obj) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n defineReactive$$1(obj, keys[i]);\n }\n};\n\n/**\n * Observe a list of Array items.\n */\nObserver.prototype.observeArray = function observeArray (items) {\n for (var i = 0, l = items.length; i < l; i++) {\n observe(items[i]);\n }\n};\n\n// helpers\n\n/**\n * Augment a target Object or Array by intercepting\n * the prototype chain using __proto__\n */\nfunction protoAugment (target, src) {\n /* eslint-disable no-proto */\n target.__proto__ = src;\n /* eslint-enable no-proto */\n}\n\n/**\n * Augment a target Object or Array by defining\n * hidden properties.\n */\n/* istanbul ignore next */\nfunction copyAugment (target, src, keys) {\n for (var i = 0, l = keys.length; i < l; i++) {\n var key = keys[i];\n def(target, key, src[key]);\n }\n}\n\n/**\n * Attempt to create an observer instance for a value,\n * returns the new observer if successfully observed,\n * or the existing observer if the value already has one.\n */\nfunction observe (value, asRootData) {\n if (!isObject(value) || value instanceof VNode) {\n return\n }\n var ob;\n if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n ob = value.__ob__;\n } else if (\n shouldObserve &&\n !isServerRendering() &&\n (Array.isArray(value) || isPlainObject(value)) &&\n Object.isExtensible(value) &&\n !value._isVue\n ) {\n ob = new Observer(value);\n }\n if (asRootData && ob) {\n ob.vmCount++;\n }\n return ob\n}\n\n/**\n * Define a reactive property on an Object.\n */\nfunction defineReactive$$1 (\n obj,\n key,\n val,\n customSetter,\n shallow\n) {\n var dep = new Dep();\n\n var property = Object.getOwnPropertyDescriptor(obj, key);\n if (property && property.configurable === false) {\n return\n }\n\n // cater for pre-defined getter/setters\n var getter = property && property.get;\n var setter = property && property.set;\n if ((!getter || setter) && arguments.length === 2) {\n val = obj[key];\n }\n\n var childOb = !shallow && observe(val);\n Object.defineProperty(obj, key, {\n enumerable: true,\n configurable: true,\n get: function reactiveGetter () {\n var value = getter ? getter.call(obj) : val;\n if (Dep.target) {\n dep.depend();\n if (childOb) {\n childOb.dep.depend();\n if (Array.isArray(value)) {\n dependArray(value);\n }\n }\n }\n return value\n },\n set: function reactiveSetter (newVal) {\n var value = getter ? getter.call(obj) : val;\n /* eslint-disable no-self-compare */\n if (newVal === value || (newVal !== newVal && value !== value)) {\n return\n }\n /* eslint-enable no-self-compare */\n if (process.env.NODE_ENV !== 'production' && customSetter) {\n customSetter();\n }\n // #7981: for accessor properties without setter\n if (getter && !setter) { return }\n if (setter) {\n setter.call(obj, newVal);\n } else {\n val = newVal;\n }\n childOb = !shallow && observe(newVal);\n dep.notify();\n }\n });\n}\n\n/**\n * Set a property on an object. Adds the new property and\n * triggers change notification if the property doesn't\n * already exist.\n */\nfunction set (target, key, val) {\n if (process.env.NODE_ENV !== 'production' &&\n (isUndef(target) || isPrimitive(target))\n ) {\n warn((\"Cannot set reactive property on undefined, null, or primitive value: \" + ((target))));\n }\n if (Array.isArray(target) && isValidArrayIndex(key)) {\n target.length = Math.max(target.length, key);\n target.splice(key, 1, val);\n return val\n }\n if (key in target && !(key in Object.prototype)) {\n target[key] = val;\n return val\n }\n var ob = (target).__ob__;\n if (target._isVue || (ob && ob.vmCount)) {\n process.env.NODE_ENV !== 'production' && warn(\n 'Avoid adding reactive properties to a Vue instance or its root $data ' +\n 'at runtime - declare it upfront in the data option.'\n );\n return val\n }\n if (!ob) {\n target[key] = val;\n return val\n }\n defineReactive$$1(ob.value, key, val);\n ob.dep.notify();\n return val\n}\n\n/**\n * Delete a property and trigger change if necessary.\n */\nfunction del (target, key) {\n if (process.env.NODE_ENV !== 'production' &&\n (isUndef(target) || isPrimitive(target))\n ) {\n warn((\"Cannot delete reactive property on undefined, null, or primitive value: \" + ((target))));\n }\n if (Array.isArray(target) && isValidArrayIndex(key)) {\n target.splice(key, 1);\n return\n }\n var ob = (target).__ob__;\n if (target._isVue || (ob && ob.vmCount)) {\n process.env.NODE_ENV !== 'production' && warn(\n 'Avoid deleting properties on a Vue instance or its root $data ' +\n '- just set it to null.'\n );\n return\n }\n if (!hasOwn(target, key)) {\n return\n }\n delete target[key];\n if (!ob) {\n return\n }\n ob.dep.notify();\n}\n\n/**\n * Collect dependencies on array elements when the array is touched, since\n * we cannot intercept array element access like property getters.\n */\nfunction dependArray (value) {\n for (var e = (void 0), i = 0, l = value.length; i < l; i++) {\n e = value[i];\n e && e.__ob__ && e.__ob__.dep.depend();\n if (Array.isArray(e)) {\n dependArray(e);\n }\n }\n}\n\n/* */\n\n/**\n * Option overwriting strategies are functions that handle\n * how to merge a parent option value and a child option\n * value into the final value.\n */\nvar strats = config.optionMergeStrategies;\n\n/**\n * Options with restrictions\n */\nif (process.env.NODE_ENV !== 'production') {\n strats.el = strats.propsData = function (parent, child, vm, key) {\n if (!vm) {\n warn(\n \"option \\\"\" + key + \"\\\" can only be used during instance \" +\n 'creation with the `new` keyword.'\n );\n }\n return defaultStrat(parent, child)\n };\n}\n\n/**\n * Helper that recursively merges two data objects together.\n */\nfunction mergeData (to, from) {\n if (!from) { return to }\n var key, toVal, fromVal;\n\n var keys = hasSymbol\n ? Reflect.ownKeys(from)\n : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === '__ob__') { continue }\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to\n}\n\n/**\n * Data\n */\nfunction mergeDataOrFn (\n parentVal,\n childVal,\n vm\n) {\n if (!vm) {\n // in a Vue.extend merge, both should be functions\n if (!childVal) {\n return parentVal\n }\n if (!parentVal) {\n return childVal\n }\n // when parentVal & childVal are both present,\n // we need to return a function that returns the\n // merged result of both functions... no need to\n // check if parentVal is a function here because\n // it has to be a function to pass previous merges.\n return function mergedDataFn () {\n return mergeData(\n typeof childVal === 'function' ? childVal.call(this, this) : childVal,\n typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal\n )\n }\n } else {\n return function mergedInstanceDataFn () {\n // instance merge\n var instanceData = typeof childVal === 'function'\n ? childVal.call(vm, vm)\n : childVal;\n var defaultData = typeof parentVal === 'function'\n ? parentVal.call(vm, vm)\n : parentVal;\n if (instanceData) {\n return mergeData(instanceData, defaultData)\n } else {\n return defaultData\n }\n }\n }\n}\n\nstrats.data = function (\n parentVal,\n childVal,\n vm\n) {\n if (!vm) {\n if (childVal && typeof childVal !== 'function') {\n process.env.NODE_ENV !== 'production' && warn(\n 'The \"data\" option should be a function ' +\n 'that returns a per-instance value in component ' +\n 'definitions.',\n vm\n );\n\n return parentVal\n }\n return mergeDataOrFn(parentVal, childVal)\n }\n\n return mergeDataOrFn(parentVal, childVal, vm)\n};\n\n/**\n * Hooks and props are merged as arrays.\n */\nfunction mergeHook (\n parentVal,\n childVal\n) {\n var res = childVal\n ? parentVal\n ? parentVal.concat(childVal)\n : Array.isArray(childVal)\n ? childVal\n : [childVal]\n : parentVal;\n return res\n ? dedupeHooks(res)\n : res\n}\n\nfunction dedupeHooks (hooks) {\n var res = [];\n for (var i = 0; i < hooks.length; i++) {\n if (res.indexOf(hooks[i]) === -1) {\n res.push(hooks[i]);\n }\n }\n return res\n}\n\nLIFECYCLE_HOOKS.forEach(function (hook) {\n strats[hook] = mergeHook;\n});\n\n/**\n * Assets\n *\n * When a vm is present (instance creation), we need to do\n * a three-way merge between constructor options, instance\n * options and parent options.\n */\nfunction mergeAssets (\n parentVal,\n childVal,\n vm,\n key\n) {\n var res = Object.create(parentVal || null);\n if (childVal) {\n process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);\n return extend(res, childVal)\n } else {\n return res\n }\n}\n\nASSET_TYPES.forEach(function (type) {\n strats[type + 's'] = mergeAssets;\n});\n\n/**\n * Watchers.\n *\n * Watchers hashes should not overwrite one\n * another, so we merge them as arrays.\n */\nstrats.watch = function (\n parentVal,\n childVal,\n vm,\n key\n) {\n // work around Firefox's Object.prototype.watch...\n if (parentVal === nativeWatch) { parentVal = undefined; }\n if (childVal === nativeWatch) { childVal = undefined; }\n /* istanbul ignore if */\n if (!childVal) { return Object.create(parentVal || null) }\n if (process.env.NODE_ENV !== 'production') {\n assertObjectType(key, childVal, vm);\n }\n if (!parentVal) { return childVal }\n var ret = {};\n extend(ret, parentVal);\n for (var key$1 in childVal) {\n var parent = ret[key$1];\n var child = childVal[key$1];\n if (parent && !Array.isArray(parent)) {\n parent = [parent];\n }\n ret[key$1] = parent\n ? parent.concat(child)\n : Array.isArray(child) ? child : [child];\n }\n return ret\n};\n\n/**\n * Other object hashes.\n */\nstrats.props =\nstrats.methods =\nstrats.inject =\nstrats.computed = function (\n parentVal,\n childVal,\n vm,\n key\n) {\n if (childVal && process.env.NODE_ENV !== 'production') {\n assertObjectType(key, childVal, vm);\n }\n if (!parentVal) { return childVal }\n var ret = Object.create(null);\n extend(ret, parentVal);\n if (childVal) { extend(ret, childVal); }\n return ret\n};\nstrats.provide = mergeDataOrFn;\n\n/**\n * Default strategy.\n */\nvar defaultStrat = function (parentVal, childVal) {\n return childVal === undefined\n ? parentVal\n : childVal\n};\n\n/**\n * Validate component names\n */\nfunction checkComponents (options) {\n for (var key in options.components) {\n validateComponentName(key);\n }\n}\n\nfunction validateComponentName (name) {\n if (!new RegExp((\"^[a-zA-Z][\\\\-\\\\.0-9_\" + (unicodeRegExp.source) + \"]*$\")).test(name)) {\n warn(\n 'Invalid component name: \"' + name + '\". Component names ' +\n 'should conform to valid custom element name in html5 specification.'\n );\n }\n if (isBuiltInTag(name) || config.isReservedTag(name)) {\n warn(\n 'Do not use built-in or reserved HTML elements as component ' +\n 'id: ' + name\n );\n }\n}\n\n/**\n * Ensure all props option syntax are normalized into the\n * Object-based format.\n */\nfunction normalizeProps (options, vm) {\n var props = options.props;\n if (!props) { return }\n var res = {};\n var i, val, name;\n if (Array.isArray(props)) {\n i = props.length;\n while (i--) {\n val = props[i];\n if (typeof val === 'string') {\n name = camelize(val);\n res[name] = { type: null };\n } else if (process.env.NODE_ENV !== 'production') {\n warn('props must be strings when using array syntax.');\n }\n }\n } else if (isPlainObject(props)) {\n for (var key in props) {\n val = props[key];\n name = camelize(key);\n res[name] = isPlainObject(val)\n ? val\n : { type: val };\n }\n } else if (process.env.NODE_ENV !== 'production') {\n warn(\n \"Invalid value for option \\\"props\\\": expected an Array or an Object, \" +\n \"but got \" + (toRawType(props)) + \".\",\n vm\n );\n }\n options.props = res;\n}\n\n/**\n * Normalize all injections into Object-based format\n */\nfunction normalizeInject (options, vm) {\n var inject = options.inject;\n if (!inject) { return }\n var normalized = options.inject = {};\n if (Array.isArray(inject)) {\n for (var i = 0; i < inject.length; i++) {\n normalized[inject[i]] = { from: inject[i] };\n }\n } else if (isPlainObject(inject)) {\n for (var key in inject) {\n var val = inject[key];\n normalized[key] = isPlainObject(val)\n ? extend({ from: key }, val)\n : { from: val };\n }\n } else if (process.env.NODE_ENV !== 'production') {\n warn(\n \"Invalid value for option \\\"inject\\\": expected an Array or an Object, \" +\n \"but got \" + (toRawType(inject)) + \".\",\n vm\n );\n }\n}\n\n/**\n * Normalize raw function directives into object format.\n */\nfunction normalizeDirectives (options) {\n var dirs = options.directives;\n if (dirs) {\n for (var key in dirs) {\n var def$$1 = dirs[key];\n if (typeof def$$1 === 'function') {\n dirs[key] = { bind: def$$1, update: def$$1 };\n }\n }\n }\n}\n\nfunction assertObjectType (name, value, vm) {\n if (!isPlainObject(value)) {\n warn(\n \"Invalid value for option \\\"\" + name + \"\\\": expected an Object, \" +\n \"but got \" + (toRawType(value)) + \".\",\n vm\n );\n }\n}\n\n/**\n * Merge two option objects into a new one.\n * Core utility used in both instantiation and inheritance.\n */\nfunction mergeOptions (\n parent,\n child,\n vm\n) {\n if (process.env.NODE_ENV !== 'production') {\n checkComponents(child);\n }\n\n if (typeof child === 'function') {\n child = child.options;\n }\n\n normalizeProps(child, vm);\n normalizeInject(child, vm);\n normalizeDirectives(child);\n\n // Apply extends and mixins on the child options,\n // but only if it is a raw options object that isn't\n // the result of another mergeOptions call.\n // Only merged options has the _base property.\n if (!child._base) {\n if (child.extends) {\n parent = mergeOptions(parent, child.extends, vm);\n }\n if (child.mixins) {\n for (var i = 0, l = child.mixins.length; i < l; i++) {\n parent = mergeOptions(parent, child.mixins[i], vm);\n }\n }\n }\n\n var options = {};\n var key;\n for (key in parent) {\n mergeField(key);\n }\n for (key in child) {\n if (!hasOwn(parent, key)) {\n mergeField(key);\n }\n }\n function mergeField (key) {\n var strat = strats[key] || defaultStrat;\n options[key] = strat(parent[key], child[key], vm, key);\n }\n return options\n}\n\n/**\n * Resolve an asset.\n * This function is used because child instances need access\n * to assets defined in its ancestor chain.\n */\nfunction resolveAsset (\n options,\n type,\n id,\n warnMissing\n) {\n /* istanbul ignore if */\n if (typeof id !== 'string') {\n return\n }\n var assets = options[type];\n // check local registration variations first\n if (hasOwn(assets, id)) { return assets[id] }\n var camelizedId = camelize(id);\n if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }\n var PascalCaseId = capitalize(camelizedId);\n if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }\n // fallback to prototype chain\n var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];\n if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {\n warn(\n 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,\n options\n );\n }\n return res\n}\n\n/* */\n\n\n\nfunction validateProp (\n key,\n propOptions,\n propsData,\n vm\n) {\n var prop = propOptions[key];\n var absent = !hasOwn(propsData, key);\n var value = propsData[key];\n // boolean casting\n var booleanIndex = getTypeIndex(Boolean, prop.type);\n if (booleanIndex > -1) {\n if (absent && !hasOwn(prop, 'default')) {\n value = false;\n } else if (value === '' || value === hyphenate(key)) {\n // only cast empty string / same name to boolean if\n // boolean has higher priority\n var stringIndex = getTypeIndex(String, prop.type);\n if (stringIndex < 0 || booleanIndex < stringIndex) {\n value = true;\n }\n }\n }\n // check default value\n if (value === undefined) {\n value = getPropDefaultValue(vm, prop, key);\n // since the default value is a fresh copy,\n // make sure to observe it.\n var prevShouldObserve = shouldObserve;\n toggleObserving(true);\n observe(value);\n toggleObserving(prevShouldObserve);\n }\n if (\n process.env.NODE_ENV !== 'production' &&\n // skip validation for weex recycle-list child component props\n !(false)\n ) {\n assertProp(prop, key, value, vm, absent);\n }\n return value\n}\n\n/**\n * Get the default value of a prop.\n */\nfunction getPropDefaultValue (vm, prop, key) {\n // no default, return undefined\n if (!hasOwn(prop, 'default')) {\n return undefined\n }\n var def = prop.default;\n // warn against non-factory defaults for Object & Array\n if (process.env.NODE_ENV !== 'production' && isObject(def)) {\n warn(\n 'Invalid default value for prop \"' + key + '\": ' +\n 'Props with type Object/Array must use a factory function ' +\n 'to return the default value.',\n vm\n );\n }\n // the raw prop value was also undefined from previous render,\n // return previous default value to avoid unnecessary watcher trigger\n if (vm && vm.$options.propsData &&\n vm.$options.propsData[key] === undefined &&\n vm._props[key] !== undefined\n ) {\n return vm._props[key]\n }\n // call factory function for non-Function types\n // a value is Function if its prototype is function even across different execution context\n return typeof def === 'function' && getType(prop.type) !== 'Function'\n ? def.call(vm)\n : def\n}\n\n/**\n * Assert whether a prop is valid.\n */\nfunction assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}\n\nvar simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;\n\nfunction assertType (value, type) {\n var valid;\n var expectedType = getType(type);\n if (simpleCheckRE.test(expectedType)) {\n var t = typeof value;\n valid = t === expectedType.toLowerCase();\n // for primitive wrapper objects\n if (!valid && t === 'object') {\n valid = value instanceof type;\n }\n } else if (expectedType === 'Object') {\n valid = isPlainObject(value);\n } else if (expectedType === 'Array') {\n valid = Array.isArray(value);\n } else {\n valid = value instanceof type;\n }\n return {\n valid: valid,\n expectedType: expectedType\n }\n}\n\n/**\n * Use function string name to check built-in types,\n * because a simple equality check will fail when running\n * across different vms / iframes.\n */\nfunction getType (fn) {\n var match = fn && fn.toString().match(/^\\s*function (\\w+)/);\n return match ? match[1] : ''\n}\n\nfunction isSameType (a, b) {\n return getType(a) === getType(b)\n}\n\nfunction getTypeIndex (type, expectedTypes) {\n if (!Array.isArray(expectedTypes)) {\n return isSameType(expectedTypes, type) ? 0 : -1\n }\n for (var i = 0, len = expectedTypes.length; i < len; i++) {\n if (isSameType(expectedTypes[i], type)) {\n return i\n }\n }\n return -1\n}\n\nfunction getInvalidTypeMessage (name, value, expectedTypes) {\n var message = \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', '));\n var expectedType = expectedTypes[0];\n var receivedType = toRawType(value);\n var expectedValue = styleValue(value, expectedType);\n var receivedValue = styleValue(value, receivedType);\n // check if we need to specify expected value\n if (expectedTypes.length === 1 &&\n isExplicable(expectedType) &&\n !isBoolean(expectedType, receivedType)) {\n message += \" with value \" + expectedValue;\n }\n message += \", got \" + receivedType + \" \";\n // check if we need to specify received value\n if (isExplicable(receivedType)) {\n message += \"with value \" + receivedValue + \".\";\n }\n return message\n}\n\nfunction styleValue (value, type) {\n if (type === 'String') {\n return (\"\\\"\" + value + \"\\\"\")\n } else if (type === 'Number') {\n return (\"\" + (Number(value)))\n } else {\n return (\"\" + value)\n }\n}\n\nfunction isExplicable (value) {\n var explicitTypes = ['string', 'number', 'boolean'];\n return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })\n}\n\nfunction isBoolean () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })\n}\n\n/* */\n\nfunction handleError (err, vm, info) {\n // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.\n // See: https://github.com/vuejs/vuex/issues/1505\n pushTarget();\n try {\n if (vm) {\n var cur = vm;\n while ((cur = cur.$parent)) {\n var hooks = cur.$options.errorCaptured;\n if (hooks) {\n for (var i = 0; i < hooks.length; i++) {\n try {\n var capture = hooks[i].call(cur, err, vm, info) === false;\n if (capture) { return }\n } catch (e) {\n globalHandleError(e, cur, 'errorCaptured hook');\n }\n }\n }\n }\n }\n globalHandleError(err, vm, info);\n } finally {\n popTarget();\n }\n}\n\nfunction invokeWithErrorHandling (\n handler,\n context,\n args,\n vm,\n info\n) {\n var res;\n try {\n res = args ? handler.apply(context, args) : handler.call(context);\n if (res && !res._isVue && isPromise(res) && !res._handled) {\n res.catch(function (e) { return handleError(e, vm, info + \" (Promise/async)\"); });\n // issue #9511\n // avoid catch triggering multiple times when nested calls\n res._handled = true;\n }\n } catch (e) {\n handleError(e, vm, info);\n }\n return res\n}\n\nfunction globalHandleError (err, vm, info) {\n if (config.errorHandler) {\n try {\n return config.errorHandler.call(null, err, vm, info)\n } catch (e) {\n // if the user intentionally throws the original error in the handler,\n // do not log it twice\n if (e !== err) {\n logError(e, null, 'config.errorHandler');\n }\n }\n }\n logError(err, vm, info);\n}\n\nfunction logError (err, vm, info) {\n if (process.env.NODE_ENV !== 'production') {\n warn((\"Error in \" + info + \": \\\"\" + (err.toString()) + \"\\\"\"), vm);\n }\n /* istanbul ignore else */\n if ((inBrowser || inWeex) && typeof console !== 'undefined') {\n console.error(err);\n } else {\n throw err\n }\n}\n\n/* */\n\nvar isUsingMicroTask = false;\n\nvar callbacks = [];\nvar pending = false;\n\nfunction flushCallbacks () {\n pending = false;\n var copies = callbacks.slice(0);\n callbacks.length = 0;\n for (var i = 0; i < copies.length; i++) {\n copies[i]();\n }\n}\n\n// Here we have async deferring wrappers using microtasks.\n// In 2.5 we used (macro) tasks (in combination with microtasks).\n// However, it has subtle problems when state is changed right before repaint\n// (e.g. #6813, out-in transitions).\n// Also, using (macro) tasks in event handler would cause some weird behaviors\n// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).\n// So we now use microtasks everywhere, again.\n// A major drawback of this tradeoff is that there are some scenarios\n// where microtasks have too high a priority and fire in between supposedly\n// sequential events (e.g. #4521, #6690, which have workarounds)\n// or even between bubbling of the same event (#6566).\nvar timerFunc;\n\n// The nextTick behavior leverages the microtask queue, which can be accessed\n// via either native Promise.then or MutationObserver.\n// MutationObserver has wider support, however it is seriously bugged in\n// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It\n// completely stops working after triggering a few times... so, if native\n// Promise is available, we will use it:\n/* istanbul ignore next, $flow-disable-line */\nif (typeof Promise !== 'undefined' && isNative(Promise)) {\n var p = Promise.resolve();\n timerFunc = function () {\n p.then(flushCallbacks);\n // In problematic UIWebViews, Promise.then doesn't completely break, but\n // it can get stuck in a weird state where callbacks are pushed into the\n // microtask queue but the queue isn't being flushed, until the browser\n // needs to do some other work, e.g. handle a timer. Therefore we can\n // \"force\" the microtask queue to be flushed by adding an empty timer.\n if (isIOS) { setTimeout(noop); }\n };\n isUsingMicroTask = true;\n} else if (!isIE && typeof MutationObserver !== 'undefined' && (\n isNative(MutationObserver) ||\n // PhantomJS and iOS 7.x\n MutationObserver.toString() === '[object MutationObserverConstructor]'\n)) {\n // Use MutationObserver where native Promise is not available,\n // e.g. PhantomJS, iOS7, Android 4.4\n // (#6466 MutationObserver is unreliable in IE11)\n var counter = 1;\n var observer = new MutationObserver(flushCallbacks);\n var textNode = document.createTextNode(String(counter));\n observer.observe(textNode, {\n characterData: true\n });\n timerFunc = function () {\n counter = (counter + 1) % 2;\n textNode.data = String(counter);\n };\n isUsingMicroTask = true;\n} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {\n // Fallback to setImmediate.\n // Technically it leverages the (macro) task queue,\n // but it is still a better choice than setTimeout.\n timerFunc = function () {\n setImmediate(flushCallbacks);\n };\n} else {\n // Fallback to setTimeout.\n timerFunc = function () {\n setTimeout(flushCallbacks, 0);\n };\n}\n\nfunction nextTick (cb, ctx) {\n var _resolve;\n callbacks.push(function () {\n if (cb) {\n try {\n cb.call(ctx);\n } catch (e) {\n handleError(e, ctx, 'nextTick');\n }\n } else if (_resolve) {\n _resolve(ctx);\n }\n });\n if (!pending) {\n pending = true;\n timerFunc();\n }\n // $flow-disable-line\n if (!cb && typeof Promise !== 'undefined') {\n return new Promise(function (resolve) {\n _resolve = resolve;\n })\n }\n}\n\n/* */\n\n/* not type checking this file because flow doesn't play well with Proxy */\n\nvar initProxy;\n\nif (process.env.NODE_ENV !== 'production') {\n var allowedGlobals = makeMap(\n 'Infinity,undefined,NaN,isFinite,isNaN,' +\n 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +\n 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +\n 'require' // for Webpack/Browserify\n );\n\n var warnNonPresent = function (target, key) {\n warn(\n \"Property or method \\\"\" + key + \"\\\" is not defined on the instance but \" +\n 'referenced during render. Make sure that this property is reactive, ' +\n 'either in the data option, or for class-based components, by ' +\n 'initializing the property. ' +\n 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',\n target\n );\n };\n\n var warnReservedPrefix = function (target, key) {\n warn(\n \"Property \\\"\" + key + \"\\\" must be accessed with \\\"$data.\" + key + \"\\\" because \" +\n 'properties starting with \"$\" or \"_\" are not proxied in the Vue instance to ' +\n 'prevent conflicts with Vue internals. ' +\n 'See: https://vuejs.org/v2/api/#data',\n target\n );\n };\n\n var hasProxy =\n typeof Proxy !== 'undefined' && isNative(Proxy);\n\n if (hasProxy) {\n var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');\n config.keyCodes = new Proxy(config.keyCodes, {\n set: function set (target, key, value) {\n if (isBuiltInModifier(key)) {\n warn((\"Avoid overwriting built-in modifier in config.keyCodes: .\" + key));\n return false\n } else {\n target[key] = value;\n return true\n }\n }\n });\n }\n\n var hasHandler = {\n has: function has (target, key) {\n var has = key in target;\n var isAllowed = allowedGlobals(key) ||\n (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));\n if (!has && !isAllowed) {\n if (key in target.$data) { warnReservedPrefix(target, key); }\n else { warnNonPresent(target, key); }\n }\n return has || !isAllowed\n }\n };\n\n var getHandler = {\n get: function get (target, key) {\n if (typeof key === 'string' && !(key in target)) {\n if (key in target.$data) { warnReservedPrefix(target, key); }\n else { warnNonPresent(target, key); }\n }\n return target[key]\n }\n };\n\n initProxy = function initProxy (vm) {\n if (hasProxy) {\n // determine which proxy handler to use\n var options = vm.$options;\n var handlers = options.render && options.render._withStripped\n ? getHandler\n : hasHandler;\n vm._renderProxy = new Proxy(vm, handlers);\n } else {\n vm._renderProxy = vm;\n }\n };\n}\n\n/* */\n\nvar seenObjects = new _Set();\n\n/**\n * Recursively traverse an object to evoke all converted\n * getters, so that every nested property inside the object\n * is collected as a \"deep\" dependency.\n */\nfunction traverse (val) {\n _traverse(val, seenObjects);\n seenObjects.clear();\n}\n\nfunction _traverse (val, seen) {\n var i, keys;\n var isA = Array.isArray(val);\n if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {\n return\n }\n if (val.__ob__) {\n var depId = val.__ob__.dep.id;\n if (seen.has(depId)) {\n return\n }\n seen.add(depId);\n }\n if (isA) {\n i = val.length;\n while (i--) { _traverse(val[i], seen); }\n } else {\n keys = Object.keys(val);\n i = keys.length;\n while (i--) { _traverse(val[keys[i]], seen); }\n }\n}\n\nvar mark;\nvar measure;\n\nif (process.env.NODE_ENV !== 'production') {\n var perf = inBrowser && window.performance;\n /* istanbul ignore if */\n if (\n perf &&\n perf.mark &&\n perf.measure &&\n perf.clearMarks &&\n perf.clearMeasures\n ) {\n mark = function (tag) { return perf.mark(tag); };\n measure = function (name, startTag, endTag) {\n perf.measure(name, startTag, endTag);\n perf.clearMarks(startTag);\n perf.clearMarks(endTag);\n // perf.clearMeasures(name)\n };\n }\n}\n\n/* */\n\nvar normalizeEvent = cached(function (name) {\n var passive = name.charAt(0) === '&';\n name = passive ? name.slice(1) : name;\n var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first\n name = once$$1 ? name.slice(1) : name;\n var capture = name.charAt(0) === '!';\n name = capture ? name.slice(1) : name;\n return {\n name: name,\n once: once$$1,\n capture: capture,\n passive: passive\n }\n});\n\nfunction createFnInvoker (fns, vm) {\n function invoker () {\n var arguments$1 = arguments;\n\n var fns = invoker.fns;\n if (Array.isArray(fns)) {\n var cloned = fns.slice();\n for (var i = 0; i < cloned.length; i++) {\n invokeWithErrorHandling(cloned[i], null, arguments$1, vm, \"v-on handler\");\n }\n } else {\n // return handler return value for single handlers\n return invokeWithErrorHandling(fns, null, arguments, vm, \"v-on handler\")\n }\n }\n invoker.fns = fns;\n return invoker\n}\n\nfunction updateListeners (\n on,\n oldOn,\n add,\n remove$$1,\n createOnceHandler,\n vm\n) {\n var name, def$$1, cur, old, event;\n for (name in on) {\n def$$1 = cur = on[name];\n old = oldOn[name];\n event = normalizeEvent(name);\n if (isUndef(cur)) {\n process.env.NODE_ENV !== 'production' && warn(\n \"Invalid handler for event \\\"\" + (event.name) + \"\\\": got \" + String(cur),\n vm\n );\n } else if (isUndef(old)) {\n if (isUndef(cur.fns)) {\n cur = on[name] = createFnInvoker(cur, vm);\n }\n if (isTrue(event.once)) {\n cur = on[name] = createOnceHandler(event.name, cur, event.capture);\n }\n add(event.name, cur, event.capture, event.passive, event.params);\n } else if (cur !== old) {\n old.fns = cur;\n on[name] = old;\n }\n }\n for (name in oldOn) {\n if (isUndef(on[name])) {\n event = normalizeEvent(name);\n remove$$1(event.name, oldOn[name], event.capture);\n }\n }\n}\n\n/* */\n\nfunction mergeVNodeHook (def, hookKey, hook) {\n if (def instanceof VNode) {\n def = def.data.hook || (def.data.hook = {});\n }\n var invoker;\n var oldHook = def[hookKey];\n\n function wrappedHook () {\n hook.apply(this, arguments);\n // important: remove merged hook to ensure it's called only once\n // and prevent memory leak\n remove(invoker.fns, wrappedHook);\n }\n\n if (isUndef(oldHook)) {\n // no existing hook\n invoker = createFnInvoker([wrappedHook]);\n } else {\n /* istanbul ignore if */\n if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {\n // already a merged invoker\n invoker = oldHook;\n invoker.fns.push(wrappedHook);\n } else {\n // existing plain hook\n invoker = createFnInvoker([oldHook, wrappedHook]);\n }\n }\n\n invoker.merged = true;\n def[hookKey] = invoker;\n}\n\n/* */\n\nfunction extractPropsFromVNodeData (\n data,\n Ctor,\n tag\n) {\n // we are only extracting raw values here.\n // validation and default values are handled in the child\n // component itself.\n var propOptions = Ctor.options.props;\n if (isUndef(propOptions)) {\n return\n }\n var res = {};\n var attrs = data.attrs;\n var props = data.props;\n if (isDef(attrs) || isDef(props)) {\n for (var key in propOptions) {\n var altKey = hyphenate(key);\n if (process.env.NODE_ENV !== 'production') {\n var keyInLowerCase = key.toLowerCase();\n if (\n key !== keyInLowerCase &&\n attrs && hasOwn(attrs, keyInLowerCase)\n ) {\n tip(\n \"Prop \\\"\" + keyInLowerCase + \"\\\" is passed to component \" +\n (formatComponentName(tag || Ctor)) + \", but the declared prop name is\" +\n \" \\\"\" + key + \"\\\". \" +\n \"Note that HTML attributes are case-insensitive and camelCased \" +\n \"props need to use their kebab-case equivalents when using in-DOM \" +\n \"templates. You should probably use \\\"\" + altKey + \"\\\" instead of \\\"\" + key + \"\\\".\"\n );\n }\n }\n checkProp(res, props, key, altKey, true) ||\n checkProp(res, attrs, key, altKey, false);\n }\n }\n return res\n}\n\nfunction checkProp (\n res,\n hash,\n key,\n altKey,\n preserve\n) {\n if (isDef(hash)) {\n if (hasOwn(hash, key)) {\n res[key] = hash[key];\n if (!preserve) {\n delete hash[key];\n }\n return true\n } else if (hasOwn(hash, altKey)) {\n res[key] = hash[altKey];\n if (!preserve) {\n delete hash[altKey];\n }\n return true\n }\n }\n return false\n}\n\n/* */\n\n// The template compiler attempts to minimize the need for normalization by\n// statically analyzing the template at compile time.\n//\n// For plain HTML markup, normalization can be completely skipped because the\n// generated render function is guaranteed to return Array. There are\n// two cases where extra normalization is needed:\n\n// 1. When the children contains components - because a functional component\n// may return an Array instead of a single root. In this case, just a simple\n// normalization is needed - if any child is an Array, we flatten the whole\n// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep\n// because functional components already normalize their own children.\nfunction simpleNormalizeChildren (children) {\n for (var i = 0; i < children.length; i++) {\n if (Array.isArray(children[i])) {\n return Array.prototype.concat.apply([], children)\n }\n }\n return children\n}\n\n// 2. When the children contains constructs that always generated nested Arrays,\n// e.g.