From 87d47cd857b0a9d0c837a1f350566ab329d67699 Mon Sep 17 00:00:00 2001 From: status-im-auto Date: Wed, 7 Sep 2022 06:09:30 +0000 Subject: [PATCH] Updates --- eth-pm/asset-manifest.json | 22 +++++ eth-pm/favicon.ico | Bin 0 -> 3870 bytes eth-pm/index.html | 1 + eth-pm/logo192.png | Bin 0 -> 5347 bytes eth-pm/logo512.png | Bin 0 -> 9664 bytes eth-pm/manifest.json | 25 ++++++ eth-pm/robots.txt | 3 + eth-pm/static/css/main.0350996a.css | 2 + eth-pm/static/css/main.0350996a.css.map | 1 + eth-pm/static/js/main.15205ba0.js | 3 + eth-pm/static/js/main.15205ba0.js.LICENSE.txt | 78 ++++++++++++++++++ eth-pm/static/js/main.15205ba0.js.map | 1 + ...o-all-400-normal.b5a0a0df312d3423493b.woff | Bin 0 -> 66044 bytes ...llic-400-normal.3605d18d8a4ce5bd39c3.woff2 | Bin 0 -> 9900 bytes ...-ext-400-normal.dd55ea0a2e90d5d86e15.woff2 | Bin 0 -> 15520 bytes ...reek-400-normal.352cc77aaed5208ce13c.woff2 | Bin 0 -> 7296 bytes ...-ext-400-normal.bc7ace6e50c7d9d4d959.woff2 | Bin 0 -> 1528 bytes ...atin-400-normal.176f8f5bd5f02b3abfcf.woff2 | Bin 0 -> 15736 bytes ...-ext-400-normal.dcc07bcfcd475f34f20b.woff2 | Bin 0 -> 12200 bytes ...mese-400-normal.52cebac009baf5592e7d.woff2 | Bin 0 -> 5468 bytes .../static/media/rpc.93e8f6196bd2c425bf03.cjs | 1 + 21 files changed, 137 insertions(+) create mode 100644 eth-pm/asset-manifest.json create mode 100644 eth-pm/favicon.ico create mode 100644 eth-pm/index.html create mode 100644 eth-pm/logo192.png create mode 100644 eth-pm/logo512.png create mode 100644 eth-pm/manifest.json create mode 100644 eth-pm/robots.txt create mode 100644 eth-pm/static/css/main.0350996a.css create mode 100644 eth-pm/static/css/main.0350996a.css.map create mode 100644 eth-pm/static/js/main.15205ba0.js create mode 100644 eth-pm/static/js/main.15205ba0.js.LICENSE.txt create mode 100644 eth-pm/static/js/main.15205ba0.js.map create mode 100644 eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff create mode 100644 eth-pm/static/media/roboto-cyrillic-400-normal.3605d18d8a4ce5bd39c3.woff2 create mode 100644 eth-pm/static/media/roboto-cyrillic-ext-400-normal.dd55ea0a2e90d5d86e15.woff2 create mode 100644 eth-pm/static/media/roboto-greek-400-normal.352cc77aaed5208ce13c.woff2 create mode 100644 eth-pm/static/media/roboto-greek-ext-400-normal.bc7ace6e50c7d9d4d959.woff2 create mode 100644 eth-pm/static/media/roboto-latin-400-normal.176f8f5bd5f02b3abfcf.woff2 create mode 100644 eth-pm/static/media/roboto-latin-ext-400-normal.dcc07bcfcd475f34f20b.woff2 create mode 100644 eth-pm/static/media/roboto-vietnamese-400-normal.52cebac009baf5592e7d.woff2 create mode 100644 eth-pm/static/media/rpc.93e8f6196bd2c425bf03.cjs diff --git a/eth-pm/asset-manifest.json b/eth-pm/asset-manifest.json new file mode 100644 index 0000000..be2ac23 --- /dev/null +++ b/eth-pm/asset-manifest.json @@ -0,0 +1,22 @@ +{ + "files": { + "main.css": "/eth-pm/static/css/main.0350996a.css", + "main.js": "/eth-pm/static/js/main.15205ba0.js", + "static/media/roboto-all-400-normal.woff": "/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff", + "static/media/rpc.cjs": "/eth-pm/static/media/rpc.93e8f6196bd2c425bf03.cjs", + "static/media/roboto-latin-400-normal.woff2": "/eth-pm/static/media/roboto-latin-400-normal.176f8f5bd5f02b3abfcf.woff2", + "static/media/roboto-cyrillic-ext-400-normal.woff2": "/eth-pm/static/media/roboto-cyrillic-ext-400-normal.dd55ea0a2e90d5d86e15.woff2", + "static/media/roboto-latin-ext-400-normal.woff2": "/eth-pm/static/media/roboto-latin-ext-400-normal.dcc07bcfcd475f34f20b.woff2", + "static/media/roboto-cyrillic-400-normal.woff2": "/eth-pm/static/media/roboto-cyrillic-400-normal.3605d18d8a4ce5bd39c3.woff2", + "static/media/roboto-greek-400-normal.woff2": "/eth-pm/static/media/roboto-greek-400-normal.352cc77aaed5208ce13c.woff2", + "static/media/roboto-vietnamese-400-normal.woff2": "/eth-pm/static/media/roboto-vietnamese-400-normal.52cebac009baf5592e7d.woff2", + "static/media/roboto-greek-ext-400-normal.woff2": "/eth-pm/static/media/roboto-greek-ext-400-normal.bc7ace6e50c7d9d4d959.woff2", + "index.html": "/eth-pm/index.html", + "main.0350996a.css.map": "/eth-pm/static/css/main.0350996a.css.map", + "main.15205ba0.js.map": "/eth-pm/static/js/main.15205ba0.js.map" + }, + "entrypoints": [ + "static/css/main.0350996a.css", + "static/js/main.15205ba0.js" + ] +} \ No newline at end of file diff --git a/eth-pm/favicon.ico b/eth-pm/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..a11777cc471a4344702741ab1c8a588998b1311a GIT binary patch literal 3870 zcma);c{J4h9>;%nil|2-o+rCuEF-(I%-F}ijC~o(k~HKAkr0)!FCj~d>`RtpD?8b; zXOC1OD!V*IsqUwzbMF1)-gEDD=A573Z-&G7^LoAC9|WO7Xc0Cx1g^Zu0u_SjAPB3vGa^W|sj)80f#V0@M_CAZTIO(t--xg= z!sii`1giyH7EKL_+Wi0ab<)&E_0KD!3Rp2^HNB*K2@PHCs4PWSA32*-^7d{9nH2_E zmC{C*N*)(vEF1_aMamw2A{ZH5aIDqiabnFdJ|y0%aS|64E$`s2ccV~3lR!u<){eS` z#^Mx6o(iP1Ix%4dv`t@!&Za-K@mTm#vadc{0aWDV*_%EiGK7qMC_(`exc>-$Gb9~W!w_^{*pYRm~G zBN{nA;cm^w$VWg1O^^<6vY`1XCD|s_zv*g*5&V#wv&s#h$xlUilPe4U@I&UXZbL z0)%9Uj&@yd03n;!7do+bfixH^FeZ-Ema}s;DQX2gY+7g0s(9;`8GyvPY1*vxiF&|w z>!vA~GA<~JUqH}d;DfBSi^IT*#lrzXl$fNpq0_T1tA+`A$1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2RS%}T>^~EYqdL1q4nD%0n&Xqr^cK^`J5W;lRRB^R-O8b&HENO||mo0xaD+S=I8RTlIfVgqN@SXDr2&-)we--K7w= zJVU8?Z+7k9dy;s;^gDkQa`0nz6N{T?(A&Iz)2!DEecLyRa&FI!id#5Z7B*O2=PsR0 zEvc|8{NS^)!d)MDX(97Xw}m&kEO@5jqRaDZ!+%`wYOI<23q|&js`&o4xvjP7D_xv@ z5hEwpsp{HezI9!~6O{~)lLR@oF7?J7i>1|5a~UuoN=q&6N}EJPV_GD`&M*v8Y`^2j zKII*d_@Fi$+i*YEW+Hbzn{iQk~yP z>7N{S4)r*!NwQ`(qcN#8SRQsNK6>{)X12nbF`*7#ecO7I)Q$uZsV+xS4E7aUn+U(K baj7?x%VD!5Cxk2YbYLNVeiXvvpMCWYo=by@ literal 0 HcmV?d00001 diff --git a/eth-pm/index.html b/eth-pm/index.html new file mode 100644 index 0000000..383461b --- /dev/null +++ b/eth-pm/index.html @@ -0,0 +1 @@ +React App
\ No newline at end of file diff --git a/eth-pm/logo192.png b/eth-pm/logo192.png new file mode 100644 index 0000000000000000000000000000000000000000..fc44b0a3796c0e0a64c3d858ca038bd4570465d9 GIT binary patch literal 5347 zcmZWtbyO6NvR-oO24RV%BvuJ&=?+<7=`LvyB&A_#M7mSDYw1v6DJkiYl9XjT!%$dLEBTQ8R9|wd3008in6lFF3GV-6mLi?MoP_y~}QUnaDCHI#t z7w^m$@6DI)|C8_jrT?q=f8D?0AM?L)Z}xAo^e^W>t$*Y0KlT5=@bBjT9kxb%-KNdk zeOS1tKO#ChhG7%{ApNBzE2ZVNcxbrin#E1TiAw#BlUhXllzhN$qWez5l;h+t^q#Eav8PhR2|T}y5kkflaK`ba-eoE+Z2q@o6P$)=&` z+(8}+-McnNO>e#$Rr{32ngsZIAX>GH??tqgwUuUz6kjns|LjsB37zUEWd|(&O!)DY zQLrq%Y>)Y8G`yYbYCx&aVHi@-vZ3|ebG!f$sTQqMgi0hWRJ^Wc+Ibv!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I=p<5E#LTkwzVR@=yY|uBVI1HG|8h+d;G-qfuj}-ZR6fN>EfCCW z9~wRQoAPEa#aO?3h?x{YvV*d+NtPkf&4V0k4|L=uj!U{L+oLa(z#&iuhJr3-PjO3R z5s?=nn_5^*^Rawr>>Nr@K(jwkB#JK-=+HqwfdO<+P5byeim)wvqGlP-P|~Nse8=XF zz`?RYB|D6SwS}C+YQv+;}k6$-%D(@+t14BL@vM z2q%q?f6D-A5s$_WY3{^G0F131bbh|g!}#BKw=HQ7mx;Dzg4Z*bTLQSfo{ed{4}NZW zfrRm^Ca$rlE{Ue~uYv>R9{3smwATcdM_6+yWIO z*ZRH~uXE@#p$XTbCt5j7j2=86e{9>HIB6xDzV+vAo&B?KUiMP|ttOElepnl%|DPqL b{|{}U^kRn2wo}j7|0ATu<;8xA7zX}7|B6mN literal 0 HcmV?d00001 diff --git a/eth-pm/manifest.json b/eth-pm/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/eth-pm/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/eth-pm/robots.txt b/eth-pm/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/eth-pm/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/eth-pm/static/css/main.0350996a.css b/eth-pm/static/css/main.0350996a.css new file mode 100644 index 0000000..a145cd2 --- /dev/null +++ b/eth-pm/static/css/main.0350996a.css @@ -0,0 +1,2 @@ +body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;margin:0}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}.App{text-align:center}.App-logo{height:40vmin;pointer-events:none}@media (prefers-reduced-motion:no-preference){.App-logo{animation:App-logo-spin 20s linear infinite}}.App-header{align-items:center;background-color:#ddd;color:#000;display:flex;flex-direction:column;font-size:calc(10px + 2vmin);justify-content:center;min-height:100vh}.App-link{color:#61dafb}@keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@font-face{font-display:swap;font-family:Roboto;font-style:normal;font-weight:400;src:url(/eth-pm/static/media/roboto-cyrillic-ext-400-normal.dd55ea0a2e90d5d86e15.woff2) format("woff2"),url(/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff) format("woff");unicode-range:u+0460-052f,u+1c80-1c88,u+20b4,u+2de0-2dff,u+a640-a69f,u+fe2e-fe2f}@font-face{font-display:swap;font-family:Roboto;font-style:normal;font-weight:400;src:url(/eth-pm/static/media/roboto-cyrillic-400-normal.3605d18d8a4ce5bd39c3.woff2) format("woff2"),url(/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff) format("woff");unicode-range:u+0400-045f,u+0490-0491,u+04b0-04b1,u+2116}@font-face{font-display:swap;font-family:Roboto;font-style:normal;font-weight:400;src:url(/eth-pm/static/media/roboto-greek-ext-400-normal.bc7ace6e50c7d9d4d959.woff2) format("woff2"),url(/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff) format("woff");unicode-range:u+1f??}@font-face{font-display:swap;font-family:Roboto;font-style:normal;font-weight:400;src:url(/eth-pm/static/media/roboto-greek-400-normal.352cc77aaed5208ce13c.woff2) format("woff2"),url(/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff) format("woff");unicode-range:u+0370-03ff}@font-face{font-display:swap;font-family:Roboto;font-style:normal;font-weight:400;src:url(/eth-pm/static/media/roboto-vietnamese-400-normal.52cebac009baf5592e7d.woff2) format("woff2"),url(/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff) format("woff");unicode-range:u+0102-0103,u+0110-0111,u+0128-0129,u+0168-0169,u+01a0-01a1,u+01af-01b0,u+1ea0-1ef9,u+20ab}@font-face{font-display:swap;font-family:Roboto;font-style:normal;font-weight:400;src:url(/eth-pm/static/media/roboto-latin-ext-400-normal.dcc07bcfcd475f34f20b.woff2) format("woff2"),url(/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff) format("woff");unicode-range:u+0100-024f,u+0259,u+1e??,u+2020,u+20a0-20ab,u+20ad-20cf,u+2113,u+2c60-2c7f,u+a720-a7ff}@font-face{font-display:swap;font-family:Roboto;font-style:normal;font-weight:400;src:url(/eth-pm/static/media/roboto-latin-400-normal.176f8f5bd5f02b3abfcf.woff2) format("woff2"),url(/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff) format("woff");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+2000-206f,u+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd} +/*# sourceMappingURL=main.0350996a.css.map*/ \ No newline at end of file diff --git a/eth-pm/static/css/main.0350996a.css.map b/eth-pm/static/css/main.0350996a.css.map new file mode 100644 index 0000000..b4e645f --- /dev/null +++ b/eth-pm/static/css/main.0350996a.css.map @@ -0,0 +1 @@ +{"version":3,"file":"static/css/main.0350996a.css","mappings":"AAAA,KAKE,kCAAmC,CACnC,iCAAkC,CAJlC,mIAEY,CAHZ,QAMF,CAEA,KACE,uEAEF,CCZA,KACE,iBACF,CAEA,UACE,aAAc,CACd,mBACF,CAEA,8CACE,UACE,2CACF,CACF,CAEA,YAKE,kBAAmB,CAJnB,qBAAyB,CAOzB,UAAY,CALZ,YAAa,CACb,qBAAsB,CAGtB,4BAA6B,CAD7B,sBAAuB,CAJvB,gBAOF,CAEA,UACE,aACF,CAEA,yBACE,GACE,sBACF,CACA,GACE,uBACF,CACF,CCpCA,WAGE,iBAAkB,CAFlB,kBAAqB,CACrB,iBAAkB,CAElB,eAAgB,CAChB,gMAAkI,CAClI,gFACF,CAEA,WAGE,iBAAkB,CAFlB,kBAAqB,CACrB,iBAAkB,CAElB,eAAgB,CAChB,4LAA8H,CAC9H,wDACF,CAEA,WAGE,iBAAkB,CAFlB,kBAAqB,CACrB,iBAAkB,CAElB,eAAgB,CAChB,6LAA+H,CAC/H,oBACF,CAEA,WAGE,iBAAkB,CAFlB,kBAAqB,CACrB,iBAAkB,CAElB,eAAgB,CAChB,yLAA2H,CAC3H,yBACF,CAEA,WAGE,iBAAkB,CAFlB,kBAAqB,CACrB,iBAAkB,CAElB,eAAgB,CAChB,8LAAgI,CAChI,wGACF,CAEA,WAGE,iBAAkB,CAFlB,kBAAqB,CACrB,iBAAkB,CAElB,eAAgB,CAChB,6LAA+H,CAC/H,qGACF,CAEA,WAGE,iBAAkB,CAFlB,kBAAqB,CACrB,iBAAkB,CAElB,eAAgB,CAChB,yLAA2H,CAC3H,mJACF","sources":["index.css","App.css","../node_modules/fontsource-roboto/index.css"],"sourcesContent":["body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n monospace;\n}\n",".App {\n text-align: center;\n}\n\n.App-logo {\n height: 40vmin;\n pointer-events: none;\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .App-logo {\n animation: App-logo-spin infinite 20s linear;\n }\n}\n\n.App-header {\n background-color: #dddddd;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n font-size: calc(10px + 2vmin);\n color: black;\n}\n\n.App-link {\n color: #61dafb;\n}\n\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n","/* roboto-cyrillic-ext-400-normal*/\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url('./files/roboto-cyrillic-ext-400-normal.woff2') format('woff2'), url('./files/roboto-all-400-normal.woff') format('woff');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* roboto-cyrillic-400-normal*/\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url('./files/roboto-cyrillic-400-normal.woff2') format('woff2'), url('./files/roboto-all-400-normal.woff') format('woff');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* roboto-greek-ext-400-normal*/\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url('./files/roboto-greek-ext-400-normal.woff2') format('woff2'), url('./files/roboto-all-400-normal.woff') format('woff');\n unicode-range: U+1F00-1FFF;\n}\n/* roboto-greek-400-normal*/\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url('./files/roboto-greek-400-normal.woff2') format('woff2'), url('./files/roboto-all-400-normal.woff') format('woff');\n unicode-range: U+0370-03FF;\n}\n/* roboto-vietnamese-400-normal*/\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url('./files/roboto-vietnamese-400-normal.woff2') format('woff2'), url('./files/roboto-all-400-normal.woff') format('woff');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* roboto-latin-ext-400-normal*/\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url('./files/roboto-latin-ext-400-normal.woff2') format('woff2'), url('./files/roboto-all-400-normal.woff') format('woff');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* roboto-latin-400-normal*/\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url('./files/roboto-latin-400-normal.woff2') format('woff2'), url('./files/roboto-all-400-normal.woff') format('woff');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/eth-pm/static/js/main.15205ba0.js b/eth-pm/static/js/main.15205ba0.js new file mode 100644 index 0000000..32dd7f1 --- /dev/null +++ b/eth-pm/static/js/main.15205ba0.js @@ -0,0 +1,3 @@ +/*! For license information please see main.15205ba0.js.LICENSE.txt */ +(()=>{var __webpack_modules__={2147:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AbiCoder:()=>re,ConstructorFragment:()=>S,ErrorFragment:()=>C,EventFragment:()=>v,FormatTypes:()=>f,Fragment:()=>y,FunctionFragment:()=>_,Indexed:()=>ue,Interface:()=>fe,LogDescription:()=>ae,ParamType:()=>g,TransactionDescription:()=>le,checkResultErrors:()=>N,defaultAbiCoder:()=>ne});var n=r(2257),i=r(520),o=r(9502);const s="abi/5.7.0",a=new o.Logger(s),l={};let c={calldata:!0,memory:!0,storage:!0},u={calldata:!0,memory:!0};function h(e,t){if("bytes"===e||"string"===e){if(c[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&u[t])return!0;return(c[t]||"payable"===t)&&a.throwArgumentError("invalid modifier","name",t),!1}function d(e,t){for(let r in t)(0,i.defineReadOnly)(e,r,t[r])}const f=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),p=new RegExp(/^(.*)\[([0-9]*)\]$/);class g{constructor(e,t){e!==l&&a.throwError("use fromString",o.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),d(this,t);let r=this.type.match(p);d(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:g.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=f.sighash),f[e]||a.throwArgumentError("invalid format type","format",e),e===f.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"===typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==f.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===f.full?", ":",")+")"):t+=this.type,e!==f.sighash&&(!0===this.indexed&&(t+=" indexed"),e===f.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"===typeof e?g.fromString(e,t):g.fromObject(e)}static fromObject(e){return g.isParamType(e)?e:new g(l,{name:e.name||null,type:k(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(g.fromObject):null})}static fromString(e,t){return r=function(e,t){let r=e;function n(t){a.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let a=0;ag.fromString(e,t)))}class y{constructor(e,t){e!==l&&a.throwError("use a static from method",o.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),d(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return y.isFragment(e)?e:"string"===typeof e?y.fromString(e):y.fromObject(e)}static fromObject(e){if(y.isFragment(e))return e;switch(e.type){case"function":return _.fromObject(e);case"event":return v.fromObject(e);case"constructor":return S.fromObject(e);case"error":return C.fromObject(e);case"fallback":case"receive":return null}return a.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?v.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?_.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?S.fromString(e.trim()):"error"===e.split(" ")[0]?C.fromString(e.substring(5).trim()):a.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class v extends y{format(e){if(e||(e=f.sighash),f[e]||a.throwArgumentError("invalid format type","format",e),e===f.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==f.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===f.full?", ":",")+") ",e!==f.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"===typeof e?v.fromString(e):v.fromObject(e)}static fromObject(e){if(v.isEventFragment(e))return e;"event"!==e.type&&a.throwArgumentError("invalid event object","value",e);const t={name:T(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(g.fromObject):[],type:"event"};return new v(l,t)}static fromString(e){let t=e.match(R);t||a.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:a.warn("unknown modifier: "+e)}})),v.fromObject({name:t[1].trim(),anonymous:r,inputs:m(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function b(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&a.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||a.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=n.O$.from(r[1]),r[0]):e}function w(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function E(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&a.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&a.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||a.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&a.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&a.throwArgumentError("unable to determine stateMutability","value",e),t}class S extends y{format(e){if(e||(e=f.sighash),f[e]||a.throwArgumentError("invalid format type","format",e),e===f.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===f.sighash&&a.throwError("cannot format a constructor for sighash",o.Logger.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===f.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"===typeof e?S.fromString(e):S.fromObject(e)}static fromObject(e){if(S.isConstructorFragment(e))return e;"constructor"!==e.type&&a.throwArgumentError("invalid constructor object","value",e);let t=E(e);t.constant&&a.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(g.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.O$.from(e.gas):null};return new S(l,r)}static fromString(e){let t={type:"constructor"},r=(e=b(e,t)).match(R);return r&&"constructor"===r[1].trim()||a.throwArgumentError("invalid constructor string","value",e),t.inputs=m(r[2].trim(),!1),w(r[3].trim(),t),S.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class _ extends S{format(e){if(e||(e=f.sighash),f[e]||a.throwArgumentError("invalid format type","format",e),e===f.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==f.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===f.full?", ":",")+") ",e!==f.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"===typeof e?_.fromString(e):_.fromObject(e)}static fromObject(e){if(_.isFunctionFragment(e))return e;"function"!==e.type&&a.throwArgumentError("invalid function object","value",e);let t=E(e);const r={type:e.type,name:T(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(g.fromObject):[],outputs:e.outputs?e.outputs.map(g.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.O$.from(e.gas):null};return new _(l,r)}static fromString(e){let t={type:"function"},r=(e=b(e,t)).split(" returns ");r.length>2&&a.throwArgumentError("invalid function string","value",e);let n=r[0].match(R);if(n||a.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&T(t.name),t.inputs=m(n[2],!1),w(n[3].trim(),t),r.length>1){let n=r[1].match(R);""==n[1].trim()&&""==n[3].trim()||a.throwArgumentError("unexpected tokens","value",e),t.outputs=m(n[2],!1)}else t.outputs=[];return _.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function A(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||a.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}class C extends y{format(e){if(e||(e=f.sighash),f[e]||a.throwArgumentError("invalid format type","format",e),e===f.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==f.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===f.full?", ":",")+") ",t.trim()}static from(e){return"string"===typeof e?C.fromString(e):C.fromObject(e)}static fromObject(e){if(C.isErrorFragment(e))return e;"error"!==e.type&&a.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:T(e.name),inputs:e.inputs?e.inputs.map(g.fromObject):[]};return A(new C(l,t))}static fromString(e){let t={type:"error"},r=e.match(R);return r||a.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&T(t.name),t.inputs=m(r[2],!1),A(C.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function k(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const I=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function T(e){return e&&e.match(I)||a.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}const R=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");var P=r(9716);const x=new o.Logger(s);function N(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let o in n){const s=e.slice();s.push(o);try{r(s,n[o])}catch(i){t.push({path:s,error:i})}}};return r([],e),t}class O{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){x.throwArgumentError(e,this.localName,t)}}class D{constructor(e){(0,i.defineReadOnly)(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return(0,P.hexConcat)(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData((0,P.concat)(e._data))}writeBytes(e){let t=(0,P.arrayify)(e);const r=t.length%this.wordSize;return r&&(t=(0,P.concat)([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=(0,P.arrayify)(n.O$.from(e));return t.length>this.wordSize&&x.throwError("value out-of-bounds",o.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=(0,P.concat)([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class M{constructor(e,t,r,n){(0,i.defineReadOnly)(this,"_data",(0,P.arrayify)(e)),(0,i.defineReadOnly)(this,"wordSize",t||32),(0,i.defineReadOnly)(this,"_coerceFunc",r),(0,i.defineReadOnly)(this,"allowLoose",n),this._offset=0}get data(){return(0,P.hexlify)(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):M.coerce(e,t)}_peekBytes(e,t,r){let n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:x.throwError("data out-of-bounds",o.Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new M(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return n.O$.from(this.readBytes(this.wordSize))}}var L=r(7419);class B extends O{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=(0,L.getAddress)(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return(0,L.getAddress)((0,P.hexZeroPad)(e.readValue().toHexString(),20))}}class U extends O{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const F=new o.Logger(s);function j(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"===typeof r){let e={};n=t.map((t=>{const n=t.localName;return n||F.throwError("cannot encode object for signature with missing names",o.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&F.throwError("cannot encode object for signature with duplicate names",o.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]}))}else F.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&F.throwArgumentError("types/value length mismatch","tuple",r);let i=new D(e.wordSize),s=new D(e.wordSize),a=[];t.forEach(((e,t)=>{let r=n[t];if(e.dynamic){let t=s.length;e.encode(s,r);let n=i.writeUpdatableValue();a.push((e=>{n(e+t)}))}else e.encode(i,r)})),a.forEach((e=>{e(i.length)}));let l=e.appendWriter(i);return l+=e.appendWriter(s),l}function V(e,t){let r=[],n=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let r=e.readValue(),a=n.subReader(r.toNumber());try{i=t.decode(a)}catch(s){if(s.code===o.Logger.errors.BUFFER_OVERRUN)throw s;i=s,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(s){if(s.code===o.Logger.errors.BUFFER_OVERRUN)throw s;i=s,i.baseType=t.name,i.name=t.localName,i.type=t.type}void 0!=i&&r.push(i)}));const i=t.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach(((e,t)=>{let n=e.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[t];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let o=0;o{throw e}})}return Object.freeze(r)}class K extends O{constructor(e,t,r){super("array",e.type+"["+(t>=0?t:"")+"]",r,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&F.throwError("insufficient data length",o.Logger.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let n=0;n{e.dynamic&&(r=!0),n.push(e.type)}));super("tuple","tuple("+n.join(",")+")",t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[n]))})),Object.freeze(e)}encode(e,t){return j(e,this.coders,t)}decode(e){return e.coerce(this.name,V(e,this.coders))}}const $=new o.Logger(s),ee=new RegExp(/^bytes([0-9]*)$/),te=new RegExp(/^(u?int)([0-9]*)$/);class re{constructor(e){(0,i.defineReadOnly)(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new B(e.name);case"bool":return new z(e.name);case"string":return new J(e.name);case"bytes":return new H(e.name);case"array":return new K(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new X((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new W(e.name)}let t=e.type.match(te);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!==0)&&$.throwArgumentError("invalid "+t[1]+" bit length","param",e),new Q(r/8,"int"===t[1],e.name)}if(t=e.type.match(ee),t){let r=parseInt(t[1]);return(0===r||r>32)&&$.throwArgumentError("invalid bytes length","param",e),new G(r,e.name)}return $.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new M(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new D(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(g.from(e))));return new X(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&$.throwError("types/values length mismatch",o.Logger.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map((e=>this._getCoder(g.from(e)))),n=new X(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map((e=>this._getCoder(g.from(e))));return new X(n,"_").decode(this._getReader((0,P.arrayify)(t),r))}}const ne=new re;var ie=r(1583),oe=r(8062);const se=new o.Logger(s);class ae extends i.Description{}class le extends i.Description{}class ce extends i.Description{}class ue extends i.Description{static isIndexed(e){return!(!e||!e._isIndexed)}}const he={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function de(e,t){const r=new Error("deferred error during ABI decoding triggered accessing ".concat(e));return r.error=t,r}class fe{constructor(e){let t=[];t="string"===typeof e?JSON.parse(e):e,(0,i.defineReadOnly)(this,"fragments",t.map((e=>y.from(e))).filter((e=>null!=e))),(0,i.defineReadOnly)(this,"_abiCoder",(0,i.getStatic)(new.target,"getAbiCoder")()),(0,i.defineReadOnly)(this,"functions",{}),(0,i.defineReadOnly)(this,"errors",{}),(0,i.defineReadOnly)(this,"events",{}),(0,i.defineReadOnly)(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void se.warn("duplicate definition - constructor"):void(0,i.defineReadOnly)(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let r=e.format();t[r]?se.warn("duplicate definition - "+r):t[r]=e})),this.deploy||(0,i.defineReadOnly)(this,"deploy",S.from({payable:!1,type:"constructor"})),(0,i.defineReadOnly)(this,"_isInterface",!0)}format(e){e||(e=f.full),e===f.sighash&&se.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===f.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return ne}static getAddress(e){return(0,L.getAddress)(e)}static getSighash(e){return(0,P.hexDataSlice)((0,ie.id)(e.format()),0,4)}static getEventTopic(e){return(0,ie.id)(e.format())}getFunction(e){if((0,P.isHexString)(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];se.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===r.length?se.throwArgumentError("no matching function","name",t):r.length>1&&se.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[_.fromString(e).format()];return t||se.throwArgumentError("no matching function","signature",e),t}getEvent(e){if((0,P.isHexString)(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];se.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===r.length?se.throwArgumentError("no matching event","name",t):r.length>1&&se.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[v.fromString(e).format()];return t||se.throwArgumentError("no matching event","signature",e),t}getError(e){if((0,P.isHexString)(e)){const t=(0,i.getStatic)(this.constructor,"getSighash");for(const r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}se.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===r.length?se.throwArgumentError("no matching error","name",t):r.length>1&&se.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[_.fromString(e).format()];return t||se.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"===typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(r){throw t}}return(0,i.getStatic)(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"===typeof e&&(e=this.getEvent(e)),(0,i.getStatic)(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"===typeof e&&(e=this.getError(e));const r=(0,P.arrayify)(t);return(0,P.hexlify)(r.slice(0,4))!==this.getSighash(e)&&se.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",(0,P.hexlify)(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"===typeof e&&(e=this.getError(e)),(0,P.hexlify)((0,P.concat)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"===typeof e&&(e=this.getFunction(e));const r=(0,P.arrayify)(t);return(0,P.hexlify)(r.slice(0,4))!==this.getSighash(e)&&se.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",(0,P.hexlify)(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"===typeof e&&(e=this.getFunction(e)),(0,P.hexlify)((0,P.concat)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"===typeof e&&(e=this.getFunction(e));let r=(0,P.arrayify)(t),n=null,i="",s=null,a=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(c){}break;case 4:{const e=(0,P.hexlify)(r.slice(0,4)),t=he[e];if(t)s=this._abiCoder.decode(t.inputs,r.slice(4)),a=t.name,l=t.signature,t.reason&&(n=s[0]),"Error"===a?i="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(s[0])):"Panic"===a&&(i="; VM Exception while processing transaction: reverted with panic code ".concat(s[0]));else try{const t=this.getError(e);s=this._abiCoder.decode(t.inputs,r.slice(4)),a=t.name,l=t.format()}catch(c){}break}}return se.throwError("call revert exception"+i,o.Logger.errors.CALL_EXCEPTION,{method:e.format(),data:(0,P.hexlify)(t),errorArgs:s,errorName:a,errorSignature:l,reason:n})}encodeFunctionResult(e,t){return"string"===typeof e&&(e=this.getFunction(e)),(0,P.hexlify)(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"===typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&se.throwError("too many arguments for "+e.format(),o.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(e,t)=>"string"===e.type?(0,ie.id)(t):"bytes"===e.type?(0,oe.keccak256)((0,P.hexlify)(t)):("bool"===e.type&&"boolean"===typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=n.O$.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),(0,P.hexZeroPad)((0,P.hexlify)(t),32));for(t.forEach(((t,n)=>{let o=e.inputs[n];o.indexed?null==t?r.push(null):"array"===o.baseType||"tuple"===o.baseType?se.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?r.push(t.map((e=>i(o,e)))):r.push(i(o,t)):null!=t&&se.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(e,t){"string"===typeof e&&(e=this.getEvent(e));const r=[],n=[],i=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&se.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const s=t[o];if(e.indexed)if("string"===e.type)r.push((0,ie.id)(s));else if("bytes"===e.type)r.push((0,oe.keccak256)(s));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[s]))}else n.push(e),i.push(s)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(e,t,r){if("string"===typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){let t=this.getEventTopic(e);(0,P.isHexString)(r[0],32)&&r[0].toLowerCase()===t||se.throwError("fragment/topic mismatch",o.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],s=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(g.fromObject({type:"bytes32",name:e.name})),s.push(!0)):(n.push(e),s.push(!1)):(i.push(e),s.push(!1))}));let a=null!=r?this._abiCoder.decode(n,(0,P.concat)(r)):null,l=this._abiCoder.decode(i,t,!0),c=[],u=0,h=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==a)c[t]=new ue({_isIndexed:!0,hash:null});else if(s[t])c[t]=new ue({_isIndexed:!0,hash:a[h++]});else try{c[t]=a[h++]}catch(r){c[t]=r}else try{c[t]=l[u++]}catch(r){c[t]=r}if(e.name&&null==c[e.name]){const r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:()=>{throw de("property ".concat(JSON.stringify(e.name)),r)}}):c[e.name]=r}}));for(let o=0;o{throw de("index ".concat(o),e)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new le({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:n.O$.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new ae({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=(0,P.hexlify)(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new ce({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!(!e||!e._isInterface)}}},9745:(e,t,r)=>{"use strict";r.d(t,{Sg:()=>l,zt:()=>c});var n=r(2257),i=r(520),o=r(9502);var s=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const a=new o.Logger("abstract-provider/5.7.0");class l extends i.Description{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class c{constructor(){a.checkAbstract(new.target,c),(0,i.defineReadOnly)(this,"_isProvider",!0)}getFeeData(){return s(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield(0,i.resolveProperties)({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,o=null,s=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,s=n.O$.from("1500000000"),o=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:o,maxPriorityFeePerGas:s,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}},8408:(e,t,r)=>{"use strict";r.d(t,{E:()=>c});var n=r(520),i=r(9502);var o=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const s=new i.Logger("abstract-signer/5.7.0"),a=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],l=[i.Logger.errors.INSUFFICIENT_FUNDS,i.Logger.errors.NONCE_EXPIRED,i.Logger.errors.REPLACEMENT_UNDERPRICED];class c{constructor(){s.checkAbstract(new.target,c),(0,n.defineReadOnly)(this,"_isSigner",!0)}getBalance(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return o(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield(0,n.resolveProperties)(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return o(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield(0,n.resolveProperties)(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return o(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)}))}getChainId(){return o(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return o(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return o(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const r in e)-1===a.indexOf(r)&&s.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=(0,n.shallowCopy)(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&s.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return o(this,void 0,void 0,(function*(){const t=yield(0,n.resolveProperties)(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>o(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&s.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||s.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):s.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(r&&s.throwError("network does not support EIP-1559",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):s.throwError("failed to get consistent fee data",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(l.indexOf(e.code)>=0)throw e;return s.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&s.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield(0,n.resolveProperties)(t)}))}_checkProvider(e){this.provider||s.throwError("missing provider",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}},7419:(e,t,r)=>{"use strict";r.r(t),r.d(t,{getAddress:()=>f,getContractAddress:()=>m,getCreate2Address:()=>y,getIcapAddress:()=>g,isAddress:()=>p});var n=r(9716),i=r(2257),o=r(8062),s=r(7986);const a=new(r(9502).Logger)("address/5.7.0");function l(e){(0,n.isHexString)(e,20)||a.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=t[n].charCodeAt(0);const i=(0,n.arrayify)((0,o.keccak256)(r));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(t[n]=t[n].toUpperCase()),(15&i[n>>1])>=8&&(t[n+1]=t[n+1].toUpperCase());return"0x"+t.join("")}const c={};for(let v=0;v<10;v++)c[String(v)]=String(v);for(let v=0;v<26;v++)c[String.fromCharCode(65+v)]=String(10+v);const u=Math.floor((h=9007199254740991,Math.log10?Math.log10(h):Math.log(h)/Math.LN10));var h;function d(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>c[e])).join("");for(;t.length>=u;){let e=t.substring(0,u);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function f(e){let t=null;if("string"!==typeof e&&a.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=l(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&a.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==d(e)&&a.throwArgumentError("bad icap checksum","address",e),t=(0,i.g$)(e.substring(4));t.length<40;)t="0"+t;t=l("0x"+t)}else a.throwArgumentError("invalid address","address",e);return t}function p(e){try{return f(e),!0}catch(t){}return!1}function g(e){let t=(0,i.t2)(f(e).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+d("XE00"+t)+t}function m(e){let t=null;try{t=f(e.from)}catch(l){a.throwArgumentError("missing from address","transaction",e)}const r=(0,n.stripZeros)((0,n.arrayify)(i.O$.from(e.nonce).toHexString()));return f((0,n.hexDataSlice)((0,o.keccak256)((0,s.encode)([t,r])),12))}function y(e,t,r){return 32!==(0,n.hexDataLength)(t)&&a.throwArgumentError("salt must be 32 bytes","salt",t),32!==(0,n.hexDataLength)(r)&&a.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),f((0,n.hexDataSlice)((0,o.keccak256)((0,n.concat)(["0xff",f(e),t,r])),12))}},7354:(e,t,r)=>{"use strict";r.d(t,{J:()=>i,c:()=>o});var n=r(9716);function i(e){e=atob(e);const t=[];for(let r=0;r{"use strict";r.r(t),r.d(t,{decode:()=>n.J,encode:()=>n.c});var n=r(7354)},3482:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Base32:()=>s,Base58:()=>a,BaseX:()=>o});var n=r(9716),i=r(520);class o{constructor(e){(0,i.defineReadOnly)(this,"alphabet",e),(0,i.defineReadOnly)(this,"base",e.length),(0,i.defineReadOnly)(this,"_alphabetMap",{}),(0,i.defineReadOnly)(this,"_leader",e.charAt(0));for(let t=0;t0;)r.push(e%this.base),e=e/this.base|0}let i="";for(let n=0;0===t[n]&&n=0;--n)i+=this.alphabet[r[n]];return i}decode(e){if("string"!==typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r{"use strict";r.d(t,{i:()=>n});const n="bignumber/5.7.0"},2257:(e,t,r)=>{"use strict";r.d(t,{O$:()=>p,Zm:()=>d,g$:()=>b,t2:()=>w});var n=r(518),i=r.n(n),o=r(9716),s=r(9502),a=r(6945),l=i().BN;const c=new s.Logger(a.i),u={},h=9007199254740991;function d(e){return null!=e&&(p.isBigNumber(e)||"number"===typeof e&&e%1===0||"string"===typeof e&&!!e.match(/^-?[0-9]+$/)||(0,o.isHexString)(e)||"bigint"===typeof e||(0,o.isBytes)(e))}let f=!1;class p{constructor(e,t){e!==u&&c.throwError("cannot call constructor directly; use BigNumber.from",s.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return m(y(this).fromTwos(e))}toTwos(e){return m(y(this).toTwos(e))}abs(){return"-"===this._hex[0]?p.from(this._hex.substring(1)):this}add(e){return m(y(this).add(y(e)))}sub(e){return m(y(this).sub(y(e)))}div(e){return p.from(e).isZero()&&v("division-by-zero","div"),m(y(this).div(y(e)))}mul(e){return m(y(this).mul(y(e)))}mod(e){const t=y(e);return t.isNeg()&&v("division-by-zero","mod"),m(y(this).umod(t))}pow(e){const t=y(e);return t.isNeg()&&v("negative-power","pow"),m(y(this).pow(t))}and(e){const t=y(e);return(this.isNegative()||t.isNeg())&&v("unbound-bitwise-result","and"),m(y(this).and(t))}or(e){const t=y(e);return(this.isNegative()||t.isNeg())&&v("unbound-bitwise-result","or"),m(y(this).or(t))}xor(e){const t=y(e);return(this.isNegative()||t.isNeg())&&v("unbound-bitwise-result","xor"),m(y(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&v("negative-width","mask"),m(y(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&v("negative-width","shl"),m(y(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&v("negative-width","shr"),m(y(this).shrn(e))}eq(e){return y(this).eq(y(e))}lt(e){return y(this).lt(y(e))}lte(e){return y(this).lte(y(e))}gt(e){return y(this).gt(y(e))}gte(e){return y(this).gte(y(e))}isNegative(){return"-"===this._hex[0]}isZero(){return y(this).isZero()}toNumber(){try{return y(this).toNumber()}catch(e){v("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return c.throwError("this platform does not support BigInt",s.Logger.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?f||(f=!0,c.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?c.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Logger.errors.UNEXPECTED_ARGUMENT,{}):c.throwError("BigNumber.toString does not accept parameters",s.Logger.errors.UNEXPECTED_ARGUMENT,{})),y(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof p)return e;if("string"===typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new p(u,g(e)):e.match(/^-?[0-9]+$/)?new p(u,g(new l(e))):c.throwArgumentError("invalid BigNumber string","value",e);if("number"===typeof e)return e%1&&v("underflow","BigNumber.from",e),(e>=h||e<=-h)&&v("overflow","BigNumber.from",e),p.from(String(e));const t=e;if("bigint"===typeof t)return p.from(t.toString());if((0,o.isBytes)(t))return p.from((0,o.hexlify)(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"===typeof e)return p.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"===typeof e&&((0,o.isHexString)(e)||"-"===e[0]&&(0,o.isHexString)(e.substring(1))))return p.from(e)}return c.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function g(e){if("string"!==typeof e)return g(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&c.throwArgumentError("invalid hex","value",e),"0x00"===(e=g(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function m(e){return p.from(g(e))}function y(e){const t=p.from(e).toHexString();return"-"===t[0]?new l("-"+t.substring(3),16):new l(t.substring(2),16)}function v(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),c.throwError(e,s.Logger.errors.NUMERIC_FAULT,n)}function b(e){return new l(e,36).toString(16)}function w(e){return new l(e,16).toString(36)}},9716:(e,t,r)=>{"use strict";r.r(t),r.d(t,{arrayify:()=>c,concat:()=>u,hexConcat:()=>v,hexDataLength:()=>m,hexDataSlice:()=>y,hexStripZeros:()=>w,hexValue:()=>b,hexZeroPad:()=>E,hexlify:()=>g,isBytes:()=>l,isBytesLike:()=>s,isHexString:()=>f,joinSignature:()=>_,splitSignature:()=>S,stripZeros:()=>h,zeroPad:()=>d});const n=new(r(9502).Logger)("bytes/5.7.0");function i(e){return!!e.toHexString}function o(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function s(e){return f(e)&&!(e.length%2)||l(e)}function a(e){return"number"===typeof e&&e==e&&e%1===0}function l(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!a(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function c(e,t){if(t||(t={}),"number"===typeof e){n.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),o(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e)&&(e=e.toHexString()),f(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":n.throwArgumentError("hex data is odd-length","value",e));const i=[];for(let e=0;ec(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),o(n)}function h(e){let t=c(e);if(0===t.length)return t;let r=0;for(;rt&&n.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),o(r)}function f(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const p="0123456789abcdef";function g(e,t){if(t||(t={}),"number"===typeof e){n.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=p[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e))return e.toHexString();if(f(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":n.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(l(e)){let t="0x";for(let r=0;r>4]+p[15&n]}return t}return n.throwArgumentError("invalid hexlify value","value",e)}function m(e){if("string"!==typeof e)e=g(e);else if(!f(e)||e.length%2)return null;return(e.length-2)/2}function y(e,t,r){return"string"!==typeof e?e=g(e):(!f(e)||e.length%2)&&n.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 b(e){const t=w(g(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!==typeof e&&(e=g(e)),f(e)||n.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t2*t+2&&n.throwArgumentError("value out of range","value",arguments[1]);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,yParityAndS:"0x",compact:"0x"};if(s(e)){let r=c(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=g(r.slice(0,32)),t.s=g(r.slice(32,64))):65===r.length?(t.r=g(r.slice(0,32)),t.s=g(r.slice(32,64)),t.v=r[64]):n.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:n.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,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(c(t._vs),32);t._vs=g(r);const i=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const o=g(r);null==t.s?t.s=o:t.s!==o&&n.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?n.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&n.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&f(t.r)?t.r=E(t.r,32):n.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&f(t.s)?t.s=E(t.s,32):n.throwArgumentError("signature missing or invalid s","signature",e);const r=c(t.s);r[0]>=128&&n.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const i=g(r);t._vs&&(f(t._vs)||n.throwArgumentError("signature invalid _vs","signature",e),t._vs=E(t._vs,32)),null==t._vs?t._vs=i:t._vs!==i&&n.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function _(e){return g(u([(e=S(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},5422:(e,t,r)=>{"use strict";r.d(t,{Bz:()=>a,_Y:()=>o,fh:()=>s,tL:()=>i});var n=r(2257);const i=n.O$.from(-1),o=n.O$.from(0),s=n.O$.from(1),a=n.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},4867:(e,t,r)=>{"use strict";r.d(t,{R:()=>n});const n="0x0000000000000000000000000000000000000000000000000000000000000000"},9366:(e,t,r)=>{"use strict";r.d(t,{i:()=>n});const n="hash/5.7.0"},1583:(e,t,r)=>{"use strict";r.d(t,{id:()=>o});var n=r(8062),i=r(3374);function o(e){return(0,n.keccak256)((0,i.Y0)(e))}},1049:(e,t,r)=>{"use strict";r.r(t),r.d(t,{_TypedDataEncoder:()=>s.E,dnsEncode:()=>i.Kn,ensNormalize:()=>i.w3,hashMessage:()=>o.r,id:()=>n.id,isValidName:()=>i.r1,messagePrefix:()=>o.B,namehash:()=>i.VM});var n=r(1583),i=r(5235),o=r(2273),s=r(5992)},2273:(e,t,r)=>{"use strict";r.d(t,{B:()=>s,r:()=>a});var n=r(9716),i=r(8062),o=r(3374);const s="\x19Ethereum Signed Message:\n";function a(e){return"string"===typeof e&&(e=(0,o.Y0)(e)),(0,i.keccak256)((0,n.concat)([(0,o.Y0)(s),(0,o.Y0)(String(e.length)),e]))}},5235:(e,t,r)=>{"use strict";r.d(t,{Kn:()=>D,w3:()=>x,r1:()=>N,VM:()=>O});var n=r(9716),i=r(3374),o=r(8062),s=r(9502),a=r(9366);function l(e,t){null==t&&(t=1);const r=[],n=r.forEach,i=function(e,t){n.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function c(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let w=1;w>--l&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let g=0;for(let w=0;w<31;w++)g=g<<1|u();let m=[],y=0,v=h;for(;;){let e=Math.floor(((g-y+1)*i-1)/v),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e>>1|u(),s=s<<1^d,a=(a^d)<<1|d|1;y=s,v=1+a-s}let b=n-4;return m.map((t=>{switch(t-b){case 3:return b+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return b+256+(e[a++]<<8|e[a++]);case 1:return b+e[a++];default:return t-1}}))}(e))}function u(e){return 1&e?~e>>1:e>>1}function h(e,t){let r=Array(e);for(let n=0,i=-1;nt[e])):r}function p(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;in[t].push(e)));return n}function g(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return l(p(i.length,1+e,t).map(((e,t)=>{const o=e[0],s=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[o+t*r,s.map((e=>e+i))]}))})))}function m(e,t){return p(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const y=c((0,r(7354).J)("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEB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AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),v=new Set(f(y)),b=new Set(f(y)),w=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(g(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(m(r,e))}return function(e){const t={};for(let r=0;re-t));return function r(){let n=[];for(;;){let i=f(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(y);function S(e){return(0,i.XL)(e)}function _(e){return e.filter((e=>65039!=e))}function A(e){for(let r of e.split(".")){let e=S(r);try{for(let t=e.lastIndexOf(95)-1;t>=0;t--)if(95!==e[t])throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&45===e[2]&&45===e[3])throw new Error("invalid label extension")}catch(t){throw new Error('Invalid label "'.concat(r,'": ').concat(t.message))}}return e}function C(e){return A(function(e,t){let r=S(e).reverse(),n=[];for(;r.length;){let e=k(r);if(e){n.push(...t(e));continue}let i=r.pop();if(v.has(i)){n.push(i);continue}if(b.has(i))continue;let o=w[i];if(!o)throw new Error("Disallowed codepoint: 0x".concat(i.toString(16).toUpperCase()));n.push(...o)}return A((i=String.fromCodePoint(...n),i.normalize("NFC")));var i}(e,_))}function k(e,t){var r;let n,i,o=E,s=[],a=e.length;for(t&&(t.length=0);a;){let l=e[--a];if(o=null===(r=o.branches.find((e=>e.set.has(l))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=l;else if(o.check&&l===i)break;s.push(l),o.fe0f&&(s.push(65039),a>0&&65039==e[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),t&&t.push(...e.slice(a).reverse()),e.length=a)}return n}const I=new s.Logger(a.i),T=new Uint8Array(32);function R(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function P(e){const t=(0,i.Y0)(C(e)),r=[];if(0===e.length)return r;let n=0;for(let i=0;i=t.length)throw new Error("invalid ENS name; empty component");return r.push(R(t.slice(n))),r}function x(e){return P(e).map((e=>(0,i.ZN)(e))).join(".")}function N(e){try{return 0!==P(e).length}catch(t){}return!1}function O(e){"string"!==typeof e&&I.throwArgumentError("invalid ENS name; not a string","name",e);let t=T;const r=P(e);for(;r.length;)t=(0,o.keccak256)((0,n.concat)([t,(0,o.keccak256)(r.pop())]));return(0,n.hexlify)(t)}function D(e){return(0,n.hexlify)((0,n.concat)(P(e).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}T.fill(0)},5992:(e,t,r)=>{"use strict";r.d(t,{E:()=>k});var n=r(7419),i=r(2257),o=r(9716),s=r(8062),a=r(520),l=r(9502),c=r(9366),u=r(1583),h=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const d=new l.Logger(c.i),f=new Uint8Array(32);f.fill(0);const p=i.O$.from(-1),g=i.O$.from(0),m=i.O$.from(1),y=i.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const v=(0,o.hexZeroPad)(m.toHexString(),32),b=(0,o.hexZeroPad)(g.toHexString(),32),w={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},E=["name","version","chainId","verifyingContract","salt"];function S(e){return function(t){return"string"!==typeof t&&d.throwArgumentError("invalid domain value for ".concat(JSON.stringify(e)),"domain.".concat(e),t),t}}const _={name:S("name"),version:S("version"),chainId:function(e){try{return i.O$.from(e).toString()}catch(t){}return d.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,n.getAddress)(e).toLowerCase()}catch(t){}return d.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=(0,o.arrayify)(e);if(32!==t.length)throw new Error("bad length");return(0,o.hexlify)(t)}catch(t){}return d.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function A(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],n=parseInt(t[2]||"256");(n%8!==0||n>256||t[2]&&t[2]!==String(n))&&d.throwArgumentError("invalid numeric width","type",e);const s=y.mask(r?n-1:n),a=r?s.add(m).mul(p):g;return function(t){const r=i.O$.from(t);return(r.lt(a)||r.gt(s))&&d.throwArgumentError("value out-of-bounds for ".concat(e),"value",t),(0,o.hexZeroPad)(r.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&d.throwArgumentError("invalid bytes width","type",e),function(t){return(0,o.arrayify)(t).length!==r&&d.throwArgumentError("invalid length for ".concat(e),"value",t),function(e){const t=(0,o.arrayify)(e),r=t.length%32;return r?(0,o.hexConcat)([t,f.slice(r)]):(0,o.hexlify)(t)}(t)}}}switch(e){case"address":return function(e){return(0,o.hexZeroPad)((0,n.getAddress)(e),32)};case"bool":return function(e){return e?v:b};case"bytes":return function(e){return(0,s.keccak256)(e)};case"string":return function(e){return(0,u.id)(e)}}return null}function C(e,t){return"".concat(e,"(").concat(t.map((e=>{let{name:t,type:r}=e;return r+" "+t})).join(","),")")}class k{constructor(e){(0,a.defineReadOnly)(this,"types",Object.freeze((0,a.deepCopy)(e))),(0,a.defineReadOnly)(this,"_encoderCache",{}),(0,a.defineReadOnly)(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach((e=>{t[e]={},r[e]=[],n[e]={}}));for(const o in e){const n={};e[o].forEach((i=>{n[i.name]&&d.throwArgumentError("duplicate variable name ".concat(JSON.stringify(i.name)," in ").concat(JSON.stringify(o)),"types",e),n[i.name]=!0;const s=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===o&&d.throwArgumentError("circular type reference to ".concat(JSON.stringify(s)),"types",e);A(s)||(r[s]||d.throwArgumentError("unknown type ".concat(JSON.stringify(s)),"types",e),r[s].push(o),t[o][s]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?d.throwArgumentError("missing primary type","types",e):i.length>1&&d.throwArgumentError("ambiguous primary types or unused types: ".concat(i.map((e=>JSON.stringify(e))).join(", ")),"types",e),(0,a.defineReadOnly)(this,"primaryType",i[0]),function i(o,s){s[o]&&d.throwArgumentError("circular type reference to ".concat(JSON.stringify(o)),"types",e),s[o]=!0,Object.keys(t[o]).forEach((e=>{r[e]&&(i(e,s),Object.keys(s).forEach((t=>{n[t][e]=!0})))})),delete s[o]}(this.primaryType,{});for(const o in n){const t=Object.keys(n[o]);t.sort(),this._types[o]=C(o,e[o])+t.map((t=>C(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=A(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],r=this.getEncoder(e),n=parseInt(t[3]);return t=>{n>=0&&t.length!==n&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(s.keccak256)),(0,s.keccak256)((0,o.hexConcat)(i))}}const r=this.types[e];if(r){const t=(0,u.id)(this._types[e]);return e=>{const n=r.map((t=>{let{name:r,type:n}=t;const i=this.getEncoder(n)(e[r]);return this._types[n]?(0,s.keccak256)(i):i}));return n.unshift(t),(0,o.hexConcat)(n)}}return d.throwArgumentError("unknown type: ".concat(e),"type",e)}encodeType(e){const t=this._types[e];return t||d.throwArgumentError("unknown type: ".concat(JSON.stringify(e)),"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return(0,s.keccak256)(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(A(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],i=parseInt(n[3]);return i>=0&&t.length!==i&&d.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,r)))}const i=this.types[e];return i?i.reduce(((e,n)=>{let{name:i,type:o}=n;return e[i]=this._visit(o,t[i],r),e}),{}):d.throwArgumentError("unknown type: ".concat(e),"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new k(e)}static getPrimaryType(e){return k.from(e).primaryType}static hashStruct(e,t,r){return k.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=w[r];n||d.throwArgumentError("invalid typed-data domain key: ".concat(JSON.stringify(r)),"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>E.indexOf(e.name)-E.indexOf(t.name))),k.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return(0,o.hexConcat)(["0x1901",k.hashDomain(e),k.from(t).hash(r)])}static hash(e,t,r){return(0,s.keccak256)(k.encode(e,t,r))}static resolveNames(e,t,r,n){return h(this,void 0,void 0,(function*(){e=(0,a.shallowCopy)(e);const i={};e.verifyingContract&&!(0,o.isHexString)(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=k.from(t);s.visit(r,((e,t)=>("address"!==e||(0,o.isHexString)(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield n(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=s.visit(r,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:r}}))}static getPayload(e,t,r){k.hashDomain(e);const n={},s=[];E.forEach((t=>{const r=e[t];null!=r&&(n[t]=_[t](r),s.push({name:t,type:w[t]}))}));const l=k.from(t),c=(0,a.shallowCopy)(t);return c.EIP712Domain?d.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):c.EIP712Domain=s,l.encode(r),{types:c,domain:n,primaryType:l.primaryType,message:l.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return(0,o.hexlify)((0,o.arrayify)(t));if(e.match(/^u?int/))return i.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&d.throwArgumentError("invalid string","value",t),t}return d.throwArgumentError("unsupported type","type",e)}))}}}},5148:(e,t,r)=>{"use strict";r.r(t),r.d(t,{HDNode:()=>x,defaultPath:()=>P,entropyToMnemonic:()=>D,getAccountPath:()=>L,isValidMnemonic:()=>M,mnemonicToEntropy:()=>O,mnemonicToSeed:()=>N});var n=r(3482),i=r(9716),o=r(2257),s=r(3374),a=r(2522),l=r(520),c=r(8865),u=r(9598),h=r(4667),d=r(5452),f=r(1583),p=r(9502);const g=new p.Logger("wordlists/5.7.0");class m{constructor(e){g.checkAbstract(new.target,m),(0,l.defineReadOnly)(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){const t=[];for(let r=0;r<2048;r++){const n=e.getWord(r);if(r!==e.getWordIndex(n))return"0x";t.push(n)}return(0,f.id)(t.join("\n")+"\n")}static register(e,t){t||(t=e.locale)}}let y=null;function v(e){if(null==y&&(y="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==m.check(e)))throw y=null,new Error("BIP39 Wordlist for en (English) FAILED")}const b=new class extends m{constructor(){super("en")}getWord(e){return v(this),y[e]}getWordIndex(e){return v(this),y.indexOf(e)}};m.register(b);const w={en:b},E=new p.Logger("hdnode/5.7.0"),S=o.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_=(0,s.Y0)("Bitcoin seed"),A=2147483648;function C(e){return(1<=256)throw new Error("Depth too large!");return I((0,i.concat)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",(0,i.hexlify)(this.depth),this.parentFingerprint,(0,i.hexZeroPad)((0,i.hexlify)(this.index),4),this.chainCode,null!=this.privateKey?(0,i.concat)(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new x(R,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let t=this.path;t&&(t+="/"+(2147483647&e));const r=new Uint8Array(37);if(e&A){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set((0,i.arrayify)(this.privateKey),1),t&&(t+="'")}else r.set((0,i.arrayify)(this.publicKey));for(let i=24;i>=0;i-=8)r[33+(i>>3)]=e>>24-i&255;const n=(0,i.arrayify)((0,u.Gy)(h.p.sha512,this.chainCode,r)),s=n.slice(0,32),a=n.slice(32);let l=null,d=null;if(this.privateKey)l=k(o.O$.from(s).add(this.privateKey).mod(S));else{d=new c.SigningKey((0,i.hexlify)(s))._addPoint(this.publicKey)}let f=t;const p=this.mnemonic;return p&&(f=Object.freeze({phrase:p.phrase,path:t,locale:p.locale||"en"})),new x(R,l,d,this.fingerprint,k(a),e,this.depth+1,f)}derivePath(e){const t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();let r=this;for(let n=0;n=A)throw new Error("invalid path index - "+e);r=r._derive(A+t)}else{if(!e.match(/^[0-9]+$/))throw new Error("invalid path component - "+e);{const t=parseInt(e);if(t>=A)throw new Error("invalid path index - "+e);r=r._derive(t)}}}return r}static _fromSeed(e,t){const r=(0,i.arrayify)(e);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=(0,i.arrayify)((0,u.Gy)(h.p.sha512,_,r));return new x(R,k(n.slice(0,32)),null,"0x00000000",k(n.slice(32)),0,0,t)}static fromMnemonic(e,t,r){return e=D(O(e,r=T(r)),r),x._fromSeed(N(e,t),{phrase:e,path:"m",locale:r.locale})}static fromSeed(e){return x._fromSeed(e,null)}static fromExtendedKey(e){const t=n.Base58.decode(e);82===t.length&&I(t.slice(0,78))===e||E.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=t[4],o=(0,i.hexlify)(t.slice(5,9)),s=parseInt((0,i.hexlify)(t.slice(9,13)).substring(2),16),a=(0,i.hexlify)(t.slice(13,45)),l=t.slice(45,78);switch((0,i.hexlify)(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new x(R,null,(0,i.hexlify)(l),o,a,s,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==l[0])break;return new x(R,(0,i.hexlify)(l.slice(1)),null,o,a,s,r,null)}return E.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function N(e,t){t||(t="");const r=(0,s.Y0)("mnemonic"+t,s.Uj.NFKD);return(0,a.n)((0,s.Y0)(e,s.Uj.NFKD),r,2048,64,"sha512")}function O(e,t){t=T(t),E.checkNormalize();const r=t.split(e);if(r.length%3!==0)throw new Error("invalid mnemonic");const n=(0,i.arrayify)(new Uint8Array(Math.ceil(11*r.length/8)));let o=0;for(let i=0;i>3]|=1<<7-o%8),o++}const s=32*r.length/3,a=C(r.length/3);if(((0,i.arrayify)((0,u.JQ)(n.slice(0,s/8)))[0]&a)!==(n[n.length-1]&a))throw new Error("invalid checksum");return(0,i.hexlify)(n.slice(0,s/8))}function D(e,t){if(t=T(t),(e=(0,i.arrayify)(e)).length%4!==0||e.length<16||e.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let i=0;i8?(r[r.length-1]<<=8,r[r.length-1]|=e[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[i]>>8-n,r.push(e[i]&(1<<8-n)-1),n+=3);const o=e.length/4,s=(0,i.arrayify)((0,u.JQ)(e))[0]&C(o);return r[r.length-1]<<=o,r[r.length-1]|=s>>8-o,t.join(r.map((e=>t.getWord(e))))}function M(e,t){try{return O(e,t),!0}catch(r){}return!1}function L(e){return("number"!==typeof e||e<0||e>=A||e%1)&&E.throwArgumentError("invalid account index","index",e),"m/44'/60'/".concat(e,"'/0/0")}},5382:(e,t,r)=>{"use strict";r.d(t,{i:()=>n});const n="json-wallets/5.7.0"},1529:(e,t,r)=>{"use strict";r.r(t),r.d(t,{decryptCrowdsale:()=>m,decryptJsonWallet:()=>E,decryptJsonWalletSync:()=>S,decryptKeystore:()=>w.pe,decryptKeystoreSync:()=>w.hb,encryptKeystore:()=>w.HI,getJsonWalletAddress:()=>b,isCrowdsaleWallet:()=>y,isKeystoreWallet:()=>v});var n=r(468),i=r.n(n),o=r(7419),s=r(9716),a=r(8062),l=r(2522),c=r(3374),u=r(520),h=r(9502),d=r(5382),f=r(8661);const p=new h.Logger(d.i);class g extends u.Description{isCrowdsaleAccount(e){return!(!e||!e._isCrowdsaleAccount)}}function m(e,t){const r=JSON.parse(e);t=(0,f.Ij)(t);const n=(0,o.getAddress)((0,f.gx)(r,"ethaddr")),u=(0,f.p3)((0,f.gx)(r,"encseed"));u&&u.length%16===0||p.throwArgumentError("invalid encseed","json",e);const h=(0,s.arrayify)((0,l.n)(t,t,2e3,32,"sha256")).slice(0,16),d=u.slice(0,16),m=u.slice(16),y=new(i().ModeOfOperation.cbc)(h,d),v=i().padding.pkcs7.strip((0,s.arrayify)(y.decrypt(m)));let b="";for(let i=0;i{"use strict";r.d(t,{HI:()=>T,hb:()=>k,pe:()=>I});var n=r(468),i=r.n(n),o=r(2065),s=r.n(o),a=r(7419),l=r(9716),c=r(5148),u=r(8062),h=r(2522),d=r(5244),f=r(520),p=r(5452),g=r(8661),m=r(9502),y=r(5382),v=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const b=new m.Logger(y.i);function w(e){return null!=e&&e.mnemonic&&e.mnemonic.phrase}class E extends f.Description{isKeystoreAccount(e){return!(!e||!e._isKeystoreAccount)}}function S(e,t){const r=(0,g.p3)((0,g.gx)(e,"crypto/ciphertext"));if((0,l.hexlify)((0,u.keccak256)((0,l.concat)([t.slice(16,32),r]))).substring(2)!==(0,g.gx)(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(e,t,r){if("aes-128-ctr"===(0,g.gx)(e,"crypto/cipher")){const n=(0,g.p3)((0,g.gx)(e,"crypto/cipherparams/iv")),o=new(i().Counter)(n),s=new(i().ModeOfOperation.ctr)(t,o);return(0,l.arrayify)(s.decrypt(r))}return null}(e,t.slice(0,16),r);n||b.throwError("unsupported cipher",m.Logger.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const o=t.slice(32,64),s=(0,p.computeAddress)(n);if(e.address){let t=e.address.toLowerCase();if("0x"!==t.substring(0,2)&&(t="0x"+t),(0,a.getAddress)(t)!==s)throw new Error("address mismatch")}const h={_isKeystoreAccount:!0,address:s,privateKey:(0,l.hexlify)(n)};if("0.1"===(0,g.gx)(e,"x-ethers/version")){const t=(0,g.p3)((0,g.gx)(e,"x-ethers/mnemonicCiphertext")),r=(0,g.p3)((0,g.gx)(e,"x-ethers/mnemonicCounter")),n=new(i().Counter)(r),s=new(i().ModeOfOperation.ctr)(o,n),a=(0,g.gx)(e,"x-ethers/path")||c.defaultPath,u=(0,g.gx)(e,"x-ethers/locale")||"en",f=(0,l.arrayify)(s.decrypt(t));try{const e=(0,c.entropyToMnemonic)(f,u),t=c.HDNode.fromMnemonic(e,null,u).derivePath(a);if(t.privateKey!=h.privateKey)throw new Error("mnemonic mismatch");h.mnemonic=t.mnemonic}catch(d){if(d.code!==m.Logger.errors.INVALID_ARGUMENT||"wordlist"!==d.argument)throw d}}return new E(h)}function _(e,t,r,n,i){return(0,l.arrayify)((0,h.n)(e,t,r,n,i))}function A(e,t,r,n,i){return Promise.resolve(_(e,t,r,n,i))}function C(e,t,r,n,i){const o=(0,g.Ij)(t),s=(0,g.gx)(e,"crypto/kdf");if(s&&"string"===typeof s){const t=function(e,t){return b.throwArgumentError("invalid key-derivation function parameters",e,t)};if("scrypt"===s.toLowerCase()){const r=(0,g.p3)((0,g.gx)(e,"crypto/kdfparams/salt")),a=parseInt((0,g.gx)(e,"crypto/kdfparams/n")),l=parseInt((0,g.gx)(e,"crypto/kdfparams/r")),c=parseInt((0,g.gx)(e,"crypto/kdfparams/p"));a&&l&&c||t("kdf",s),0!==(a&a-1)&&t("N",a);const u=parseInt((0,g.gx)(e,"crypto/kdfparams/dklen"));return 32!==u&&t("dklen",u),n(o,r,a,l,c,64,i)}if("pbkdf2"===s.toLowerCase()){const n=(0,g.p3)((0,g.gx)(e,"crypto/kdfparams/salt"));let i=null;const s=(0,g.gx)(e,"crypto/kdfparams/prf");"hmac-sha256"===s?i="sha256":"hmac-sha512"===s?i="sha512":t("prf",s);const a=parseInt((0,g.gx)(e,"crypto/kdfparams/c")),l=parseInt((0,g.gx)(e,"crypto/kdfparams/dklen"));return 32!==l&&t("dklen",l),r(o,n,a,l,i)}}return b.throwArgumentError("unsupported key-derivation function","kdf",s)}function k(e,t){const r=JSON.parse(e);return S(r,C(r,t,_,s().syncScrypt))}function I(e,t,r){return v(this,void 0,void 0,(function*(){const n=JSON.parse(e);return S(n,yield C(n,t,A,s().scrypt,r))}))}function T(e,t,r,n){try{if((0,a.getAddress)(e.address)!==(0,p.computeAddress)(e.privateKey))throw new Error("address/privateKey mismatch");if(w(e)){const t=e.mnemonic;if(c.HDNode.fromMnemonic(t.phrase,null,t.locale).derivePath(t.path||c.defaultPath).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(k){return Promise.reject(k)}"function"!==typeof r||n||(n=r,r={}),r||(r={});const o=(0,l.arrayify)(e.privateKey),h=(0,g.Ij)(t);let f=null,m=null,y=null;if(w(e)){const t=e.mnemonic;f=(0,l.arrayify)((0,c.mnemonicToEntropy)(t.phrase,t.locale||"en")),m=t.path||c.defaultPath,y=t.locale||"en"}let v=r.client;v||(v="ethers.js");let b=null;b=r.salt?(0,l.arrayify)(r.salt):(0,d.O)(32);let E=null;if(r.iv){if(E=(0,l.arrayify)(r.iv),16!==E.length)throw new Error("invalid iv")}else E=(0,d.O)(16);let S=null;if(r.uuid){if(S=(0,l.arrayify)(r.uuid),16!==S.length)throw new Error("invalid uuid")}else S=(0,d.O)(16);let _=1<<17,A=8,C=1;return r.scrypt&&(r.scrypt.N&&(_=r.scrypt.N),r.scrypt.r&&(A=r.scrypt.r),r.scrypt.p&&(C=r.scrypt.p)),s().scrypt(h,b,_,A,C,64,n).then((t=>{const r=(t=(0,l.arrayify)(t)).slice(0,16),n=t.slice(16,32),s=t.slice(32,64),a=new(i().Counter)(E),c=new(i().ModeOfOperation.ctr)(r,a),h=(0,l.arrayify)(c.encrypt(o)),p=(0,u.keccak256)((0,l.concat)([n,h])),w={address:e.address.substring(2).toLowerCase(),id:(0,g.EH)(S),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:(0,l.hexlify)(E).substring(2)},ciphertext:(0,l.hexlify)(h).substring(2),kdf:"scrypt",kdfparams:{salt:(0,l.hexlify)(b).substring(2),n:_,dklen:32,p:C,r:A},mac:p.substring(2)}};if(f){const e=(0,d.O)(16),t=new(i().Counter)(e),r=new(i().ModeOfOperation.ctr)(s,t),n=(0,l.arrayify)(r.encrypt(f)),o=new Date,a=o.getUTCFullYear()+"-"+(0,g.VP)(o.getUTCMonth()+1,2)+"-"+(0,g.VP)(o.getUTCDate(),2)+"T"+(0,g.VP)(o.getUTCHours(),2)+"-"+(0,g.VP)(o.getUTCMinutes(),2)+"-"+(0,g.VP)(o.getUTCSeconds(),2)+".0Z";w["x-ethers"]={client:v,gethFilename:"UTC--"+a+"--"+w.address,mnemonicCounter:(0,l.hexlify)(e).substring(2),mnemonicCiphertext:(0,l.hexlify)(n).substring(2),path:m,locale:y,version:"0.1"}}return JSON.stringify(w)}))}},8661:(e,t,r)=>{"use strict";r.d(t,{EH:()=>c,Ij:()=>a,VP:()=>s,gx:()=>l,p3:()=>o});var n=r(9716),i=r(3374);function o(e){return"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),(0,n.arrayify)(e)}function s(e,t){for(e=String(e);e.length{"use strict";r.r(t),r.d(t,{keccak256:()=>s});var n=r(7898),i=r.n(n),o=r(9716);function s(e){return"0x"+i().keccak_256((0,o.arrayify)(e))}},9502:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ErrorCode:()=>u,LogLevel:()=>c,Logger:()=>d});let n=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.default,a=null;const l=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var c,u;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(c||(c={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(u||(u={}));const h="0123456789abcdef";class d{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",e),s>o[r]||console.log.apply(console,t)}debug(){for(var e=arguments.length,t=new Array(e),r=0;r{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4],r+=h[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(a){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push("code=".concat(t)),n.push("version=".concat(this.version));const o=e;let s="";switch(t){case u.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case u.CALL_EXCEPTION:case u.INSUFFICIENT_FUNDS:case u.MISSING_NEW:case u.NONCE_EXPIRED:case u.REPLACEMENT_UNDERPRICED:case u.TRANSACTION_REPLACED:case u.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=o,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,d.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),l&&this.throwError("platform missing String.prototype.normalize",d.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:l})}checkSafeUint53(e,t){"number"===typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,d.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",d.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",d.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",d.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return a||(a=new d("logger/5.7.0")),a}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!e)return;this.globalLogger().throwError("error censorship permanent",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!e,n=!!t}static setLogLevel(e){const t=o[e.toLowerCase()];null!=t?s=t:d.globalLogger().warn("invalid log level - "+e)}static from(e){return new d(e)}}d.errors=u,d.levels=c},2522:(e,t,r)=>{"use strict";r.d(t,{n:()=>o});var n=r(9716),i=r(9598);function o(e,t,r,o,s){let a;e=(0,n.arrayify)(e),t=(0,n.arrayify)(t);let l=1;const c=new Uint8Array(o),u=new Uint8Array(t.length+4);let h,d;u.set(t);for(let f=1;f<=l;f++){u[t.length]=f>>24&255,u[t.length+1]=f>>16&255,u[t.length+2]=f>>8&255,u[t.length+3]=255&f;let p=(0,n.arrayify)((0,i.Gy)(s,e,u));a||(a=p.length,d=new Uint8Array(a),l=Math.ceil(o/a),h=o-(l-1)*a),d.set(p);for(let t=1;t{"use strict";r.r(t),r.d(t,{Description:()=>g,checkProperties:()=>c,deepCopy:()=>p,defineReadOnly:()=>s,getStatic:()=>a,resolveProperties:()=>l,shallowCopy:()=>u});var n=r(9502);var i=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const o=new n.Logger("properties/5.7.0");function s(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function a(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!==typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function l(e){return i(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function c(e,t){e&&"object"===typeof e||o.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||o.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function u(e){const t={};for(const r in e)t[r]=e[r];return t}const h={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function d(e){if(void 0===e||null===e||h[typeof e])return!0;if(Array.isArray(e)||"object"===typeof e){if(!Object.isFrozen(e))return!1;const r=Object.keys(e);for(let n=0;np(e))));if("object"===typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&s(t,r,p(n))}return t}return o.throwArgumentError("Cannot deepCopy ".concat(typeof e),"object",e)}function p(e){return f(e)}class g{constructor(e){for(const t in e)this[t]=p(e[t])}}},740:(e,t,r)=>{"use strict";r.r(t),r.d(t,{randomBytes:()=>n.O,shuffled:()=>i});var n=r(5244);function i(e){for(let t=(e=e.slice()).length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}},5244:(e,t,r)=>{"use strict";r.d(t,{O:()=>l});var n=r(9716),i=r(9502);const o=new i.Logger("random/5.7.0");const s=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof r.g)return r.g;throw new Error("unable to locate global object")}();let a=s.crypto||s.msCrypto;function l(e){(e<=0||e>1024||e%1||e!=e)&&o.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return a.getRandomValues(t),(0,n.arrayify)(t)}a&&a.getRandomValues||(o.warn("WARNING: Missing strong random number source"),a={getRandomValues:function(e){return o.throwError("no secure random source avaialble",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}})},7986:(e,t,r)=>{"use strict";r.r(t),r.d(t,{decode:()=>d,encode:()=>c});var n=r(9716),i=r(9502);const o=new i.Logger("rlp/5.7.0");function s(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function a(e,t,r){let n=0;for(let i=0;it+1+n&&o.throwError("child data too short",i.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:s}}function h(e,t){if(0===e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&o.throwError("data short segment too short",i.Logger.errors.BUFFER_OVERRUN,{});const n=a(e,t+1,r);return t+1+r+n>e.length&&o.throwError("data long segment too short",i.Logger.errors.BUFFER_OVERRUN,{}),u(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{}),u(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});const s=a(e,t+1,r);t+1+r+s>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+r+s,result:(0,n.hexlify)(e.slice(t+1+r,t+1+r+s))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:(0,n.hexlify)(e.slice(t+1,t+1+r))}}return{consumed:1,result:(0,n.hexlify)(e[t])}}function d(e){const t=(0,n.arrayify)(e),r=h(t,0);return r.consumed!==t.length&&o.throwArgumentError("invalid rlp data","data",e),r.result}},6620:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SupportedAlgorithm:()=>i.p,computeHmac:()=>n.Gy,ripemd160:()=>n.bP,sha256:()=>n.JQ,sha512:()=>n.o});var n=r(9598),i=r(4667)},9598:(e,t,r)=>{"use strict";r.d(t,{Gy:()=>d,bP:()=>c,JQ:()=>u,o:()=>h});var n=r(3125),i=r.n(n),o=r(9716),s=r(4667),a=r(9502);const l=new a.Logger("sha2/5.7.0");function c(e){return"0x"+i().ripemd160().update((0,o.arrayify)(e)).digest("hex")}function u(e){return"0x"+i().sha256().update((0,o.arrayify)(e)).digest("hex")}function h(e){return"0x"+i().sha512().update((0,o.arrayify)(e)).digest("hex")}function d(e,t,r){return s.p[e]||l.throwError("unsupported algorithm "+e,a.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+i().hmac(i()[e],(0,o.arrayify)(t)).update((0,o.arrayify)(r)).digest("hex")}},4667:(e,t,r)=>{"use strict";var n;r.d(t,{p:()=>n}),function(e){e.sha256="sha256",e.sha512="sha512"}(n||(n={}))},3668:function(e,t,r){!function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof r.g?r.g:"undefined"!=typeof self?self:{};function n(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&r.path)}},r.exports),r.exports}var i=n((function(e){!function(t){for(var r=[null,0,{}],n=10,i=44032,o=4352,s=4449,a=4519,l=19,c=21,u=28,h=c*u,d=l*h,f=function(e,t){this.codepoint=e,this.feature=t},p={},g=[],m=0;m<=255;++m)g[m]=0;var y=[function(e,t,n){return t<60||13311>8&255]>n&&(p[t]=i),i},function(e,t,r){return r?e(t,r):new f(t,null)},function(e,t,r){var n;if(t=55296&&e<=56319},f.isLowSurrogate=function(e){return e>=56320&&e<=57343},f.prototype.prepFeature=function(){this.feature||(this.feature=f.fromCharCode(this.codepoint,!0).feature)},f.prototype.toString=function(){if(this.codepoint<65536)return String.fromCharCode(this.codepoint);var e=this.codepoint-65536;return String.fromCharCode(Math.floor(e/1024)+55296,e%1024+56320)},f.prototype.getDecomp=function(){return this.prepFeature(),this.feature[0]||null},f.prototype.isCompatibility=function(){return this.prepFeature(),!!this.feature[1]&&256&this.feature[1]},f.prototype.isExclude=function(){return this.prepFeature(),!!this.feature[1]&&512&this.feature[1]},f.prototype.getCanonicalClass=function(){return this.prepFeature(),this.feature[1]?255&this.feature[1]:0},f.prototype.getComposite=function(e){if(this.prepFeature(),!this.feature[2])return null;var t=this.feature[2][e.codepoint];return t?f.fromCharCode(t):null};var v=function(e){this.str=e,this.cursor=0};v.prototype.next=function(){if(this.str&&this.cursor0&&!(this.resBuf[r-1].getCanonicalClass()<=e);--r);this.resBuf.splice(r,0,t)}while(0!==e);return this.resBuf.shift()};var E=function(e){this.it=e,this.procBuf=[],this.resBuf=[],this.lastClass=null};E.prototype.next=function(){for(;0===this.resBuf.length;){var e=this.it.next();if(!e){this.resBuf=this.procBuf,this.procBuf=[];break}if(0===this.procBuf.length)this.lastClass=e.getCanonicalClass(),this.procBuf.push(e);else{var t=this.procBuf[0].getComposite(e),r=e.getCanonicalClass();t&&(this.lastClass255||(i=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");s+=n.charAt((t=r<<16|i<<8|o)>>18&63)+n.charAt(t>>12&63)+n.charAt(t>>6&63)+n.charAt(63&t)}return l?s.slice(0,l-3)+"===".substring(l):s},e.atob=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!i.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");e+="==".slice(2-(3&e.length));for(var t,r,o,s="",a=0;a>16&255):64===o?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return s}}}(t)}));!function(){var e=[];try{for(var r=[],n=["NFD","NFC","NFKD","NFKC"],s=0;s{var e=atob(t.result.split(",").pop().trim()),r=new ArrayBuffer(e.length);new Uint8Array(r).set(Array.from(e).map((e=>e.charCodeAt(0)))),this._result=r,this._setReadyState(this.DONE)},t.readAsDataURL(e)}}}catch(e){console.log("Missing FileReader; unsupported platform")}if(e.length)for(console.log("Shims Injected:"),s=0;s{"use strict";r.r(t),r.d(t,{SigningKey:()=>Z,computePublicKey:()=>Y,recoverPublicKey:()=>Q});var n=r(518),i=r.n(n),o=r(3125),s=r.n(o);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof r.g?r.g:"undefined"!==typeof self&&self;function a(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&r.path)}},e(r,r.exports),r.exports}var l=c;function c(e,t){if(!e)throw new Error(t||"Assertion failed")}c.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var u=a((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),h=a((function(e,t){var r=t;r.assert=l,r.toArray=u.toArray,r.zero2=u.zero2,r.toHex=u.toHex,r.encode=u.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-l:l,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,l=e.andln(3)+i&3,c=t.andln(3)+o&3;3===l&&(l=-1),3===c&&(c=-1),s=0===(1&l)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?l:-l,r[0].push(s),a=0===(1&c)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==l?c:-c,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new(i())(e,"hex","le")}})),d=h.getNAF,f=h.getJSF,p=h.assert;function g(e,t){this.type=e,this.p=new(i())(t.p,16),this.red=t.prime?i().red(t.prime):i().mont(this.p),this.zero=new(i())(0).toRed(this.red),this.one=new(i())(1).toRed(this.red),this.two=new(i())(2).toRed(this.red),this.n=t.n&&new(i())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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))}var m=g;function y(e,t){this.curve=e,this.type=t,this.precomputed=null}g.prototype.point=function(){throw new Error("Not implemented")},g.prototype.validate=function(){throw new Error("Not implemented")},g.prototype._fixedNafMul=function(e,t){p(e.precomputed);var r=e._getDoubles(),n=d(t,1,this._bitLength),i=(1<=o;l--)s=(s<<1)+n[l];a.push(s)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o=0;a--){for(var l=0;a>=0&&0===o[a];a--)l++;if(a>=0&&l++,s=s.dblp(l),a<0)break;var c=o[a];p(0!==c),s="affine"===e.type?c>0?s.mixedAdd(i[c-1>>1]):s.mixedAdd(i[-c-1>>1].neg()):c>0?s.add(i[c-1>>1]):s.add(i[-c-1>>1].neg())}return"affine"===e.type?s.toP():s},g.prototype._wnafMulAdd=function(e,t,r,n,i){var o,s,a,l=this._wnafT1,c=this._wnafT2,u=this._wnafT3,h=0;for(o=0;o=1;o-=2){var g=o-1,m=o;if(1===l[g]&&1===l[m]){var y=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(y[1]=t[g].add(t[m]),y[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(y[1]=t[g].toJ().mixedAdd(t[m]),y[2]=t[g].add(t[m].neg())):(y[1]=t[g].toJ().mixedAdd(t[m]),y[2]=t[g].toJ().mixedAdd(t[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],b=f(r[g],r[m]);for(h=Math.max(b[0].length,h),u[g]=new Array(h),u[m]=new Array(h),s=0;s=0;o--){for(var A=0;o>=0;){var C=!0;for(s=0;s=0&&A++,S=S.dblp(A),o<0)break;for(s=0;s0?a=c[s][k-1>>1]:k<0&&(a=c[s][-k-1>>1].neg()),S="affine"===a.type?S.mixedAdd(a):S.add(a))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},y.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(s=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},w.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),l=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:l.add(c).neg()}},w.prototype.pointFromX=function(e,t){(e=new(i())(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.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(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},w.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},w.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},S.prototype.isInfinity=function(){return this.inf},S.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(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 this.curve.point(r,n)},S.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},S.prototype.getX=function(){return this.x.fromRed()},S.prototype.getY=function(){return this.y.fromRed()},S.prototype.mul=function(e){return e=new(i())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},S.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},S.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},S.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},S.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.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 t},S.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},v(_,m.BasePoint),w.prototype.jpoint=function(e,t,r){return new _(this,e,t,r)},_.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},_.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},_.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),l=o.redSub(s);if(0===a.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),h=n.redMul(c),d=l.redSqr().redIAdd(u).redISub(h).redISub(h),f=l.redMul(h.redISub(d)).redISub(o.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,f,p)},_.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),c=l.redMul(s),u=r.redMul(l),h=a.redSqr().redIAdd(c).redISub(u).redISub(u),d=a.redMul(u.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(s);return this.curve.jpoint(h,d,f)},_.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},_.prototype.inspect=function(){return this.isInfinity()?"":""},_.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var A=a((function(e,t){var r=t;r.base=m,r.short=E,r.mont=null,r.edwards=null})),C=a((function(e,t){var r,n=t,i=h.assert;function o(e){"short"===e.type?this.curve=new A.short(e):"edwards"===e.type?this.curve=new A.edwards(e):this.curve=new A.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,a("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:s().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("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:s().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("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:s().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("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:s().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"]}),a("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:s().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"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["9"]}),a("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:s().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(l){r=void 0}a("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:s().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function k(e){if(!(this instanceof k))return new k(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=u.toArray(e.entropy,e.entropyEnc||"hex"),r=u.toArray(e.nonce,e.nonceEnc||"hex"),n=u.toArray(e.pers,e.persEnc||"hex");l(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var I=k;k.prototype._init=function(e,t,r){var n=e.concat(t).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(e.concat(r||[])),this._reseed=1},k.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(n=r,r=t,t=null),r&&(r=u.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var x=h.assert;function N(e,t){if(e instanceof N)return e;this._importDER(e,t)||(x(e.r&&e.s,"Signature without r or s"),this.r=new(i())(e.r,16),this.s=new(i())(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var O=N;function D(){this.place=0}function M(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function L(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}N.prototype._importDER=function(e,t){e=h.toArray(e,t);var r=new D;if(48!==e[r.place++])return!1;var n=M(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=M(e,r);if(!1===o)return!1;var s=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var a=M(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var l=e.slice(r.place,a+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new(i())(s),this.s=new(i())(l),this.recoveryParam=null,!0},N.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=L(t),r=L(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var n=[2];B(n,t.length),(n=n.concat(t)).push(2),B(n,r.length);var i=n.concat(r),o=[48];return B(o,i.length),o=o.concat(i),h.encode(o,e)};var U=function(){throw new Error("unsupported")},F=h.assert;function j(e){if(!(this instanceof j))return new j(e);"string"===typeof e&&(F(Object.prototype.hasOwnProperty.call(C,e),"Unknown curve "+e),e=C[e]),e instanceof C.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var V=j;j.prototype.keyPair=function(e){return new P(this,e)},j.prototype.keyFromPrivate=function(e,t){return P.fromPrivate(this,e,t)},j.prototype.keyFromPublic=function(e,t){return P.fromPublic(this,e,t)},j.prototype.genKeyPair=function(e){e||(e={});for(var t=new I({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||U(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(i())(2));;){var o=new(i())(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},j.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},j.prototype.sign=function(e,t,r,n){"object"===typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new(i())(e,16));for(var o=this.n.byteLength(),s=t.getPrivate().toArray("be",o),a=e.toArray("be",o),l=new I({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new(i())(1)),u=0;;u++){var h=n.k?n.k(u):new(i())(l.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(c)>=0)){var d=this.g.mul(h);if(!d.isInfinity()){var f=d.getX(),p=f.umod(this.n);if(0!==p.cmpn(0)){var g=h.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==f.cmp(p)?2:0);return n.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),m^=1),new O({r:p,s:g,recoveryParam:m})}}}}}},j.prototype.verify=function(e,t,r,n){e=this._truncateToN(new(i())(e,16)),r=this.keyFromPublic(r,n);var o=(t=new O(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,l=s.invm(this.n),c=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},j.prototype.recoverPubKey=function(e,t,r,n){F((3&r)===r,"The recovery param is more than two bits"),t=new O(t,n);var o=this.n,s=new(i())(e),a=t.r,l=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var h=t.r.invm(o),d=o.sub(s).mul(h).umod(o),f=l.mul(h).umod(o);return this.g.mulAdd(d,a,f)},j.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new O(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var K=a((function(e,t){var r=t;r.version="6.5.4",r.utils=h,r.rand=function(){throw new Error("unsupported")},r.curve=A,r.curves=C,r.ec=V,r.eddsa=null})).ec,z=r(9716),q=r(520);const H=new(r(9502).Logger)("signing-key/5.7.0");let G=null;function W(){return G||(G=new K("secp256k1")),G}class Z{constructor(e){(0,q.defineReadOnly)(this,"curve","secp256k1"),(0,q.defineReadOnly)(this,"privateKey",(0,z.hexlify)(e)),32!==(0,z.hexDataLength)(this.privateKey)&&H.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=W().keyFromPrivate((0,z.arrayify)(this.privateKey));(0,q.defineReadOnly)(this,"publicKey","0x"+t.getPublic(!1,"hex")),(0,q.defineReadOnly)(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),(0,q.defineReadOnly)(this,"_isSigningKey",!0)}_addPoint(e){const t=W().keyFromPublic((0,z.arrayify)(this.publicKey)),r=W().keyFromPublic((0,z.arrayify)(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=W().keyFromPrivate((0,z.arrayify)(this.privateKey)),r=(0,z.arrayify)(e);32!==r.length&&H.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return(0,z.splitSignature)({recoveryParam:n.recoveryParam,r:(0,z.hexZeroPad)("0x"+n.r.toString(16),32),s:(0,z.hexZeroPad)("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=W().keyFromPrivate((0,z.arrayify)(this.privateKey)),r=W().keyFromPublic((0,z.arrayify)(Y(e)));return(0,z.hexZeroPad)("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function Q(e,t){const r=(0,z.splitSignature)(t),n={r:(0,z.arrayify)(r.r),s:(0,z.arrayify)(r.s)};return"0x"+W().recoverPubKey((0,z.arrayify)(e),n,r.recoveryParam).encode("hex",!1)}function Y(e,t){const r=(0,z.arrayify)(e);if(32===r.length){const e=new Z(r);return t?"0x"+W().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?(0,z.hexlify)(r):"0x"+W().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+W().keyFromPublic(r).getPublic(!0,"hex"):(0,z.hexlify)(r):H.throwArgumentError("invalid public or private key","key","[REDACTED]")}},4530:(e,t,r)=>{"use strict";r.r(t),r.d(t,{keccak256:()=>g,pack:()=>p,sha256:()=>m});var n=r(2257),i=r(9716),o=r(8062),s=r(9598),a=r(3374),l=r(9502);const c=new RegExp("^bytes([0-9]+)$"),u=new RegExp("^(u?int)([0-9]*)$"),h=new RegExp("^(.*)\\[([0-9]*)\\]$"),d=new l.Logger("solidity/5.7.0");function f(e,t,r){switch(e){case"address":return r?(0,i.zeroPad)(t,32):(0,i.arrayify)(t);case"string":return(0,a.Y0)(t);case"bytes":return(0,i.arrayify)(t);case"bool":return t=t?"0x01":"0x00",r?(0,i.zeroPad)(t,32):(0,i.arrayify)(t)}let o=e.match(u);if(o){let s=parseInt(o[2]||"256");return(o[2]&&String(s)!==o[2]||s%8!==0||0===s||s>256)&&d.throwArgumentError("invalid number type","type",e),r&&(s=256),t=n.O$.from(t).toTwos(s),(0,i.zeroPad)(t,s/8)}if(o=e.match(c),o){const n=parseInt(o[1]);return(String(n)!==o[1]||0===n||n>32)&&d.throwArgumentError("invalid bytes type","type",e),(0,i.arrayify)(t).byteLength!==n&&d.throwArgumentError("invalid value for ".concat(e),"value",t),r?(0,i.arrayify)((t+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):t}if(o=e.match(h),o&&Array.isArray(t)){const r=o[1];parseInt(o[2]||String(t.length))!=t.length&&d.throwArgumentError("invalid array length for ".concat(e),"value",t);const n=[];return t.forEach((function(e){n.push(f(r,e,!0))})),(0,i.concat)(n)}return d.throwArgumentError("invalid type","type",e)}function p(e,t){e.length!=t.length&&d.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach((function(e,n){r.push(f(e,t[n]))})),(0,i.hexlify)((0,i.concat)(r))}function g(e,t){return(0,o.keccak256)(p(e,t))}function m(e,t){return(0,s.JQ)(p(e,t))}},3902:(e,t,r)=>{"use strict";r.r(t),r.d(t,{UnicodeNormalizationForm:()=>o.Uj,Utf8ErrorFuncs:()=>o.te,Utf8ErrorReason:()=>o.Uw,_toEscapedUtf8String:()=>o.U$,formatBytes32String:()=>s,nameprep:()=>v,parseBytes32String:()=>a,toUtf8Bytes:()=>o.Y0,toUtf8CodePoints:()=>o.XL,toUtf8String:()=>o.ZN});var n=r(4867),i=r(9716),o=r(3374);function s(e){const t=(0,o.Y0)(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,i.hexlify)((0,i.concat)([t,n.R]).slice(0,32))}function a(e){const t=(0,i.arrayify)(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===t[r-1];)r--;return(0,o.ZN)(t.slice(0,r))}function l(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function c(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function u(e,t){let r=0;for(let n=0;n=r&&e<=r+i.h&&(e-r)%(i.d||1)===0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}const h=c("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),d="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),f=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],p=l("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),g=l("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),m=l("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!==0)throw new Error("bad data");let t=[];for(let r=0;r{if(d.indexOf(e)>=0)return[];if(e>=65024&&e<=65039)return[];let t=function(e){let t=u(e,f);if(t)return[e+t.s];let r=p[e];if(r)return r;let n=g[e];return n?[e+n[0]]:m[e]||null}(e);return t||[e]})),t=r.reduce(((e,t)=>(t.forEach((t=>{e.push(t)})),e)),[]),t=(0,o.XL)((0,o.uu)(t),o.Uj.NFKC),t.forEach((e=>{if(u(e,y))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),t.forEach((e=>{if(u(e,h))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=(0,o.uu)(t);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}},3374:(e,t,r)=>{"use strict";r.d(t,{Uj:()=>o,te:()=>l,Uw:()=>s,U$:()=>d,uu:()=>f,Y0:()=>u,XL:()=>g,ZN:()=>p});var n=r(9716);const i=new(r(9502).Logger)("strings/5.7.0");var o,s;function a(e,t,r,n,i){if(e===s.BAD_PREFIX||e===s.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n>6===2;n++)e++;return e}return e===s.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(o||(o={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(s||(s={}));const l=Object.freeze({error:function(e,t,r,n,o){return i.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:a,replace:function(e,t,r,n,i){return e===s.OVERLONG?(n.push(i),0):(n.push(65533),a(e,t,r))}});function c(e,t){null==t&&(t=l.error),e=(0,n.arrayify)(e);const r=[];let i=0;for(;i>7===0){r.push(n);continue}let o=null,a=null;if(192===(224&n))o=1,a=127;else if(224===(240&n))o=2,a=2047;else{if(240!==(248&n)){i+=t(128===(192&n)?s.UNEXPECTED_CONTINUE:s.BAD_PREFIX,i-1,e,r);continue}o=3,a=65535}if(i-1+o>=e.length){i+=t(s.OVERRUN,i-1,e,r);continue}let l=n&(1<<8-o-1)-1;for(let c=0;c1114111?i+=t(s.OUT_OF_RANGE,i-1-o,e,r,l):l>=55296&&l<=57343?i+=t(s.UTF16_SURROGATE,i-1-o,e,r,l):l<=a?i+=t(s.OVERLONG,i-1-o,e,r,l):r.push(l))}return r}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.current;t!=o.current&&(i.checkNormalize(),e=e.normalize(t));let r=[];for(let n=0;n>6|192),r.push(63&t|128);else if(55296==(64512&t)){n++;const i=e.charCodeAt(n);if(n>=e.length||56320!==(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&t)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(t>>12|224),r.push(t>>6&63|128),r.push(63&t|128)}return(0,n.arrayify)(r)}function h(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function d(e,t){return'"'+c(e,t).map((e=>{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?h(e):h(55296+((e-=65536)>>10&1023))+h(56320+(1023&e))})).join("")+'"'}function f(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function p(e,t){return f(c(e,t))}function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.current;return c(u(e,t))}},5452:(e,t,r)=>{"use strict";r.r(t),r.d(t,{TransactionTypes:()=>f,accessListify:()=>S,computeAddress:()=>v,parse:()=>T,recoverAddress:()=>b,serialize:()=>k});var n=r(7419),i=r(2257),o=r(9716),s=r(5422),a=r(8062),l=r(520),c=r(7986),u=r(8865),h=r(9502);const d=new h.Logger("transactions/5.7.0");var f;function p(e){return"0x"===e?null:(0,n.getAddress)(e)}function g(e){return"0x"===e?s._Y:i.O$.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(f||(f={}));const m=[{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"}],y={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function v(e){const t=(0,u.computePublicKey)(e);return(0,n.getAddress)((0,o.hexDataSlice)((0,a.keccak256)((0,o.hexDataSlice)(t,1)),12))}function b(e,t){return v((0,u.recoverPublicKey)((0,o.arrayify)(e),t))}function w(e,t){const r=(0,o.stripZeros)(i.O$.from(e).toHexString());return r.length>32&&d.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function E(e,t){return{address:(0,n.getAddress)(e),storageKeys:(t||[]).map(((t,r)=>(32!==(0,o.hexDataLength)(t)&&d.throwArgumentError("invalid access list storageKey","accessList[".concat(e,":").concat(r,"]"),t),t.toLowerCase())))}}function S(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&d.throwArgumentError("access list expected to be [ address, storageKeys[] ]","value[".concat(t,"]"),e),E(e[0],e[1])):E(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return E(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function _(e){return S(e).map((e=>[e.address,e.storageKeys]))}function A(e,t){if(null!=e.gasPrice){const t=i.O$.from(e.gasPrice),r=i.O$.from(e.maxFeePerGas||0);t.eq(r)||d.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),w(e.maxFeePerGas||0,"maxFeePerGas"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,n.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",_(e.accessList||[])];if(t){const e=(0,o.splitSignature)(t);r.push(w(e.recoveryParam,"recoveryParam")),r.push((0,o.stripZeros)(e.r)),r.push((0,o.stripZeros)(e.s))}return(0,o.hexConcat)(["0x02",c.encode(r)])}function C(e,t){const r=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.gasPrice||0,"gasPrice"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,n.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",_(e.accessList||[])];if(t){const e=(0,o.splitSignature)(t);r.push(w(e.recoveryParam,"recoveryParam")),r.push((0,o.stripZeros)(e.r)),r.push((0,o.stripZeros)(e.s))}return(0,o.hexConcat)(["0x01",c.encode(r)])}function k(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&d.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){(0,l.checkProperties)(e,y);const r=[];m.forEach((function(t){let n=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),n=(0,o.arrayify)((0,o.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=(0,o.stripZeros)(n),n.length>t.maxLength&&d.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n)),r.push((0,o.hexlify)(n))}));let n=0;if(null!=e.chainId?(n=e.chainId,"number"!==typeof n&&d.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!(0,o.isBytesLike)(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push((0,o.hexlify)(n)),r.push("0x"),r.push("0x")),!t)return c.encode(r);const i=(0,o.splitSignature)(t);let s=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),s+=2*n+8,i.v>28&&i.v!==s&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==s&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push((0,o.hexlify)(s)),r.push((0,o.stripZeros)((0,o.arrayify)(i.r))),r.push((0,o.stripZeros)((0,o.arrayify)(i.s))),c.encode(r)}(e,t);switch(e.type){case 1:return C(e,t);case 2:return A(e,t)}return d.throwError("unsupported transaction type: ".concat(e.type),h.Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function I(e,t,r){try{const r=g(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(n){d.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=(0,o.hexZeroPad)(t[1],32),e.s=(0,o.hexZeroPad)(t[2],32);try{const t=(0,a.keccak256)(r(e));e.from=b(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(n){}}function T(e){const t=(0,o.arrayify)(e);if(t[0]>127)return function(e){const t=c.decode(e);9!==t.length&&6!==t.length&&d.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:g(t[0]).toNumber(),gasPrice:g(t[1]),gasLimit:g(t[2]),to:p(t[3]),value:g(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=i.O$.from(t[6]).toNumber()}catch(n){return r}if(r.r=(0,o.hexZeroPad)(t[7],32),r.s=(0,o.hexZeroPad)(t[8],32),i.O$.from(r.r).isZero()&&i.O$.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 s=t.slice(0,6);0!==r.chainId&&(s.push((0,o.hexlify)(r.chainId)),s.push("0x"),s.push("0x"),i-=2*r.chainId+8);const l=(0,a.keccak256)(c.encode(s));try{r.from=b(l,{r:(0,o.hexlify)(r.r),s:(0,o.hexlify)(r.s),recoveryParam:i})}catch(n){}r.hash=(0,a.keccak256)(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=c.decode(e.slice(1));8!==t.length&&11!==t.length&&d.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.hexlify)(e));const r={type:1,chainId:g(t[0]).toNumber(),nonce:g(t[1]).toNumber(),gasPrice:g(t[2]),gasLimit:g(t[3]),to:p(t[4]),value:g(t[5]),data:t[6],accessList:S(t[7])};return 8===t.length||(r.hash=(0,a.keccak256)(e),I(r,t.slice(8),C)),r}(t);case 2:return function(e){const t=c.decode(e.slice(1));9!==t.length&&12!==t.length&&d.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.hexlify)(e));const r=g(t[2]),n=g(t[3]),i={type:2,chainId:g(t[0]).toNumber(),nonce:g(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:g(t[4]),to:p(t[5]),value:g(t[6]),data:t[7],accessList:S(t[8])};return 9===t.length||(i.hash=(0,a.keccak256)(e),I(i,t.slice(9),A)),i}(t)}return d.throwError("unsupported transaction type: ".concat(t[0]),h.Logger.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}},9601:(e,t,r)=>{"use strict";r.r(t),r.d(t,{commify:()=>S,formatEther:()=>C,formatUnits:()=>_,parseEther:()=>k,parseUnits:()=>A});var n=r(9716),i=r(9502),o=r(6945),s=r(2257);const a=new i.Logger(o.i),l={},c=s.O$.from(0),u=s.O$.from(-1);function h(e,t,r,n){const o={fault:t,operation:r};return void 0!==n&&(o.value=n),a.throwError(e,i.Logger.errors.NUMERIC_FAULT,o)}let d="0";for(;d.length<256;)d+=d;function f(e){if("number"!==typeof e)try{e=s.O$.from(e).toNumber()}catch(t){}return"number"===typeof e&&e>=0&&e<=256&&!(e%1)?"1"+d.substring(0,e):a.throwArgumentError("invalid decimal size","decimals",e)}function p(e,t){null==t&&(t=0);const r=f(t),n=(e=s.O$.from(e)).lt(c);n&&(e=e.mul(u));let i=e.mod(r).toString();for(;i.length2&&a.throwArgumentError("too many decimal points","value",e);let o=i[0],l=i[1];for(o||(o="0"),l||(l="0");"0"===l[l.length-1];)l=l.substring(0,l.length-1);for(l.length>r.length-1&&h("fractional component exceeds decimals","underflow","parseFixed"),""===l&&(l="0");l.lengthnull==e[t]?n:(typeof e[t]!==r&&a.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&a.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&a.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new m(l,t,r,n)}}class y{constructor(e,t,r,n){e!==l&&a.throwError("cannot use FixedNumber constructor; use FixedNumber.from",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&a.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=g(this._value,this.format.decimals),r=g(e._value,e.format.decimals);return y.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=g(this._value,this.format.decimals),r=g(e._value,e.format.decimals);return y.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=g(this._value,this.format.decimals),r=g(e._value,e.format.decimals);return y.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=g(this._value,this.format.decimals),r=g(e._value,e.format.decimals);return y.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=y.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(v.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=y.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(v.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&a.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=y.from("1"+d.substring(0,e),this.format),n=b.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&a.throwArgumentError("invalid byte width","width",e);const t=s.O$.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return(0,n.hexZeroPad)(t,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return y.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||(0,s.Zm)(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),y.fromString(p(e,t),m.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=m.from(t),i=g(e,r.decimals);!r.signed&&i.lt(c)&&h("unsigned value cannot be negative","overflow","value",e);let o=null;r.signed?o=i.toTwos(r.width).toHexString():(o=i.toHexString(),o=(0,n.hexZeroPad)(o,r.width/8));const s=p(i,r.decimals);return new y(l,o,s,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=m.from(t);if((0,n.arrayify)(e).length>r.width/8)throw new Error("overflow");let i=s.O$.from(e);r.signed&&(i=i.fromTwos(r.width));const o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=p(i,r.decimals);return new y(l,o,a,r)}static from(e,t){if("string"===typeof e)return y.fromString(e,t);if((0,n.isBytes)(e))return y.fromBytes(e,t);try{return y.fromValue(e,0,t)}catch(r){if(r.code!==i.Logger.errors.INVALID_ARGUMENT)throw r}return a.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const v=y.from(1),b=y.from("0.5"),w=new i.Logger("units/5.7.0"),E=["wei","kwei","mwei","gwei","szabo","finney","ether"];function S(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&w.throwArgumentError("invalid value","value",e);let r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const e=r.length-3;o.unshift(r.substring(e)),r=r.substring(0,e)}}return n+o.join(",")+i}function _(e,t){if("string"===typeof t){const e=E.indexOf(t);-1!==e&&(t=3*e)}return p(e,null!=t?t:18)}function A(e,t){if("string"!==typeof e&&w.throwArgumentError("value must be a string","value",e),"string"===typeof t){const e=E.indexOf(t);-1!==e&&(t=3*e)}return g(e,null!=t?t:18)}function C(e){return _(e,18)}function k(e){return A(e,18)}},2876:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Wallet:()=>w,verifyMessage:()=>E,verifyTypedData:()=>S});var n=r(7419),i=r(9745),o=r(8408),s=r(9716),a=r(2273),l=r(5992),c=r(5148),u=r(8062),h=r(520),d=r(5244),f=r(8865),p=r(3463),g=r(1529),m=r(5452),y=r(9502);var v=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const b=new y.Logger("wallet/5.7.0");class w extends o.E{constructor(e,t){if(super(),null!=(r=e)&&(0,s.isHexString)(r.privateKey,32)&&null!=r.address){const t=new f.SigningKey(e.privateKey);if((0,h.defineReadOnly)(this,"_signingKey",(()=>t)),(0,h.defineReadOnly)(this,"address",(0,m.computeAddress)(this.publicKey)),this.address!==(0,n.getAddress)(e.address)&&b.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){const t=e.mnemonic;return t&&t.phrase}(e)){const t=e.mnemonic;(0,h.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);(0,m.computeAddress)(n.privateKey)!==this.address&&b.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,h.defineReadOnly)(this,"_mnemonic",(()=>null))}else{if(f.SigningKey.isSigningKey(e))"secp256k1"!==e.curve&&b.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,h.defineReadOnly)(this,"_signingKey",(()=>e));else{"string"===typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);const t=new f.SigningKey(e);(0,h.defineReadOnly)(this,"_signingKey",(()=>t))}(0,h.defineReadOnly)(this,"_mnemonic",(()=>null)),(0,h.defineReadOnly)(this,"address",(0,m.computeAddress)(this.publicKey))}var r;t&&!i.zt.isProvider(t)&&b.throwArgumentError("invalid provider","provider",t),(0,h.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 w(this,e)}signTransaction(e){return(0,h.resolveProperties)(e).then((t=>{null!=t.from&&((0,n.getAddress)(t.from)!==this.address&&b.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete t.from);const r=this._signingKey().signDigest((0,u.keccak256)((0,m.serialize)(t)));return(0,m.serialize)(t,r)}))}signMessage(e){return v(this,void 0,void 0,(function*(){return(0,s.joinSignature)(this._signingKey().signDigest((0,a.r)(e)))}))}_signTypedData(e,t,r){return v(this,void 0,void 0,(function*(){const n=yield l.E.resolveNames(e,t,r,(e=>(null==this.provider&&b.throwError("cannot resolve ENS names without a provider",y.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),this.provider.resolveName(e))));return(0,s.joinSignature)(this._signingKey().signDigest(l.E.hash(n.domain,t,n.value)))}))}encrypt(e,t,r){if("function"!==typeof t||r||(r=t,t={}),r&&"function"!==typeof r)throw new Error("invalid callback");return t||(t={}),(0,p.HI)(this,e,t,r)}static createRandom(e){let t=(0,d.O)(16);e||(e={}),e.extraEntropy&&(t=(0,s.arrayify)((0,s.hexDataSlice)((0,u.keccak256)((0,s.concat)([t,e.extraEntropy])),0,16)));const r=(0,c.entropyToMnemonic)(t,e.locale);return w.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return(0,g.decryptJsonWallet)(e,t,r).then((e=>new w(e)))}static fromEncryptedJsonSync(e,t){return new w((0,g.decryptJsonWalletSync)(e,t))}static fromMnemonic(e,t,r){return t||(t=c.defaultPath),new w(c.HDNode.fromMnemonic(e,null,r).derivePath(t))}}function E(e,t){return(0,m.recoverAddress)((0,a.r)(e),t)}function S(e,t,r,n){return(0,m.recoverAddress)(l.E.hash(e,t,r),n)}},5889:(e,t,r)=>{"use strict";r.r(t),r.d(t,{_fetchData:()=>p,fetchJson:()=>g,poll:()=>m});var n=r(7354),i=r(9716),o=r(520),s=r(3374),a=r(9502);var l=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};function c(e,t){return l(this,void 0,void 0,(function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(r.mode=e.mode),e.cache&&(r.cache=e.cache),e.credentials&&(r.credentials=e.credentials),e.redirect&&(r.redirect=e.redirect),e.referrer&&(r.referrer=e.referrer)}const n=yield fetch(e,r),o=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach(((e,t)=>{s[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{s[e.toLowerCase()]=n.headers.get(e)})),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:(0,i.arrayify)(new Uint8Array(o))}}))}var u=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(t){o(t)}}function a(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const h=new a.Logger("web/5.7.0");function d(e){return new Promise((t=>{setTimeout(t,e)}))}function f(e,t){if(null==e)return null;if("string"===typeof e)return e;if((0,i.isBytesLike)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return(0,s.ZN)(e)}catch(r){}return(0,i.hexlify)(e)}return e}function p(e,t,r){const i="object"===typeof e&&null!=e.throttleLimit?e.throttleLimit:12;h.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);const l="object"===typeof e?e.throttleCallback:null,p="object"===typeof e&&"number"===typeof e.throttleSlotInterval?e.throttleSlotInterval:100;h.assertArgument(p>0&&p%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",p);const g="object"===typeof e&&!!e.errorPassThrough,m={};let y=null;const v={method:"GET"};let b=!1,w=12e4;if("string"===typeof e)y=e;else if("object"===typeof e){if(null!=e&&null!=e.url||h.throwArgumentError("missing URL","connection.url",e),y=e.url,"number"===typeof e.timeout&&e.timeout>0&&(w=e.timeout),e.headers)for(const t in e.headers)m[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(b=!0);if(v.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==y.substring(0,6)&&!0!==e.allowInsecureAuthentication&&h.throwError("basic authentication requires a secure https url",a.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:y,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;m.authorization={key:"Authorization",value:"Basic "+(0,n.c)((0,s.Y0)(t))}}null!=e.skipFetchSetup&&(v.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(v.fetchOptions=(0,o.shallowCopy)(e.fetchOptions))}const E=new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$","i"),S=y?y.match(E):null;if(S)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":S[1]},body:(0,n.J)(S[2])};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(k){h.throwError("processing response error",a.Logger.errors.SERVER_ERROR,{body:f(S[1],S[2]),error:k,requestBody:null,requestMethod:"GET",url:y})}t&&(v.method="POST",v.body=t,null==m["content-type"]&&(m["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==m["content-length"]&&(m["content-length"]={key:"Content-Length",value:String(t.length)}));const _={};Object.keys(m).forEach((e=>{const t=m[e];_[t.key]=t.value})),v.headers=_;const A=function(){let e=null;return{promise:new Promise((function(t,r){w&&(e=setTimeout((()=>{null!=e&&(e=null,r(h.makeError("timeout",a.Logger.errors.TIMEOUT,{requestBody:f(v.body,_["content-type"]),requestMethod:v.method,timeout:w,url:y})))}),w))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),C=function(){return u(this,void 0,void 0,(function*(){for(let e=0;e=300)&&(A.cancel(),h.throwError("bad response",a.Logger.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:f(n,t.headers?t.headers["content-type"]:null),requestBody:f(v.body,_["content-type"]),requestMethod:v.method,url:y})),r)try{const e=yield r(n,t);return A.cancel(),e}catch(k){if(k.throttleRetry&&e"content-type"===e.toLowerCase())).length||(r.headers=(0,o.shallowCopy)(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return p(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse((0,s.ZN)(e))}catch(i){h.throwError("invalid JSON",a.Logger.errors.SERVER_ERROR,{body:e,error:i})}return r&&(n=r(n,t)),n}))}function m(e,t){return t||(t={}),null==(t=(0,o.shallowCopy)(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let l=0;!function i(){return e().then((function(e){if(void 0!==e)s()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(l++,l>a)return void(s()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,l)));et.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){s()&&n(e)}))}()}))}},4806:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"}},3108:(e,t,r)=>{"use strict";r.d(t,{$n:()=>h,Fq:()=>c,_j:()=>u,mi:()=>a});var n=r(7483);function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.min(Math.max(t,e),r)}function o(e){if(e.type)return e;if("#"===e.charAt(0))return o(function(e){e=e.substr(1);var t=new RegExp(".{1,".concat(e.length>=6?2:1,"}"),"g"),r=e.match(t);return r&&1===r[0].length&&(r=r.map((function(e){return e+e}))),r?"rgb".concat(4===r.length?"a":"","(").concat(r.map((function(e,t){return t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3})).join(", "),")"):""}(e));var t=e.indexOf("("),r=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla"].indexOf(r))throw new Error((0,n.Z)(3,e));var i=e.substring(t+1,e.length-1).split(",");return{type:r,values:i=i.map((function(e){return parseFloat(e)}))}}function s(e){var t=e.type,r=e.values;return-1!==t.indexOf("rgb")?r=r.map((function(e,t){return t<3?parseInt(e,10):e})):-1!==t.indexOf("hsl")&&(r[1]="".concat(r[1],"%"),r[2]="".concat(r[2],"%")),"".concat(t,"(").concat(r.join(", "),")")}function a(e,t){var r=l(e),n=l(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function l(e){var t="hsl"===(e=o(e)).type?o(function(e){var t=(e=o(e)).values,r=t[0],n=t[1]/100,i=t[2]/100,a=n*Math.min(i,1-i),l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e+r/30)%12;return i-a*Math.max(Math.min(t-3,9-t,1),-1)},c="rgb",u=[Math.round(255*l(0)),Math.round(255*l(8)),Math.round(255*l(4))];return"hsla"===e.type&&(c+="a",u.push(t[3])),s({type:c,values:u})}(e)).values:e.values;return t=t.map((function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)})),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function c(e,t){return e=o(e),t=i(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),e.values[3]=t,s(e)}function u(e,t){if(e=o(e),t=i(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb"))for(var r=0;r<3;r+=1)e.values[r]*=1-t;return s(e)}function h(e,t){if(e=o(e),t=i(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(var r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;return s(e)}},8513:(e,t,r)=>{"use strict";r.d(t,{A:()=>X,Z:()=>$});var n=r(5987),i=r(1534),o=r(7462),s=["xs","sm","md","lg","xl"];function a(e){var t=e.values,r=void 0===t?{xs:0,sm:600,md:960,lg:1280,xl:1920}:t,i=e.unit,a=void 0===i?"px":i,l=e.step,c=void 0===l?5:l,u=(0,n.Z)(e,["values","unit","step"]);function h(e){var t="number"===typeof r[e]?r[e]:e;return"@media (min-width:".concat(t).concat(a,")")}function d(e,t){var n=s.indexOf(t);return n===s.length-1?h(e):"@media (min-width:".concat("number"===typeof r[e]?r[e]:e).concat(a,") and ")+"(max-width:".concat((-1!==n&&"number"===typeof r[s[n+1]]?r[s[n+1]]:t)-c/100).concat(a,")")}return(0,o.Z)({keys:s,values:r,up:h,down:function(e){var t=s.indexOf(e)+1,n=r[s[t]];return t===s.length?h("xs"):"@media (max-width:".concat(("number"===typeof n&&t>0?n:e)-c/100).concat(a,")")},between:d,only:function(e){return d(e,e)},width:function(e){return r[e]}},u)}var l=r(4942);function c(e,t,r){var n;return(0,o.Z)({gutters:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return console.warn(["Material-UI: theme.mixins.gutters() is deprecated.","You can use the source of the mixin directly:","\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n "].join("\n")),(0,o.Z)({paddingLeft:t(2),paddingRight:t(2)},r,(0,l.Z)({},e.up("sm"),(0,o.Z)({paddingLeft:t(3),paddingRight:t(3)},r[e.up("sm")])))},toolbar:(n={minHeight:56},(0,l.Z)(n,"".concat(e.up("xs")," and (orientation: landscape)"),{minHeight:48}),(0,l.Z)(n,e.up("sm"),{minHeight:64}),n)},r)}var u=r(7483);const h={black:"#000",white:"#fff"};const d={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#d5d5d5",A200:"#aaaaaa",A400:"#303030",A700:"#616161"};const f={50:"#e8eaf6",100:"#c5cae9",200:"#9fa8da",300:"#7986cb",400:"#5c6bc0",500:"#3f51b5",600:"#3949ab",700:"#303f9f",800:"#283593",900:"#1a237e",A100:"#8c9eff",A200:"#536dfe",A400:"#3d5afe",A700:"#304ffe"};const p={50:"#fce4ec",100:"#f8bbd0",200:"#f48fb1",300:"#f06292",400:"#ec407a",500:"#e91e63",600:"#d81b60",700:"#c2185b",800:"#ad1457",900:"#880e4f",A100:"#ff80ab",A200:"#ff4081",A400:"#f50057",A700:"#c51162"};const g={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"};const m={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"};const y={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"};var v=r(4806),b=r(3108),w={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.38)",hint:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:h.white,default:d[50]},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},E={text:{primary:h.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",hint:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:d[800],default:"#303030"},action:{active:h.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function S(e,t,r,n){var i=n.light||n,o=n.dark||1.5*n;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:"light"===t?e.light=(0,b.$n)(e.main,i):"dark"===t&&(e.dark=(0,b._j)(e.main,o)))}function _(e){var t=e.primary,r=void 0===t?{light:f[300],main:f[500],dark:f[700]}:t,s=e.secondary,a=void 0===s?{light:p.A200,main:p.A400,dark:p.A700}:s,l=e.error,c=void 0===l?{light:g[300],main:g[500],dark:g[700]}:l,_=e.warning,A=void 0===_?{light:m[300],main:m[500],dark:m[700]}:_,C=e.info,k=void 0===C?{light:y[300],main:y[500],dark:y[700]}:C,I=e.success,T=void 0===I?{light:v.Z[300],main:v.Z[500],dark:v.Z[700]}:I,R=e.type,P=void 0===R?"light":R,x=e.contrastThreshold,N=void 0===x?3:x,O=e.tonalOffset,D=void 0===O?.2:O,M=(0,n.Z)(e,["primary","secondary","error","warning","info","success","type","contrastThreshold","tonalOffset"]);function L(e){return(0,b.mi)(e,E.text.primary)>=N?E.text.primary:w.text.primary}var B=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:300,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:700;if(!(e=(0,o.Z)({},e)).main&&e[t]&&(e.main=e[t]),!e.main)throw new Error((0,u.Z)(4,t));if("string"!==typeof e.main)throw new Error((0,u.Z)(5,JSON.stringify(e.main)));return S(e,"light",r,D),S(e,"dark",n,D),e.contrastText||(e.contrastText=L(e.main)),e},U={dark:E,light:w};return(0,i.Z)((0,o.Z)({common:h,type:P,primary:B(r),secondary:B(a,"A400","A200","A700"),error:B(c),warning:B(A),info:B(k),success:B(T),grey:d,contrastThreshold:N,getContrastText:L,augmentColor:B,tonalOffset:D},U[P]),M)}function A(e){return Math.round(1e5*e)/1e5}function C(e){return A(e)}var k={textTransform:"uppercase"},I='"Roboto", "Helvetica", "Arial", sans-serif';function T(e,t){var r="function"===typeof t?t(e):t,s=r.fontFamily,a=void 0===s?I:s,l=r.fontSize,c=void 0===l?14:l,u=r.fontWeightLight,h=void 0===u?300:u,d=r.fontWeightRegular,f=void 0===d?400:d,p=r.fontWeightMedium,g=void 0===p?500:p,m=r.fontWeightBold,y=void 0===m?700:m,v=r.htmlFontSize,b=void 0===v?16:v,w=r.allVariants,E=r.pxToRem,S=(0,n.Z)(r,["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"]);var _=c/14,T=E||function(e){return"".concat(e/b*_,"rem")},R=function(e,t,r,n,i){return(0,o.Z)({fontFamily:a,fontWeight:e,fontSize:T(t),lineHeight:r},a===I?{letterSpacing:"".concat(A(n/t),"em")}:{},i,w)},P={h1:R(h,96,1.167,-1.5),h2:R(h,60,1.2,-.5),h3:R(f,48,1.167,0),h4:R(f,34,1.235,.25),h5:R(f,24,1.334,0),h6:R(g,20,1.6,.15),subtitle1:R(f,16,1.75,.15),subtitle2:R(g,14,1.57,.1),body1:R(f,16,1.5,.15),body2:R(f,14,1.43,.15),button:R(g,14,1.75,.4,k),caption:R(f,12,1.66,.4),overline:R(f,12,2.66,1,k)};return(0,i.Z)((0,o.Z)({htmlFontSize:b,pxToRem:T,round:C,fontFamily:a,fontSize:c,fontWeightLight:h,fontWeightRegular:f,fontWeightMedium:g,fontWeightBold:y},P),S,{clone:!1})}function R(){return["".concat(arguments.length<=0?void 0:arguments[0],"px ").concat(arguments.length<=1?void 0:arguments[1],"px ").concat(arguments.length<=2?void 0:arguments[2],"px ").concat(arguments.length<=3?void 0:arguments[3],"px rgba(0,0,0,").concat(.2,")"),"".concat(arguments.length<=4?void 0:arguments[4],"px ").concat(arguments.length<=5?void 0:arguments[5],"px ").concat(arguments.length<=6?void 0:arguments[6],"px ").concat(arguments.length<=7?void 0:arguments[7],"px rgba(0,0,0,").concat(.14,")"),"".concat(arguments.length<=8?void 0:arguments[8],"px ").concat(arguments.length<=9?void 0:arguments[9],"px ").concat(arguments.length<=10?void 0:arguments[10],"px ").concat(arguments.length<=11?void 0:arguments[11],"px rgba(0,0,0,").concat(.12,")")].join(",")}const P=["none",R(0,2,1,-1,0,1,1,0,0,1,3,0),R(0,3,1,-2,0,2,2,0,0,1,5,0),R(0,3,3,-2,0,3,4,0,0,1,8,0),R(0,2,4,-1,0,4,5,0,0,1,10,0),R(0,3,5,-1,0,5,8,0,0,1,14,0),R(0,3,5,-1,0,6,10,0,0,1,18,0),R(0,4,5,-2,0,7,10,1,0,2,16,1),R(0,5,5,-3,0,8,10,1,0,3,14,2),R(0,5,6,-3,0,9,12,1,0,3,16,2),R(0,6,6,-3,0,10,14,1,0,4,18,3),R(0,6,7,-4,0,11,15,1,0,4,20,3),R(0,7,8,-4,0,12,17,2,0,5,22,4),R(0,7,8,-4,0,13,19,2,0,5,24,4),R(0,7,9,-4,0,14,21,2,0,5,26,4),R(0,8,9,-5,0,15,22,2,0,6,28,5),R(0,8,10,-5,0,16,24,2,0,6,30,5),R(0,8,11,-5,0,17,26,2,0,6,32,5),R(0,9,11,-5,0,18,28,2,0,7,34,6),R(0,9,12,-6,0,19,29,2,0,7,36,6),R(0,10,13,-6,0,20,31,3,0,8,38,7),R(0,10,13,-6,0,21,33,3,0,8,40,7),R(0,10,14,-6,0,22,35,3,0,8,42,7),R(0,11,14,-7,0,23,36,3,0,9,44,8),R(0,11,15,-7,0,24,38,3,0,9,46,8)];const x={borderRadius:4};var N=r(885),O=r(1002),D={xs:0,sm:600,md:960,lg:1280,xl:1920},M={keys:["xs","sm","md","lg","xl"],up:function(e){return"@media (min-width:".concat(D[e],"px)")}};const L=function(e,t){return t?(0,i.Z)(e,t,{clone:!1}):e};var B={m:"margin",p:"padding"},U={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},F={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},j=function(e){var t={};return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}((function(e){if(e.length>2){if(!F[e])return[e];e=F[e]}var t=e.split(""),r=(0,N.Z)(t,2),n=r[0],i=r[1],o=B[n],s=U[i]||"";return Array.isArray(s)?s.map((function(e){return o+e})):[o+s]})),V=["m","mt","mr","mb","ml","mx","my","p","pt","pr","pb","pl","px","py","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY"];function K(e){var t=e.spacing||8;return"number"===typeof t?function(e){return t*e}:Array.isArray(t)?function(e){return t[e]}:"function"===typeof t?t:function(){}}function z(e,t){return function(r){return e.reduce((function(e,n){return e[n]=function(e,t){if("string"===typeof t||null==t)return t;var r=e(Math.abs(t));return t>=0?r:"number"===typeof r?-r:"-".concat(r)}(t,r),e}),{})}}function q(e){var t=K(e.theme);return Object.keys(e).map((function(r){if(-1===V.indexOf(r))return null;var n=z(j(r),t),i=e[r];return function(e,t,r){if(Array.isArray(t)){var n=e.theme.breakpoints||M;return t.reduce((function(e,i,o){return e[n.up(n.keys[o])]=r(t[o]),e}),{})}if("object"===(0,O.Z)(t)){var i=e.theme.breakpoints||M;return Object.keys(t).reduce((function(e,n){return e[i.up(n)]=r(t[n]),e}),{})}return r(t)}(e,i,n)})).reduce(L,{})}q.propTypes={},q.filterProps=V;function H(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8;if(e.mui)return e;var t=K({spacing:e}),r=function(){for(var e=arguments.length,r=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:["all"],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.duration,i=void 0===r?W.standard:r,o=t.easing,s=void 0===o?G.easeInOut:o,a=t.delay,l=void 0===a?0:a;(0,n.Z)(t,["duration","easing","delay"]);return(Array.isArray(e)?e:[e]).map((function(e){return"".concat(e," ").concat("string"===typeof i?i:Z(i)," ").concat(s," ").concat("string"===typeof l?l:Z(l))})).join(",")},getAutoHeightDuration:function(e){if(!e)return 0;var t=e/36;return Math.round(10*(4+15*Math.pow(t,.25)+t/5))}};var Y=r(9535);function J(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.breakpoints,r=void 0===t?{}:t,o=e.mixins,s=void 0===o?{}:o,l=e.palette,u=void 0===l?{}:l,h=e.spacing,d=e.typography,f=void 0===d?{}:d,p=(0,n.Z)(e,["breakpoints","mixins","palette","spacing","typography"]),g=_(u),m=a(r),y=H(h),v=(0,i.Z)({breakpoints:m,direction:"ltr",mixins:c(m,y,s),overrides:{},palette:g,props:{},shadows:P,typography:T(g,f),spacing:y,shape:x,transitions:Q,zIndex:Y.Z},p),b=arguments.length,w=new Array(b>1?b-1:0),E=1;E{"use strict";r.d(t,{Z:()=>n});const n=(0,r(8513).Z)()},8317:(e,t,r)=>{"use strict";r.d(t,{Z:()=>f});var n=r(7462),i=r(5987),o=r(2791),s=r(2110),a=r.n(s),l=r(3401),c=r(794),u=r(8444);const h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){var s=t.defaultTheme,h=t.withTheme,d=void 0!==h&&h,f=t.name,p=(0,i.Z)(t,["defaultTheme","withTheme","name"]);var g=f,m=(0,l.Z)(e,(0,n.Z)({defaultTheme:s,Component:r,name:f||r.displayName,classNamePrefix:g},p)),y=o.forwardRef((function(e,t){e.classes;var a,l=e.innerRef,h=(0,i.Z)(e,["classes","innerRef"]),p=m((0,n.Z)({},r.defaultProps,e)),g=h;return("string"===typeof f||d)&&(a=(0,u.Z)()||s,f&&(g=(0,c.Z)({theme:a,name:f,props:h})),d&&!g.theme&&(g.theme=a)),o.createElement(r,(0,n.Z)({ref:l||t,classes:p},g))}));return a()(y,r),y}};var d=r(663);const f=function(e,t){return h(e,(0,n.Z)({defaultTheme:d.Z},t))}},9535:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500}},1122:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(7483);function i(e){if("string"!==typeof e)throw new Error((0,n.Z)(7));return e.charAt(0).toUpperCase()+e.slice(1)}},7545:(e,t,r)=>{"use strict";function n(){for(var e=arguments.length,t=new Array(e),r=0;rn})},8499:(e,t,r)=>{"use strict";r.d(t,{Z:()=>h});var n=r(7462),i=r(2791),o=r(5987),s=r(8182),a=r(8317),l=r(1122),c=i.forwardRef((function(e,t){var r=e.children,a=e.classes,c=e.className,u=e.color,h=void 0===u?"inherit":u,d=e.component,f=void 0===d?"svg":d,p=e.fontSize,g=void 0===p?"medium":p,m=e.htmlColor,y=e.titleAccess,v=e.viewBox,b=void 0===v?"0 0 24 24":v,w=(0,o.Z)(e,["children","classes","className","color","component","fontSize","htmlColor","titleAccess","viewBox"]);return i.createElement(f,(0,n.Z)({className:(0,s.Z)(a.root,c,"inherit"!==h&&a["color".concat((0,l.Z)(h))],"default"!==g&&"medium"!==g&&a["fontSize".concat((0,l.Z)(g))]),focusable:"false",viewBox:b,color:m,"aria-hidden":!y||void 0,role:y?"img":void 0,ref:t},w),r,y?i.createElement("title",null,y):null)}));c.muiName="SvgIcon";const u=(0,a.Z)((function(e){return{root:{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0,fontSize:e.typography.pxToRem(24),transition:e.transitions.create("fill",{duration:e.transitions.duration.shorter})},colorPrimary:{color:e.palette.primary.main},colorSecondary:{color:e.palette.secondary.main},colorAction:{color:e.palette.action.active},colorError:{color:e.palette.error.main},colorDisabled:{color:e.palette.action.disabled},fontSizeInherit:{fontSize:"inherit"},fontSizeSmall:{fontSize:e.typography.pxToRem(20)},fontSizeLarge:{fontSize:e.typography.pxToRem(35)}}}),{name:"MuiSvgIcon"})(c);function h(e,t){var r=function(t,r){return i.createElement(u,(0,n.Z)({ref:r},t),e)};return r.muiName=u.muiName,i.memo(i.forwardRef(r))}},503:(e,t,r)=>{"use strict";function n(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:166;function n(){for(var n=arguments.length,i=new Array(n),o=0;on})},2446:(e,t,r)=>{"use strict";r.r(t),r.d(t,{capitalize:()=>n.Z,createChainedFunction:()=>i.Z,createSvgIcon:()=>o.Z,debounce:()=>s.Z,deprecatedPropType:()=>a,isMuiElement:()=>l.Z,ownerDocument:()=>c.Z,ownerWindow:()=>u.Z,requirePropFactory:()=>h,setRef:()=>d.Z,unstable_useId:()=>v,unsupportedProp:()=>f,useControlled:()=>p.Z,useEventCallback:()=>g.Z,useForkRef:()=>m.Z,useIsFocusVisible:()=>b.Z});var n=r(1122),i=r(7545),o=r(8499),s=r(503);function a(e,t){return function(){return null}}var l=r(3375),c=r(539),u=r(7636);function h(e){return function(){return null}}var d=r(1565);function f(e,t,r,n,i){return null}var p=r(799),g=r(2216),m=r(9806),y=r(2791);function v(e){var t=y.useState(e),r=t[0],n=t[1],i=e||r;return y.useEffect((function(){null==r&&n("mui-".concat(Math.round(1e5*Math.random())))}),[r]),i}var b=r(1175)},3375:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(2791);function i(e,t){return n.isValidElement(e)&&-1!==t.indexOf(e.type.muiName)}},539:(e,t,r)=>{"use strict";function n(e){return e&&e.ownerDocument||document}r.d(t,{Z:()=>n})},7636:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(539);function i(e){return(0,n.Z)(e).defaultView||window}},1565:(e,t,r)=>{"use strict";function n(e,t){"function"===typeof e?e(t):e&&(e.current=t)}r.d(t,{Z:()=>n})},799:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(2791);function i(e){var t=e.controlled,r=e.default,i=(e.name,e.state,n.useRef(void 0!==t).current),o=n.useState(r),s=o[0],a=o[1];return[i?t:s,n.useCallback((function(e){i||a(e)}),[])]}},2216:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(2791),i="undefined"!==typeof window?n.useLayoutEffect:n.useEffect;function o(e){var t=n.useRef(e);return i((function(){t.current=e})),n.useCallback((function(){return t.current.apply(void 0,arguments)}),[])}},9806:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(2791),i=r(1565);function o(e,t){return n.useMemo((function(){return null==e&&null==t?null:function(r){(0,i.Z)(e,r),(0,i.Z)(t,r)}}),[e,t])}},1175:(e,t,r)=>{"use strict";r.d(t,{Z:()=>p});var n=r(2791),i=r(4164),o=!0,s=!1,a=null,l={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function c(e){e.metaKey||e.altKey||e.ctrlKey||(o=!0)}function u(){o=!1}function h(){"hidden"===this.visibilityState&&s&&(o=!0)}function d(e){var t=e.target;try{return t.matches(":focus-visible")}catch(r){}return o||function(e){var t=e.type,r=e.tagName;return!("INPUT"!==r||!l[t]||e.readOnly)||"TEXTAREA"===r&&!e.readOnly||!!e.isContentEditable}(t)}function f(){s=!0,window.clearTimeout(a),a=window.setTimeout((function(){s=!1}),100)}function p(){return{isFocusVisible:d,onBlurVisible:f,ref:n.useCallback((function(e){var t,r=i.findDOMNode(e);null!=r&&((t=r.ownerDocument).addEventListener("keydown",c,!0),t.addEventListener("mousedown",u,!0),t.addEventListener("pointerdown",u,!0),t.addEventListener("touchstart",u,!0),t.addEventListener("visibilitychange",h,!0))}),[])}}},771:(e,t,r)=>{"use strict";var n=r(4836),i=r(5263);t.Z=void 0;var o=i(r(2791)),s=(0,n(r(4894)).default)(o.createElement("path",{d:"M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z"}),"Wifi");t.Z=s},4894:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.createSvgIcon}});var n=r(2446)},9316:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n="function"===typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__"},794:(e,t,r)=>{"use strict";function n(e){var t=e.theme,r=e.name,n=e.props;if(!t||!t.props||!t.props[r])return n;var i,o=t.props[r];for(i in o)void 0===n[i]&&(n[i]=o[i]);return n}r.d(t,{Z:()=>n})},3401:(e,t,r)=>{"use strict";r.d(t,{Z:()=>vr});var n=r(5987),i=r(7462),o=r(2791),s="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};const a="object"===("undefined"===typeof window?"undefined":s(window))&&"object"===("undefined"===typeof document?"undefined":s(document))&&9===document.nodeType;var l=r(3144),c=r(1721),u=r(7326),h=r(3366),d={}.constructor;function f(e){if(null==e||"object"!==typeof e)return e;if(Array.isArray(e))return e.map(f);if(e.constructor!==d)return e;var t={};for(var r in e)t[r]=f(e[r]);return t}function p(e,t,r){void 0===e&&(e="unnamed");var n=r.jss,i=f(t),o=n.plugins.onCreateRule(e,i,r);return o||(e[0],null)}var g=function(e,t){for(var r="",n=0;n<+~=|^:(),"'`\s])/g,E="undefined"!==typeof CSS&&CSS.escape,S=function(e){return E?E(e):e.replace(w,"\\$1")},_=function(){function e(e,t,r){this.type="style",this.isProcessed=!1;var n=r.sheet,i=r.Renderer;this.key=e,this.options=r,this.style=t,n?this.renderer=n.renderer:i&&(this.renderer=new i)}return e.prototype.prop=function(e,t,r){if(void 0===t)return this.style[e];var n=!!r&&r.force;if(!n&&this.style[e]===t)return this;var i=t;r&&!1===r.process||(i=this.options.jss.plugins.onChangeValue(t,e,this));var o=null==i||!1===i,s=e in this.style;if(o&&!s&&!n)return this;var a=o&&s;if(a?delete this.style[e]:this.style[e]=i,this.renderable&&this.renderer)return a?this.renderer.removeProperty(this.renderable,e):this.renderer.setProperty(this.renderable,e,i),this;var l=this.options.sheet;return l&&l.attached,this},e}(),A=function(e){function t(t,r,n){var i;i=e.call(this,t,r,n)||this;var o=n.selector,s=n.scoped,a=n.sheet,l=n.generateId;return o?i.selectorText=o:!1!==s&&(i.id=l((0,u.Z)((0,u.Z)(i)),a),i.selectorText="."+S(i.id)),i}(0,c.Z)(t,e);var r=t.prototype;return r.applyTo=function(e){var t=this.renderer;if(t){var r=this.toJSON();for(var n in r)t.setProperty(e,n,r[n])}return this},r.toJSON=function(){var e={};for(var t in this.style){var r=this.style[t];"object"!==typeof r?e[t]=r:Array.isArray(r)&&(e[t]=m(r))}return e},r.toString=function(e){var t=this.options.sheet,r=!!t&&t.options.link?(0,i.Z)({},e,{allowEmpty:!0}):e;return b(this.selectorText,this.style,r)},(0,l.Z)(t,[{key:"selector",set:function(e){if(e!==this.selectorText){this.selectorText=e;var t=this.renderer,r=this.renderable;if(r&&t)t.setSelector(r,e)||t.replaceRule(r,this)}},get:function(){return this.selectorText}}]),t}(_),C={onCreateRule:function(e,t,r){return"@"===e[0]||r.parent&&"keyframes"===r.parent.type?null:new A(e,t,r)}},k={indent:1,children:!0},I=/@([\w-]+)/,T=function(){function e(e,t,r){this.type="conditional",this.isProcessed=!1,this.key=e;var n=e.match(I);for(var o in this.at=n?n[1]:"unknown",this.query=r.name||"@"+this.at,this.options=r,this.rules=new X((0,i.Z)({},r,{parent:this})),t)this.rules.add(o,t[o]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.indexOf=function(e){return this.rules.indexOf(e)},t.addRule=function(e,t,r){var n=this.rules.add(e,t,r);return n?(this.options.jss.plugins.onProcessRule(n),n):null},t.replaceRule=function(e,t,r){var n=this.rules.replace(e,t,r);return n&&this.options.jss.plugins.onProcessRule(n),n},t.toString=function(e){void 0===e&&(e=k);var t=y(e).linebreak;if(null==e.indent&&(e.indent=k.indent),null==e.children&&(e.children=k.children),!1===e.children)return this.query+" {}";var r=this.rules.toString(e);return r?this.query+" {"+t+r+t+"}":""},e}(),R=/@media|@supports\s+/,P={onCreateRule:function(e,t,r){return R.test(e)?new T(e,t,r):null}},x={indent:1,children:!0},N=/@keyframes\s+([\w-]+)/,O=function(){function e(e,t,r){this.type="keyframes",this.at="@keyframes",this.isProcessed=!1;var n=e.match(N);n&&n[1]?this.name=n[1]:this.name="noname",this.key=this.type+"-"+this.name,this.options=r;var o=r.scoped,s=r.sheet,a=r.generateId;for(var l in this.id=!1===o?this.name:S(a(this,s)),this.rules=new X((0,i.Z)({},r,{parent:this})),t)this.rules.add(l,t[l],(0,i.Z)({},r,{parent:this}));this.rules.process()}return e.prototype.toString=function(e){void 0===e&&(e=x);var t=y(e).linebreak;if(null==e.indent&&(e.indent=x.indent),null==e.children&&(e.children=x.children),!1===e.children)return this.at+" "+this.id+" {}";var r=this.rules.toString(e);return r&&(r=""+t+r+t),this.at+" "+this.id+" {"+r+"}"},e}(),D=/@keyframes\s+/,M=/\$([\w-]+)/g,L=function(e,t){return"string"===typeof e?e.replace(M,(function(e,r){return r in t?t[r]:e})):e},B=function(e,t,r){var n=e[t],i=L(n,r);i!==n&&(e[t]=i)},U={onCreateRule:function(e,t,r){return"string"===typeof e&&D.test(e)?new O(e,t,r):null},onProcessStyle:function(e,t,r){return"style"===t.type&&r?("animation-name"in e&&B(e,"animation-name",r.keyframes),"animation"in e&&B(e,"animation",r.keyframes),e):e},onChangeValue:function(e,t,r){var n=r.options.sheet;if(!n)return e;switch(t){case"animation":case"animation-name":return L(e,n.keyframes);default:return e}}},F=function(e){function t(){return e.apply(this,arguments)||this}return(0,c.Z)(t,e),t.prototype.toString=function(e){var t=this.options.sheet,r=!!t&&t.options.link?(0,i.Z)({},e,{allowEmpty:!0}):e;return b(this.key,this.style,r)},t}(_),j={onCreateRule:function(e,t,r){return r.parent&&"keyframes"===r.parent.type?new F(e,t,r):null}},V=function(){function e(e,t,r){this.type="font-face",this.at="@font-face",this.isProcessed=!1,this.key=e,this.style=t,this.options=r}return e.prototype.toString=function(e){var t=y(e).linebreak;if(Array.isArray(this.style)){for(var r="",n=0;n=this.index)t.push(e);else for(var n=0;nr)return void t.splice(n,0,e)},t.reset=function(){this.registry=[]},t.remove=function(e){var t=this.registry.indexOf(e);this.registry.splice(t,1)},t.toString=function(e){for(var t=void 0===e?{}:e,r=t.attached,n=(0,h.Z)(t,["attached"]),i=y(n).linebreak,o="",s=0;s-1?n.substr(0,i-1):n;e.style.setProperty(t,o,i>-1?"important":"")}}catch(s){return!1}return!0},ue=function(e,t){try{e.attributeStyleMap?e.attributeStyleMap.delete(t):e.style.removeProperty(t)}catch(r){}},he=function(e,t){return e.selectorText=t,e.selectorText===t},de=ae((function(){return document.querySelector("head")}));function fe(e){var t=re.registry;if(t.length>0){var r=function(e,t){for(var r=0;rt.index&&n.options.insertionPoint===t.insertionPoint)return n}return null}(t,e);if(r&&r.renderer)return{parent:r.renderer.element.parentNode,node:r.renderer.element};if(r=function(e,t){for(var r=e.length-1;r>=0;r--){var n=e[r];if(n.attached&&n.options.insertionPoint===t.insertionPoint)return n}return null}(t,e),r&&r.renderer)return{parent:r.renderer.element.parentNode,node:r.renderer.element.nextSibling}}var n=e.insertionPoint;if(n&&"string"===typeof n){var i=function(e){for(var t=de(),r=0;rr?r:t},ye=function(){function e(e){this.getPropertyValue=le,this.setProperty=ce,this.removeProperty=ue,this.setSelector=he,this.hasInsertedRules=!1,this.cssRules=[],e&&re.add(e),this.sheet=e;var t=this.sheet?this.sheet.options:{},r=t.media,n=t.meta,i=t.element;this.element=i||function(){var e=document.createElement("style");return e.textContent="\n",e}(),this.element.setAttribute("data-jss",""),r&&this.element.setAttribute("media",r),n&&this.element.setAttribute("data-meta",n);var o=pe();o&&this.element.setAttribute("nonce",o)}var t=e.prototype;return t.attach=function(){if(!this.element.parentNode&&this.sheet){!function(e,t){var r=t.insertionPoint,n=fe(t);if(!1!==n&&n.parent)n.parent.insertBefore(e,n.node);else if(r&&"number"===typeof r.nodeType){var i=r,o=i.parentNode;o&&o.insertBefore(e,i.nextSibling)}else de().appendChild(e)}(this.element,this.sheet.options);var e=Boolean(this.sheet&&this.sheet.deployed);this.hasInsertedRules&&e&&(this.hasInsertedRules=!1,this.deploy())}},t.detach=function(){if(this.sheet){var e=this.element.parentNode;e&&e.removeChild(this.element),this.sheet.options.link&&(this.cssRules=[],this.element.textContent="\n")}},t.deploy=function(){var e=this.sheet;e&&(e.options.link?this.insertRules(e.rules):this.element.textContent="\n"+e.toString()+"\n")},t.insertRules=function(e,t){for(var r=0;r-1){var i=Ft[e];if(!Array.isArray(i))return ft+_t(i)in t&&pt+i;if(!n)return!1;for(var o=0;ot?1:-1:e.length-t.length};return{onProcessStyle:function(t,r){if("style"!==r.type)return t;for(var n={},i=Object.keys(t).sort(e),o=0;o0&&void 0!==arguments[0]?arguments[0]:{},t=e.disableGlobal,r=void 0!==t&&t,n=e.productionPrefix,i=void 0===n?"jss":n,o=e.seed,s=void 0===o?"":o,a=""===s?"":"".concat(s,"-"),l=0,c=function(){return l+=1};return function(e,t){var n=t.options.name;if(n&&0===n.indexOf("Mui")&&!t.options.link&&!r){if(-1!==Te.indexOf(e.key))return"Mui-".concat(e.key);var o="".concat(a).concat(n,"-").concat(e.key);return t.options.theme[Ie.Z]&&""===s?"".concat(o,"-").concat(c()):o}return"".concat(a).concat(i).concat(c())}}(),sr={disableGeneration:!1,generateClassName:or,jss:ir,sheetsCache:null,sheetsManager:new Map,sheetsRegistry:null},ar=o.createContext(sr);var lr=-1e9;function cr(){return lr+=1}var ur=r(1534);function hr(e){var t="function"===typeof e;return{create:function(r,n){var o;try{o=t?e(r):e}catch(l){throw l}if(!n||!r.overrides||!r.overrides[n])return o;var s=r.overrides[n],a=(0,i.Z)({},o);return Object.keys(s).forEach((function(e){a[e]=(0,ur.Z)(a[e],s[e])})),a},options:{}}}const dr={};function fr(e,t,r){var n=e.state;if(e.stylesOptions.disableGeneration)return t||{};n.cacheClasses||(n.cacheClasses={value:null,lastProp:null,lastJSS:{}});var i=!1;return n.classes!==n.cacheClasses.lastJSS&&(n.cacheClasses.lastJSS=n.classes,i=!0),t!==n.cacheClasses.lastProp&&(n.cacheClasses.lastProp=t,i=!0),i&&(n.cacheClasses.value=(0,_e.Z)({baseClasses:n.cacheClasses.lastJSS,newClasses:t,Component:r})),n.cacheClasses.value}function pr(e,t){var r=e.state,n=e.theme,o=e.stylesOptions,s=e.stylesCreator,a=e.name;if(!o.disableGeneration){var l=Ce.get(o.sheetsManager,s,n);l||(l={refs:0,staticSheet:null,dynamicStyles:null},Ce.set(o.sheetsManager,s,n,l));var c=(0,i.Z)({},s.options,o,{theme:n,flip:"boolean"===typeof o.flip?o.flip:"rtl"===n.direction});c.generateId=c.serverGenerateClassName||c.generateClassName;var u=o.sheetsRegistry;if(0===l.refs){var h;o.sheetsCache&&(h=Ce.get(o.sheetsCache,s,n));var d=s.create(n,a);h||((h=o.jss.createStyleSheet(d,(0,i.Z)({link:!1},c))).attach(),o.sheetsCache&&Ce.set(o.sheetsCache,s,n,h)),u&&u.add(h),l.staticSheet=h,l.dynamicStyles=Se(d)}if(l.dynamicStyles){var f=o.jss.createStyleSheet(l.dynamicStyles,(0,i.Z)({link:!0},c));f.update(t),f.attach(),r.dynamicSheet=f,r.classes=(0,_e.Z)({baseClasses:l.staticSheet.classes,newClasses:f.classes}),u&&u.add(f)}else r.classes=l.staticSheet.classes;l.refs+=1}}function gr(e,t){var r=e.state;r.dynamicSheet&&r.dynamicSheet.update(t)}function mr(e){var t=e.state,r=e.theme,n=e.stylesOptions,i=e.stylesCreator;if(!n.disableGeneration){var o=Ce.get(n.sheetsManager,i,r);o.refs-=1;var s=n.sheetsRegistry;0===o.refs&&(Ce.delete(n.sheetsManager,i,r),n.jss.removeStyleSheet(o.staticSheet),s&&s.remove(o.staticSheet)),t.dynamicSheet&&(n.jss.removeStyleSheet(t.dynamicSheet),s&&s.remove(t.dynamicSheet))}}function yr(e,t){var r,n=o.useRef([]),i=o.useMemo((function(){return{}}),t);n.current!==i&&(n.current=i,r=e()),o.useEffect((function(){return function(){r&&r()}}),[i])}function vr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.name,s=t.classNamePrefix,a=t.Component,l=t.defaultTheme,c=void 0===l?dr:l,u=(0,n.Z)(t,["name","classNamePrefix","Component","defaultTheme"]),h=hr(e),d=r||s||"makeStyles";h.options={index:cr(),name:r,meta:d,classNamePrefix:d};var f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,ke.Z)()||c,n=(0,i.Z)({},o.useContext(ar),u),s=o.useRef(),l=o.useRef();yr((function(){var i={name:r,state:{},stylesCreator:h,stylesOptions:n,theme:t};return pr(i,e),l.current=!1,s.current=i,function(){mr(i)}}),[t,h]),o.useEffect((function(){l.current&&gr(s.current,e),l.current=!0}));var d=fr(s.current,e.classes,a);return d};return f}},5352:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(7462);function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.baseClasses,r=e.newClasses;e.Component;if(!r)return t;var i=(0,n.Z)({},t);return Object.keys(r).forEach((function(e){r[e]&&(i[e]="".concat(t[e]," ").concat(r[e]))})),i}},423:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n=r(2791).createContext(null)},8444:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(2791),i=r(423);function o(){return n.useContext(i.Z)}},1534:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});var n=r(7462),i=r(1002);function o(e){return e&&"object"===(0,i.Z)(e)&&e.constructor===Object}function s(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{clone:!0},i=r.clone?(0,n.Z)({},e):e;return o(e)&&o(t)&&Object.keys(t).forEach((function(n){"__proto__"!==n&&(o(t[n])&&n in e?i[n]=s(e[n],t[n],r):i[n]=t[n])})),i}},7483:(e,t,r)=>{"use strict";function n(e){for(var t="https://mui.com/production-error/?code="+e,r=1;rn})},7206:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,o=!0;for(;i{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var i,o=null,s=[],a=0,l=0;t>2],i=(3&c)<<4,l=1;break;case 1:s[a++]=n[i|c>>4],i=(15&c)<<2,l=2;break;case 2:s[a++]=n[i|c>>6],s[a++]=n[63&c],l=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return l&&(s[a++]=n[i],s[a++]=61,1===l&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,o=r,a=0,l=0;l1)break;if(void 0===(c=i[c]))throw Error(s);switch(a){case 0:n=c,a=1;break;case 1:t[r++]=n<<2|(48&c)>>4,n=c,a=2;break;case 2:t[r++]=(15&n)<<4|(60&c)>>2,n=c,a=3;break;case 3:t[r++]=(3&n)<<6|c,a=0}}if(1===a)throw Error(s);return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},3297:e=>{"use strict";function t(e,r){"string"===typeof e&&(r=e,e=void 0);var n=[];function i(e){if("string"!==typeof e){var r=o();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var s=Object.keys(e),a=new Array(s.length+1),l=new Array(s.length),c=0;c{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n{"use strict";e.exports=o;var n=r(7206),i=r(7172)("fs");function o(e,t,r){return"function"===typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&i&&i.readFile?i.readFile(e,(function(n,i){return n&&"undefined"!==typeof XMLHttpRequest?o.xhr(e,t,r):n?r(n):r(null,t.binary?i:i.toString("utf8"))})):o.xhr(e,t,r):n(o,this,e,t)}o.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var i=0;i{"use strict";function t(e){return"undefined"!==typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,s=8388607&n;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,i,o){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+r);else{var l=Math.floor(Math.log(n)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=n*Math.pow(2,-l))>>>0,i,o+t),e((s<<31|l+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}}function s(e,t,r,n,i){var o=e(n,i+t),s=e(n,i+r),a=2*(s>>31)+1,l=s>>>20&2047,c=4294967296*(1048575&s)+o;return 2047===l?c?NaN:a*(1/0):0===l?5e-324*a*c:a*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},7172:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},7468:(e,t)=>{"use strict";var r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),i="";r&&(i=t.shift()+"/");for(var o=0;o0&&".."!==t[o-1]?t.splice(--o,2):r?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return i+t.join("/")};r.resolve=function(e,t,r){return r||(t=i(t)),n(t)?t:(r||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},8236:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(r){if(r<1||r>i)return e(r);s+r>n&&(o=e(n),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},3861:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n191&&n<224?o[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(n>>10),o[s++]=56320+(1023&n)):o[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,r){for(var n,i,o=r,s=0;s>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}},6232:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5073);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function l(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function c(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function u(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),u(e/4294967296>>>0,t,r),u(e>>>0,t,r+4),t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),h(e>>>0,t,r),h(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=l,t.readUint32LE=c,t.writeUint32BE=u,t.writeInt32BE=u,t.writeUint32LE=h,t.writeInt32LE=h,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=l(e,t);return 4294967296*l(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=f,t.writeInt64LE=f,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6232),i=r(9116);function o(e,t,r){for(var i=1634760805,o=857760878,s=2036477234,a=1797285236,l=r[3]<<24|r[2]<<16|r[1]<<8|r[0],c=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],h=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],f=r[23]<<24|r[22]<<16|r[21]<<8|r[20],p=r[27]<<24|r[26]<<16|r[25]<<8|r[24],g=r[31]<<24|r[30]<<16|r[29]<<8|r[28],m=t[3]<<24|t[2]<<16|t[1]<<8|t[0],y=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=i,E=o,S=s,_=a,A=l,C=c,k=u,I=h,T=d,R=f,P=p,x=g,N=m,O=y,D=v,M=b,L=0;L<20;L+=2)A=(A^=T=T+(N=(N^=w=w+A|0)>>>16|N<<16)|0)>>>20|A<<12,C=(C^=R=R+(O=(O^=E=E+C|0)>>>16|O<<16)|0)>>>20|C<<12,k=(k^=P=P+(D=(D^=S=S+k|0)>>>16|D<<16)|0)>>>20|k<<12,I=(I^=x=x+(M=(M^=_=_+I|0)>>>16|M<<16)|0)>>>20|I<<12,k=(k^=P=P+(D=(D^=S=S+k|0)>>>24|D<<8)|0)>>>25|k<<7,I=(I^=x=x+(M=(M^=_=_+I|0)>>>24|M<<8)|0)>>>25|I<<7,C=(C^=R=R+(O=(O^=E=E+C|0)>>>24|O<<8)|0)>>>25|C<<7,A=(A^=T=T+(N=(N^=w=w+A|0)>>>24|N<<8)|0)>>>25|A<<7,C=(C^=P=P+(M=(M^=w=w+C|0)>>>16|M<<16)|0)>>>20|C<<12,k=(k^=x=x+(N=(N^=E=E+k|0)>>>16|N<<16)|0)>>>20|k<<12,I=(I^=T=T+(O=(O^=S=S+I|0)>>>16|O<<16)|0)>>>20|I<<12,A=(A^=R=R+(D=(D^=_=_+A|0)>>>16|D<<16)|0)>>>20|A<<12,I=(I^=T=T+(O=(O^=S=S+I|0)>>>24|O<<8)|0)>>>25|I<<7,A=(A^=R=R+(D=(D^=_=_+A|0)>>>24|D<<8)|0)>>>25|A<<7,k=(k^=x=x+(N=(N^=E=E+k|0)>>>24|N<<8)|0)>>>25|k<<7,C=(C^=P=P+(M=(M^=w=w+C|0)>>>24|M<<8)|0)>>>25|C<<7;n.writeUint32LE(w+i|0,e,0),n.writeUint32LE(E+o|0,e,4),n.writeUint32LE(S+s|0,e,8),n.writeUint32LE(_+a|0,e,12),n.writeUint32LE(A+l|0,e,16),n.writeUint32LE(C+c|0,e,20),n.writeUint32LE(k+u|0,e,24),n.writeUint32LE(I+h|0,e,28),n.writeUint32LE(T+d|0,e,32),n.writeUint32LE(R+f|0,e,36),n.writeUint32LE(P+p|0,e,40),n.writeUint32LE(x+g|0,e,44),n.writeUint32LE(N+m|0,e,48),n.writeUint32LE(O+y|0,e,52),n.writeUint32LE(D+v|0,e,56),n.writeUint32LE(M+b|0,e,60)}function s(e,t,r,n,s){if(void 0===s&&(s=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=s,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),s(e,t,r,r,n)}},3642:(e,t,r)=>{"use strict";var n=r(8284),i=r(5629),o=r(9116),s=r(6232),a=r(8770);t.Cv=32,t.WH=12,t.pg=16;var l=new Uint8Array(16),c=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);n.stream(this._key,s,a,4);var l,c=t.length+this.tagLength;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");l=i}else l=new Uint8Array(c);return n.streamXOR(this._key,s,t,l,4),this._authenticate(l.subarray(l.length-this.tagLength,l.length),a,l.subarray(0,l.length-this.tagLength),r),o.wipe(s),l},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&a.update(l.subarray(n.length%16))),a.update(r),r.length%16>0&&a.update(l.subarray(r.length%16));var c=new Uint8Array(8);n&&s.writeUint64LE(n.length,c),a.update(c),s.writeUint64LE(r.length,c),a.update(c);for(var u=a.digest(),h=0;h{"use strict";function r(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,r){return~(e-1)&t|e-1&r},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=r,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==r(e,t)}},1412:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},2497:(e,t,r)=>{"use strict";var n=r(5499),i=r(9116),o=function(){function e(e,t,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1412),i=r(8770),o=r(9116),s=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},5629:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8770),i=r(9116);t.DIGEST_LENGTH=16;var o=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=8191&r;var n=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var l=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|l<<5);var c=e[14]|e[15]<<8;this._r[8]=8191&(l>>>8|c<<8),this._r[9]=c>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],l=this._h[4],c=this._h[5],u=this._h[6],h=this._h[7],d=this._h[8],f=this._h[9],p=this._r[0],g=this._r[1],m=this._r[2],y=this._r[3],v=this._r[4],b=this._r[5],w=this._r[6],E=this._r[7],S=this._r[8],_=this._r[9];r>=16;){var A=e[t+0]|e[t+1]<<8;i+=8191&A;var C=e[t+2]|e[t+3]<<8;o+=8191&(A>>>13|C<<3);var k=e[t+4]|e[t+5]<<8;s+=8191&(C>>>10|k<<6);var I=e[t+6]|e[t+7]<<8;a+=8191&(k>>>7|I<<9);var T=e[t+8]|e[t+9]<<8;l+=8191&(I>>>4|T<<12),c+=T>>>1&8191;var R=e[t+10]|e[t+11]<<8;u+=8191&(T>>>14|R<<2);var P=e[t+12]|e[t+13]<<8;h+=8191&(R>>>11|P<<5);var x=e[t+14]|e[t+15]<<8,N=0,O=N;O+=i*p,O+=o*(5*_),O+=s*(5*S),O+=a*(5*E),N=(O+=l*(5*w))>>>13,O&=8191,O+=c*(5*b),O+=u*(5*v),O+=h*(5*y),O+=(d+=8191&(P>>>8|x<<8))*(5*m);var D=N+=(O+=(f+=x>>>5|n)*(5*g))>>>13;D+=i*g,D+=o*p,D+=s*(5*_),D+=a*(5*S),N=(D+=l*(5*E))>>>13,D&=8191,D+=c*(5*w),D+=u*(5*b),D+=h*(5*v),D+=d*(5*y),N+=(D+=f*(5*m))>>>13,D&=8191;var M=N;M+=i*m,M+=o*g,M+=s*p,M+=a*(5*_),N=(M+=l*(5*S))>>>13,M&=8191,M+=c*(5*E),M+=u*(5*w),M+=h*(5*b),M+=d*(5*v);var L=N+=(M+=f*(5*y))>>>13;L+=i*y,L+=o*m,L+=s*g,L+=a*p,N=(L+=l*(5*_))>>>13,L&=8191,L+=c*(5*S),L+=u*(5*E),L+=h*(5*w),L+=d*(5*b);var B=N+=(L+=f*(5*v))>>>13;B+=i*v,B+=o*y,B+=s*m,B+=a*g,N=(B+=l*p)>>>13,B&=8191,B+=c*(5*_),B+=u*(5*S),B+=h*(5*E),B+=d*(5*w);var U=N+=(B+=f*(5*b))>>>13;U+=i*b,U+=o*v,U+=s*y,U+=a*m,N=(U+=l*g)>>>13,U&=8191,U+=c*p,U+=u*(5*_),U+=h*(5*S),U+=d*(5*E);var F=N+=(U+=f*(5*w))>>>13;F+=i*w,F+=o*b,F+=s*v,F+=a*y,N=(F+=l*m)>>>13,F&=8191,F+=c*g,F+=u*p,F+=h*(5*_),F+=d*(5*S);var j=N+=(F+=f*(5*E))>>>13;j+=i*E,j+=o*w,j+=s*b,j+=a*v,N=(j+=l*y)>>>13,j&=8191,j+=c*m,j+=u*g,j+=h*p,j+=d*(5*_);var V=N+=(j+=f*(5*S))>>>13;V+=i*S,V+=o*E,V+=s*w,V+=a*b,N=(V+=l*v)>>>13,V&=8191,V+=c*y,V+=u*m,V+=h*g,V+=d*p;var K=N+=(V+=f*(5*_))>>>13;K+=i*_,K+=o*S,K+=s*E,K+=a*w,N=(K+=l*b)>>>13,K&=8191,K+=c*v,K+=u*y,K+=h*m,K+=d*g,i=O=8191&(N=(N=((N+=(K+=f*p)>>>13)<<2)+N|0)+(O&=8191)|0),o=D+=N>>>=13,s=M&=8191,a=L&=8191,l=B&=8191,c=U&=8191,u=F&=8191,h=j&=8191,d=V&=8191,f=K&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=l,this._h[5]=c,this._h[6]=u,this._h[7]=h,this._h[8]=d,this._h[9]=f},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=r,r=this._h[o]>>>13,this._h[o]&=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,s[0]=this._h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this._h[o]=this._h[o]&n|s[o];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,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const n=r(933),i=r(6232),o=r(9116);function s(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.defaultRandomSource;return r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.defaultRandomSource;const r=s(4,e),n=(0,i.readUint32LE)(r);return(0,o.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const l=r.length,c=256-256%l;for(;e>0;){const t=s(Math.ceil(256*e/c),n);for(let n=0;n0;n++){const o=t[n];o1&&void 0!==arguments[1]?arguments[1]:a,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;const i=Math.ceil(e/(Math.log(r.length)/Math.LN2));return l(i,r,n)}},8136:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0;t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!==typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const n=r(9116);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5883);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const n=r(8136),i=r(8188);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},4888:(e,t,r)=>{"use strict";var n=r(6232),i=r(9116);t.k=32,t.cn=64;var o=function(){function e(){this.digestLength=t.k,this.blockSize=t.cn,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%64<56?64:128;this._buffer[r]=128;for(var l=r+1;l0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=o;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,r,i,o){for(;o>=64;){for(var a=t[0],l=t[1],c=t[2],u=t[3],h=t[4],d=t[5],f=t[6],p=t[7],g=0;g<16;g++){var m=i+4*g;e[g]=n.readUint32BE(r,m)}for(g=16;g<64;g++){var y=e[g-2],v=(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10,b=((y=e[g-15])>>>7|y<<25)^(y>>>18|y<<14)^y>>>3;e[g]=(v+e[g-7]|0)+(b+e[g-16]|0)}for(g=0;g<64;g++){v=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&d^~h&f)|0)+(p+(s[g]+e[g]|0)|0)|0,b=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&l^a&c^l&c)|0;p=f,f=d,d=h,h=u+v|0,u=c,c=l,l=a,a=v+b|0}t[0]+=a,t[1]+=l,t[2]+=c,t[3]+=u,t[4]+=h,t[5]+=d,t[6]+=f,t[7]+=p,i+=64,o-=64}return i}t.vp=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{"use strict";t.gi=t.Au=t._w=t.KS=t.kz=void 0;const n=r(6271),i=r(9116);function o(e){const t=new Float64Array(16);if(e)for(let r=0;r=0;--o){const e=r[o>>>3]>>>(7&o)&1;c(i,s,e),c(p,g,e),u(m,i,p),h(i,i,p),u(p,s,g),h(s,s,g),f(g,m),f(y,i),d(i,p,i),d(p,s,m),u(m,i,p),h(i,i,p),f(s,i),h(p,g,y),d(i,p,a),u(i,i,g),d(p,p,i),d(i,g,y),d(g,s,n),f(s,m),c(i,s,e),c(p,g,e)}for(let o=0;o<16;o++)n[o+16]=i[o],n[o+32]=p[o],n[o+48]=s[o],n[o+64]=g[o];const v=n.subarray(32),b=n.subarray(16);!function(e,t){const r=o();for(let n=0;n<16;n++)r[n]=t[n];for(let n=253;n>=0;n--)f(r,r),2!==n&&4!==n&&d(r,r,t);for(let n=0;n<16;n++)e[n]=r[n]}(v,v),d(b,b,v);const w=new Uint8Array(32);return function(e,t){const r=o(),n=o();for(let i=0;i<16;i++)n[i]=t[i];l(n),l(n),l(n);for(let i=0;i<2;i++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,c(n,r,1-e)}for(let i=0;i<16;i++)e[2*i]=255&n[i],e[2*i+1]=n[i]>>8}(w,b),w}function g(e){return p(e,s)}function m(e){if(e.length!==t.KS)throw new Error("x25519: seed must be ".concat(t.KS," bytes"));const r=new Uint8Array(e);return{publicKey:g(r),secretKey:r}}t._w=m,t.Au=function(e){const t=(0,n.randomBytes)(32,e),r=m(t);return(0,i.wipe)(t),r},t.gi=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(r.length!==t.kz)throw new Error("X25519: incorrect public key length");const i=p(e,r);if(n){let e=0;for(let 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 o(e){return new Uint8Array(e)}function s(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={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);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("")}},l=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],r=0;r>4]+e[15&i])}return r.join("")}}}(),c={16:10,24:12,32:14},u=[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],d=[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],f=[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],g=[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],m=[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],y=[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],v=[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],b=[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],E=[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],S=[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],_=[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],A=[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]=o[t],this._Kd[e-r][t%4]=o[t];for(var s,a=0,l=i;l>16&255]<<24^h[s>>8&255]<<16^h[255&s]<<8^h[s>>24&255]^u[a]<<24,a+=1,8!=i)for(t=1;t>8&255]<<8^h[s>>16&255]<<16^h[s>>24&255]<<24;for(t=i/2+1;t>2,f=l%4,this._Ke[d][f]=o[t],this._Kd[e-d][f]=o[t++],l++}for(var d=1;d>24&255]^S[s>>16&255]^_[s>>8&255]^A[255&s]},k.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 s=1;s>24&255]^p[n[(i+1)%4]>>16&255]^g[n[(i+2)%4]>>8&255]^m[255&n[(i+3)%4]]^this._Ke[s][i];n=r.slice()}var a,l=o(16);for(i=0;i<4;i++)a=this._Ke[t][i],l[4*i]=255&(h[n[i]>>24&255]^a>>24),l[4*i+1]=255&(h[n[(i+1)%4]>>16&255]^a>>16),l[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^a>>8),l[4*i+3]=255&(h[255&n[(i+3)%4]]^a);return l},k.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 s=1;s>24&255]^v[n[(i+3)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^w[255&n[(i+1)%4]]^this._Kd[s][i];n=r.slice()}var a,l=o(16);for(i=0;i<4;i++)a=this._Kd[t][i],l[4*i]=255&(d[n[i]>>24&255]^a>>24),l[4*i+1]=255&(d[n[(i+3)%4]>>16&255]^a>>16),l[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^a>>8),l[4*i+3]=255&(d[255&n[(i+1)%4]]^a);return l};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 k(e)};I.prototype.encrypt=function(e){if((e=i(e)).length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),n=0;n=0;--t)this._counter[t]=e%256,e>>=8},x.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},x.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 x||(t=new x(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new k(e)};N.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n{function t(e){const t=new globalThis.AbortController;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const n of e)if(n&&n.addEventListener){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}e.exports=t,e.exports.anySignal=t},1360:e=>{"use strict";for(var t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function s(e){for(var t=1,r=0;r126)return"Invalid prefix ("+e+")";t=o(t)^n>>5}for(t=o(t),r=0;rt)return"Exceeds length limit";var n=e.toLowerCase(),i=e.toUpperCase();if(e!==n&&e!==i)return"Mixed-case string "+e;var a=(e=n).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;var l=e.slice(0,a),c=e.slice(a+1);if(c.length<6)return"Data too short";var u=s(l);if("string"===typeof u)return u;for(var h=[],d=0;d=c.length||h.push(p)}return 1!==u?"Invalid checksum for "+e:{prefix:l,words:h}}function l(e,t,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<=t)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var i=s(e=e.toLowerCase());if("string"===typeof i)throw new Error(i);for(var a=e+"1",l=0;l>5!==0)throw new Error("Non 5-bit word");i=o(i)^c,a+=t.charAt(c)}for(l=0;l<6;++l)i=o(i);for(i^=1,l=0;l<6;++l){a+=t.charAt(i>>5*(5-l)&31)}return a},toWordsUnsafe:function(e){var t=l(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=l(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=l(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=l(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}}},518:function(e,t,r){!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 o(e,t,r){if(o.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 s;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(6601).Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function l(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,i){for(var o=0,s=0,a=Math.min(e.length,r),l=t;l=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&s0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.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);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=l(e,t,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2===0?t+1:t;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.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 o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,l=0,u=r;u1&&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},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(T){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?""}var d=["","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],p=[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];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?d[6-l.length]+l+r:l+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=f[e],u=p[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var g=h.modrn(u).toString(e);r=(h=h.idivn(u)).isZero()?g+r:d[c-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!==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 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},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(s,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function g(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],o=0|t.words[0],s=i*o,a=67108863&s,l=s/67108864|0;r.words[0]=a;for(var c=1;c>>26,h=67108863&l,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;u+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}r.words[c]=0|h,l=0|u}return 0!==l?r.words[c]=0|l:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();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");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=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},o.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},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.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)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.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)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.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()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.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,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(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.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 o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,f=0|s[1],p=8191&f,g=f>>>13,m=0|s[2],y=8191&m,v=m>>>13,b=0|s[3],w=8191&b,E=b>>>13,S=0|s[4],_=8191&S,A=S>>>13,C=0|s[5],k=8191&C,I=C>>>13,T=0|s[6],R=8191&T,P=T>>>13,x=0|s[7],N=8191&x,O=x>>>13,D=0|s[8],M=8191&D,L=D>>>13,B=0|s[9],U=8191&B,F=B>>>13,j=0|a[0],V=8191&j,K=j>>>13,z=0|a[1],q=8191&z,H=z>>>13,G=0|a[2],W=8191&G,Z=G>>>13,Q=0|a[3],Y=8191&Q,J=Q>>>13,X=0|a[4],$=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],le=8191&ae,ce=ae>>>13,ue=0|a[8],he=8191&ue,de=ue>>>13,fe=0|a[9],pe=8191&fe,ge=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(c+(n=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,K))+Math.imul(d,V)|0))<<13)|0;c=((o=Math.imul(d,K))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,K))+Math.imul(g,V)|0,o=Math.imul(g,K);var ye=(c+(n=n+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,V),i=(i=Math.imul(y,K))+Math.imul(v,V)|0,o=Math.imul(v,K),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,H)|0;var ve=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(d,W)|0))<<13)|0;c=((o=o+Math.imul(d,Z)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,V),i=(i=Math.imul(w,K))+Math.imul(E,V)|0,o=Math.imul(E,K),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,Z)|0;var be=(c+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(_,V),i=(i=Math.imul(_,K))+Math.imul(A,V)|0,o=Math.imul(A,K),n=n+Math.imul(w,q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(E,q)|0,o=o+Math.imul(E,H)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var we=(c+(n=n+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,V),i=(i=Math.imul(k,K))+Math.imul(I,V)|0,o=Math.imul(I,K),n=n+Math.imul(_,q)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,H)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Z)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,J)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0;var Ee=(c+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(R,V),i=(i=Math.imul(R,K))+Math.imul(P,V)|0,o=Math.imul(P,K),n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,H)|0)+Math.imul(I,q)|0,o=o+Math.imul(I,H)|0,n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(E,Y)|0,o=o+Math.imul(E,J)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0;var Se=(c+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(N,V),i=(i=Math.imul(N,K))+Math.imul(O,V)|0,o=Math.imul(O,K),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,H)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,H)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Z)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var _e=(c+(n=n+Math.imul(h,le)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,le)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(M,V),i=(i=Math.imul(M,K))+Math.imul(L,V)|0,o=Math.imul(L,K),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,H)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,H)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Z)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(g,le)|0,o=o+Math.imul(g,ce)|0;var Ae=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,K))+Math.imul(F,V)|0,o=Math.imul(F,K),n=n+Math.imul(M,q)|0,i=(i=i+Math.imul(M,H)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,H)|0,n=n+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(P,Y)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,n=n+Math.imul(y,le)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(v,le)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(g,he)|0,o=o+Math.imul(g,de)|0;var Ce=(c+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ge)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,H))+Math.imul(F,q)|0,o=Math.imul(F,H),n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,Z)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(E,le)|0,o=o+Math.imul(E,ce)|0,n=n+Math.imul(y,he)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var ke=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,W),i=(i=Math.imul(U,Z))+Math.imul(F,W)|0,o=Math.imul(F,Z),n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,n=n+Math.imul(_,le)|0,i=(i=i+Math.imul(_,ce)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(E,he)|0,o=o+Math.imul(E,de)|0;var Ie=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,J))+Math.imul(F,Y)|0,o=Math.imul(F,J),n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,se)|0,n=n+Math.imul(k,le)|0,i=(i=i+Math.imul(k,ce)|0)+Math.imul(I,le)|0,o=o+Math.imul(I,ce)|0,n=n+Math.imul(_,he)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var Te=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(E,pe)|0))<<13)|0;c=((o=o+Math.imul(E,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(F,$)|0,o=Math.imul(F,ee),n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,n=n+Math.imul(R,le)|0,i=(i=i+Math.imul(R,ce)|0)+Math.imul(P,le)|0,o=o+Math.imul(P,ce)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,de)|0)+Math.imul(I,he)|0,o=o+Math.imul(I,de)|0;var Re=(c+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,ge)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(F,re)|0,o=Math.imul(F,ne),n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(N,le)|0,i=(i=i+Math.imul(N,ce)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,ce)|0,n=n+Math.imul(R,he)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var Pe=(c+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,ge)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(F,oe)|0,o=Math.imul(F,se),n=n+Math.imul(M,le)|0,i=(i=i+Math.imul(M,ce)|0)+Math.imul(L,le)|0,o=o+Math.imul(L,ce)|0,n=n+Math.imul(N,he)|0,i=(i=i+Math.imul(N,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var xe=(c+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ge)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ge)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,le),i=(i=Math.imul(U,ce))+Math.imul(F,le)|0,o=Math.imul(F,ce),n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(L,he)|0,o=o+Math.imul(L,de)|0;var Ne=(c+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,ge)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,ge)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(U,he),i=(i=Math.imul(U,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Oe=(c+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,ge)|0)+Math.imul(L,pe)|0))<<13)|0;c=((o=o+Math.imul(L,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863;var De=(c+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(F,pe)|0))<<13)|0;return c=((o=Math.imul(F,ge))+(i>>>13)|0)+(De>>>26)|0,De&=67108863,l[0]=me,l[1]=ye,l[2]=ve,l[3]=be,l[4]=we,l[5]=Ee,l[6]=Se,l[7]=_e,l[8]=Ae,l[9]=Ce,l[10]=ke,l[11]=Ie,l[12]=Te,l[13]=Re,l[14]=Pe,l[15]=xe,l[16]=Ne,l[17]=Oe,l[18]=De,0!==c&&(l[19]=c,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,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function v(e,t,r){return y(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(m=g),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?g(this,e,t):r<1024?y(this,e,t):v(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,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 o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==u||c>=i);c--){var h=0|this.words[c];this.words[c]=u<<26-o|h>>>o,u=h&a}return l&&0!==u&&(l.words[l.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.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},o.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)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,l=n.length-i.length;if("mod"!==t){(a=new o(null)).length=l+1,a.words=new Array(a.length);for(var c=0;c=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):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&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.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),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.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();for(var i=new o(1),s=new o(0),a=new o(0),l=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0===(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(u),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(u),l.isub(h)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(l)):(r.isub(t),a.isub(i),l.isub(s))}return{a:a,b:l,gcd:r.iushln(c)}},o.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();for(var i,s=new o(1),a=new o(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,u=1;0===(t.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);for(var h=0,d=1;0===(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.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);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"===typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new k(e)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function E(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function C(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"===typeof e){var t=o._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 I(e){k.call(this,e),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)}E.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},E.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},E.prototype.split=function(e,t){e.iushrn(this.n,0,t)},E.prototype.imulK=function(e){return e.imul(this.k)},i(S,E),S.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},S.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},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new _;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new C}return w[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):(u(e,e.umod(this.m)._forceRed(this)),e)},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 o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),l=a.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,c).cmp(l);)u.redIAdd(l);for(var h=this.pow(u,i),d=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=s;0!==f.cmp(a);){for(var g=f,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var c=t.words[n],u=l-1;u>=0;u--){var h=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===u)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}l=26}return i},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},o.mont=function(e){return new I(e)},i(I,k),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.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),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)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(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),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)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},8182:(e,t,r)=>{"use strict";function n(e){var t,r,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;ti});const i=function(){for(var e,t,r=0,i="";r{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,s=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,l){l=l||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\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(!a)return;var l=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*s;case"weeks":case"week":case"w":return l*o;case"days":case"day":case"d":return l*i;case"hours":case"hour":case"hrs":case"hr":case"h":return l*n;case"minutes":case"minute":case"mins":case"min":case"m":return l*r;case"seconds":case"second":case"secs":case"sec":case"s":return l*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(e);if("number"===c&&isFinite(e))return l.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},8392:(e,t,r)=>{t.formatArgs=function(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)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(r){}!e&&"undefined"!==typeof process&&"env"in process&&(e={NODE_ENV:"production",PUBLIC_URL:"/eth-pm",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.DEBUG);return e},t.useColors=function(){if("undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),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.log=console.debug||console.log||(()=>{}),e.exports=r(8472)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},8472:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i{if("%%"===e)return"%";c++;const i=t.formatters[r];if("function"===typeof i){const t=n[c];e=i.call(o,t),n.splice(c,1),c--}return e})),t.formatArgs.call(o,n);const u=o.log||t.log;u.apply(o,n)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"===typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+("undefined"===typeof r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"===typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"use strict";function t(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}t.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},t.prototype.get=function(e){return this.peekAt(e)},t.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},t.prototype.peekFront=function(){return this.peek()},t.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(t.prototype,"length",{get:function(){return this.size()}}),t.prototype.size=function(){return this._head===this._tail?0:this._headthis._capacity&&this.pop(),this._head1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},t.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head1e4&&e<=t>>>2&&this._shrinkArray(),r}},t.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),n=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var i,o=this._list[t];if(e0;i--)this._list[t]=this._list[t=t-1+n&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--)this._list[t]=this._list[t=t+1+n&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+n&this._capacityMask}return o}}},t.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var o=this.size(),s=this._list.length;if(!(n>=o||n<-o||t<1)){if(n<0&&(n+=o),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=o)return r=this.toArray(),this.clear(),r;var a;for(n+t>o&&(t=o-n),r=new Array(t),a=0;a0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+s&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(n0;a--)this.unshift(this._list[n=n-1+s&this._capacityMask]);for(n=this._head-1+s&this._capacityMask;i>0;)this._list[n=n-1+s&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+s&this._capacityMask,a=o-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+s&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=s>>>2&&this._shrinkArray(),r}}},t.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(arguments.length>2){var i,o,s,a=arguments.length,l=this._list.length,c=2;if(!n||r0&&(this._head=this._head+r+l&this._capacityMask)):(s=this.remove(r,t),this._head=this._head+r+l&this._capacityMask);a>c;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(o[i-1])}else{var u=(o=new Array(n-(r+t))).length;for(i=0;ithis._tail){for(t=this._head;t>>=1,this._capacityMask>>>=1},e.exports=t},7963:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"===typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"===typeof r&&(n=r,r=""),r&&(n.code=r);try{return t(e,n)}catch(i){n.message=e.message,n.stack=e.stack;const r=function(){};r.prototype=Object.create(Object.getPrototypeOf(e));return t(new r,n)}}},3580:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.formatBytes32String=t.Utf8ErrorFuncs=t.toUtf8String=t.toUtf8CodePoints=t.toUtf8Bytes=t._toEscapedUtf8String=t.nameprep=t.hexDataSlice=t.hexDataLength=t.hexZeroPad=t.hexValue=t.hexStripZeros=t.hexConcat=t.isHexString=t.hexlify=t.base64=t.base58=t.TransactionDescription=t.LogDescription=t.Interface=t.SigningKey=t.HDNode=t.defaultPath=t.isBytesLike=t.isBytes=t.zeroPad=t.stripZeros=t.concat=t.arrayify=t.shallowCopy=t.resolveProperties=t.getStatic=t.defineReadOnly=t.deepCopy=t.checkProperties=t.poll=t.fetchJson=t._fetchData=t.RLP=t.Logger=t.checkResultErrors=t.FormatTypes=t.ParamType=t.FunctionFragment=t.EventFragment=t.ErrorFragment=t.ConstructorFragment=t.Fragment=t.defaultAbiCoder=t.AbiCoder=void 0,t.Indexed=t.Utf8ErrorReason=t.UnicodeNormalizationForm=t.SupportedAlgorithm=t.mnemonicToSeed=t.isValidMnemonic=t.entropyToMnemonic=t.mnemonicToEntropy=t.getAccountPath=t.verifyTypedData=t.verifyMessage=t.recoverPublicKey=t.computePublicKey=t.recoverAddress=t.computeAddress=t.getJsonWalletAddress=t.TransactionTypes=t.serializeTransaction=t.parseTransaction=t.accessListify=t.joinSignature=t.splitSignature=t.soliditySha256=t.solidityKeccak256=t.solidityPack=t.shuffled=t.randomBytes=t.sha512=t.sha256=t.ripemd160=t.keccak256=t.computeHmac=t.commify=t.parseUnits=t.formatUnits=t.parseEther=t.formatEther=t.isAddress=t.getCreate2Address=t.getContractAddress=t.getIcapAddress=t.getAddress=t._TypedDataEncoder=t.id=t.isValidName=t.namehash=t.hashMessage=t.dnsEncode=t.parseBytes32String=void 0;var s=r(2147);Object.defineProperty(t,"AbiCoder",{enumerable:!0,get:function(){return s.AbiCoder}}),Object.defineProperty(t,"checkResultErrors",{enumerable:!0,get:function(){return s.checkResultErrors}}),Object.defineProperty(t,"ConstructorFragment",{enumerable:!0,get:function(){return s.ConstructorFragment}}),Object.defineProperty(t,"defaultAbiCoder",{enumerable:!0,get:function(){return s.defaultAbiCoder}}),Object.defineProperty(t,"ErrorFragment",{enumerable:!0,get:function(){return s.ErrorFragment}}),Object.defineProperty(t,"EventFragment",{enumerable:!0,get:function(){return s.EventFragment}}),Object.defineProperty(t,"FormatTypes",{enumerable:!0,get:function(){return s.FormatTypes}}),Object.defineProperty(t,"Fragment",{enumerable:!0,get:function(){return s.Fragment}}),Object.defineProperty(t,"FunctionFragment",{enumerable:!0,get:function(){return s.FunctionFragment}}),Object.defineProperty(t,"Indexed",{enumerable:!0,get:function(){return s.Indexed}}),Object.defineProperty(t,"Interface",{enumerable:!0,get:function(){return s.Interface}}),Object.defineProperty(t,"LogDescription",{enumerable:!0,get:function(){return s.LogDescription}}),Object.defineProperty(t,"ParamType",{enumerable:!0,get:function(){return s.ParamType}}),Object.defineProperty(t,"TransactionDescription",{enumerable:!0,get:function(){return s.TransactionDescription}});var a=r(7419);Object.defineProperty(t,"getAddress",{enumerable:!0,get:function(){return a.getAddress}}),Object.defineProperty(t,"getCreate2Address",{enumerable:!0,get:function(){return a.getCreate2Address}}),Object.defineProperty(t,"getContractAddress",{enumerable:!0,get:function(){return a.getContractAddress}}),Object.defineProperty(t,"getIcapAddress",{enumerable:!0,get:function(){return a.getIcapAddress}}),Object.defineProperty(t,"isAddress",{enumerable:!0,get:function(){return a.isAddress}});var l=o(r(1800));t.base64=l;var c=r(3482);Object.defineProperty(t,"base58",{enumerable:!0,get:function(){return c.Base58}});var u=r(9716);Object.defineProperty(t,"arrayify",{enumerable:!0,get:function(){return u.arrayify}}),Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return u.concat}}),Object.defineProperty(t,"hexConcat",{enumerable:!0,get:function(){return u.hexConcat}}),Object.defineProperty(t,"hexDataSlice",{enumerable:!0,get:function(){return u.hexDataSlice}}),Object.defineProperty(t,"hexDataLength",{enumerable:!0,get:function(){return u.hexDataLength}}),Object.defineProperty(t,"hexlify",{enumerable:!0,get:function(){return u.hexlify}}),Object.defineProperty(t,"hexStripZeros",{enumerable:!0,get:function(){return u.hexStripZeros}}),Object.defineProperty(t,"hexValue",{enumerable:!0,get:function(){return u.hexValue}}),Object.defineProperty(t,"hexZeroPad",{enumerable:!0,get:function(){return u.hexZeroPad}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return u.isBytes}}),Object.defineProperty(t,"isBytesLike",{enumerable:!0,get:function(){return u.isBytesLike}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return u.isHexString}}),Object.defineProperty(t,"joinSignature",{enumerable:!0,get:function(){return u.joinSignature}}),Object.defineProperty(t,"zeroPad",{enumerable:!0,get:function(){return u.zeroPad}}),Object.defineProperty(t,"splitSignature",{enumerable:!0,get:function(){return u.splitSignature}}),Object.defineProperty(t,"stripZeros",{enumerable:!0,get:function(){return u.stripZeros}});var h=r(1049);Object.defineProperty(t,"_TypedDataEncoder",{enumerable:!0,get:function(){return h._TypedDataEncoder}}),Object.defineProperty(t,"dnsEncode",{enumerable:!0,get:function(){return h.dnsEncode}}),Object.defineProperty(t,"hashMessage",{enumerable:!0,get:function(){return h.hashMessage}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return h.id}}),Object.defineProperty(t,"isValidName",{enumerable:!0,get:function(){return h.isValidName}}),Object.defineProperty(t,"namehash",{enumerable:!0,get:function(){return h.namehash}});var d=r(5148);Object.defineProperty(t,"defaultPath",{enumerable:!0,get:function(){return d.defaultPath}}),Object.defineProperty(t,"entropyToMnemonic",{enumerable:!0,get:function(){return d.entropyToMnemonic}}),Object.defineProperty(t,"getAccountPath",{enumerable:!0,get:function(){return d.getAccountPath}}),Object.defineProperty(t,"HDNode",{enumerable:!0,get:function(){return d.HDNode}}),Object.defineProperty(t,"isValidMnemonic",{enumerable:!0,get:function(){return d.isValidMnemonic}}),Object.defineProperty(t,"mnemonicToEntropy",{enumerable:!0,get:function(){return d.mnemonicToEntropy}}),Object.defineProperty(t,"mnemonicToSeed",{enumerable:!0,get:function(){return d.mnemonicToSeed}});var f=r(1529);Object.defineProperty(t,"getJsonWalletAddress",{enumerable:!0,get:function(){return f.getJsonWalletAddress}});var p=r(8062);Object.defineProperty(t,"keccak256",{enumerable:!0,get:function(){return p.keccak256}});var g=r(9502);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return g.Logger}});var m=r(6620);Object.defineProperty(t,"computeHmac",{enumerable:!0,get:function(){return m.computeHmac}}),Object.defineProperty(t,"ripemd160",{enumerable:!0,get:function(){return m.ripemd160}}),Object.defineProperty(t,"sha256",{enumerable:!0,get:function(){return m.sha256}}),Object.defineProperty(t,"sha512",{enumerable:!0,get:function(){return m.sha512}});var y=r(4530);Object.defineProperty(t,"solidityKeccak256",{enumerable:!0,get:function(){return y.keccak256}}),Object.defineProperty(t,"solidityPack",{enumerable:!0,get:function(){return y.pack}}),Object.defineProperty(t,"soliditySha256",{enumerable:!0,get:function(){return y.sha256}});var v=r(740);Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return v.randomBytes}}),Object.defineProperty(t,"shuffled",{enumerable:!0,get:function(){return v.shuffled}});var b=r(520);Object.defineProperty(t,"checkProperties",{enumerable:!0,get:function(){return b.checkProperties}}),Object.defineProperty(t,"deepCopy",{enumerable:!0,get:function(){return b.deepCopy}}),Object.defineProperty(t,"defineReadOnly",{enumerable:!0,get:function(){return b.defineReadOnly}}),Object.defineProperty(t,"getStatic",{enumerable:!0,get:function(){return b.getStatic}}),Object.defineProperty(t,"resolveProperties",{enumerable:!0,get:function(){return b.resolveProperties}}),Object.defineProperty(t,"shallowCopy",{enumerable:!0,get:function(){return b.shallowCopy}});var w=o(r(7986));t.RLP=w;var E=r(8865);Object.defineProperty(t,"computePublicKey",{enumerable:!0,get:function(){return E.computePublicKey}}),Object.defineProperty(t,"recoverPublicKey",{enumerable:!0,get:function(){return E.recoverPublicKey}}),Object.defineProperty(t,"SigningKey",{enumerable:!0,get:function(){return E.SigningKey}});var S=r(3902);Object.defineProperty(t,"formatBytes32String",{enumerable:!0,get:function(){return S.formatBytes32String}}),Object.defineProperty(t,"nameprep",{enumerable:!0,get:function(){return S.nameprep}}),Object.defineProperty(t,"parseBytes32String",{enumerable:!0,get:function(){return S.parseBytes32String}}),Object.defineProperty(t,"_toEscapedUtf8String",{enumerable:!0,get:function(){return S._toEscapedUtf8String}}),Object.defineProperty(t,"toUtf8Bytes",{enumerable:!0,get:function(){return S.toUtf8Bytes}}),Object.defineProperty(t,"toUtf8CodePoints",{enumerable:!0,get:function(){return S.toUtf8CodePoints}}),Object.defineProperty(t,"toUtf8String",{enumerable:!0,get:function(){return S.toUtf8String}}),Object.defineProperty(t,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return S.Utf8ErrorFuncs}});var _=r(5452);Object.defineProperty(t,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(t,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(t,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(t,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(t,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(t,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var A=r(9601);Object.defineProperty(t,"commify",{enumerable:!0,get:function(){return A.commify}}),Object.defineProperty(t,"formatEther",{enumerable:!0,get:function(){return A.formatEther}}),Object.defineProperty(t,"parseEther",{enumerable:!0,get:function(){return A.parseEther}}),Object.defineProperty(t,"formatUnits",{enumerable:!0,get:function(){return A.formatUnits}}),Object.defineProperty(t,"parseUnits",{enumerable:!0,get:function(){return A.parseUnits}});var C=r(2876);Object.defineProperty(t,"verifyMessage",{enumerable:!0,get:function(){return C.verifyMessage}}),Object.defineProperty(t,"verifyTypedData",{enumerable:!0,get:function(){return C.verifyTypedData}});var k=r(5889);Object.defineProperty(t,"_fetchData",{enumerable:!0,get:function(){return k._fetchData}}),Object.defineProperty(t,"fetchJson",{enumerable:!0,get:function(){return k.fetchJson}}),Object.defineProperty(t,"poll",{enumerable:!0,get:function(){return k.poll}});var I=r(6620);Object.defineProperty(t,"SupportedAlgorithm",{enumerable:!0,get:function(){return I.SupportedAlgorithm}});var T=r(3902);Object.defineProperty(t,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return T.UnicodeNormalizationForm}}),Object.defineProperty(t,"Utf8ErrorReason",{enumerable:!0,get:function(){return T.Utf8ErrorReason}})},3634:(e,t,r)=>{"use strict";const n=r(5413);t.zN=n.EventIterator,n.EventIterator},5413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn("EventIterator queue reached ".concat(this.pushQueue.length," items")))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e){let{highWaterMark:t=100,lowWaterMark:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},7143:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!==typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i{"use strict";var t,r="object"===typeof Reflect?Reflect:null,n=r&&"function"===typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"===typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!==e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var i,o,s;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"===typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,function(e){console&&console.warn&&console.warn(e)}(c)}return e}function u(){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 h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(void 0===l)return!1;if("function"===typeof l)n(l,this,t);else{var c=l.length,u=p(l,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},1167:e=>{e.exports=class{constructor(e){if(!(e>0)||0!==(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},5125:(e,t,r)=>{const n=r(1167);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}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},3125:(e,t,r)=>{var n=t;n.utils=r(9046),n.common=r(9684),n.sha=r(9194),n.ripemd=r(6645),n.hmac=r(3609),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},9684:(e,t,r)=>{"use strict";var n=r(9046),i=r(2325);function o(){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=o,o.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){var r=(e=this.pending).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,o=8;o{"use strict";var n=r(9046),i=r(2325);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t{"use strict";var n=r(9046),i=r(9684),o=n.rotl32,s=n.sum32,a=n.sum32_3,l=n.sum32_4,c=i.BlockHash;function u(){if(!(this instanceof u))return new u;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function f(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(u,c),t.ripemd160=u,u.blockSize=512,u.outSize=160,u.hmacStrength=192,u.padLength=64,u.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],u=this.h[4],v=r,b=n,w=i,E=c,S=u,_=0;_<80;_++){var A=s(o(l(r,h(_,n,i,c),e[p[_]+t],d(_)),m[_]),u);r=u,u=c,c=o(i,10),i=n,n=A,A=s(o(l(v,h(79-_,b,w,E),e[g[_]+t],f(_)),y[_]),S),v=S,S=E,E=o(w,10),w=b,b=A}A=a(this.h[1],i,E),this.h[1]=a(this.h[2],c,S),this.h[2]=a(this.h[3],u,v),this.h[3]=a(this.h[4],r,b),this.h[4]=a(this.h[0],n,w),this.h[0]=A},u.prototype._digest=function(e){return"hex"===e?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],g=[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],m=[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],y=[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]},9194:(e,t,r)=>{"use strict";t.sha1=r(7361),t.sha224=r(7753),t.sha256=r(6966),t.sha384=r(1233),t.sha512=r(9063)},7361:(e,t,r)=>{"use strict";var n=r(9046),i=r(9684),o=r(4343),s=n.rotl32,a=n.sum32,l=n.sum32_5,c=o.ft_1,u=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,u),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(9046),i=r(6966);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},6966:(e,t,r)=>{"use strict";var n=r(9046),i=r(9684),o=r(4343),s=r(2325),a=n.sum32,l=n.sum32_4,c=n.sum32_5,u=o.ch32,h=o.maj32,d=o.s0_256,f=o.s1_256,p=o.g0_256,g=o.g1_256,m=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(v,m),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(9046),i=r(9063);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),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},9063:(e,t,r)=>{"use strict";var n=r(9046),i=r(9684),o=r(2325),s=n.rotr64_hi,a=n.rotr64_lo,l=n.shr64_hi,c=n.shr64_lo,u=n.sum64,h=n.sum64_hi,d=n.sum64_lo,f=n.sum64_4_hi,p=n.sum64_4_lo,g=n.sum64_5_hi,m=n.sum64_5_lo,y=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function b(){if(!(this instanceof b))return new b;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function w(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function E(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function S(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function _(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function A(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function C(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function k(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function I(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=s(e,t,1)^s(e,t,8)^l(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=a(e,t,1)^a(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=s(e,t,19)^s(t,e,29)^l(e,t,6);return r<0&&(r+=4294967296),r}function x(e,t){var r=a(e,t,19)^a(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(b,y),e.exports=b,b.blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(9046).rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function s(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?s(t,r,n):2===e?o(t,r,n):void 0},t.ch32=i,t.maj32=o,t.p32=s,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},9046:(e,t,r)=>{"use strict";var n=r(2325),i=r(2534);function o(e,t){return 55296===(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320===(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function l(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(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,"")).length%2!==0&&(e="0"+e),i=0;i>6|192,r[n++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var r=new Array(4*e.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},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var l=0,c=t;return l+=(c=c+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,l,c){var u=0,h=t;return u+=(h=h+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,l,c){return t+n+o+a+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},4737:e=>{e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,o){r[i]=o,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},2110:(e,t,r)=>{"use strict";var n=r(8309),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function l(e){return n.isMemo(e)?s:a[e.$$typeof]||i}a[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[n.Memo]=s;var c=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,r,n){if("string"!==typeof r){if(p){var i=f(r);i&&i!==p&&e(t,i,n)}var s=u(r);h&&(s=s.concat(h(r)));for(var a=l(t),g=l(r),m=0;m{"use strict";var r="function"===typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,o=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,a=r?Symbol.for("react.profiler"):60114,l=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,u=r?Symbol.for("react.async_mode"):60111,h=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.suspense"):60113,p=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,m=r?Symbol.for("react.lazy"):60116,y=r?Symbol.for("react.block"):60121,v=r?Symbol.for("react.fundamental"):60117,b=r?Symbol.for("react.responder"):60118,w=r?Symbol.for("react.scope"):60119;function E(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case u:case h:case o:case a:case s:case f:return e;default:switch(e=e&&e.$$typeof){case c:case d:case m:case g:case l:return e;default:return t}}case i:return t}}}function S(e){return E(e)===h}t.AsyncMode=u,t.ConcurrentMode=h,t.ContextConsumer=c,t.ContextProvider=l,t.Element=n,t.ForwardRef=d,t.Fragment=o,t.Lazy=m,t.Memo=g,t.Portal=i,t.Profiler=a,t.StrictMode=s,t.Suspense=f,t.isAsyncMode=function(e){return S(e)||E(e)===u},t.isConcurrentMode=S,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===l},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return E(e)===d},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===m},t.isMemo=function(e){return E(e)===g},t.isPortal=function(e){return E(e)===i},t.isProfiler=function(e){return E(e)===a},t.isStrictMode=function(e){return E(e)===s},t.isSuspense=function(e){return E(e)===f},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===o||e===h||e===a||e===s||e===f||e===p||"object"===typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===g||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===v||e.$$typeof===b||e.$$typeof===w||e.$$typeof===y)},t.typeOf=E},8309:(e,t,r)=>{"use strict";e.exports=r(746)},2534:e=>{"function"===typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},8974:e=>{"use strict";const t="[a-fA-F\\d:]",r=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):"",n="(?: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}",i="[a-fA-F\\d]{1,4}",o="\n(?:\n(?:".concat(i,":){7}(?:").concat(i,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(i,":){6}(?:").concat(n,"|:").concat(i,"|:)| // 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(?:").concat(i,":){5}(?::").concat(n,"|(?::").concat(i,"){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(?:").concat(i,":){4}(?:(?::").concat(i,"){0,1}:").concat(n,"|(?::").concat(i,"){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(?:").concat(i,":){3}(?:(?::").concat(i,"){0,2}:").concat(n,"|(?::").concat(i,"){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(?:").concat(i,":){2}(?:(?::").concat(i,"){0,3}:").concat(n,"|(?::").concat(i,"){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(?:").concat(i,":){1}(?:(?::").concat(i,"){0,4}:").concat(n,"|(?::").concat(i,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(i,"){0,5}:").concat(n,"|(?::").concat(i,"){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(),s=new RegExp("(?:^".concat(n,"$)|(?:^").concat(o,"$)")),a=new RegExp("^".concat(n,"$")),l=new RegExp("^".concat(o,"$")),c=e=>e&&e.exact?s:new RegExp("(?:".concat(r(e)).concat(n).concat(r(e),")|(?:").concat(r(e)).concat(o).concat(r(e),")"),"g");c.v4=e=>e&&e.exact?a:new RegExp("".concat(r(e)).concat(n).concat(r(e)),"g"),c.v6=e=>e&&e.exact?l:new RegExp("".concat(r(e)).concat(o).concat(r(e)),"g"),e.exports=c},7201:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),threeOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),twoOctet:new RegExp("^".concat(r,"\\.").concat(r,"$"),"i"),longValue:new RegExp("^".concat(r,"$"),"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(s,"i"),native:new RegExp("^(::)?(".concat(a,")?([0-9a-f]+)?(::)?(").concat(s,")?$"),"i"),deprecatedTransitional:new RegExp("^(?:::)(".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?$"),"i")};function c(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(e.match(l.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(o=e.indexOf(":",o+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e0;){if(i=r-n,i<0&&(i=0),e[o]>>i!==t[o]>>i)return!1;n-=r,o+=1}return!0}function h(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error("ipaddr: cannot parse ".concat(e," as octal"))}return parseInt(e,10)}function d(e,t){for(;e.length=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],t&&0!==o)return null;8!==o&&(t=!0),e+=o}return 32-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse("::ffff:".concat(this.toString()))},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),f.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(e){return null!==this.parser(e)},f.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(t){return!1}},f.IPv4.isValidFourPartDecimal=function(e){return!(!f.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},f.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(e){let t,r,i;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),r=[];if(i=h(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),r=[];if(i=h(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(h(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},f.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;ti&&(n=r.index,i=r[0].length);return i<0?t:"".concat(t.substring(0,n),"::").concat(t.substring(n+i))},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),f.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(t,")"))}},f.IPv6.isIPv6=function(e){return null!==this.parser(e)},f.IPv6.isValid=function(e){if("string"===typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(t){return!1}},f.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(s,")"))}},f.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},f.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(e){let t,r,n,i,o,s;if(n=e.match(l.deprecatedTransitional))return this.parser("::ffff:".concat(n[1]));if(l.native.test(e))return c(e,8);if((n=e.match(l.transitional))&&(s=n[6]||"",t=c(n[1].slice(0,-1)+s,6),t.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r{e.exports=function(){return"undefined"!==typeof window&&"object"===typeof window.process&&"renderer"===window.process.type||(!("undefined"===typeof process||"object"!==typeof process.versions||!process.versions.electron)||"object"===typeof navigator&&"string"===typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}},887:e=>{"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}},6791:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:o,defaultBase:s}=r(5732),a=r(9640);e.exports={URL:n,URLSearchParams:o,format:i,relative:a,defaultBase:s}},9640:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i}=r(5732);e.exports=function(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0,a=r.protocol?r.protocol.replace(":",""):"http";a=(o[a]||s||a)+":";try{t=new n(e)}catch(c){t={}}const l=Object.assign({},r,{protocol:a||t.protocol,host:r.host||t.host});return new n(e,i(l)).toString()}},5732:e=>{"use strict";const t="undefined"!==typeof navigator&&"ReactNative"===navigator.product;const r=self.URL,n=t?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";e.exports={URLWithLegacySupport:class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;this.super=new r(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return r.createObjectURL(e)}static revokeObjectURL(e){r.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:n,format:function(e){if("string"===typeof e){return new r(e).toString()}if(!(e instanceof r)){const t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),l=e.hash||"",c=e.pathname||"",u=e.path||c+a;return"".concat(i).concat(t||r).concat(o||s+n).concat(u).concat(l)}}}},464:e=>{"use strict";e.exports=async e=>{const t=[];for await(const r of e)t.push(r);return t}},9272:e=>{"use strict";e.exports=async e=>{for await(const t of e);}},2393:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}},4744:e=>{"use strict";e.exports=async e=>{for await(const t of e)return t}},1309:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r),yield r}},7889:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)yield t(r)}},6155:(e,t,r)=>{"use strict";const n=r(9202);e.exports=async function*(){for(var e=arguments.length,t=new Array(e),r=0;r{try{await Promise.all(t.map((async e=>{for await(const t of e)i.push(t)}))),i.end()}catch(e){i.end(e)}}),0),yield*i}},9202:(e,t,r)=>{const n=r(5125);e.exports=e=>{let t;"function"===typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,i,o,s=new n;const a=e=>i?i(e):(s.push(e),r),l=e=>o?r:a({done:!1,value:e}),c=e=>o?r:(o=!0,e?(e=>(s=new n,i?i({error:e}):(s.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!s.isEmpty()){if(e.writev){let e;const t=[];for(;!s.isEmpty();){if(e=s.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=s.shift();if(t.error)throw t.error;return t}return o?{done:!0}:new Promise(((t,n)=>{i=o=>(i=null,o.error?n(o.error):e.writev&&!o.done?t({done:o.done,value:[o.value]}):t(o),r)}))},return:()=>(s=new n,c(),{done:!0}),throw:e=>(c(e),{done:!0}),push:l,end:c},!t)return r;const u=r;return r={[Symbol.asyncIterator](){return this},next:()=>u.next(),throw:e=>(u.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(u.return(),t&&(t(),t=null),{done:!0}),push:l,end:e=>(u.end(e),t&&(t(e),t=null),r)},r}},2035:(e,t,r)=>{"use strict";const n=r(464);e.exports=async function*(e,t){const r=await n(e);yield*r.sort(t)}},5959:e=>{"use strict";e.exports=async function*(e,t){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}},7898:(e,t,r)=>{var n;!function(){"use strict";var i="input is invalid type",o="object"===typeof window,s=o?window:{};s.JS_SHA3_NO_WINDOW&&(o=!1);var a=!o&&"object"===typeof self;!s.JS_SHA3_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node?s=r.g:a&&(s=self);var l=!s.JS_SHA3_NO_COMMON_JS&&e.exports,c=r.amdO,u=!s.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,h="0123456789abcdef".split(""),d=[4,1024,262144,67108864],f=[0,8,16,24],p=[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],g=[224,256,384,512],m=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!s.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!u||!s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var b=function(e,t,r){return function(n){return new D(e,t,e).update(n)[r]()}},w=function(e,t,r){return function(n,i){return new D(e,t,i).update(n)[r]()}},E=function(e,t,r){return function(t,n,i,o){return k["cshake"+e].update(t,n,i,o)[r]()}},S=function(e,t,r){return function(t,n,i,o){return k["kmac"+e].update(t,n,i,o)[r]()}},_=function(e,t,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 M(e,t,r){D.call(this,e,t,r)}D.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}for(var n,o,s=this.blocks,a=this.byteCount,l=e.length,c=this.blockCount,h=0,d=this.s;h>2]|=e[h]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(s[n>>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)<=a){for(this.start=n-a,this.block=s[c],n=0;n>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},D.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}var n=0,o=e.length;if(t)n=o;else for(var s=0;s=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(e),n},D.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+h[15&e]+h[e>>12&15]+h[e>>8&15]+h[e>>20&15]+h[e>>16&15]+h[e>>28&15]+h[e>>24&15];s%t===0&&(L(r),o=0)}return i&&(e=r[o],a+=h[e>>4&15]+h[15&e],i>1&&(a+=h[e>>12&15]+h[e>>8&15]),i>2&&(a+=h[e>>20&15]+h[e>>16&15])),a},D.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var l=new Uint32Array(e);s>8&255,l[e+2]=t>>16&255,l[e+3]=t>>24&255;a%r===0&&L(n)}return o&&(e=a<<2,t=n[s],l[e]=255&t,o>1&&(l[e+1]=t>>8&255),o>2&&(l[e+2]=t>>16&255)),l},M.prototype=new D,M.prototype.finalize=function(){return this.encode(this.outputBits,!0),D.prototype.finalize.call(this)};var L=function(e){var t,r,n,i,o,s,a,l,c,u,h,d,f,g,m,y,v,b,w,E,S,_,A,C,k,I,T,R,P,x,N,O,D,M,L,B,U,F,j,V,K,z,q,H,G,W,Z,Q,Y,J,X,$,ee,te,re,ne,ie,oe,se,ae,le,ce,ue;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(l<<1|c>>>31),r=o^(c<<1|l>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(u<<1|h>>>31),r=a^(h<<1|u>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=l^(d<<1|f>>>31),r=c^(f<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=u^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,g=e[0],m=e[1],W=e[11]<<4|e[10]>>>28,Z=e[10]<<4|e[11]>>>28,R=e[20]<<3|e[21]>>>29,P=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,le=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,M=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Q=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,x=e[33]<<13|e[32]>>>19,N=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,B=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,O=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,C=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,I=e[18]<<20|e[19]>>>12,T=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,V=e[38]<<8|e[39]>>>24,K=e[39]<<8|e[38]>>>24,_=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=g^~y&b,e[1]=m^~v&w,e[10]=C^~I&R,e[11]=k^~T&P,e[20]=M^~B&F,e[21]=L^~U&j,e[30]=H^~W&Q,e[31]=G^~Z&Y,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=y^~b&E,e[3]=v^~w&S,e[12]=I^~R&x,e[13]=T^~P&N,e[22]=B^~F&V,e[23]=U^~j&K,e[32]=W^~Q&J,e[33]=Z^~Y&X,e[42]=ne^~oe&ae,e[43]=ie^~se&le,e[4]=b^~E&_,e[5]=w^~S&A,e[14]=R^~x&O,e[15]=P^~N&D,e[24]=F^~V&z,e[25]=j^~K&q,e[34]=Q^~J&$,e[35]=Y^~X&ee,e[44]=oe^~ae&ce,e[45]=se^~le&ue,e[6]=E^~_&g,e[7]=S^~A&m,e[16]=x^~O&C,e[17]=N^~D&k,e[26]=V^~z&M,e[27]=K^~q&L,e[36]=J^~$&H,e[37]=X^~ee&G,e[46]=ae^~ce&te,e[47]=le^~ue&re,e[8]=_^~g&y,e[9]=A^~m&v,e[18]=O^~C&I,e[19]=D^~k&T,e[28]=z^~M&B,e[29]=q^~L&U,e[38]=$^~H&W,e[39]=ee^~G&Z,e[48]=ce^~te&ne,e[49]=ue^~re&ie,e[0]^=p[n],e[1]^=p[n+1]};if(l)e.exports=k;else{for(T=0;TObject.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,l={concatArrays:!1,ignoreUndefined:!1},c=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)o.call(e,n)&&t.push(n)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return c(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return c(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):e}const h=(e,t,r,n)=>(r.forEach((r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,d(e[r],t[r],n)):s(e,r,u(t[r])))})),e);function d(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r!a.includes(e))),r)})),n})(e,t,r):n(t)&&n(e)?h(e,t,c(t),r):u(t)}e.exports=function(){const e=d(u(l),this!==a&&this||{},l);let t={_:{}};for(var r=arguments.length,i=new Array(r),o=0;o{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},8193:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,s=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,l){l=l||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\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(!a)return;var l=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*s;case"weeks":case"week":case"w":return l*o;case"days":case"day":case"d":return l*i;case"hours":case"hour":case"hrs":case"hr":case"h":return l*n;case"minutes":case"minute":case"mins":case"min":case"m":return l*r;case"seconds":case"second":case"secs":case"sec":case"s":return l*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(e);if("number"===c&&isFinite(e))return l.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},486:e=>{"use strict";function t(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,o,s,a;for(t=[],i=o=0;o<=3&&0!==e.length;i=++o){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}s=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(s)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),s=n("a"),o=n("A"),r=function(e){var t,r,a,l,c;for(l=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),c=a;a>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")l=l*t+(10+n(e[a])-s)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;l=l*t+(10+n(e[a])-o)>>>0}}if(l>4294967295)throw new Error("too large");a++}if(a===c)throw new Error("empty octet");return[l,a]},e=function(){function e(e,t){var r,n,i;if("string"!==typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"===typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(o){throw o,new Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(o){throw o,new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=l(this.netLong),this.mask=l(this.maskLong),this.hostmask=l(~this.maskLong),this.first=this.bitmask<=30?l(this.netLong+1):this.base,this.last=this.bitmask<=30?l(this.netLong+this.size-2):l(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?l(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"===typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(l(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(l(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=l,t.Netmask=e}).call(this)},8605:(e,t,r)=>{var n=r(392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(3397),r(4533),r(3877),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){u||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return f(r._w,e,t,!1)},decrypt:function(e,t){return f(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!==typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i>>=2;for(i=0;i>8^255&h^99,o[g]=h,s[h]=g,f=(d=e[h])<<24^h<<16^h<<8^h^d,p=((r=e[g])^(n=e[r])^(i=e[n]))<<24^(g^i)<<16^(g^n^i)<<8^g^r^i;for(var y=0;y<4;++y)l[y][g]=f,c[y][h]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===g?g=m=1:(g=r^e[e[e[r^i]]],m^=e[e[m]])}}function d(e,t){for(var r,n=e.slice(0),i=1,s=n.length,l=4*(s+6+1),u=s;u>>16&255]<<24^o[r>>>8&255]<<16^o[255&r]<<8^o[r>>>24]^a[i]<<24,i++):s>6&&u%s===4&&(r=o[r>>>24]<<24^o[r>>>16&255]<<16^o[r>>>8&255]<<8^o[255&r]),n[u]=n[u-s]^r;if(t){for(var h,d=c[0],f=c[1],p=c[2],g=c[3],m=n.slice(0),y=(u=0,(l=n.length)-4);u>>24]]^f[o[h>>>16&255]]^p[o[h>>>8&255]]^g[o[255&h]];n=m}return n}function f(e,t,r,n){var i,a,u,h,d,f,p,g,m,y,v,b,w=e.length/4-1;n?(i=c[0],a=c[1],u=c[2],h=c[3],d=s):(i=l[0],a=l[1],u=l[2],h=l[3],d=o),f=t[0]^e[0],p=t[n?3:1]^e[1],g=t[2]^e[2],m=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^a[p>>>16&255]^u[g>>>8&255]^h[255&m]^e[++E],v=i[p>>>24]^a[g>>>16&255]^u[m>>>8&255]^h[255&f]^e[++E],b=i[g>>>24]^a[m>>>16&255]^u[f>>>8&255]^h[255&p]^e[++E],m=i[m>>>24]^a[f>>>16&255]^u[p>>>8&255]^h[255&g]^e[++E],f=y,p=v,g=b;r[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[g>>>8&255]<<8^d[255&m]^e[++E],r[n?3:1]=d[p>>>24]<<24^d[g>>>16&255]<<16^d[m>>>8&255]<<8^d[255&f]^e[++E],r[2]=d[g>>>24]<<24^d[m>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],r[n?1:3]=d[m>>>24]<<24^d[f>>>16&255]<<16^d[p>>>8&255]<<8^d[255&g]^e[++E]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},5049:(e,t,r)=>{var n=r(392);r(3877),r(2886);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],l=0;lt){if(n.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=f,p}f=t}var g=32===(32&l);if(g)if(h=[],void 0===f)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),h.push(s(e,t,r+1,n)),t-=a-e.length()}else for(;f>0;)a=e.length(),h.push(s(e,f,r+1,n)),t-=a-e.length(),f-=a-e.length();if(void 0===h&&c===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===h&&n.decodeBitStrings&&c===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&f>1){var m=e.read,y=t,v=0;if(u===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{a=e.length();var b=s(e,t,r+1,{strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,u==i.Type.BITSTRING&&w++;var E=b.tagClass;w!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(h=[b])}catch(_){}void 0===h&&(e.read=m,t=y)}if(void 0===h){if(void 0===f){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(u===i.Type.BMPSTRING)for(h="";f>0;f-=2)o(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(f),t-=f}var S=void 0===d?null:{bitStringContents:d};return i.create(c,u,g,h,S)}i.fromDer=function(e,t){void 0===t&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"===typeof t&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.length(),i=s(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var o=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw o.byteCount=r,o.remaining=e.length(),o}return i},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,o=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:o.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0===(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128===(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var l=o.length(),c="";do{c+=String.fromCharCode(255&l),l>>>=8}while(l>0);t.putByte(128|c.length);for(a=c.length-1;a>=0;--a)t.putByte(c.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,r,i,o,s=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var l=2;l>>=7,t||(o|=128),r.push(o),t=!1}while(i>0);for(var c=r.length-1;c>=0;--c)a.putByte(r[c])}return a},i.derToOid=function(e){var t;"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var l=e.charAt(10),c=10;"+"!==l&&"-"!==l&&(a=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),c&&("+"===(l=e.charAt(c))||"-"===l)){var u=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10);u*=6e4,"+"===l?t.setTime(+t-u):t.setTime(+t+u)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),l=0,c=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var h=e.length-5,d=e.charAt(h);"+"!==d&&"-"!==d||(c=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),c*=6e4,"+"===d&&(c*=-1),u=!0);return"."===e.charAt(14)&&(l=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,l),t.setTime(+t+c)):(t.setFullYear(r,n,i),t.setHours(o,s,a,l)),t},i.dateToUtcTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"===typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,o){var s=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,l=0;s&&l0&&(o+="\n");for(var s="",l=0;l1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?o+=" (1 unused bit shown)":d>1&&(o+=" ("+d+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)a.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{o+=n.util.decodeUtf8(e.value)}catch(p){if("URI malformed"!==p.message)throw p;o+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:a.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},5754:e=>{var t={};e.exports=t;var r={};t.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 i=0,o=t.length,s=t.charAt(0),a=[0];for(i=0;i0;)a.push(c%o),c=c/o|0}for(i=0;0===e[i]&&i=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r0;)o.push(a%n),a=a/n|0}var l="";for(r=0;0===e.at(r)&&r=0;--r)l+=t[o[r]];return l}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},t.decode=function(e,t){if("string"!==typeof e)throw new TypeError('"input" must be a string.');if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');var n=r[t];if(!n){n=r[t]=[];for(var i=0;i>=8;for(;u>0;)a.push(255&u),u>>=8}for(var h=0;e[h]===s&&h{var n=r(392);r(3877),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)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)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())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){for(e&&this._input.putBuffer(e);!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)))}},4533:(e,t,r)=>{var n=r(392);r(3877),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(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=o(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=o(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&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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=o(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&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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=o(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&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(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{for(this._j0=[0,0,0,0];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),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];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&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(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),s(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=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[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,o=new Array(i),s=0;s>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o{var n=r(392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(3397),r(4533),r(3877),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({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 f(r._keys,e,t,!1)},decrypt:function(e,t){return f(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=function(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],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[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],l=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[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],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[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],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,y=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w>>4^S))<<4,E^=t=65535&((S^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(S^=t<<-16)))<<2,E^=t=65535&((S^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(S^=t<<-16)))<<1,E^=t=16711935&((S^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var _=0;_>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),S&=-15;var A=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|o[E>>>16&15]|s[E>>>12&15]|a[E>>>8&15]|l[E>>>4&15],C=c[S>>>28]|u[S>>>24&15]|h[S>>>20&15]|d[S>>>16&15]|f[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(C>>>16^A),y[b++]=A^t,y[b++]=C^t<<16}}return y}(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 o=[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],s=[-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],l=[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],c=[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],u=[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],d=[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 f(e,t,r,n){var i,f,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 g=t[0],m=t[1];g^=(f=252645135&(g>>>4^m))<<4,g^=(f=65535&(g>>>16^(m^=f)))<<16,g^=f=858993459&((m^=f)>>>2^g),g^=f=16711935&((m^=f<<2)>>>8^g),g=(g^=(f=1431655765&(g>>>1^(m^=f<<8)))<<1)<<1|g>>>31,m=(m^=f)<<1|m>>>31;for(var y=0;y>>4|m<<28)^e[w+1];f=g,g=m,m=f^(s[E>>>24&63]|l[E>>>16&63]|u[E>>>8&63]|d[63&E]|o[S>>>24&63]|a[S>>>16&63]|c[S>>>8&63]|h[63&S])}f=g,g=m,m=f}m=m>>>1|m<<31,m^=f=1431655765&((g=g>>>1|g<<31)>>>1^m),m^=(f=16711935&(m>>>8^(g^=f<<1)))<<8,m^=(f=858993459&(m>>>2^(g^=f)))<<2,m^=f=65535&((g^=f)>>>16^m),m^=f=252645135&((g^=f<<16)>>>4^m),g^=f<<4,r[0]=g,r[1]=m}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},392:e=>{e.exports={options:{usePureJavaScript:!1}}},878:(e,t,r)=>{var n=r(392);r(29),r(3877),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"===typeof o){if(!((o=o.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"===typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var l=0;lt.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=s.length();for(l=0;l{var n,i=r(392);e.exports=i.jsbn=i.jsbn||{};function o(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var l=16383&this.data[e],c=this.data[e++]>>14,u=a*l+c*s;i=((l=s*l+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+a*c,r.data[n++]=268435455&l}return i}i.jsbn.BigInteger=o,"undefined"===typeof navigator?(o.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var l=32767&this.data[e],c=this.data[e++]>>15,u=a*l+c*s;i=((l=s*l+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+a*c+(i>>>30),r.data[n++]=1073741823&l}return i},n=30):"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(o.prototype.am=a,n=28),o.prototype.DB=n,o.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function g(e){this.m=e}function m(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function A(e){return e}function C(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}g.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},g.prototype.revert=function(e){return e},g.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},m.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},m.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},m.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var a=8==r?255&e[n]:d(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<>this.DB-s):this.data[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>i|a,a=(this.data[r]&o)<=0;--r)t.data[r]=0;t.data[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},o.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,a),i.lShiftTo(u,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,d=a.data[h-1];if(0!=d){var f=d*(1<1?a.data[h-2]>>this.F2:0),g=this.FV/f,m=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t=0;){var E=r.data[--v]==d?this.DM:Math.floor(r.data[v]*g+(r.data[v-1]+y)*m);if((r.data[v]+=a.am(0,E,r,b,0,h))0&&r.rShiftTo(u,r),l<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var l=r;r=n,n=l}return t.revert(r)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=h(r));s>=0;)a>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=h(r));return i?o:"0"},o.prototype.negate=function(){var e=s();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new g(t):new m(t),this.exp(e,r)},o.ZERO=f(0),o.ONE=f(1),_.prototype.convert=A,_.prototype.revert=A,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.prototype.sqrTo=function(e,t){e.squareTo(t)},C.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},C.prototype.revert=function(e){return e},C.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},C.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var k=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],I=(1<<26)/k[k.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=f(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,l=0;l=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},o.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var l=n.modPow(i,this);if(0!=l.compareTo(o.ONE)&&0!=l.compareTo(t)){for(var c=1;c++>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=s();return this.bitwiseTo(e,y,t),t},o.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t},o.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,b,t),t},o.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,w,t),t},o.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var h=s();for(n.sqrTo(a[1],h);l<=u;)a[l]=s(),n.mulTo(h,a[l-2],a[l]),l+=2}var d,y,v=e.t-1,b=!0,w=s();for(i=p(e.data[v])-1;v>=0;){for(i>=c?d=e.data[v]>>i-c&u:(d=(e.data[v]&(1<0&&(d|=e.data[v-1]>>this.DB+i-c)),l=r;0==(1&d);)d>>=1,--l;if((i-=l)<0&&(i+=this.DB,--v),b)a[d].copyTo(o),b=!1;else{for(;l>1;)n.sqrTo(o,w),n.sqrTo(w,o),l-=2;l>0?n.sqrTo(o,w):(y=o,o=w,w=y),n.mulTo(w,a[d],o)}for(;v>=0&&0==(e.data[v]&1<=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(l,s)):(n.subTo(r,n),t&&a.subTo(i,a),l.subTo(s,l))}return 0!=n.compareTo(o.ONE)?o.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l},o.prototype.pow=function(e){return this.exp(e,new _)},o.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},o.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=k[k.length-1]){for(t=0;t{var n=r(392);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},1746:(e,t,r)=>{var n=r(392);r(7263),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},7263:(e,t,r)=>{var n=r(392);r(3877),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s{var n=r(392);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.3.101.112","EdDSA25519"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("1.3.14.3.2.29","sha1WithRSASignature"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("2.16.840.1.101.3.4.2.4","sha224"),o("2.16.840.1.101.3.4.2.5","sha512-224"),o("2.16.840.1.101.3.4.2.6","sha512-256"),o("1.2.840.113549.2.2","md2"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.4","surname"),o("2.5.4.5","serialNumber"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.9","streetAddress"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.5.4.12","title"),o("2.5.4.13","description"),o("2.5.4.15","businessCategory"),o("2.5.4.17","postalCode"),o("2.5.4.42","givenName"),o("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),o("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),o("2.16.840.1.113730.1.1","nsCertType"),o("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},9835:(e,t,r)=>{var n=r(392);if(r(8605),r(5049),r(1400),r(29),r(2886),r(6019),r(6193),r(3860),r(654),r(5493),r(3877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,l={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},u={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=s.oids[o.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return f(t)}function f(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()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,l,c,u=n.random.getBytesSync(r.saltSize),h=r.count,d=o.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,g,m;switch(r.algorithm){case"aes128":i=16,p=16,g=a["aes128-CBC"],m=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,g=a["aes192-CBC"],m=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,g=a["aes256-CBC"],m=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,g=a.desCBC,m=n.des.createEncryptionCipher;break;default:throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S}var y="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(y),b=n.pkcs5.pbkdf2(t,u,h,i,v),w=n.random.getBytesSync(p);(_=m(b)).start(w),_.update(o.toDer(e)),_.finish(),c=_.output.getBytes();var E=function(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]));return a}(u,d,i,y);l=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,w)])])])}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var _,A=new n.util.ByteBuffer(u);b=s.pbe.generatePkcs12Key(t,A,1,h,i),w=s.pbe.generatePkcs12Key(t,A,2,h,i);(_=n.des.createEncryptionCipher(b)).start(w),_.update(o.toDer(e)),_.finish(),c=_.output.getBytes(),l=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,u),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,d.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[l,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,c)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,l,i,a)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=a,c}var u=o.derToOid(i.encryptionOid),h=s.pbe.getCipher(u,i.encryptionParams,t),d=n.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(r=o.fromDer(h.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.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 o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,l,c,u;switch(r.algorithm){case"aes128":a="AES-128-CBC",c=16,l=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",c=24,l=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",c=32,l=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",c=24,l=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",c=8,l=n.random.getBytesSync(8),u=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 d=u(n.pbe.opensslDeriveBytes(t,l.substr(0,8),c));d.start(l),d.update(o.toDer(s.privateKeyToAsn1(e))),d.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(l).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(f)},s.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)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,l;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,l=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,l=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,l=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,l=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,l=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,l=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,l=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,l=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var u=n.util.hexToBytes(i.dekInfo.parameters),h=l(n.pbe.opensslDeriveBytes(t,u.substr(0,8),a));if(h.start(u),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,l;if("undefined"===typeof s||null===s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var c=s.digestLength,u=s.blockLength,h=new n.util.ByteBuffer,d=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(l=0;l=0;l--)R>>=8,R+=C.at(l)+T.at(l),T.setAt(l,255&R);I.putBuffer(T)}w=I,h.putBuffer(_)}return h.truncate(h.length()-o),h},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.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}},s.pbe.getCipherForPBES2=function(e,t,r){var i,a={},l=[];if(!o.validate(t,c,a,l))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=l,i;if((e=o.derToOid(a.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(a.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var u,h,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":u=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,h=n.des.createDecryptionCipher;break;case"desCBC":u=8,h=n.des.createDecryptionCipher}var g=d(a.prfOid),m=n.pkcs5.pbkdf2(r,f,p,u,g),y=a.encIv,v=h(m);return v.start(y),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,u,i,a))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,g;var l,c,h,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:l=24,c=8,h=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:l=5,c=8,h=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,g}var m=d(i.prfOid),y=s.pbe.generatePkcs12Key(r,f,1,p,l,m);return m.start(),h(y,s.pbe.generatePkcs12Key(r,f,2,p,c,m))},s.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 o=[h(i,e+t)],s=16,a=1;s{var n=r(392);r(878),r(29),r(3877);var i,o=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(5819)),e.exports=n.pbkdf2=o.pbkdf2=function(e,t,r,o,s,a){if("function"===typeof s&&(a=s,s=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===s||"object"!==typeof s)&&(i.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!==typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===i.pbkdf2Sync.length?i.pbkdf2(e,t,r,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,r,o,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,r,o).toString("binary"):i.pbkdf2Sync(e,t,r,o,s).toString("binary");if("undefined"!==typeof s&&null!==s||(s="sha1"),"string"===typeof s){if(!(s in n.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=n.md[s].create()}var l=s.digestLength;if(o>4294967295*l){var c=new Error("Derived key is too long.");if(a)return a(c);throw c}var u=Math.ceil(o/l),h=o-(u-1)*l,d=n.hmac.create();d.start(s,e);var f,p,g,m="";if(!a){for(var y=1;y<=u;++y){d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(y)),f=g=d.digest().getBytes();for(var v=2;v<=r;++v)d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,l),g=p;m+=yu)return a(null,m);d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(y)),f=g=d.digest().getBytes(),v=2,w()}function w(){if(v<=r)return d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,l),g=p,++v,n.util.setImmediate(w);m+=y{var n=r(392);r(3877);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=o(r)),e.headers)for(var s=0;s{var n=r(392);r(3877),r(3860),r(928);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);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,s,a,l;"string"===typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(l=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),l||(l=a);var c=Math.ceil(e.n.bitLength()/8),u=c-2*a.digestLength-2;if(t.length>u)throw(m=new Error("RSAES-OAEP input message length is too long.")).length=t.length,m.maxLength=u,m;i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",f=u-t.length,p=0;p{var n=r(392);r(8605),r(5049),r(1400),r(2886),r(6193),r(4922),r(3860),r(3877),r(3391);var i=n.asn1,o=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}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?t.encParameter.value:void 0,content:t.encKey}}}function a(e){for(var t,r=[],o=0;o0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=r&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.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()),s])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"===typeof o&&(o=n.pki.certificateFromPem(o)),r=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof s&&(s=n.pki.privateKeyFromPem(s));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 l=t.authenticatedAttributes||[];if(l.length>0){for(var c=!1,u=!1,h=0;h{var n=r(392);r(5049),r(3877);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={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"}]};o.contentInfoValidator=s;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"}]};o.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)},o.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 l={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"}]};o.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"},s,{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:[l]}]},o.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",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},5132:(e,t,r)=>{var n=r(392);r(3877),r(3055),r(3860),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof o&&(o={name:o}),o.options=o.options||{};var s=t.prng||n.random,l={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;re&&(s=c(e,t));var f=s.toString(16);i.target.postMessage({hex:f,workLoad:u}),s.dAddOffset(h,0)}}}f()}(e,t,i,o);return a(e,t,i,o)}(e,l,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(e,t,r,n){var i=c(e,t),o=function(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}(i.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),l(i,e,t,0,o,s,n)}function l(e,t,r,o,s,a,u){var h=+new Date;do{if(e.bitLength()>t&&(e=c(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-h{var n=r(392);r(3877);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(i=r(5819)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,o=new Array(32),s=0;s<32;++s)o[s]=r.create();function a(){if(t.pools[0].messageLength>=32)return l();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),l()}function l(){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 c(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var o=n.util.createBuffer();if(t)for(;o.length()>16)))<<16,d=4294967295&(u=(2147483647&(u+=c>>15))+(u>>31));for(l=0;l<3;++l)h=d>>>(l<<3),h^=Math.floor(256*Math.random()),o.putByte(255&h)}return o.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,a=t.plugin.formatSeed,c=n.util.createBuffer();t.key=null,function u(h){if(h)return r(h);if(c.length()>=e)return r(null,c.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return l(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),l(),e()}))}(u)}));var d=i(t.key,t.seed);t.generated+=d.length,c.putBytes(d),t.key=s(i(t.key,o(t.seed))),t.seed=a(i(t.key,t.seed)),n.util.setImmediate(u)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var l=n.util.createBuffer();l.length()1048575&&(t.key=null),null===t.key&&a();var c=r(t.key,t.seed);t.generated+=c.length,l.putBytes(c),t.key=o(r(t.key,i(t.seed))),t.seed=s(r(t.key,t.seed))}return l.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,c(e))}catch(r){t(r)}},t.seedFileSync=c),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){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(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}}})}))}))}},t}},325:(e,t,r)=>{var n=r(392);r(3860),r(3877),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,o=r.digestLength,s=e.salt||null;if("string"===typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,l={encode:function(e,l){var c,u,h=l-1,d=Math.ceil(h/8),f=e.digest().getBytes();if(d>8*d-h&255;return(w=String.fromCharCode(w.charCodeAt(0)&~E)+w.substr(1))+g+String.fromCharCode(188)},verify:function(e,s,a){var l,c=a-1,u=Math.ceil(c/8);if(s=s.substr(-u),u>8*u-c&255;if(0!==(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=i.generate(f,h),m="";for(l=0;l{var n=r(392);r(8605),r(7404),r(6140),r(3877),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),l=null,c=n.util.globalScope,u=c.crypto||c.msCrypto;if(u&&u.getRandomValues&&(l=function(e){return u.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!l){if("undefined"===typeof window||window.document,a.collectInt(+new Date,32),"undefined"!==typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(f){}a.collect(h),h=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},654:(e,t,r)=>{var n=r(392);r(3877);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],o=[1,2,3,5],s=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,o=e,s=e.length(),a=t,l=Math.ceil(a/8),c=255>>(7&a);for(r=s;r<128;r++)o.putByte(i[o.at(r-1)+o.at(r-s)&255]);for(o.setAt(128-l,i[o.at(128-l)&c]),r=127-l;r>=0;r--)o.setAt(r,i[o.at(r+1)^o.at(r+l)]);return o};var l=function(e,t,r){var i,l,c,u,h=!1,d=null,f=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)g.push(e.getInt16Le());r?(i=function(e){for(c=0;c<4;c++)e[c]+=g[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=s(e[c],o[c]),u++},l=function(e){for(c=0;c<4;c++)e[c]+=g[63&e[(c+3)%4]]}):(i=function(e){for(c=3;c>=0;c--)e[c]=a(e[c],o[c]),e[c]-=g[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),u--},l=function(e){for(c=3;c>=0;c--)e[c]-=g[63&e[(c+3)%4]]});var m=function(e){var t=[];for(c=0;c<4;c++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}u=r?0:63;for(var i=0;i=8;)m([[5,i],[1,l],[6,i],[1,l],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(h=!0,y.update()),!r&&(t=0===d.length()))if(e)t=e(8,f,!r);else{var i=f.length(),o=f.at(i-1);o>i?t=!1:f.truncate(o)}return t}}};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 l(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 l(e,t,!1)}},5493:(e,t,r)=>{var n=r(392);if(r(5049),r(3055),r(2886),r(2627),r(5132),r(3860),r(3877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.util.isNodejs?r(5819):null,s=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var l=n.pki,c=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",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:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",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:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},g=function(e){var t;if(!(e.algorithm in l.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=l.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),o=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);o.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),o.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var a=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),s.toDer(i).getBytes()},m=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=0||!o.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var l=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return l=l.multiply(o.modInverse(t.n)).mod(t.n)};function y(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a,l=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var c=0;c0;){var u=0,h=n.random.getBytes(l);for(c=0;c1;){if(255!==s.getByte()){--s.read;break}++c}else if(2===l)for(c=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++c}if(0!==s.getByte()||c!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function b(e,t,r){"function"===typeof t&&(r=t,t={});var o={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?c(t,e.q):void a(e.qBits,c))}))}function a(e,t){n.prime.generateProbablePrime(e,o,t)}function c(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,c);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,c);var u=e.e.modInverse(e.phi);e.keys={privateKey:l.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:l.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(o.prng=t.prng),s()}function w(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0===(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128===(128&r.charCodeAt(1)))?r.substr(1):r}function E(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}function S(e){return n.util.isNodejs&&"function"===typeof o[e]}function _(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.crypto&&"object"===typeof a.globalScope.crypto.subtle&&"function"===typeof a.globalScope.crypto.subtle[e]}function A(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.msCrypto&&"object"===typeof a.globalScope.msCrypto.subtle&&"function"===typeof a.globalScope.msCrypto.subtle[e]}function C(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(c)),u.getBytes()},l.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var l=new i(n.util.createBuffer(e).toHex(),16);if(l.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=m(l,t,r).toString(16),u=n.util.createBuffer(),h=s-Math.ceil(c.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(c)),!1!==o?v(u.getBytes(),t,r):u.getBytes()},l.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},l.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,o=0,s=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||uh?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(c[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:l.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:l.rsa.setPublicKey(e.n,e.e)}}u+=(n=+new Date)-a,a=n}return null!==e.keys},l.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"===typeof e?(r=e,e=void 0):"function"===typeof e&&(i=e,e=void 0):2===arguments.length?"number"===typeof e?"function"===typeof t?(i=t,t=void 0):"number"!==typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"===typeof t?"function"===typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(S("generateKeyPair"))return o.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:l.privateKeyFromPem(r),publicKey:l.publicKeyFromPem(t)})}));if(_("generateKey")&&_("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:C(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=l.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:l.setRsaPublicKey(t.n,t.e)})}}));if(A("generateKey")&&A("exportKey")){var c=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:C(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return c.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=l.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:l.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(c.onerror=function(e){i(e)})}}else if(S("generateKeyPairSync")){var u=o.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:l.privateKeyFromPem(u.privateKey),publicKey:l.publicKeyFromPem(u.publicKey)}}var h=l.rsa.createKeyPairGenerationState(e,t,r);if(!i)return l.rsa.stepKeyPairGenerationState(h,0),h.keys;b(h,r,i)},l.setRsaPublicKey=l.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return y(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"===typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return l.rsa.encrypt(o,r,!0)},verify:function(e,t,i,o){"string"===typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===o&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=v(t,r,!0);var i=s.fromDer(t,{parseAllBytes:o._parseAllDigestBytes}),a={},l=[];if(!s.validate(i,p,a,l))throw(c=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=l,c;var c,u=s.derToOid(a.algorithmIdentifier);if(u!==n.oids.md2&&u!==n.oids.md5&&u!==n.oids.sha1&&u!==n.oids.sha224&&u!==n.oids.sha256&&u!==n.oids.sha384&&u!==n.oids.sha512&&u!==n.oids["sha512-224"]&&u!==n.oids["sha512-256"])throw(c=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,c;if((u===n.oids.md2||u===n.oids.md5)&&!("parameters"in a))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===a.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=v(t,r,!0))}});var a=l.rsa.decrypt(t,r,!0,!1);return i.verify(e,a,r.n.bitLength())}};return r},l.setRsaPrivateKey=l.rsa.setPrivateKey=function(e,t,r,i,o,s,a,c){var u={n:e,e:t,d:r,p:i,q:o,dP:s,dQ:a,qInv:c,decrypt:function(e,t,r){"string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=l.rsa.decrypt(e,u,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,u,!1)},sign:function(e,t){var r=!1;"string"===typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:g},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,u.n.bitLength());return l.rsa.encrypt(n,u,r)}};return u},l.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(l.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},l.privateKeyFromAsn1=function(e){var t,r,o,a,c,d,f,p,g={},m=[];if(s.validate(e,u,g,m)&&(e=s.fromDer(n.util.createBuffer(g.privateKey))),g={},m=[],!s.validate(e,h,g,m)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=m,y}return t=n.util.createBuffer(g.privateKeyModulus).toHex(),r=n.util.createBuffer(g.privateKeyPublicExponent).toHex(),o=n.util.createBuffer(g.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(g.privateKeyPrime1).toHex(),c=n.util.createBuffer(g.privateKeyPrime2).toHex(),d=n.util.createBuffer(g.privateKeyExponent1).toHex(),f=n.util.createBuffer(g.privateKeyExponent2).toHex(),p=n.util.createBuffer(g.privateKeyCoefficient).toHex(),l.setRsaPrivateKey(new i(t,16),new i(r,16),new i(o,16),new i(a,16),new i(c,16),new i(d,16),new i(f,16),new i(p,16))},l.privateKeyToAsn1=l.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.qInv))])},l.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,f,t,r)){var o,a=s.derToOid(t.publicKeyOid);if(a!==l.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=a,o;e=t.rsaPublicKey}if(r=[],!s.validate(e,d,t,r))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,o;var c=n.util.createBuffer(t.publicKeyModulus).toHex(),u=n.util.createBuffer(t.publicKeyExponent).toHex();return l.setRsaPublicKey(new i(c,16),new i(u,16))},l.publicKeyToAsn1=l.publicKeyToSubjectPublicKeyInfo=function(e){return 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(l.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[l.publicKeyToRSAPublicKey(e)])])},l.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.e))])}},928:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0);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,o=0;o>>0,l>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=l[1],l[1]=l[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,l[0]=l[1]/4294967296>>>0;return t.putBytes(o),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var l,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-c));for(var u=8*i.fullMessageLength[0],h=0;h>>0,s.putInt32(u>>>0),u=l>>>0;s.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,s);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var o=null,s=!1;function a(e,t,r){for(var n,i,o,s,a,l,c,u=r.length();u>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,l=e.h4,c=0;c<16;++c)n=r.getInt32(),t[c]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+l+1518500249+n,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<20;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+l+1518500249+n,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<32;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(o^s^a)+l+1859775393+n,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<40;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(o^s^a)+l+1859775393+n,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<60;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(o&s|a&(o^s))+l+2400959708+n,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;c<80;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(o^s^a)+l+3395469782+n,l=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+l|0,u-=64}}},7404:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(o=String.fromCharCode(128),o+=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],s=!0);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,o=0;o>>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(o),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-c));for(var u=8*i.fullMessageLength[0],h=0;h>>0,s.putInt32(u>>>0),u=a>>>0;s.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};l(d,r,s);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},i};var o=null,s=!1,a=null;function l(e,t,r){for(var n,i,o,s,l,c,u,h,d,f,p,g,m,y=r.length();y>=64;){for(l=0;l<16;++l)t[l]=r.getInt32();for(;l<64;++l)n=((n=t[l-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[l-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[l]=n+t[l-7]+i+t[l-16]|0;for(c=e.h0,u=e.h1,h=e.h2,d=e.h3,f=e.h4,p=e.h5,g=e.h6,m=e.h7,l=0;l<64;++l)o=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),s=c&u|h&(c^u),n=m+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(g^f&(p^g))+a[l]+t[l],m=g,g=p,p=f,f=d+n>>>0,d=h,h=u,u=c,c=n+(i=o+s)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+u|0,e.h2=e.h2+h|0,e.h3=e.h3+d|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+g|0,e.h7=e.h7+m|0,y-=64}}},4770:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var o=n.sha384=n.sha512.sha384=n.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=o,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||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),l=[[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]],(c={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),"undefined"===typeof e&&(e="SHA-512"),!(e in c))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=c[e],r=null,i=n.util.createBuffer(),o=new Array(80),h=0;h<80;++h)o[h]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,o=0;o>>0,s>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=s[1],s[1]=s[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),u(r,o,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,l=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(s.substr(0,f.blockLength-l));for(var c=8*f.fullMessageLength[0],h=0;h>>0,t.putInt32(c>>>0),c=a>>>0;t.putInt32(c);var d=new Array(r.length);for(h=0;h=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)n=(((x=(O=t[P-2])[0])>>>19|(N=O[1])<<13)^(N>>>29|x<<3)^x>>>6)>>>0,i=((x<<13|N>>>19)^(N<<3|x>>>29)^(x<<26|N>>>6))>>>0,o=(((x=(M=t[P-15])[0])>>>1|(N=M[1])<<31)^(x>>>8|N<<24)^x>>>7)>>>0,s=((x<<31|N>>>1)^(x<<24|N>>>8)^(x<<25|N>>>7))>>>0,D=t[P-7],L=t[P-16],N=i+D[1]+s+L[1],t[P][0]=n+D[0]+o+L[0]+(N/4294967296>>>0)>>>0,t[P][1]=N>>>0;for(p=e[0][0],g=e[0][1],m=e[1][0],y=e[1][1],v=e[2][0],b=e[2][1],w=e[3][0],E=e[3][1],S=e[4][0],_=e[4][1],A=e[5][0],C=e[5][1],k=e[6][0],I=e[6][1],T=e[7][0],R=e[7][1],P=0;P<80;++P)u=((S>>>14|_<<18)^(S>>>18|_<<14)^(_>>>9|S<<23))>>>0,h=(k^S&(A^k))>>>0,a=((p>>>28|g<<4)^(g>>>2|p<<30)^(g>>>7|p<<25))>>>0,c=((p<<4|g>>>28)^(g<<30|p>>>2)^(g<<25|p>>>7))>>>0,d=(p&m|v&(p^m))>>>0,f=(g&y|b&(g^y))>>>0,N=R+(((S<<18|_>>>14)^(S<<14|_>>>18)^(_<<23|S>>>9))>>>0)+((I^_&(C^I))>>>0)+l[P][1]+t[P][1],n=T+u+h+l[P][0]+t[P][0]+(N/4294967296>>>0)>>>0,i=N>>>0,o=a+d+((N=c+f)/4294967296>>>0)>>>0,s=N>>>0,T=k,R=I,k=A,I=C,A=S,C=_,S=w+n+((N=E+i)/4294967296>>>0)>>>0,_=N>>>0,w=v,E=b,v=m,b=y,m=p,y=g,p=n+o+((N=i+s)/4294967296>>>0)>>>0,g=N>>>0;N=e[0][1]+g,e[0][0]=e[0][0]+p+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+y,e[1][0]=e[1][0]+m+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+b,e[2][0]=e[2][0]+v+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+E,e[3][0]=e[3][0]+w+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+_,e[4][0]=e[4][0]+S+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+C,e[5][0]=e[5][0]+A+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+I,e[6][0]=e[6][0]+k+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+R,e[7][0]=e[7][0]+T+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,B-=128}}},3877:(e,t,r)=>{var n=r(392),i=r(5754),o=e.exports=n.util=n.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function a(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(o.isArrayBuffer(e)||o.isArrayBufferView(e))if("undefined"!==typeof Buffer&&e instanceof Buffer)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?(r=Date.now(),s(e)):(t.push(e),1===t.length&&i.setAttribute("a",n=!n))}}o.nextTick=o.setImmediate}(),o.isNodejs="undefined"!==typeof process&&process.versions&&process.versions.node,o.globalScope=o.isNodejs?r.g:"undefined"===typeof self?window:self,o.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},o.isArrayBufferView=function(e){return e&&o.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},o.ByteBuffer=a,o.ByteStringBuffer=a;o.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},o.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},o.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},o.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(o.encodeUtf8(e))},o.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.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))},o.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},o.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},o.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))},o.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},o.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},o.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},o.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},o.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},o.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},o.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},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},o.ByteStringBuffer.prototype.copy=function(){var e=o.createBuffer(this.data);return e.read=this.read,e},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},o.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},o.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},o.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},o.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},o.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},o.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},o.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},o.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},o.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},o.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},o.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},o.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},o.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},o.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},o.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this)},o.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},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},o.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},o.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},o.xorBytes=function(e,t,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o},o.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 l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[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],u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(e,t){for(var r,n,i,o="",s="",a=0;a>2),o+=l.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=l.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":l.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},o.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,o="",s=0;s>4),64!==n&&(o+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(o+=String.fromCharCode((3&n)<<6|i)));return o},o.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},o.decodeUtf8=function(e){return decodeURIComponent(escape(e))},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:i.encode,decode:i.decode}},o.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},o.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o>2),o+=l.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=l.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":l.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},o.binary.base64.decode=function(e,t,r){var n,i,o,s,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var l=0,u=r=r||0;l>4,64!==o&&(a[u++]=(15&i)<<4|o>>2,64!==s&&(a[u++]=(3&o)<<6|s));return t?u-r:a.subarray(0,u)},o.binary.base58.encode=function(e,t){return o.binary.baseN.encode(e,u,t)},o.binary.base58.decode=function(e,t){return o.binary.baseN.decode(e,u,t)},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(e,t,r){e=o.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s0&&o.push(r),s=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},o.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,l=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=c.length>3?c.length%3:0;return l+(u?c.substr(0,u)+a:"")+c.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-c).toFixed(o).slice(2):"")},o.formatSize=function(e){return e=e>=1073741824?o.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?o.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?o.formatNumber(e/1024,0)+" KiB":o.formatNumber(e,0)+" bytes"},o.bytesFromIP=function(e){return-1!==e.indexOf(".")?o.bytesFromIPv4(e):-1!==e.indexOf(":")?o.bytesFromIPv6(e):null},o.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=o.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:l,end:l})}t.push(s)}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},o.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in o&&!e.update)return t(null,o.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,t(null,o.cores);if("undefined"===typeof Worker)return o.cores=1,t(null,o.cores);if("undefined"===typeof Blob)return o.cores=2,t(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()a.st&&i.sti.st&&a.st{var n=r(392);r(8605),r(5049),r(1400),r(29),r(1746),r(2886),r(6193),r(325),r(5493),r(3877);var i=n.asn1,o=e.exports=n.pki=n.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var l=n.pki.rsa.publicKeyValidator,c={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"},l,{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"}]},u={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"},l,{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}]}]}]},d={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 f(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 f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,f.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var m=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=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(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(l.validity.notBefore=h[0],l.validity.notAfter=h[1],l.tbsCertificate=r.tbsCertificate,t){l.md=g({signatureOid:l.signatureOid,type:"certificate"});var d=i.toDer(l.tbsCertificate);l.md.update(d.getBytes())}var m=n.md.sha1.create(),y=i.toDer(r.certIssuer);m.update(y.getBytes()),l.issuer.getField=function(e){return f(l.issuer,e)},l.issuer.addField=function(e){v([e]),l.issuer.attributes.push(e)},l.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(l.issuer.uniqueId=r.certIssuerUniqueId),l.issuer.hash=m.digest().toHex();var b=n.md.sha1.create(),w=i.toDer(r.certSubject);return b.update(w.getBytes()),l.subject.getField=function(e){return f(l.subject,e)},l.subject.addField=function(e){v([e]),l.subject.attributes.push(e)},l.subject.attributes=o.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(l.subject.uniqueId=r.certSubjectUniqueId),l.subject.hash=b.digest().toHex(),r.certExtensions?l.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):l.extensions=[],l.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),l},o.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=l.value.charCodeAt(1),o=l.value.length>2?l.value.charCodeAt(2):0),t.digitalSignature=128===(128&r),t.nonRepudiation=64===(64&r),t.keyEncipherment=32===(32&r),t.dataEncipherment=16===(16&r),t.keyAgreement=8===(8&r),t.keyCertSign=4===(4&r),t.cRLSign=2===(2&r),t.encipherOnly=1===(1&r),t.decipherOnly=128===(128&o)}else if("basicConstraints"===t.name){(l=i.fromDer(t.value)).value.length>0&&l.value[0].type===i.Type.BOOLEAN?t.cA=0!==l.value[0].value.charCodeAt(0):t.cA=!1;var a=null;l.value.length>0&&l.value[0].type===i.Type.INTEGER?a=l.value[0].value:l.value.length>1&&(a=l.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var l=i.fromDer(t.value),c=0;c1&&(r=l.value.charCodeAt(1)),t.client=128===(128&r),t.server=64===(64&r),t.email=32===(32&r),t.objsign=16===(16&r),t.reserved=8===(8&r),t.sslCA=4===(4&r),t.emailCA=2===(2&r),t.objCA=1===(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];l=i.fromDer(t.value);for(var d=0;d=S&&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))}o.getTBSCertificate=function(e){var t=A(e.validity.notBefore),r=A(e.validity.notAfter),s=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()),w(e.siginfo.algorithmOid,e.siginfo.parameters)]),y(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),y(e.subject),o.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&s.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&&s.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&&s.value.push(o.certificateExtensionsToAsn1(e.extensions)),s},o.getCertificationRequestInfo=function(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()),y(e.subject),o.publicKeyToAsn1(e.publicKey),E(e)])},o.distinguishedNameToAsn1=function(e){return y(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.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()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.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;nu.validity.notAfter)&&(l={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:s}),null===l){if(null===(h=t[0]||e.getIssuer(u))&&u.isIssuer(u)&&(d=!0,h=u),h){var f=h;n.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){h=f.shift();try{p=h.verify(u)}catch(S){}}p||(l={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==l||h&&!d||e.hasCertificate(u)||(l={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===l&&h&&!u.isIssuer(h)&&(l={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===l)for(var g={keyUsage:!0,basicConstraints:!0},m=0;null===l&&mv.pathLenConstraint&&(l={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}var w=null===l||l.error,E=r.verify?r.verify(w,c,i):w;if(!0!==E)throw!0===w&&(l={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(E||0===E)&&("object"!==typeof E||n.util.isArray(E)?"string"===typeof E&&(l.error=E):(E.message&&(l.message=E.message),E.error&&(l.error=E.error))),l;l=null,a=!1,++c}while(t.length>0);return!0}},9879:(e,t,r)=>{const n=r(5125),i=r(2673);e.exports=class{constructor(){this._buffer=new n,this._waitingConsumers=new n}push(e){const{promise:t,resolve:r}=i();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},2673:e=>{"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},3931:(e,t,r)=>{"use strict";e.exports=r(3794).default},3794:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(7922),o=n(r(8974)),s=n(r(4514)),a=r(7201),l=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"].map((e=>new i.Netmask(e)));function c(e){return/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e)}t.default=e=>{if((0,a.isValid)(e)){const t=(0,a.parse)(e);if("ipv4"===t.kind())return function(e){for(let t of l)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return c(e)}else if((0,s.default)(e)&&o.default.v6().test(e))return c(e)}},4514:(e,t,r)=>{"use strict";const n=r(8974),i=e=>n({exact:!0}).test(e);i.v4=e=>n.v4({exact:!0}).test(e),i.v6=e=>n.v6({exact:!0}).test(e),i.version=e=>i(e)?i.v4(e)?4:6:void 0,e.exports=i},5368:(e,t,r)=>{"use strict";e.exports=r(8154)},9899:(e,t,r)=>{"use strict";e.exports=r(4582)},1427:e=>{"use strict";e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},7276:(e,t,r)=>{"use strict";var n=t,i=r(222),o=r(2440);function s(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",n);for(var o=t.resolvedType.values,s=Object.keys(o),a=0;a>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,l)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,r,n,n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var o=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,o?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n{"use strict";e.exports=function(e){var t=o.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos>>3){");for(var r=0;r>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===i.basic[l]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",l),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',c):t("%s[k]=value",c)):a.repeated?(t("if(!(%s&&%s.length))",c,c)("%s=[]",c),void 0!==i.packed[l]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";e.exports=function(e){for(var t,r=o.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(o.compareFieldsById),l=0;l>>0,8|i.mapKey[c.keyType],c.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),r("}")("}")):c.repeated?(r("if(%s!=null&&%s.length){",t,t),c.packed&&void 0!==i.packed[h]?r("w.uint32(%i).fork()",(c.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?s(r,c,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(c.id<<3|d)>>>0,h,t)),r("}")):(c.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,c.name),void 0===d?s(r,c,u,t):r("w.uint32(%i).%s(%s)",(c.id<<3|d)>>>0,h,t))}return r("return w")};var n=r(222),i=r(8517),o=r(2440);function s(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},222:(e,t,r)=>{"use strict";e.exports=s;var n=r(5154);((s.prototype=Object.create(n.prototype)).constructor=s).className="Enum";var i=r(3452),o=r(2440);function s(e,t,r,i,o,s){if(n.call(this,e,r),t&&"object"!==typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=o||{},this.valuesOptions=s,this.reserved=void 0,t)for(var a=Object.keys(t),l=0;l{"use strict";e.exports=c;var n=r(5154);((c.prototype=Object.create(n.prototype)).constructor=c).className="Field";var i,o=r(222),s=r(8517),a=r(2440),l=/^required|optional|repeated$/;function c(e,t,r,i,o,c,u){if(a.isObject(i)?(u=o,c=i,i=o=void 0):a.isObject(o)&&(u=c,c=o,o=void 0),n.call(this,e,c),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==i&&!l.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==o&&!a.isString(o))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=r,this.id=t,this.extend=o||void 0,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==s.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}c.fromJSON=function(e,t){return new c(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(c.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),c.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},c.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},c.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=s.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&"string"===typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof o)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"===typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},c.d=function(e,t,r,n){return"function"===typeof t?t=a.decorateType(t).name:t&&"object"===typeof t&&(t=a.decorateEnum(t).name),function(i,o){a.decorateType(i.constructor).add(new c(o,e,t,r,{default:n}))}},c._configure=function(e){i=e}},4582:(e,t,r)=>{"use strict";var n=e.exports=r(4722);n.build="light",n.load=function(e,t,r){return"function"===typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(6886),n.decoder=r(2715),n.verifier=r(709),n.converter=r(7276),n.ReflectionObject=r(5154),n.Namespace=r(3452),n.Root=r(8622),n.Enum=r(222),n.Type=r(8716),n.Field=r(6734),n.OneOf=r(9794),n.MapField=r(4479),n.Service=r(4173),n.Method=r(4865),n.Message=r(4486),n.wrappers=r(9025),n.types=r(8517),n.util=r(2440),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},4722:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(7063),n.BufferWriter=r(2815),n.Reader=r(6216),n.BufferReader=r(3557),n.util=r(3097),n.rpc=r(9994),n.roots=r(7907),n.configure=i,i()},8154:(e,t,r)=>{"use strict";var n=e.exports=r(4582);n.build="full",n.tokenize=r(3077),n.parse=r(7781),n.common=r(1427),n.Root._configure(n.Type,n.parse,n.common)},4479:(e,t,r)=>{"use strict";e.exports=s;var n=r(6734);((s.prototype=Object.create(n.prototype)).constructor=s).className="MapField";var i=r(8517),o=r(2440);function s(e,t,r,i,s,a){if(n.call(this,e,t,i,void 0,void 0,s,a),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},s.d=function(e,t,r){return"function"===typeof r?r=o.decorateType(r).name:r&&"object"===typeof r&&(r=o.decorateEnum(r).name),function(n,i){o.decorateType(n.constructor).add(new s(i,e,t,r))}}},4486:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e){if(e)for(var t=Object.keys(e),r=0;r{"use strict";e.exports=o;var n=r(5154);((o.prototype=Object.create(n.prototype)).constructor=o).className="Method";var i=r(2440);function o(e,t,r,o,s,a,l,c,u){if(i.isObject(s)?(l=s,s=a=void 0):i.isObject(a)&&(l=a,a=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(r))throw TypeError("requestType must be a string");if(!i.isString(o))throw TypeError("responseType must be a string");n.call(this,e,l),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=o,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=c,this.parsedOptions=u}o.fromJSON=function(e,t){return new o(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},o.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},3452:(e,t,r)=>{"use strict";e.exports=h;var n=r(5154);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var i,o,s,a=r(6734),l=r(2440),c=r(9794);function u(e,t){if(e&&e.length){for(var r={},n=0;nt)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var r=0;r0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else r.add(r=new h(n))}return t&&r.addJSON(t),r},h.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t-1)return n}else if(n instanceof h&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var i=0;i{"use strict";e.exports=o,o.className="ReflectionObject";var n,i=r(2440);function o(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(o.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.prototype.toJSON=function(){throw Error()},o.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof n&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},o.prototype.getOption=function(e){if(this.options)return this.options[e]},o.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var o=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(o){var s=o[e];i.setProperty(s,r,t)}else(o={})[e]=i.setProperty({},r,t),n.push(o)}else{var a={};a[e]=t,n.push(a)}return this},o.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n{"use strict";e.exports=s;var n=r(5154);((s.prototype=Object.create(n.prototype)).constructor=s).className="OneOf";var i=r(6734),o=r(2440);function s(e,t,r,i){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t-1&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t{"use strict";e.exports=A,A.filename=null,A.defaults={keepCase:!1};var n=r(3077),i=r(8622),o=r(8716),s=r(6734),a=r(4479),l=r(9794),c=r(222),u=r(4173),h=r(4865),d=r(8517),f=r(2440),p=/^[1-9][0-9]*$/,g=/^-?[1-9][0-9]*$/,m=/^0[x][0-9a-fA-F]+$/,y=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,b=/^-?0[0-7]+$/,w=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,S=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,_=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function A(e,t,r){t instanceof i||(r=t,t=new i),r||(r=A.defaults);var C,k,I,T,R,P=r.preferTrailingComment||!1,x=n(e,r.alternateCommentMode||!1),N=x.next,O=x.push,D=x.peek,M=x.skip,L=x.cmnt,B=!0,U=!1,F=t,j=r.keepCase?function(e){return e}:f.camelCase;function V(e,t,r){var n=A.filename;return r||(A.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+x.line+")")}function K(){var e,t=[];do{if('"'!==(e=N())&&"'"!==e)throw V(e);t.push(N()),M(e),e=D()}while('"'===e||"'"===e);return t.join("")}function z(e){var t=N();switch(t){case"'":case'"':return O(t),K();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(e))return r*parseInt(e,10);if(m.test(e))return r*parseInt(e,16);if(v.test(e))return r*parseInt(e,8);if(w.test(e))return r*parseFloat(e);throw V(e,"number",t)}(t,!0)}catch(r){if(e&&S.test(t))return t;throw V(t,"value")}}function q(e,t){var r,n;do{!t||'"'!==(r=D())&&"'"!==r?e.push([n=H(N()),M("to",!0)?H(N()):n]):e.push(K())}while(M(",",!0));M(";")}function H(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw V(e,"id");if(g.test(e))return parseInt(e,10);if(y.test(e))return parseInt(e,16);if(b.test(e))return parseInt(e,8);throw V(e,"id")}function G(){if(void 0!==C)throw V("package");if(C=N(),!S.test(C))throw V(C,"name");F=F.define(C),M(";")}function W(){var e,t=D();switch(t){case"weak":e=I||(I=[]),N();break;case"public":N();default:e=k||(k=[])}t=K(),M(";"),e.push(t)}function Z(){if(M("="),T=K(),!(U="proto3"===T)&&"proto2"!==T)throw V(T,"syntax");M(";")}function Q(e,t){switch(t){case"option":return ee(e,t),M(";"),!0;case"message":return J(e,t),!0;case"enum":return $(e,t),!0;case"service":return function(e,t){if(!E.test(t=N()))throw V(t,"service name");var r=new u(t);Y(r,(function(e){if(!Q(r,e)){if("rpc"!==e)throw V(e);!function(e,t){var r=L(),n=t;if(!E.test(t=N()))throw V(t,"name");var i,o,s,a,l=t;M("("),M("stream",!0)&&(o=!0);if(!S.test(t=N()))throw V(t);i=t,M(")"),M("returns"),M("("),M("stream",!0)&&(a=!0);if(!S.test(t=N()))throw V(t);s=t,M(")");var c=new h(l,n,i,s,o,a);c.comment=r,Y(c,(function(e){if("option"!==e)throw V(e);ee(c,e),M(";")})),e.add(c)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!S.test(t=N()))throw V(t,"reference");var r=t;Y(null,(function(t){switch(t){case"required":case"repeated":X(e,t,r);break;case"optional":X(e,U?"proto3_optional":"optional",r);break;default:if(!U||!S.test(t))throw V(t);O(t),X(e,"optional",r)}}))}(e,t),!0}return!1}function Y(e,t,r){var n=x.line;if(e&&("string"!==typeof e.comment&&(e.comment=L()),e.filename=A.filename),M("{",!0)){for(var i;"}"!==(i=N());)t(i);M(";",!0)}else r&&r(),M(";"),e&&("string"!==typeof e.comment||P)&&(e.comment=L(n)||e.comment)}function J(e,t){if(!E.test(t=N()))throw V(t,"type name");var r=new o(t);Y(r,(function(e){if(!Q(r,e))switch(e){case"map":!function(e){M("<");var t=N();if(void 0===d.mapKey[t])throw V(t,"type");M(",");var r=N();if(!S.test(r))throw V(r,"type");M(">");var n=N();if(!E.test(n))throw V(n,"name");M("=");var i=new a(j(n),H(N()),t,r);Y(i,(function(e){if("option"!==e)throw V(e);ee(i,e),M(";")}),(function(){ne(i)})),e.add(i)}(r);break;case"required":case"repeated":X(r,e);break;case"optional":X(r,U?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!E.test(t=N()))throw V(t,"name");var r=new l(j(t));Y(r,(function(e){"option"===e?(ee(r,e),M(";")):(O(e),X(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":q(r.extensions||(r.extensions=[]));break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:if(!U||!S.test(e))throw V(e);O(e),X(r,"optional")}})),e.add(r)}function X(e,t,r){var n=N();if("group"!==n){if(!S.test(n))throw V(n,"type");var i=N();if(!E.test(i))throw V(i,"name");i=j(i),M("=");var a=new s(i,H(N()),n,t,r);if(Y(a,(function(e){if("option"!==e)throw V(e);ee(a,e),M(";")}),(function(){ne(a)})),"proto3_optional"===t){var c=new l("_"+i);a.setOption("proto3_optional",!0),c.add(a),e.add(c)}else e.add(a);U||!a.repeated||void 0===d.packed[n]&&void 0!==d.basic[n]||a.setOption("packed",!1,!0)}else!function(e,t){var r=N();if(!E.test(r))throw V(r,"name");var n=f.lcFirst(r);r===n&&(r=f.ucFirst(r));M("=");var i=H(N()),a=new o(r);a.group=!0;var l=new s(n,i,r,t);l.filename=A.filename,Y(a,(function(e){switch(e){case"option":ee(a,e),M(";");break;case"required":case"repeated":X(a,e);break;case"optional":X(a,U?"proto3_optional":"optional");break;case"message":J(a,e);break;case"enum":$(a,e);break;default:throw V(e)}})),e.add(a).add(l)}(e,t)}function $(e,t){if(!E.test(t=N()))throw V(t,"name");var r=new c(t);Y(r,(function(e){switch(e){case"option":ee(r,e),M(";");break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!E.test(t))throw V(t,"name");M("=");var r=H(N(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Y(n,(function(e){if("option"!==e)throw V(e);ee(n,e),M(";")}),(function(){ne(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function ee(e,t){var r=M("(",!0);if(!S.test(t=N()))throw V(t,"name");var n,i=t,o=i;r&&(M(")"),o=i="("+i+")",t=D(),_.test(t)&&(n=t.slice(1),i+=t,N())),M("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,o,te(e,i),n)}function te(e,t){if(M("{",!0)){for(var r={};!M("}",!0);){if(!E.test(R=N()))throw V(R,"name");var n,i=R;if(M(":",!0),"{"===D())n=te(e,t+"."+R);else if("["===D()){var o;if(n=[],M("[",!0)){do{o=z(!0),n.push(o)}while(M(",",!0));M("]"),"undefined"!==typeof o&&re(e,t+"."+R,o)}}else n=z(!0),re(e,t+"."+R,n);var s=r[i];s&&(n=[].concat(s).concat(n)),r[i]=n,M(",",!0),M(";",!0)}return r}var a=z(!0);return re(e,t,a),a}function re(e,t,r){e.setOption&&e.setOption(t,r)}function ne(e){if(M("[",!0)){do{ee(e,"option")}while(M(",",!0));M("]")}return e}for(;null!==(R=N());)switch(R){case"package":if(!B)throw V(R);G();break;case"import":if(!B)throw V(R);W();break;case"syntax":if(!B)throw V(R);Z();break;case"option":ee(F,R),M(";");break;default:if(Q(F,R)){B=!1;continue}throw V(R)}return A.filename=null,{package:C,imports:k,weakImports:I,syntax:T,root:t}}},6216:(e,t,r)=>{"use strict";e.exports=l;var n,i=r(3097),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(l.create=function(e){return i.Buffer.isBuffer(e)?new n(e):c(e)})(e)}:c};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}l.create=u(),l.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,l.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},l.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},l.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){n=e,l.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(l.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},3557:(e,t,r)=>{"use strict";e.exports=o;var n=r(6216);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(3097);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},8622:(e,t,r)=>{"use strict";e.exports=h;var n=r(3452);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var i,o,s,a=r(6734),l=r(222),c=r(9794),u=r(2440);function h(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,r,n){"function"===typeof r&&(n=r,r=void 0);var i=this;if(!n)return u.asPromise(e,i,t,r);var a=n===d;function l(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function c(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in s)return r}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){o.filename=e;var n,s=o(t,i,r),h=0;if(s.imports)for(;h-1))if(i.files.push(e),e in s)a?h(e,s[e]):(++p,setTimeout((function(){--p,h(e,s[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(o){return void(t||l(o))}h(e,r)}else++p,i.fetch(e,(function(r,o){--p,n&&(r?t?p||l(null,i):l(r):h(e,o))}))}var p=0;u.isString(t)&&(t=[t]);for(var g,m=0;m-1&&this.deferred.splice(t,1)}}else if(e instanceof l)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r{"use strict";e.exports={}},9994:(e,t,r)=>{"use strict";t.Service=r(4281)},4281:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(l){return a.emit("error",l,t),void setTimeout((function(){s(l)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},4173:(e,t,r)=>{"use strict";e.exports=a;var n=r(3452);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var i=r(4865),o=r(2440),s=r(9994);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function l(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),o=0;o{"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,o=/^\s*\*?\/*/,s=/\n/g,a=/\s/,l=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(l,(function(e,t){switch(t){case"\\":case"":return t;default:return c[t]||""}}))}function h(e,l){e=e.toString();var c=0,h=e.length,d=1,f=0,p={},g=[],m=null;function y(e){return Error("illegal "+e+" (line "+d+")")}function v(t){return e.charAt(t)}function b(t,r,n){var a,c={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(l?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){c.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,r).split(s),g=0;g0)return g.shift();if(m)return function(){var t="'"===m?n:r;t.lastIndex=c-1;var i=t.exec(e);if(!i)throw y("string");return c=t.lastIndex,_(m),m=null,u(i[1])}();var i,o,s,f,p,S=0===c;do{if(c===h)return null;for(i=!1;a.test(s=v(c));)if("\n"===s&&(S=!0,++d),++c===h)return null;if("/"===v(c)){if(++c===h)throw y("comment");if("/"===v(c))if(l){if(f=c,p=!1,w(c)){p=!0;do{if((c=E(c))===h)break;if(c++,!S)break}while(w(c))}else c=Math.min(h,E(c)+1);p&&(b(f,c,S),S=!0),d++,i=!0}else{for(p="/"===v(f=c+1);"\n"!==v(++c);)if(c===h)return null;++c,p&&(b(f,c-1,S),S=!0),++d,i=!0}else{if("*"!==(s=v(c)))return"/";f=c+1,p=l||"*"===v(f);do{if("\n"===s&&++d,++c===h)throw y("comment");o=s,s=v(c)}while("*"!==o||"/"!==s);++c,p&&(b(f,c-2,S),S=!0),i=!0}}}while(i);var A=c;if(t.lastIndex=0,!t.test(v(A++)))for(;A{"use strict";e.exports=v;var n=r(3452);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var i=r(222),o=r(9794),s=r(6734),a=r(4479),l=r(4173),c=r(4486),u=r(6216),h=r(7063),d=r(2440),f=r(6886),p=r(2715),g=r(709),m=r(7276),y=r(9025);function v(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t{"use strict";var n=t,i=r(2440),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var r=0,n={};for(t|=0;r{"use strict";var n,i,o=e.exports=r(3097),s=r(7907);o.codegen=r(3297),o.fetch=r(7635),o.path=r(7468),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n0)t[i]=e(t[i]||{},r,n);else{var o=t[i];o&&(n=[].concat(o).concat(n)),t[i]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(r(8622)))}})},9351:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},3097:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;ie,set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(9351),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,n={};r.length&&t("var p={}");for(var l=0;l{"use strict";var n=t,i=r(4486);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var o=this.lookup(n);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var s=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=n,s}return this.toObject(e,t)}}},7063:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(3097),o=i.LongBits,s=i.base64,a=i.utf8;function l(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function m(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new l(e,t,r),this.len+=t,this},p.prototype=Object.create(l.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var y=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(y,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},2815:(e,t,r)=>{"use strict";e.exports=o;var n=r(7063);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(3097);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},4463:(e,t,r)=>{"use strict";var n=r(2791),i=r(5296);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r
= it.Source | (() => it.Source) | it.Duplex\nexport type Transform = it.Transform | it.Duplex\nexport type Sink = it.Sink | it.Duplex\n\nexport function pipe (\n first: Source\n): it.Source\n\nexport function pipe (\n first: Source,\n second: Sink\n): B\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Sink\n): C\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Transform,\n fourth: Sink\n): D\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Transform,\n fourth: Transform,\n fifth: Sink\n): E\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Transform,\n fourth: Transform,\n fifth: Transform,\n sixth: Sink\n): F\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Transform,\n fourth: Transform,\n fifth: Transform,\n sixth: Transform,\n seventh: Sink\n): G\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Transform,\n fourth: Transform,\n fifth: Transform,\n sixth: Transform,\n seventh: Transform,\n eighth: Sink\n): H\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Transform,\n fourth: Transform,\n fifth: Transform,\n sixth: Transform,\n seventh: Transform,\n eighth: Transform,\n ninth: Sink\n): I\n\nexport function pipe (\n first: Source,\n second: Transform,\n third: Transform,\n fourth: Transform,\n fifth: Transform,\n sixth: Transform,\n seventh: Transform,\n eighth: Transform,\n ninth: Transform,\n tenth: Sink\n): J\n\nexport function pipe (first: any, ...rest: any[]): any {\n // Duplex at start: wrap in function and return duplex source\n if (isDuplex(first)) {\n const duplex = first\n first = () => duplex.source\n // Iterable at start: wrap in function\n } else if (isIterable(first)) {\n const source = first\n first = () => source\n }\n\n const fns = [first, ...rest]\n\n if (fns.length > 1) {\n // Duplex at end: use duplex sink\n if (isDuplex(fns[fns.length - 1])) {\n fns[fns.length - 1] = fns[fns.length - 1].sink\n }\n }\n\n if (fns.length > 2) {\n // Duplex in the middle, consume source with duplex sink and return duplex source\n for (let i = 1; i < fns.length - 1; i++) {\n if (isDuplex(fns[i])) {\n fns[i] = duplexPipelineFn(fns[i])\n }\n }\n }\n\n return rawPipe(...fns)\n}\n","import { Peer } from \"@libp2p/interface-peer-store\";\nimport { Libp2p } from \"libp2p\";\n\n/**\n * Returns a pseudo-random peer that supports the given protocol.\n * Useful for protocols such as store and light push\n */\nexport async function selectRandomPeer(\n peers: Peer[]\n): Promise {\n if (peers.length === 0) return;\n\n const index = Math.round(Math.random() * (peers.length - 1));\n return peers[index];\n}\n\n/**\n * Returns the list of peers that supports the given protocol.\n */\nexport async function getPeersForProtocol(\n libp2p: Libp2p,\n protocols: string[]\n): Promise {\n const peers: Peer[] = [];\n await libp2p.peerStore.forEach((peer) => {\n for (let i = 0; i < protocols.length; i++) {\n if (peer.protocols.includes(protocols[i])) {\n peers.push(peer);\n break;\n }\n }\n });\n return peers;\n}\n","import * as secp from \"@noble/secp256k1\";\n\nimport { getSubtle, randomBytes, sha256 } from \"../crypto\";\nimport { concat, hexToBytes } from \"../utils\";\n/**\n * HKDF as implemented in go-ethereum.\n */\nfunction kdf(secret: Uint8Array, outputLength: number): Promise {\n let ctr = 1;\n let written = 0;\n let willBeResult = Promise.resolve(new Uint8Array());\n while (written < outputLength) {\n const counters = new Uint8Array([ctr >> 24, ctr >> 16, ctr >> 8, ctr]);\n const countersSecret = concat(\n [counters, secret],\n counters.length + secret.length\n );\n const willBeHashResult = sha256(countersSecret);\n willBeResult = willBeResult.then((result) =>\n willBeHashResult.then((hashResult) => {\n const _hashResult = new Uint8Array(hashResult);\n return concat(\n [result, _hashResult],\n result.length + _hashResult.length\n );\n })\n );\n written += 32;\n ctr += 1;\n }\n return willBeResult;\n}\n\nfunction aesCtrEncrypt(\n counter: Uint8Array,\n key: ArrayBufferLike,\n data: ArrayBufferLike\n): Promise {\n return getSubtle()\n .importKey(\"raw\", key, \"AES-CTR\", false, [\"encrypt\"])\n .then((cryptoKey) =>\n getSubtle().encrypt(\n { name: \"AES-CTR\", counter: counter, length: 128 },\n cryptoKey,\n data\n )\n )\n .then((bytes) => new Uint8Array(bytes));\n}\n\nfunction aesCtrDecrypt(\n counter: Uint8Array,\n key: ArrayBufferLike,\n data: ArrayBufferLike\n): Promise {\n return getSubtle()\n .importKey(\"raw\", key, \"AES-CTR\", false, [\"decrypt\"])\n .then((cryptoKey) =>\n getSubtle().decrypt(\n { name: \"AES-CTR\", counter: counter, length: 128 },\n cryptoKey,\n data\n )\n )\n .then((bytes) => new Uint8Array(bytes));\n}\n\nfunction hmacSha256Sign(\n key: ArrayBufferLike,\n msg: ArrayBufferLike\n): PromiseLike {\n const algorithm = { name: \"HMAC\", hash: { name: \"SHA-256\" } };\n return getSubtle()\n .importKey(\"raw\", key, algorithm, false, [\"sign\"])\n .then((cryptoKey) => getSubtle().sign(algorithm, cryptoKey, msg))\n .then((bytes) => new Uint8Array(bytes));\n}\n\nfunction hmacSha256Verify(\n key: ArrayBufferLike,\n msg: ArrayBufferLike,\n sig: ArrayBufferLike\n): Promise {\n const algorithm = { name: \"HMAC\", hash: { name: \"SHA-256\" } };\n const _key = getSubtle().importKey(\"raw\", key, algorithm, false, [\"verify\"]);\n return _key.then((cryptoKey) =>\n getSubtle().verify(algorithm, cryptoKey, sig, msg)\n );\n}\n\n/**\n * Derive shared secret for given private and public keys.\n *\n * @param privateKeyA Sender's private key (32 bytes)\n * @param publicKeyB Recipient's public key (65 bytes)\n * @returns A promise that resolves with the derived shared secret (Px, 32 bytes)\n * @throws Error If arguments are invalid\n */\nfunction derive(privateKeyA: Uint8Array, publicKeyB: Uint8Array): Uint8Array {\n if (privateKeyA.length !== 32) {\n throw new Error(\n `Bad private key, it should be 32 bytes but it's actually ${privateKeyA.length} bytes long`\n );\n } else if (publicKeyB.length !== 65) {\n throw new Error(\n `Bad public key, it should be 65 bytes but it's actually ${publicKeyB.length} bytes long`\n );\n } else if (publicKeyB[0] !== 4) {\n throw new Error(\"Bad public key, a valid public key would begin with 4\");\n } else {\n const px = secp.getSharedSecret(privateKeyA, publicKeyB, true);\n // Remove the compression prefix\n return new Uint8Array(hexToBytes(px).slice(1));\n }\n}\n\n/**\n * Encrypt message for given recipient's public key.\n *\n * @param publicKeyTo Recipient's public key (65 bytes)\n * @param msg The message being encrypted\n * @return A promise that resolves with the ECIES structure serialized\n */\nexport async function encrypt(\n publicKeyTo: Uint8Array,\n msg: Uint8Array\n): Promise {\n const ephemPrivateKey = randomBytes(32);\n\n const sharedPx = await derive(ephemPrivateKey, publicKeyTo);\n\n const hash = await kdf(sharedPx, 32);\n\n const iv = randomBytes(16);\n const encryptionKey = hash.slice(0, 16);\n const cipherText = await aesCtrEncrypt(iv, encryptionKey, msg);\n\n const ivCipherText = concat([iv, cipherText], iv.length + cipherText.length);\n\n const macKey = await sha256(hash.slice(16));\n const hmac = await hmacSha256Sign(macKey, ivCipherText);\n const ephemPublicKey = secp.getPublicKey(ephemPrivateKey, false);\n\n return concat(\n [ephemPublicKey, ivCipherText, hmac],\n ephemPublicKey.length + ivCipherText.length + hmac.length\n );\n}\n\nconst metaLength = 1 + 64 + 16 + 32;\n\n/**\n * Decrypt message using given private key.\n *\n * @param privateKey A 32-byte private key of recipient of the message\n * @param encrypted ECIES serialized structure (result of ECIES encryption)\n * @returns The clear text\n * @throws Error If decryption fails\n */\nexport async function decrypt(\n privateKey: Uint8Array,\n encrypted: Uint8Array\n): Promise {\n if (encrypted.length <= metaLength) {\n throw new Error(\n `Invalid Ciphertext. Data is too small. It should ba at least ${metaLength} bytes`\n );\n } else if (encrypted[0] !== 4) {\n throw new Error(\n `Not a valid ciphertext. It should begin with 4 but actually begin with ${encrypted[0]}`\n );\n } else {\n // deserialize\n const ephemPublicKey = encrypted.slice(0, 65);\n const cipherTextLength = encrypted.length - metaLength;\n const iv = encrypted.slice(65, 65 + 16);\n const cipherAndIv = encrypted.slice(65, 65 + 16 + cipherTextLength);\n const ciphertext = cipherAndIv.slice(16);\n const msgMac = encrypted.slice(65 + 16 + cipherTextLength);\n\n // check HMAC\n const px = derive(privateKey, ephemPublicKey);\n const hash = await kdf(px, 32);\n const [encryptionKey, macKey] = await sha256(hash.slice(16)).then(\n (macKey) => [hash.slice(0, 16), macKey]\n );\n\n if (!(await hmacSha256Verify(macKey, cipherAndIv, msgMac))) {\n throw new Error(\"Incorrect MAC\");\n }\n\n return aesCtrDecrypt(iv, encryptionKey, ciphertext);\n }\n}\n","import * as secp from \"@noble/secp256k1\";\n\nimport { keccak256, randomBytes, sign } from \"../crypto\";\nimport { concat, hexToBytes } from \"../utils\";\n\nimport { Symmetric } from \"./constants\";\nimport * as ecies from \"./ecies\";\nimport * as symmetric from \"./symmetric\";\n\nconst FlagsLength = 1;\nconst FlagMask = 3; // 0011\nconst IsSignedMask = 4; // 0100\nconst PaddingTarget = 256;\nconst SignatureLength = 65;\n\nexport type Signature = {\n signature: Uint8Array;\n publicKey: Uint8Array | undefined;\n};\n\n/**\n * Encode the payload pre-encryption.\n *\n * @internal\n * @param messagePayload: The payload to include in the message\n * @param sigPrivKey: If set, a signature using this private key is added.\n * @returns The encoded payload, ready for encryption using {@link encryptAsymmetric}\n * or {@link encryptSymmetric}.\n */\nexport async function clearEncode(\n messagePayload: Uint8Array,\n sigPrivKey?: Uint8Array\n): Promise<{ payload: Uint8Array; sig?: Signature }> {\n let envelope = new Uint8Array([0]); // No flags\n envelope = addPayloadSizeField(envelope, messagePayload);\n envelope = concat([envelope, messagePayload]);\n\n // Calculate padding:\n let rawSize =\n FlagsLength +\n computeSizeOfPayloadSizeField(messagePayload) +\n messagePayload.length;\n\n if (sigPrivKey) {\n rawSize += SignatureLength;\n }\n\n const remainder = rawSize % PaddingTarget;\n const paddingSize = PaddingTarget - remainder;\n const pad = randomBytes(paddingSize);\n\n if (!validateDataIntegrity(pad, paddingSize)) {\n throw new Error(\"failed to generate random padding of size \" + paddingSize);\n }\n\n envelope = concat([envelope, pad]);\n let sig;\n if (sigPrivKey) {\n envelope[0] |= IsSignedMask;\n const hash = keccak256(envelope);\n const bytesSignature = await sign(hash, sigPrivKey);\n envelope = concat([envelope, bytesSignature]);\n sig = {\n signature: bytesSignature,\n publicKey: secp.getPublicKey(sigPrivKey, false),\n };\n }\n\n return { payload: envelope, sig };\n}\n\n/**\n * Decode a decrypted payload.\n *\n * @internal\n */\nexport function clearDecode(\n message: Uint8Array\n): { payload: Uint8Array; sig?: Signature } | undefined {\n const sizeOfPayloadSizeField = getSizeOfPayloadSizeField(message);\n if (sizeOfPayloadSizeField === 0) return;\n\n const payloadSize = getPayloadSize(message, sizeOfPayloadSizeField);\n const payloadStart = 1 + sizeOfPayloadSizeField;\n const payload = message.slice(payloadStart, payloadStart + payloadSize);\n\n const isSigned = isMessageSigned(message);\n\n let sig;\n if (isSigned) {\n const signature = getSignature(message);\n const hash = getHash(message, isSigned);\n const publicKey = ecRecoverPubKey(hash, signature);\n sig = { signature, publicKey };\n }\n\n return { payload, sig };\n}\n\nfunction getSizeOfPayloadSizeField(message: Uint8Array): number {\n const messageDataView = new DataView(message.buffer);\n return messageDataView.getUint8(0) & FlagMask;\n}\n\nfunction getPayloadSize(\n message: Uint8Array,\n sizeOfPayloadSizeField: number\n): number {\n let payloadSizeBytes = message.slice(1, 1 + sizeOfPayloadSizeField);\n // int 32 == 4 bytes\n if (sizeOfPayloadSizeField < 4) {\n // If less than 4 bytes pad right (Little Endian).\n payloadSizeBytes = concat(\n [payloadSizeBytes, new Uint8Array(4 - sizeOfPayloadSizeField)],\n 4\n );\n }\n const payloadSizeDataView = new DataView(payloadSizeBytes.buffer);\n return payloadSizeDataView.getInt32(0, true);\n}\n\nfunction isMessageSigned(message: Uint8Array): boolean {\n const messageDataView = new DataView(message.buffer);\n return (messageDataView.getUint8(0) & IsSignedMask) == IsSignedMask;\n}\n\n/**\n * Proceed with Asymmetric encryption of the data as per [26/WAKU-PAYLOAD](https://rfc.vac.dev/spec/26/).\n * The data MUST be flags | payload-length | payload | [signature].\n * The returned result can be set to `WakuMessage.payload`.\n *\n * @internal\n */\nexport async function encryptAsymmetric(\n data: Uint8Array,\n publicKey: Uint8Array | string\n): Promise {\n return ecies.encrypt(hexToBytes(publicKey), data);\n}\n\n/**\n * Proceed with Asymmetric decryption of the data as per [26/WAKU-PAYLOAD](https://rfc.vac.dev/spec/26/).\n * The returned data is expected to be `flags | payload-length | payload | [signature]`.\n *\n * @internal\n */\nexport async function decryptAsymmetric(\n payload: Uint8Array,\n privKey: Uint8Array\n): Promise {\n return ecies.decrypt(privKey, payload);\n}\n\n/**\n * Proceed with Symmetric encryption of the data as per [26/WAKU-PAYLOAD](https://rfc.vac.dev/spec/26/).\n *\n * @param data The data to encrypt, expected to be `flags | payload-length | payload | [signature]`.\n * @param key The key to use for encryption.\n * @returns The decrypted data, `cipherText | tag | iv` and can be set to `WakuMessage.payload`.\n *\n * @internal\n */\nexport async function encryptSymmetric(\n data: Uint8Array,\n key: Uint8Array | string\n): Promise {\n const iv = symmetric.generateIv();\n\n // Returns `cipher | tag`\n const cipher = await symmetric.encrypt(iv, hexToBytes(key), data);\n return concat([cipher, iv]);\n}\n\n/**\n * Proceed with Symmetric decryption of the data as per [26/WAKU-PAYLOAD](https://rfc.vac.dev/spec/26/).\n *\n * @param payload The cipher data, it is expected to be `cipherText | tag | iv`.\n * @param key The key to use for decryption.\n * @returns The decrypted data, expected to be `flags | payload-length | payload | [signature]`.\n *\n * @internal\n */\nexport async function decryptSymmetric(\n payload: Uint8Array,\n key: Uint8Array | string\n): Promise {\n const ivStart = payload.length - Symmetric.ivSize;\n const cipher = payload.slice(0, ivStart);\n const iv = payload.slice(ivStart);\n\n return symmetric.decrypt(iv, hexToBytes(key), cipher);\n}\n\n/**\n * Computes the flags & auxiliary-field as per [26/WAKU-PAYLOAD](https://rfc.vac.dev/spec/26/).\n */\nfunction addPayloadSizeField(msg: Uint8Array, payload: Uint8Array): Uint8Array {\n const fieldSize = computeSizeOfPayloadSizeField(payload);\n let field = new Uint8Array(4);\n const fieldDataView = new DataView(field.buffer);\n fieldDataView.setUint32(0, payload.length, true);\n field = field.slice(0, fieldSize);\n msg = concat([msg, field]);\n msg[0] |= fieldSize;\n return msg;\n}\n\n/**\n * Returns the size of the auxiliary-field which in turns contains the payload size\n */\nfunction computeSizeOfPayloadSizeField(payload: Uint8Array): number {\n let s = 1;\n for (let i = payload.length; i >= 256; i /= 256) {\n s++;\n }\n return s;\n}\n\nfunction validateDataIntegrity(\n value: Uint8Array,\n expectedSize: number\n): boolean {\n if (value.length !== expectedSize) {\n return false;\n }\n\n return expectedSize <= 3 || value.findIndex((i) => i !== 0) !== -1;\n}\n\nfunction getSignature(message: Uint8Array): Uint8Array {\n return message.slice(message.length - SignatureLength, message.length);\n}\n\nfunction getHash(message: Uint8Array, isSigned: boolean): Uint8Array {\n if (isSigned) {\n return keccak256(message.slice(0, message.length - SignatureLength));\n }\n return keccak256(message);\n}\n\nfunction ecRecoverPubKey(\n messageHash: Uint8Array,\n signature: Uint8Array\n): Uint8Array | undefined {\n const recoveryDataView = new DataView(signature.slice(64).buffer);\n const recovery = recoveryDataView.getUint8(0);\n const _signature = secp.Signature.fromCompact(signature.slice(0, 64));\n\n return secp.recoverPublicKey(\n messageHash,\n _signature,\n recovery,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: compressed: false\n false\n );\n}\n","import { getSubtle, randomBytes } from \"../crypto\";\n\nimport { Symmetric } from \"./constants\";\n\nexport async function encrypt(\n iv: Uint8Array,\n key: Uint8Array,\n clearText: Uint8Array\n): Promise {\n return getSubtle()\n .importKey(\"raw\", key, Symmetric.algorithm, false, [\"encrypt\"])\n .then((cryptoKey) =>\n getSubtle().encrypt({ iv, ...Symmetric.algorithm }, cryptoKey, clearText)\n )\n .then((cipher) => new Uint8Array(cipher));\n}\n\nexport async function decrypt(\n iv: Uint8Array,\n key: Uint8Array,\n cipherText: Uint8Array\n): Promise {\n return getSubtle()\n .importKey(\"raw\", key, Symmetric.algorithm, false, [\"decrypt\"])\n .then((cryptoKey) =>\n getSubtle().decrypt({ iv, ...Symmetric.algorithm }, cryptoKey, cipherText)\n )\n .then((clear) => new Uint8Array(clear));\n}\n\nexport function generateIv(): Uint8Array {\n return randomBytes(Symmetric.ivSize);\n}\n","import debug from \"debug\";\n\nimport * as proto from \"../../proto/message\";\nimport { bytesToUtf8, utf8ToBytes } from \"../utils\";\n\nimport * as version_1 from \"./version_1\";\n\nconst DefaultVersion = 0;\nconst dbg = debug(\"waku:message\");\nconst OneMillion = BigInt(1_000_000);\n\nexport enum DecryptionMethod {\n Asymmetric = \"asymmetric\",\n Symmetric = \"symmetric\",\n}\n\nexport interface Options {\n /**\n * Timestamp to set on the message, defaults to now if not passed.\n */\n timestamp?: Date;\n /**\n * Public Key to use to encrypt the messages using ECIES (Asymmetric Encryption).\n *\n * @throws if both `encPublicKey` and `symKey` are passed\n */\n encPublicKey?: Uint8Array | string;\n /**\n * Key to use to encrypt the messages using AES (Symmetric Encryption).\n *\n * @throws if both `encPublicKey` and `symKey` are passed\n */\n symKey?: Uint8Array | string;\n /**\n * Private key to use to sign the message, either `encPublicKey` or `symKey` must be provided as only\n * encrypted messages are signed.\n */\n sigPrivKey?: Uint8Array;\n}\n\n// TODO: Use this in Options\nexport interface DecryptionParams {\n key: Uint8Array;\n method?: DecryptionMethod;\n contentTopics?: string[];\n}\n\nexport class WakuMessage {\n private constructor(\n public proto: proto.WakuMessage,\n private _signaturePublicKey?: Uint8Array,\n private _signature?: Uint8Array\n ) {}\n\n /**\n * Create Message with an utf-8 string as payload.\n */\n static async fromUtf8String(\n utf8: string,\n contentTopic: string,\n opts?: Options\n ): Promise {\n const payload = utf8ToBytes(utf8);\n return WakuMessage.fromBytes(payload, contentTopic, opts);\n }\n\n /**\n * Create a Waku Message with the given payload.\n *\n * By default, the payload is kept clear (version 0).\n * If `opts.encPublicKey` is passed, the payload is encrypted using\n * asymmetric encryption (version 1).\n *\n * If `opts.sigPrivKey` is passed and version 1 is used, the payload is signed\n * before encryption.\n *\n * @throws if both `opts.encPublicKey` and `opt.symKey` are passed\n */\n static async fromBytes(\n payload: Uint8Array,\n contentTopic: string,\n opts?: Options\n ): Promise {\n const { timestamp, encPublicKey, symKey, sigPrivKey } = Object.assign(\n { timestamp: new Date() },\n opts ? opts : {}\n );\n\n let _payload = payload;\n let version = DefaultVersion;\n let sig;\n\n if (encPublicKey && symKey) {\n throw \"Pass either `encPublicKey` or `symKey`, not both.\";\n }\n\n if (encPublicKey) {\n const enc = await version_1.clearEncode(_payload, sigPrivKey);\n _payload = await version_1.encryptAsymmetric(enc.payload, encPublicKey);\n sig = enc.sig;\n version = 1;\n } else if (symKey) {\n const enc = await version_1.clearEncode(_payload, sigPrivKey);\n _payload = await version_1.encryptSymmetric(enc.payload, symKey);\n sig = enc.sig;\n version = 1;\n }\n\n return new WakuMessage(\n {\n payload: _payload,\n timestampDeprecated: timestamp.valueOf() / 1000,\n // milliseconds 10^-3 to nanoseconds 10^-9\n timestamp: BigInt(timestamp.valueOf()) * OneMillion,\n version,\n contentTopic,\n },\n sig?.publicKey,\n sig?.signature\n );\n }\n\n /**\n * Decode a byte array into Waku Message.\n *\n * @params bytes The message encoded using protobuf as defined in [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/).\n * @params decryptionKeys If the payload is encrypted (version = 1), then the\n * keys are used to attempt decryption of the message. The passed key can either\n * be asymmetric private keys or symmetric keys, both method are tried for each\n * key until the message is decrypted or combinations are run out.\n */\n static async decode(\n bytes: Uint8Array,\n decryptionParams?: DecryptionParams[]\n ): Promise {\n const protoBuf = proto.WakuMessage.decode(bytes);\n\n return WakuMessage.decodeProto(protoBuf, decryptionParams);\n }\n\n /**\n * Decode and decrypt Waku Message Protobuf Object into Waku Message.\n *\n * @params protoBuf The message to decode and decrypt.\n * @params decryptionParams If the payload is encrypted (version = 1), then the\n * keys are used to attempt decryption of the message. The passed key can either\n * be asymmetric private keys or symmetric keys, both method are tried for each\n * key until the message is decrypted or combinations are run out.\n */\n static async decodeProto(\n protoBuf: proto.WakuMessage,\n decryptionParams?: DecryptionParams[]\n ): Promise {\n const payload = protoBuf.payload;\n\n let signaturePublicKey;\n let signature;\n if (protoBuf.version === 1 && payload) {\n if (decryptionParams === undefined) {\n dbg(\"Payload is encrypted but no private keys have been provided.\");\n return;\n }\n\n // Returns a bunch of `undefined` and hopefully one decrypted result\n const allResults = await Promise.all(\n decryptionParams.map(async ({ key, method, contentTopics }) => {\n if (\n !contentTopics ||\n (protoBuf.contentTopic &&\n contentTopics.includes(protoBuf.contentTopic))\n ) {\n switch (method) {\n case DecryptionMethod.Asymmetric:\n try {\n return await version_1.decryptAsymmetric(payload, key);\n } catch (e) {\n dbg(\n \"Failed to decrypt message using asymmetric encryption despite decryption method being specified\",\n e\n );\n return;\n }\n case DecryptionMethod.Symmetric:\n try {\n return await version_1.decryptSymmetric(payload, key);\n } catch (e) {\n dbg(\n \"Failed to decrypt message using asymmetric encryption despite decryption method being specified\",\n e\n );\n return;\n }\n default:\n try {\n return await version_1.decryptSymmetric(payload, key);\n } catch (e) {\n dbg(\n \"Failed to decrypt message using symmetric encryption\",\n e\n );\n try {\n return await version_1.decryptAsymmetric(payload, key);\n } catch (e) {\n dbg(\n \"Failed to decrypt message using asymmetric encryption\",\n e\n );\n return;\n }\n }\n }\n } else {\n // No key available for this content topic\n return;\n }\n })\n );\n\n const isDefined = (dec: Uint8Array | undefined): dec is Uint8Array => {\n return !!dec;\n };\n\n const decodedResults = allResults.filter(isDefined);\n\n if (decodedResults.length === 0) {\n dbg(\"Failed to decrypt payload.\");\n return;\n }\n const dec = decodedResults[0];\n\n const res = await version_1.clearDecode(dec);\n if (!res) {\n dbg(\"Failed to decode payload.\");\n return;\n }\n Object.assign(protoBuf, { payload: res.payload });\n signaturePublicKey = res.sig?.publicKey;\n signature = res.sig?.signature;\n }\n\n return new WakuMessage(protoBuf, signaturePublicKey, signature);\n }\n\n encode(): Uint8Array {\n return proto.WakuMessage.encode(this.proto);\n }\n\n get payloadAsUtf8(): string {\n if (!this.payload) {\n return \"\";\n }\n\n try {\n return bytesToUtf8(this.payload);\n } catch (e) {\n dbg(\"Could not decode byte as UTF-8\", e);\n return \"\";\n }\n }\n\n get payload(): Uint8Array | undefined {\n if (this.proto.payload) {\n return new Uint8Array(this.proto.payload);\n }\n return;\n }\n\n get contentTopic(): string | undefined {\n return this.proto.contentTopic;\n }\n\n get version(): number {\n // TODO: absent value should be replaced by default\n // value of the type by the protobuf decoder\n return this.proto.version ?? 0;\n }\n\n get timestamp(): Date | undefined {\n // In the case we receive a value that is bigger than JS's max number,\n // we catch the error and return undefined.\n try {\n if (this.proto.timestamp) {\n // nanoseconds 10^-9 to milliseconds 10^-3\n const timestamp = this.proto.timestamp / OneMillion;\n return new Date(Number(timestamp));\n }\n\n if (this.proto.timestampDeprecated) {\n return new Date(this.proto.timestampDeprecated * 1000);\n }\n } catch (e) {\n return;\n }\n return;\n }\n\n /**\n * The public key used to sign the message.\n *\n * MAY be present if the message is version 1.\n */\n get signaturePublicKey(): Uint8Array | undefined {\n return this._signaturePublicKey;\n }\n\n /**\n * The signature of the message.\n *\n * MAY be present if the message is version 1.\n */\n get signature(): Uint8Array | undefined {\n return this._signature;\n }\n}\n","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from \"protons-runtime\";\nimport type { Uint8ArrayList } from \"uint8arraylist\";\nimport type { Codec } from \"protons-runtime\";\n\nexport interface FilterRequest {\n subscribe?: boolean;\n topic?: string;\n contentFilters: FilterRequest.ContentFilter[];\n}\n\nexport namespace FilterRequest {\n export interface ContentFilter {\n contentTopic?: string;\n }\n\n export namespace ContentFilter {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.contentTopic != null) {\n writer.uint32(10);\n writer.string(obj.contentTopic);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: ContentFilter): Uint8Array => {\n return encodeMessage(obj, ContentFilter.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {\n return decodeMessage(buf, ContentFilter.codec());\n };\n }\n\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.subscribe != null) {\n writer.uint32(8);\n writer.bool(obj.subscribe);\n }\n\n if (obj.topic != null) {\n writer.uint32(18);\n writer.string(obj.topic);\n }\n\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n writer.uint32(26);\n FilterRequest.ContentFilter.codec().encode(value, writer);\n }\n } else {\n throw new Error(\n 'Protocol error: required field \"contentFilters\" was not found in object'\n );\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {\n contentFilters: [],\n };\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.subscribe = reader.bool();\n break;\n case 2:\n obj.topic = reader.string();\n break;\n case 3:\n obj.contentFilters.push(\n FilterRequest.ContentFilter.codec().decode(\n reader,\n reader.uint32()\n )\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: FilterRequest): Uint8Array => {\n return encodeMessage(obj, FilterRequest.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRequest => {\n return decodeMessage(buf, FilterRequest.codec());\n };\n}\n\nexport interface MessagePush {\n messages: WakuMessage[];\n}\n\nexport namespace MessagePush {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.messages != null) {\n for (const value of obj.messages) {\n writer.uint32(10);\n WakuMessage.codec().encode(value, writer);\n }\n } else {\n throw new Error(\n 'Protocol error: required field \"messages\" was not found in object'\n );\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {\n messages: [],\n };\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.messages.push(\n WakuMessage.codec().decode(reader, reader.uint32())\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: MessagePush): Uint8Array => {\n return encodeMessage(obj, MessagePush.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): MessagePush => {\n return decodeMessage(buf, MessagePush.codec());\n };\n}\n\nexport interface FilterRPC {\n requestId?: string;\n request?: FilterRequest;\n push?: MessagePush;\n}\n\nexport namespace FilterRPC {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.requestId != null) {\n writer.uint32(10);\n writer.string(obj.requestId);\n }\n\n if (obj.request != null) {\n writer.uint32(18);\n FilterRequest.codec().encode(obj.request, writer);\n }\n\n if (obj.push != null) {\n writer.uint32(26);\n MessagePush.codec().encode(obj.push, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.request = FilterRequest.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 3:\n obj.push = MessagePush.codec().decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: FilterRPC): Uint8Array => {\n return encodeMessage(obj, FilterRPC.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): FilterRPC => {\n return decodeMessage(buf, FilterRPC.codec());\n };\n}\n\nexport interface WakuMessage {\n payload?: Uint8Array;\n contentTopic?: string;\n version?: number;\n timestampDeprecated?: number;\n timestamp?: bigint;\n}\n\nexport namespace WakuMessage {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.payload != null) {\n writer.uint32(10);\n writer.bytes(obj.payload);\n }\n\n if (obj.contentTopic != null) {\n writer.uint32(18);\n writer.string(obj.contentTopic);\n }\n\n if (obj.version != null) {\n writer.uint32(24);\n writer.uint32(obj.version);\n }\n\n if (obj.timestampDeprecated != null) {\n writer.uint32(33);\n writer.double(obj.timestampDeprecated);\n }\n\n if (obj.timestamp != null) {\n writer.uint32(80);\n writer.sint64(obj.timestamp);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 4:\n obj.timestampDeprecated = reader.double();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: WakuMessage): Uint8Array => {\n return encodeMessage(obj, WakuMessage.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {\n return decodeMessage(buf, WakuMessage.codec());\n };\n}\n","import { v4 as uuid } from \"uuid\";\n\nimport * as proto from \"../../proto/filter\";\n\nexport type ContentFilter = {\n contentTopic: string;\n};\n\n/**\n * FilterRPC represents a message conforming to the Waku Filter protocol\n */\nexport class FilterRPC {\n public constructor(public proto: proto.FilterRPC) {}\n\n static createRequest(\n topic: string,\n contentFilters: ContentFilter[],\n requestId?: string,\n subscribe = true\n ): FilterRPC {\n return new FilterRPC({\n requestId: requestId || uuid(),\n request: {\n subscribe,\n topic,\n contentFilters,\n },\n push: undefined,\n });\n }\n\n /**\n *\n * @param bytes Uint8Array of bytes from a FilterRPC message\n * @returns FilterRPC\n */\n static decode(bytes: Uint8Array): FilterRPC {\n const res = proto.FilterRPC.decode(bytes);\n return new FilterRPC(res);\n }\n\n /**\n * Encode the current FilterRPC request to bytes\n * @returns Uint8Array\n */\n encode(): Uint8Array {\n return proto.FilterRPC.encode(this.proto);\n }\n\n get push(): proto.MessagePush | undefined {\n return this.proto.push;\n }\n\n get requestId(): string | undefined {\n return this.proto.requestId;\n }\n}\n","import type { Stream } from \"@libp2p/interface-connection\";\nimport type { PeerId } from \"@libp2p/interface-peer-id\";\nimport type { Peer } from \"@libp2p/interface-peer-store\";\nimport type { IncomingStreamData } from \"@libp2p/interface-registrar\";\nimport debug from \"debug\";\nimport all from \"it-all\";\nimport * as lp from \"it-length-prefixed\";\nimport { pipe } from \"it-pipe\";\nimport type { Libp2p } from \"libp2p\";\n\nimport { WakuMessage as WakuMessageProto } from \"../../proto/message\";\nimport { DefaultPubSubTopic } from \"../constants\";\nimport { getPeersForProtocol, selectRandomPeer } from \"../select_peer\";\nimport { hexToBytes } from \"../utils\";\nimport { DecryptionMethod, WakuMessage } from \"../waku_message\";\n\nimport { ContentFilter, FilterRPC } from \"./filter_rpc\";\nexport { ContentFilter };\n\nexport const FilterCodec = \"/vac/waku/filter/2.0.0-beta1\";\n\nconst log = debug(\"waku:filter\");\n\nexport interface CreateOptions {\n /**\n * The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}.\n *\n * The usage of the default pubsub topic is recommended.\n * See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for details.\n *\n * @default {@link DefaultPubSubTopic}\n */\n pubSubTopic?: string;\n}\n\nexport type FilterSubscriptionOpts = {\n /**\n * The Pubsub topic for the subscription\n */\n pubsubTopic?: string;\n /**\n * Optionally specify a PeerId for the subscription. If not included, will use a random peer.\n */\n peerId?: PeerId;\n};\n\nexport type FilterCallback = (msg: WakuMessage) => void | Promise;\n\nexport type UnsubscribeFunction = () => Promise;\n\n/**\n * Implements client side of the [Waku v2 Filter protocol](https://rfc.vac.dev/spec/12/).\n *\n * Note this currently only works in NodeJS when the Waku node is listening on a port, see:\n * - https://github.com/status-im/go-waku/issues/245\n * - https://github.com/status-im/nwaku/issues/948\n */\nexport class WakuFilter {\n pubSubTopic: string;\n private subscriptions: Map;\n public decryptionKeys: Map<\n Uint8Array,\n { method?: DecryptionMethod; contentTopics?: string[] }\n >;\n\n constructor(public libp2p: Libp2p, options?: CreateOptions) {\n this.subscriptions = new Map();\n this.decryptionKeys = new Map();\n this.pubSubTopic = options?.pubSubTopic ?? DefaultPubSubTopic;\n this.libp2p\n .handle(FilterCodec, this.onRequest.bind(this))\n .catch((e) => log(\"Failed to register filter protocol\", e));\n }\n\n /**\n * @param contentTopics Array of ContentTopics to subscribe to. If empty, no messages will be returned from the filter.\n * @param callback A function that will be called on each message returned by the filter.\n * @param opts The FilterSubscriptionOpts used to narrow which messages are returned, and which peer to connect to.\n * @returns Unsubscribe function that can be used to end the subscription.\n */\n async subscribe(\n callback: FilterCallback,\n contentTopics: string[],\n opts?: FilterSubscriptionOpts\n ): Promise {\n const topic = opts?.pubsubTopic ?? this.pubSubTopic;\n const contentFilters = contentTopics.map((contentTopic) => ({\n contentTopic,\n }));\n const request = FilterRPC.createRequest(\n topic,\n contentFilters,\n undefined,\n true\n );\n\n const requestId = request.requestId;\n if (!requestId)\n throw new Error(\n \"Internal error: createRequest expected to set `requestId`\"\n );\n\n const peer = await this.getPeer(opts?.peerId);\n const stream = await this.newStream(peer);\n\n try {\n const res = await pipe(\n [request.encode()],\n lp.encode(),\n stream,\n lp.decode(),\n async (source) => await all(source)\n );\n\n log(\"response\", res);\n } catch (e) {\n log(\n \"Error subscribing to peer \",\n peer.id.toString(),\n \"for content topics\",\n contentTopics,\n \": \",\n e\n );\n throw e;\n }\n\n this.addCallback(requestId, callback);\n\n return async () => {\n await this.unsubscribe(topic, contentFilters, requestId, peer);\n this.removeCallback(requestId);\n };\n }\n\n private onRequest(streamData: IncomingStreamData): void {\n log(\"Receiving message push\");\n try {\n pipe(streamData.stream, lp.decode(), async (source) => {\n for await (const bytes of source) {\n const res = FilterRPC.decode(bytes.slice());\n if (res.requestId && res.push?.messages?.length) {\n await this.pushMessages(res.requestId, res.push.messages);\n }\n }\n }).then(\n () => {\n log(\"Receiving pipe closed.\");\n },\n (e) => {\n log(\"Error with receiving pipe\", e);\n }\n );\n } catch (e) {\n log(\"Error decoding message\", e);\n }\n }\n\n private async pushMessages(\n requestId: string,\n messages: WakuMessageProto[]\n ): Promise {\n const callback = this.subscriptions.get(requestId);\n if (!callback) {\n log(`No callback registered for request ID ${requestId}`);\n return;\n }\n\n const decryptionKeys = Array.from(this.decryptionKeys).map(\n ([key, { method, contentTopics }]) => {\n return {\n key,\n method,\n contentTopics,\n };\n }\n );\n\n for (const message of messages) {\n const decoded = await WakuMessage.decodeProto(message, decryptionKeys);\n if (!decoded) {\n log(\"Not able to decode message\");\n continue;\n }\n callback(decoded);\n }\n }\n\n private addCallback(requestId: string, callback: FilterCallback): void {\n this.subscriptions.set(requestId, callback);\n }\n\n private removeCallback(requestId: string): void {\n this.subscriptions.delete(requestId);\n }\n\n private async unsubscribe(\n topic: string,\n contentFilters: ContentFilter[],\n requestId: string,\n peer: Peer\n ): Promise {\n const unsubscribeRequest = FilterRPC.createRequest(\n topic,\n contentFilters,\n requestId,\n false\n );\n\n const stream = await this.newStream(peer);\n try {\n await pipe([unsubscribeRequest.encode()], lp.encode(), stream.sink);\n } catch (e) {\n log(\"Error unsubscribing\", e);\n throw e;\n }\n }\n\n // Should be able to remove any at next libp2p release >0.37.3\n private async newStream(peer: Peer): Promise {\n const connections = this.libp2p.connectionManager.getConnections(peer.id);\n if (!connections) {\n throw new Error(\"Failed to get a connection to the peer\");\n }\n\n // TODO: Appropriate connection selection\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: tsc is confused by the @libp2p/interface-connection type to use\n return connections[0].newStream(FilterCodec);\n }\n\n private async getPeer(peerId?: PeerId): Promise {\n let peer;\n if (peerId) {\n peer = await this.libp2p.peerStore.get(peerId);\n if (!peer) {\n throw new Error(\n `Failed to retrieve connection details for provided peer in peer store: ${peerId.toString()}`\n );\n }\n } else {\n peer = await this.randomPeer();\n if (!peer) {\n throw new Error(\n \"Failed to find known peer that registers waku filter protocol\"\n );\n }\n }\n return peer;\n }\n\n /**\n * Register a decryption key to attempt decryption of messages received in any\n * subsequent { @link subscribe } call. This can either be a private key for\n * asymmetric encryption or a symmetric key. { @link WakuStore } will attempt to\n * decrypt messages using both methods.\n *\n * Strings must be in hex format.\n */\n addDecryptionKey(\n key: Uint8Array | string,\n options?: { method?: DecryptionMethod; contentTopics?: string[] }\n ): void {\n this.decryptionKeys.set(hexToBytes(key), options ?? {});\n }\n\n /**\n * Delete a decryption key so that it cannot be used in future { @link subscribe } calls\n *\n * Strings must be in hex format.\n */\n deleteDecryptionKey(key: Uint8Array | string): void {\n this.decryptionKeys.delete(hexToBytes(key));\n }\n\n async peers(): Promise {\n return getPeersForProtocol(this.libp2p, [FilterCodec]);\n }\n\n async randomPeer(): Promise {\n return selectRandomPeer(await this.peers());\n }\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from \"protons-runtime\";\nimport type { Uint8ArrayList } from \"uint8arraylist\";\nimport type { Codec } from \"protons-runtime\";\n\nexport interface PushRequest {\n pubSubTopic?: string;\n message?: WakuMessage;\n}\n\nexport namespace PushRequest {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.pubSubTopic != null) {\n writer.uint32(10);\n writer.string(obj.pubSubTopic);\n }\n\n if (obj.message != null) {\n writer.uint32(18);\n WakuMessage.codec().encode(obj.message, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.pubSubTopic = reader.string();\n break;\n case 2:\n obj.message = WakuMessage.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: PushRequest): Uint8Array => {\n return encodeMessage(obj, PushRequest.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): PushRequest => {\n return decodeMessage(buf, PushRequest.codec());\n };\n}\n\nexport interface PushResponse {\n isSuccess?: boolean;\n info?: string;\n}\n\nexport namespace PushResponse {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.isSuccess != null) {\n writer.uint32(8);\n writer.bool(obj.isSuccess);\n }\n\n if (obj.info != null) {\n writer.uint32(18);\n writer.string(obj.info);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.isSuccess = reader.bool();\n break;\n case 2:\n obj.info = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: PushResponse): Uint8Array => {\n return encodeMessage(obj, PushResponse.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): PushResponse => {\n return decodeMessage(buf, PushResponse.codec());\n };\n}\n\nexport interface PushRPC {\n requestId?: string;\n request?: PushRequest;\n response?: PushResponse;\n}\n\nexport namespace PushRPC {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.requestId != null) {\n writer.uint32(10);\n writer.string(obj.requestId);\n }\n\n if (obj.request != null) {\n writer.uint32(18);\n PushRequest.codec().encode(obj.request, writer);\n }\n\n if (obj.response != null) {\n writer.uint32(26);\n PushResponse.codec().encode(obj.response, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.request = PushRequest.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 3:\n obj.response = PushResponse.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: PushRPC): Uint8Array => {\n return encodeMessage(obj, PushRPC.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): PushRPC => {\n return decodeMessage(buf, PushRPC.codec());\n };\n}\n\nexport interface WakuMessage {\n payload?: Uint8Array;\n contentTopic?: string;\n version?: number;\n timestampDeprecated?: number;\n timestamp?: bigint;\n}\n\nexport namespace WakuMessage {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.payload != null) {\n writer.uint32(10);\n writer.bytes(obj.payload);\n }\n\n if (obj.contentTopic != null) {\n writer.uint32(18);\n writer.string(obj.contentTopic);\n }\n\n if (obj.version != null) {\n writer.uint32(24);\n writer.uint32(obj.version);\n }\n\n if (obj.timestampDeprecated != null) {\n writer.uint32(33);\n writer.double(obj.timestampDeprecated);\n }\n\n if (obj.timestamp != null) {\n writer.uint32(80);\n writer.sint64(obj.timestamp);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 4:\n obj.timestampDeprecated = reader.double();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: WakuMessage): Uint8Array => {\n return encodeMessage(obj, WakuMessage.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {\n return decodeMessage(buf, WakuMessage.codec());\n };\n}\n","import type { Uint8ArrayList } from \"uint8arraylist\";\nimport { v4 as uuid } from \"uuid\";\n\nimport * as proto from \"../../proto/light_push\";\nimport { WakuMessage } from \"../waku_message\";\n\nexport class PushRPC {\n public constructor(public proto: proto.PushRPC) {}\n\n static createRequest(message: WakuMessage, pubSubTopic: string): PushRPC {\n return new PushRPC({\n requestId: uuid(),\n request: {\n message: message.proto,\n pubSubTopic: pubSubTopic,\n },\n response: undefined,\n });\n }\n\n static decode(bytes: Uint8ArrayList): PushRPC {\n const res = proto.PushRPC.decode(bytes);\n return new PushRPC(res);\n }\n\n encode(): Uint8Array {\n return proto.PushRPC.encode(this.proto);\n }\n\n get query(): proto.PushRequest | undefined {\n return this.proto.request;\n }\n\n get response(): proto.PushResponse | undefined {\n return this.proto.response;\n }\n}\n","import type { PeerId } from \"@libp2p/interface-peer-id\";\nimport type { Peer } from \"@libp2p/interface-peer-store\";\nimport all from \"it-all\";\nimport * as lp from \"it-length-prefixed\";\nimport { pipe } from \"it-pipe\";\nimport { Libp2p } from \"libp2p\";\nimport { Uint8ArrayList } from \"uint8arraylist\";\n\nimport { PushResponse } from \"../../proto/light_push\";\nimport { DefaultPubSubTopic } from \"../constants\";\nimport { getPeersForProtocol, selectRandomPeer } from \"../select_peer\";\nimport { WakuMessage } from \"../waku_message\";\n\nimport { PushRPC } from \"./push_rpc\";\n\nexport const LightPushCodec = \"/vac/waku/lightpush/2.0.0-beta1\";\nexport { PushResponse };\n\nexport interface CreateOptions {\n /**\n * The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}.\n *\n * The usage of the default pubsub topic is recommended.\n * See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for details.\n *\n * @default {@link DefaultPubSubTopic}\n */\n pubSubTopic?: string;\n}\n\nexport interface PushOptions {\n peerId?: PeerId;\n pubSubTopic?: string;\n}\n\n/**\n * Implements the [Waku v2 Light Push protocol](https://rfc.vac.dev/spec/19/).\n */\nexport class WakuLightPush {\n pubSubTopic: string;\n\n constructor(public libp2p: Libp2p, options?: CreateOptions) {\n this.pubSubTopic = options?.pubSubTopic ?? DefaultPubSubTopic;\n }\n\n async push(\n message: WakuMessage,\n opts?: PushOptions\n ): Promise {\n let peer;\n if (opts?.peerId) {\n peer = await this.libp2p.peerStore.get(opts.peerId);\n if (!peer) throw \"Peer is unknown\";\n } else {\n peer = await this.randomPeer();\n }\n if (!peer) throw \"No peer available\";\n if (!peer.protocols.includes(LightPushCodec))\n throw \"Peer does not register waku light push protocol\";\n\n const connections = this.libp2p.connectionManager.getConnections(peer.id);\n if (!connections) throw \"Failed to get a connection to the peer\";\n\n // TODO: Appropriate connection management\n const stream = await connections[0].newStream(LightPushCodec);\n try {\n const pubSubTopic = opts?.pubSubTopic\n ? opts.pubSubTopic\n : this.pubSubTopic;\n const query = PushRPC.createRequest(message, pubSubTopic);\n const res = await pipe(\n [query.encode()],\n lp.encode(),\n stream,\n lp.decode(),\n async (source) => await all(source)\n );\n try {\n const bytes = new Uint8ArrayList();\n res.forEach((chunk) => {\n bytes.append(chunk);\n });\n\n const response = PushRPC.decode(bytes).response;\n\n if (!response) {\n console.log(\"No response in PushRPC\");\n return null;\n }\n\n return response;\n } catch (err) {\n console.log(\"Failed to decode push reply\", err);\n }\n } catch (err) {\n console.log(\"Failed to send waku light push request\", err);\n }\n return null;\n }\n\n /**\n * Returns known peers from the address book (`libp2p.peerStore`) that support\n * light push protocol. Waku may or may not be currently connected to these\n * peers.\n */\n async peers(): Promise {\n return getPeersForProtocol(this.libp2p, [LightPushCodec]);\n }\n\n /**\n * Returns a random peer that supports light push protocol from the address\n * book (`libp2p.peerStore`). Waku may or may not be currently connected to\n * this peer.\n */\n async randomPeer(): Promise {\n return selectRandomPeer(await this.peers());\n }\n}\n","export const second = 1000;\nexport const minute = 60 * second;\n\n/**\n * RelayCodec is the libp2p identifier for the waku relay protocol\n */\nexport const RelayCodecs = [\n \"/vac/waku/relay/2.0.0-beta2\",\n \"/vac/waku/relay/2.0.0\",\n];\n\nexport const RelayPingContentTopic = \"/relay-ping/1/ping/null\";\n\n/**\n * RelayGossipFactor affects how many peers we will emit gossip to at each heartbeat.\n * We will send gossip to RelayGossipFactor * (total number of non-mesh peers), or\n * RelayDlazy, whichever is greater.\n */\nexport const RelayGossipFactor = 0.25;\n\n/**\n * GossipsubHeartbeatInitialDelay is the short delay before the heartbeat timer begins\n * after the router is initialized.\n */\nexport const RelayHeartbeatInitialDelay = 100;\n\n/**\n * RelayHeartbeatInterval controls the time between heartbeats.\n */\nexport const RelayHeartbeatInterval = second;\n\n/**\n * RelayPrunePeers controls the number of peers to include in prune Peer eXchange.\n * When we prune a peer that's eligible for PX (has a good score, etc), we will try to\n * send them signed peer records for up to RelayPrunePeers other peers that we\n * know of.\n */\nexport const RelayPrunePeers = 16;\n\n/**\n * RelayPruneBackoff controls the backoff time for pruned peers. This is how long\n * a peer must wait before attempting to graft into our mesh again after being pruned.\n * When pruning a peer, we send them our value of RelayPruneBackoff so they know\n * the minimum time to wait. Peers running older versions may not send a backoff time,\n * so if we receive a prune message without one, we will wait at least RelayPruneBackoff\n * before attempting to re-graft.\n */\nexport const RelayPruneBackoff = minute;\n\n/**\n * RelayFanoutTTL controls how long we keep track of the fanout state. If it's been\n * RelayFanoutTTL since we've published to a topic that we're not subscribed to,\n * we'll delete the fanout map for that topic.\n */\nexport const RelayFanoutTTL = minute;\n\n/**\n * RelayOpportunisticGraftTicks is the number of heartbeat ticks for attempting to improve the mesh\n * with opportunistic grafting. Every RelayOpportunisticGraftTicks we will attempt to select some\n * high-scoring mesh peers to replace lower-scoring ones, if the median score of our mesh peers falls\n * below a threshold\n */\nexport const RelayOpportunisticGraftTicks = 60;\n\n/**\n * RelayOpportunisticGraftPeers is the number of peers to opportunistically graft.\n */\nexport const RelayOpportunisticGraftPeers = 2;\n\n/**\n * RelayMaxIHaveLength is the maximum number of messages to include in an IHAVE message.\n * Also controls the maximum number of IHAVE ids we will accept and request with IWANT from a\n * peer within a heartbeat, to protect from IHAVE floods. You should adjust this value from the\n * default if your system is pushing more than 5000 messages in GossipsubHistoryGossip heartbeats;\n * with the defaults this is 1666 messages/s.\n */\nexport const RelayMaxIHaveLength = 5000;\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport {\n encodeMessage,\n decodeMessage,\n message,\n enumeration,\n} from \"protons-runtime\";\nimport type { Uint8ArrayList } from \"uint8arraylist\";\nimport type { Codec } from \"protons-runtime\";\n\nexport interface Index {\n digest?: Uint8Array;\n receivedTime?: bigint;\n senderTime?: bigint;\n pubsubTopic?: string;\n}\n\nexport namespace Index {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.digest != null) {\n writer.uint32(10);\n writer.bytes(obj.digest);\n }\n\n if (obj.receivedTime != null) {\n writer.uint32(16);\n writer.sint64(obj.receivedTime);\n }\n\n if (obj.senderTime != null) {\n writer.uint32(24);\n writer.sint64(obj.senderTime);\n }\n\n if (obj.pubsubTopic != null) {\n writer.uint32(34);\n writer.string(obj.pubsubTopic);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.digest = reader.bytes();\n break;\n case 2:\n obj.receivedTime = reader.sint64();\n break;\n case 3:\n obj.senderTime = reader.sint64();\n break;\n case 4:\n obj.pubsubTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: Index): Uint8Array => {\n return encodeMessage(obj, Index.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Index => {\n return decodeMessage(buf, Index.codec());\n };\n}\n\nexport interface PagingInfo {\n pageSize?: bigint;\n cursor?: Index;\n direction?: PagingInfo.Direction;\n}\n\nexport namespace PagingInfo {\n export enum Direction {\n DIRECTION_BACKWARD_UNSPECIFIED = \"DIRECTION_BACKWARD_UNSPECIFIED\",\n DIRECTION_FORWARD = \"DIRECTION_FORWARD\",\n }\n\n enum __DirectionValues {\n DIRECTION_BACKWARD_UNSPECIFIED = 0,\n DIRECTION_FORWARD = 1,\n }\n\n export namespace Direction {\n export const codec = () => {\n return enumeration(__DirectionValues);\n };\n }\n\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.pageSize != null) {\n writer.uint32(8);\n writer.uint64(obj.pageSize);\n }\n\n if (obj.cursor != null) {\n writer.uint32(18);\n Index.codec().encode(obj.cursor, writer);\n }\n\n if (obj.direction != null) {\n writer.uint32(24);\n PagingInfo.Direction.codec().encode(obj.direction, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.pageSize = reader.uint64();\n break;\n case 2:\n obj.cursor = Index.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.direction = PagingInfo.Direction.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: PagingInfo): Uint8Array => {\n return encodeMessage(obj, PagingInfo.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): PagingInfo => {\n return decodeMessage(buf, PagingInfo.codec());\n };\n}\n\nexport interface ContentFilter {\n contentTopic?: string;\n}\n\nexport namespace ContentFilter {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.contentTopic != null) {\n writer.uint32(10);\n writer.string(obj.contentTopic);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: ContentFilter): Uint8Array => {\n return encodeMessage(obj, ContentFilter.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {\n return decodeMessage(buf, ContentFilter.codec());\n };\n}\n\nexport interface HistoryQuery {\n pubSubTopic?: string;\n contentFilters: ContentFilter[];\n pagingInfo?: PagingInfo;\n startTime?: bigint;\n endTime?: bigint;\n}\n\nexport namespace HistoryQuery {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.pubSubTopic != null) {\n writer.uint32(18);\n writer.string(obj.pubSubTopic);\n }\n\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n writer.uint32(26);\n ContentFilter.codec().encode(value, writer);\n }\n } else {\n throw new Error(\n 'Protocol error: required field \"contentFilters\" was not found in object'\n );\n }\n\n if (obj.pagingInfo != null) {\n writer.uint32(34);\n PagingInfo.codec().encode(obj.pagingInfo, writer);\n }\n\n if (obj.startTime != null) {\n writer.uint32(40);\n writer.sint64(obj.startTime);\n }\n\n if (obj.endTime != null) {\n writer.uint32(48);\n writer.sint64(obj.endTime);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {\n contentFilters: [],\n };\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 2:\n obj.pubSubTopic = reader.string();\n break;\n case 3:\n obj.contentFilters.push(\n ContentFilter.codec().decode(reader, reader.uint32())\n );\n break;\n case 4:\n obj.pagingInfo = PagingInfo.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 5:\n obj.startTime = reader.sint64();\n break;\n case 6:\n obj.endTime = reader.sint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: HistoryQuery): Uint8Array => {\n return encodeMessage(obj, HistoryQuery.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryQuery => {\n return decodeMessage(buf, HistoryQuery.codec());\n };\n}\n\nexport interface HistoryResponse {\n messages: WakuMessage[];\n pagingInfo?: PagingInfo;\n error?: HistoryResponse.HistoryError;\n}\n\nexport namespace HistoryResponse {\n export enum HistoryError {\n ERROR_NONE_UNSPECIFIED = \"ERROR_NONE_UNSPECIFIED\",\n ERROR_INVALID_CURSOR = \"ERROR_INVALID_CURSOR\",\n }\n\n enum __HistoryErrorValues {\n ERROR_NONE_UNSPECIFIED = 0,\n ERROR_INVALID_CURSOR = 1,\n }\n\n export namespace HistoryError {\n export const codec = () => {\n return enumeration(__HistoryErrorValues);\n };\n }\n\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.messages != null) {\n for (const value of obj.messages) {\n writer.uint32(18);\n WakuMessage.codec().encode(value, writer);\n }\n } else {\n throw new Error(\n 'Protocol error: required field \"messages\" was not found in object'\n );\n }\n\n if (obj.pagingInfo != null) {\n writer.uint32(26);\n PagingInfo.codec().encode(obj.pagingInfo, writer);\n }\n\n if (obj.error != null) {\n writer.uint32(32);\n HistoryResponse.HistoryError.codec().encode(obj.error, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {\n messages: [],\n };\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 2:\n obj.messages.push(\n WakuMessage.codec().decode(reader, reader.uint32())\n );\n break;\n case 3:\n obj.pagingInfo = PagingInfo.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 4:\n obj.error = HistoryResponse.HistoryError.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: HistoryResponse): Uint8Array => {\n return encodeMessage(obj, HistoryResponse.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryResponse => {\n return decodeMessage(buf, HistoryResponse.codec());\n };\n}\n\nexport interface HistoryRPC {\n requestId?: string;\n query?: HistoryQuery;\n response?: HistoryResponse;\n}\n\nexport namespace HistoryRPC {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.requestId != null) {\n writer.uint32(10);\n writer.string(obj.requestId);\n }\n\n if (obj.query != null) {\n writer.uint32(18);\n HistoryQuery.codec().encode(obj.query, writer);\n }\n\n if (obj.response != null) {\n writer.uint32(26);\n HistoryResponse.codec().encode(obj.response, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.query = HistoryQuery.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 3:\n obj.response = HistoryResponse.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: HistoryRPC): Uint8Array => {\n return encodeMessage(obj, HistoryRPC.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryRPC => {\n return decodeMessage(buf, HistoryRPC.codec());\n };\n}\n\nexport interface WakuMessage {\n payload?: Uint8Array;\n contentTopic?: string;\n version?: number;\n timestampDeprecated?: number;\n timestamp?: bigint;\n}\n\nexport namespace WakuMessage {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.payload != null) {\n writer.uint32(10);\n writer.bytes(obj.payload);\n }\n\n if (obj.contentTopic != null) {\n writer.uint32(18);\n writer.string(obj.contentTopic);\n }\n\n if (obj.version != null) {\n writer.uint32(24);\n writer.uint32(obj.version);\n }\n\n if (obj.timestampDeprecated != null) {\n writer.uint32(33);\n writer.double(obj.timestampDeprecated);\n }\n\n if (obj.timestamp != null) {\n writer.uint32(80);\n writer.sint64(obj.timestamp);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 4:\n obj.timestampDeprecated = reader.double();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: WakuMessage): Uint8Array => {\n return encodeMessage(obj, WakuMessage.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {\n return decodeMessage(buf, WakuMessage.codec());\n };\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport {\n encodeMessage,\n decodeMessage,\n message,\n enumeration,\n} from \"protons-runtime\";\nimport type { Uint8ArrayList } from \"uint8arraylist\";\nimport type { Codec } from \"protons-runtime\";\n\nexport interface Index {\n digest?: Uint8Array;\n receivedTime?: number;\n senderTime?: number;\n}\n\nexport namespace Index {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.digest != null) {\n writer.uint32(10);\n writer.bytes(obj.digest);\n }\n\n if (obj.receivedTime != null) {\n writer.uint32(17);\n writer.double(obj.receivedTime);\n }\n\n if (obj.senderTime != null) {\n writer.uint32(25);\n writer.double(obj.senderTime);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.digest = reader.bytes();\n break;\n case 2:\n obj.receivedTime = reader.double();\n break;\n case 3:\n obj.senderTime = reader.double();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: Index): Uint8Array => {\n return encodeMessage(obj, Index.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Index => {\n return decodeMessage(buf, Index.codec());\n };\n}\n\nexport interface PagingInfo {\n pageSize?: bigint;\n cursor?: Index;\n direction?: PagingInfo.Direction;\n}\n\nexport namespace PagingInfo {\n export enum Direction {\n DIRECTION_BACKWARD_UNSPECIFIED = \"DIRECTION_BACKWARD_UNSPECIFIED\",\n DIRECTION_FORWARD = \"DIRECTION_FORWARD\",\n }\n\n enum __DirectionValues {\n DIRECTION_BACKWARD_UNSPECIFIED = 0,\n DIRECTION_FORWARD = 1,\n }\n\n export namespace Direction {\n export const codec = () => {\n return enumeration(__DirectionValues);\n };\n }\n\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.pageSize != null) {\n writer.uint32(8);\n writer.uint64(obj.pageSize);\n }\n\n if (obj.cursor != null) {\n writer.uint32(18);\n Index.codec().encode(obj.cursor, writer);\n }\n\n if (obj.direction != null) {\n writer.uint32(24);\n PagingInfo.Direction.codec().encode(obj.direction, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.pageSize = reader.uint64();\n break;\n case 2:\n obj.cursor = Index.codec().decode(reader, reader.uint32());\n break;\n case 3:\n obj.direction = PagingInfo.Direction.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: PagingInfo): Uint8Array => {\n return encodeMessage(obj, PagingInfo.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): PagingInfo => {\n return decodeMessage(buf, PagingInfo.codec());\n };\n}\n\nexport interface ContentFilter {\n contentTopic?: string;\n}\n\nexport namespace ContentFilter {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.contentTopic != null) {\n writer.uint32(10);\n writer.string(obj.contentTopic);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.contentTopic = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: ContentFilter): Uint8Array => {\n return encodeMessage(obj, ContentFilter.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): ContentFilter => {\n return decodeMessage(buf, ContentFilter.codec());\n };\n}\n\nexport interface HistoryQuery {\n pubSubTopic?: string;\n contentFilters: ContentFilter[];\n pagingInfo?: PagingInfo;\n startTime?: number;\n endTime?: number;\n}\n\nexport namespace HistoryQuery {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.pubSubTopic != null) {\n writer.uint32(18);\n writer.string(obj.pubSubTopic);\n }\n\n if (obj.contentFilters != null) {\n for (const value of obj.contentFilters) {\n writer.uint32(26);\n ContentFilter.codec().encode(value, writer);\n }\n } else {\n throw new Error(\n 'Protocol error: required field \"contentFilters\" was not found in object'\n );\n }\n\n if (obj.pagingInfo != null) {\n writer.uint32(34);\n PagingInfo.codec().encode(obj.pagingInfo, writer);\n }\n\n if (obj.startTime != null) {\n writer.uint32(41);\n writer.double(obj.startTime);\n }\n\n if (obj.endTime != null) {\n writer.uint32(49);\n writer.double(obj.endTime);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {\n contentFilters: [],\n };\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 2:\n obj.pubSubTopic = reader.string();\n break;\n case 3:\n obj.contentFilters.push(\n ContentFilter.codec().decode(reader, reader.uint32())\n );\n break;\n case 4:\n obj.pagingInfo = PagingInfo.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 5:\n obj.startTime = reader.double();\n break;\n case 6:\n obj.endTime = reader.double();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: HistoryQuery): Uint8Array => {\n return encodeMessage(obj, HistoryQuery.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryQuery => {\n return decodeMessage(buf, HistoryQuery.codec());\n };\n}\n\nexport interface HistoryResponse {\n messages: WakuMessage[];\n pagingInfo?: PagingInfo;\n error?: HistoryResponse.HistoryError;\n}\n\nexport namespace HistoryResponse {\n export enum HistoryError {\n ERROR_NONE_UNSPECIFIED = \"ERROR_NONE_UNSPECIFIED\",\n ERROR_INVALID_CURSOR = \"ERROR_INVALID_CURSOR\",\n }\n\n enum __HistoryErrorValues {\n ERROR_NONE_UNSPECIFIED = 0,\n ERROR_INVALID_CURSOR = 1,\n }\n\n export namespace HistoryError {\n export const codec = () => {\n return enumeration(__HistoryErrorValues);\n };\n }\n\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.messages != null) {\n for (const value of obj.messages) {\n writer.uint32(18);\n WakuMessage.codec().encode(value, writer);\n }\n } else {\n throw new Error(\n 'Protocol error: required field \"messages\" was not found in object'\n );\n }\n\n if (obj.pagingInfo != null) {\n writer.uint32(26);\n PagingInfo.codec().encode(obj.pagingInfo, writer);\n }\n\n if (obj.error != null) {\n writer.uint32(32);\n HistoryResponse.HistoryError.codec().encode(obj.error, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {\n messages: [],\n };\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 2:\n obj.messages.push(\n WakuMessage.codec().decode(reader, reader.uint32())\n );\n break;\n case 3:\n obj.pagingInfo = PagingInfo.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 4:\n obj.error = HistoryResponse.HistoryError.codec().decode(reader);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: HistoryResponse): Uint8Array => {\n return encodeMessage(obj, HistoryResponse.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryResponse => {\n return decodeMessage(buf, HistoryResponse.codec());\n };\n}\n\nexport interface HistoryRPC {\n requestId?: string;\n query?: HistoryQuery;\n response?: HistoryResponse;\n}\n\nexport namespace HistoryRPC {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.requestId != null) {\n writer.uint32(10);\n writer.string(obj.requestId);\n }\n\n if (obj.query != null) {\n writer.uint32(18);\n HistoryQuery.codec().encode(obj.query, writer);\n }\n\n if (obj.response != null) {\n writer.uint32(26);\n HistoryResponse.codec().encode(obj.response, writer);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.requestId = reader.string();\n break;\n case 2:\n obj.query = HistoryQuery.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n case 3:\n obj.response = HistoryResponse.codec().decode(\n reader,\n reader.uint32()\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: HistoryRPC): Uint8Array => {\n return encodeMessage(obj, HistoryRPC.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): HistoryRPC => {\n return decodeMessage(buf, HistoryRPC.codec());\n };\n}\n\nexport interface WakuMessage {\n payload?: Uint8Array;\n contentTopic?: string;\n version?: number;\n timestampDeprecated?: number;\n timestamp?: bigint;\n}\n\nexport namespace WakuMessage {\n let _codec: Codec;\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message(\n (obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork();\n }\n\n if (obj.payload != null) {\n writer.uint32(10);\n writer.bytes(obj.payload);\n }\n\n if (obj.contentTopic != null) {\n writer.uint32(18);\n writer.string(obj.contentTopic);\n }\n\n if (obj.version != null) {\n writer.uint32(24);\n writer.uint32(obj.version);\n }\n\n if (obj.timestampDeprecated != null) {\n writer.uint32(33);\n writer.double(obj.timestampDeprecated);\n }\n\n if (obj.timestamp != null) {\n writer.uint32(80);\n writer.sint64(obj.timestamp);\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim();\n }\n },\n (reader, length) => {\n const obj: any = {};\n\n const end = length == null ? reader.len : reader.pos + length;\n\n while (reader.pos < end) {\n const tag = reader.uint32();\n\n switch (tag >>> 3) {\n case 1:\n obj.payload = reader.bytes();\n break;\n case 2:\n obj.contentTopic = reader.string();\n break;\n case 3:\n obj.version = reader.uint32();\n break;\n case 4:\n obj.timestampDeprecated = reader.double();\n break;\n case 10:\n obj.timestamp = reader.sint64();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n\n return obj;\n }\n );\n }\n\n return _codec;\n };\n\n export const encode = (obj: WakuMessage): Uint8Array => {\n return encodeMessage(obj, WakuMessage.codec());\n };\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): WakuMessage => {\n return decodeMessage(buf, WakuMessage.codec());\n };\n}\n","export enum StoreCodecs {\n V2Beta3 = \"/vac/waku/store/2.0.0-beta3\",\n V2Beta4 = \"/vac/waku/store/2.0.0-beta4\",\n}\n","import type { Uint8ArrayList } from \"uint8arraylist\";\nimport { v4 as uuid } from \"uuid\";\n\nimport * as protoV2Beta3 from \"../../proto/store_v2beta3\";\nimport * as protoV2Beta4 from \"../../proto/store_v2beta4\";\n\nimport { StoreCodecs } from \"./constants\";\n\nconst OneMillion = BigInt(1_000_000);\n\nexport enum PageDirection {\n BACKWARD = \"backward\",\n FORWARD = \"forward\",\n}\n\nexport interface Params {\n contentTopics: string[];\n pubSubTopic: string;\n pageDirection: PageDirection;\n pageSize: number;\n startTime?: Date;\n endTime?: Date;\n cursor?: protoV2Beta3.Index | protoV2Beta4.Index;\n storeCodec?: StoreCodecs;\n}\n\nexport class HistoryRPC {\n private readonly historyRpc:\n | typeof protoV2Beta3.HistoryRPC\n | typeof protoV2Beta4.HistoryRPC;\n\n private constructor(\n public readonly proto: protoV2Beta3.HistoryRPC | protoV2Beta4.HistoryRPC,\n public readonly storeCodec: StoreCodecs\n ) {\n switch (storeCodec) {\n case StoreCodecs.V2Beta3:\n this.historyRpc = protoV2Beta3.HistoryRPC;\n break;\n case StoreCodecs.V2Beta4:\n this.historyRpc = protoV2Beta4.HistoryRPC;\n break;\n default:\n throw `Internal Error: Unexpected store codec value received in constructor: ${storeCodec}`;\n }\n }\n\n get query():\n | protoV2Beta3.HistoryQuery\n | protoV2Beta4.HistoryQuery\n | undefined {\n return this.proto.query;\n }\n\n get response():\n | protoV2Beta3.HistoryResponse\n | protoV2Beta4.HistoryResponse\n | undefined {\n return this.proto.response;\n }\n\n /**\n * Create History Query.\n */\n static createQuery(params: Params): HistoryRPC {\n const storeCodec = params.storeCodec ?? StoreCodecs.V2Beta4;\n\n const contentFilters = params.contentTopics.map((contentTopic) => {\n return { contentTopic };\n });\n\n const direction = directionToProto(params.pageDirection);\n\n switch (storeCodec) {\n case StoreCodecs.V2Beta3:\n // Using function to scope variables\n return ((): HistoryRPC => {\n const pagingInfo = {\n pageSize: BigInt(params.pageSize),\n cursor: params.cursor,\n direction,\n } as protoV2Beta3.PagingInfo;\n\n let startTime, endTime;\n if (params.startTime) startTime = params.startTime.valueOf() / 1000;\n\n if (params.endTime) endTime = params.endTime.valueOf() / 1000;\n\n return new HistoryRPC(\n {\n requestId: uuid(),\n query: {\n pubSubTopic: params.pubSubTopic,\n contentFilters,\n pagingInfo,\n startTime,\n endTime,\n },\n response: undefined,\n },\n storeCodec\n );\n })();\n case StoreCodecs.V2Beta4:\n return ((): HistoryRPC => {\n const pagingInfo = {\n pageSize: BigInt(params.pageSize),\n cursor: params.cursor,\n direction,\n } as protoV2Beta4.PagingInfo;\n\n let startTime, endTime;\n if (params.startTime) {\n // milliseconds 10^-3 to nanoseconds 10^-9\n startTime = BigInt(params.startTime.valueOf()) * OneMillion;\n }\n\n if (params.endTime) {\n // milliseconds 10^-3 to nanoseconds 10^-9\n endTime = BigInt(params.endTime.valueOf()) * OneMillion;\n }\n return new HistoryRPC(\n {\n requestId: uuid(),\n query: {\n pubSubTopic: params.pubSubTopic,\n contentFilters,\n pagingInfo,\n startTime,\n endTime,\n },\n response: undefined,\n },\n storeCodec\n );\n })();\n\n default:\n throw `Internal Error: Unexpected store codec value received in createQuery: ${storeCodec}`;\n }\n }\n\n decode(bytes: Uint8ArrayList): HistoryRPC {\n const res = this.historyRpc.decode(bytes);\n return new HistoryRPC(res, this.storeCodec);\n }\n\n encode(): Uint8Array {\n return this.historyRpc.encode(this.proto as any);\n }\n}\n\nfunction directionToProto(\n pageDirection: PageDirection\n): protoV2Beta4.PagingInfo.Direction {\n switch (pageDirection) {\n case PageDirection.BACKWARD:\n return protoV2Beta4.PagingInfo.Direction.DIRECTION_BACKWARD_UNSPECIFIED;\n case PageDirection.FORWARD:\n return protoV2Beta4.PagingInfo.Direction.DIRECTION_FORWARD;\n default:\n return protoV2Beta4.PagingInfo.Direction.DIRECTION_BACKWARD_UNSPECIFIED;\n }\n}\n","import type { PeerId } from \"@libp2p/interface-peer-id\";\nimport { Peer } from \"@libp2p/interface-peer-store\";\nimport debug from \"debug\";\nimport all from \"it-all\";\nimport * as lp from \"it-length-prefixed\";\nimport { pipe } from \"it-pipe\";\nimport { Libp2p } from \"libp2p\";\nimport { Uint8ArrayList } from \"uint8arraylist\";\n\nimport * as protoV2Beta4 from \"../../proto/store_v2beta4\";\nimport { HistoryResponse } from \"../../proto/store_v2beta4\";\nimport { DefaultPubSubTopic, StoreCodecs } from \"../constants\";\nimport { getPeersForProtocol, selectRandomPeer } from \"../select_peer\";\nimport { hexToBytes } from \"../utils\";\nimport { DecryptionMethod, WakuMessage } from \"../waku_message\";\n\nimport { HistoryRPC, PageDirection } from \"./history_rpc\";\n\nimport Error = HistoryResponse.HistoryError;\n\nconst dbg = debug(\"waku:store\");\n\nexport const DefaultPageSize = 10;\n\nexport { PageDirection, StoreCodecs };\n\nexport interface CreateOptions {\n /**\n * The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}.\n *\n * The usage of the default pubsub topic is recommended.\n * See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for details.\n *\n * @default {@link DefaultPubSubTopic}\n */\n pubSubTopic?: string;\n}\n\nexport interface TimeFilter {\n startTime: Date;\n endTime: Date;\n}\n\nexport interface QueryOptions {\n /**\n * The peer to query. If undefined, a pseudo-random peer is selected from the connected Waku Store peers.\n */\n peerId?: PeerId;\n /**\n * The pubsub topic to pass to the query.\n * See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/).\n */\n pubSubTopic?: string;\n /**\n * The direction in which pages are retrieved:\n * - { @link PageDirection.BACKWARD }: Most recent page first.\n * - { @link PageDirection.FORWARD }: Oldest page first.\n *\n * Note: This does not affect the ordering of messages with the page\n * (oldest message is always first).\n *\n * @default { @link PageDirection.BACKWARD }\n */\n pageDirection?: PageDirection;\n /**\n * The number of message per page.\n *\n * @default { @link DefaultPageSize }\n */\n pageSize?: number;\n /**\n * Retrieve messages with a timestamp within the provided values.\n */\n timeFilter?: TimeFilter;\n /**\n * Callback called on pages of stored messages as they are retrieved.\n *\n * Allows for a faster access to the results as it is called as soon as a page\n * is received. Traversal of the pages is done automatically so this function\n * will invoked for each retrieved page.\n *\n * If the call on a page returns `true`, then traversal of the pages is aborted.\n * For example, this can be used for the caller to stop the query after a\n * specific message is found.\n */\n callback?: (messages: WakuMessage[]) => void | boolean;\n /**\n * Keys that will be used to decrypt messages.\n *\n * It can be Asymmetric Private Keys and Symmetric Keys in the same array,\n * all keys will be tried with both methods.\n */\n decryptionKeys?: Array;\n}\n\n/**\n * Implements the [Waku v2 Store protocol](https://rfc.vac.dev/spec/13/).\n *\n * The Waku Store protocol can be used to retrieved historical messages.\n */\nexport class WakuStore {\n pubSubTopic: string;\n public decryptionKeys: Map<\n Uint8Array,\n { method?: DecryptionMethod; contentTopics?: string[] }\n >;\n\n constructor(public libp2p: Libp2p, options?: CreateOptions) {\n this.pubSubTopic = options?.pubSubTopic ?? DefaultPubSubTopic;\n\n this.decryptionKeys = new Map();\n }\n\n /**\n * Do a query to a Waku Store to retrieve historical/missed messages.\n *\n * @param contentTopics The content topics to pass to the query, leave empty to\n * retrieve all messages.\n * @param options Optional parameters.\n *\n * @throws If not able to reach a Waku Store peer to query\n * or if an error is encountered when processing the reply.\n */\n async queryHistory(\n contentTopics: string[],\n options?: QueryOptions\n ): Promise {\n let startTime, endTime;\n\n if (options?.timeFilter) {\n startTime = options.timeFilter.startTime;\n endTime = options.timeFilter.endTime;\n }\n\n const opts = Object.assign(\n {\n pubSubTopic: this.pubSubTopic,\n pageDirection: PageDirection.BACKWARD,\n pageSize: DefaultPageSize,\n },\n options,\n { contentTopics, startTime, endTime }\n );\n\n dbg(\"Querying history with the following options\", {\n peerId: options?.peerId?.toString(),\n ...options,\n });\n\n let peer;\n if (opts.peerId) {\n peer = await this.libp2p.peerStore.get(opts.peerId);\n if (!peer)\n throw `Failed to retrieve connection details for provided peer in peer store: ${opts.peerId.toString()}`;\n } else {\n peer = await this.randomPeer();\n if (!peer)\n throw \"Failed to find known peer that registers waku store protocol\";\n }\n\n let storeCodec = \"\";\n for (const codec of Object.values(StoreCodecs)) {\n if (peer.protocols.includes(codec)) {\n storeCodec = codec;\n // Do not break as we want to keep the last value\n }\n }\n dbg(`Use store codec ${storeCodec}`);\n if (!storeCodec)\n throw `Peer does not register waku store protocol: ${peer.id.toString()}`;\n\n Object.assign(opts, { storeCodec });\n const connections = this.libp2p.connectionManager.getConnections(peer.id);\n if (!connections || !connections.length)\n throw \"Failed to get a connection to the peer\";\n\n const decryptionKeys = Array.from(this.decryptionKeys).map(\n ([key, { method, contentTopics }]) => {\n return {\n key,\n method,\n contentTopics,\n };\n }\n );\n\n // Add the decryption keys passed to this function against the\n // content topics also passed to this function.\n if (opts.decryptionKeys) {\n opts.decryptionKeys.forEach((key) => {\n decryptionKeys.push({\n key: hexToBytes(key),\n contentTopics: contentTopics.length ? contentTopics : undefined,\n method: undefined,\n });\n });\n }\n\n const messages: WakuMessage[] = [];\n let cursor = undefined;\n while (true) {\n // TODO: Some connection selection logic?\n const stream = await connections[0].newStream(storeCodec);\n const queryOpts = Object.assign(opts, { cursor });\n const historyRpcQuery = HistoryRPC.createQuery(queryOpts);\n dbg(\"Querying store peer\", connections[0].remoteAddr.toString());\n\n const res = await pipe(\n [historyRpcQuery.encode()],\n lp.encode(),\n stream,\n lp.decode(),\n async (source) => await all(source)\n );\n const bytes = new Uint8ArrayList();\n res.forEach((chunk) => {\n bytes.append(chunk);\n });\n\n const reply = historyRpcQuery.decode(bytes);\n\n if (!reply.response) {\n dbg(\"No message returned from store: `response` field missing\");\n return messages;\n }\n\n const response = reply.response as protoV2Beta4.HistoryResponse;\n\n if (response.error && response.error !== Error.ERROR_NONE_UNSPECIFIED) {\n throw \"History response contains an Error: \" + response.error;\n }\n\n if (!response.messages || !response.messages.length) {\n // No messages left (or stored)\n dbg(\"No message returned from store: `messages` array empty\");\n return messages;\n }\n\n dbg(\n `${response.messages.length} messages retrieved for (${opts.pubSubTopic})`,\n contentTopics\n );\n\n const pageMessages: WakuMessage[] = [];\n await Promise.all(\n response.messages.map(async (protoMsg) => {\n const msg = await WakuMessage.decodeProto(protoMsg, decryptionKeys);\n\n if (msg) {\n messages.push(msg);\n pageMessages.push(msg);\n }\n })\n );\n\n let abort = false;\n if (opts.callback) {\n abort = Boolean(opts.callback(pageMessages));\n }\n\n const responsePageSize = response.pagingInfo?.pageSize;\n const queryPageSize = historyRpcQuery.query?.pagingInfo?.pageSize;\n if (\n abort ||\n // Response page size smaller than query, meaning this is the last page\n (responsePageSize && queryPageSize && responsePageSize < queryPageSize)\n ) {\n return messages;\n }\n\n cursor = response.pagingInfo?.cursor;\n if (cursor === undefined) {\n // If the server does not return cursor then there is an issue,\n // Need to abort, or we end up in an infinite loop\n dbg(\"Store response does not contain a cursor, stopping pagination\");\n return messages;\n }\n }\n }\n\n /**\n * Register a decryption key to attempt decryption of messages received in any\n * subsequent { @link queryHistory } call. This can either be a private key for\n * asymmetric encryption or a symmetric key. { @link WakuStore } will attempt to\n * decrypt messages using both methods.\n *\n * Strings must be in hex format.\n */\n addDecryptionKey(\n key: Uint8Array | string,\n options?: { method?: DecryptionMethod; contentTopics?: string[] }\n ): void {\n this.decryptionKeys.set(hexToBytes(key), options ?? {});\n }\n\n /**cursorV2Beta4\n * Delete a decryption key that was used to attempt decryption of messages\n * received in subsequent { @link queryHistory } calls.\n *\n * Strings must be in hex format.\n */\n deleteDecryptionKey(key: Uint8Array | string): void {\n this.decryptionKeys.delete(hexToBytes(key));\n }\n\n /**\n * Returns known peers from the address book (`libp2p.peerStore`) that support\n * store protocol. Waku may or may not be currently connected to these peers.\n */\n async peers(): Promise {\n const codecs = [];\n for (const codec of Object.values(StoreCodecs)) {\n codecs.push(codec);\n }\n\n return getPeersForProtocol(this.libp2p, codecs);\n }\n\n /**\n * Returns a random peer that supports store protocol from the address\n * book (`libp2p.peerStore`). Waku may or may not be currently connected to\n * this peer.\n */\n async randomPeer(): Promise {\n return selectRandomPeer(await this.peers());\n }\n}\n","import type { Stream } from \"@libp2p/interface-connection\";\nimport type { PeerId } from \"@libp2p/interface-peer-id\";\nimport { peerIdFromString } from \"@libp2p/peer-id\";\nimport type { Multiaddr } from \"@multiformats/multiaddr\";\nimport { multiaddr } from \"@multiformats/multiaddr\";\nimport debug from \"debug\";\nimport type { Libp2p } from \"libp2p\";\n\nimport { FilterCodec, WakuFilter } from \"./waku_filter\";\nimport { LightPushCodec, WakuLightPush } from \"./waku_light_push\";\nimport { DecryptionMethod, WakuMessage } from \"./waku_message\";\nimport { WakuRelay } from \"./waku_relay\";\nimport { RelayCodecs, RelayPingContentTopic } from \"./waku_relay/constants\";\nimport { StoreCodecs, WakuStore } from \"./waku_store\";\n\nexport const DefaultPingKeepAliveValueSecs = 0;\nexport const DefaultRelayKeepAliveValueSecs = 5 * 60;\n\nconst log = debug(\"waku:waku\");\n\nexport enum Protocols {\n Relay = \"relay\",\n Store = \"store\",\n LightPush = \"lightpush\",\n Filter = \"filter\",\n}\n\nexport interface WakuOptions {\n /**\n * Set keep alive frequency in seconds: Waku will send a `/ipfs/ping/1.0.0`\n * request to each peer after the set number of seconds. Set to 0 to disable.\n *\n * @default {@link DefaultPingKeepAliveValueSecs}\n */\n pingKeepAlive?: number;\n /**\n * Set keep alive frequency in seconds: Waku will send a ping message over\n * relay to each peer after the set number of seconds. Set to 0 to disable.\n *\n * @default {@link DefaultRelayKeepAliveValueSecs}\n */\n relayKeepAlive?: number;\n decryptionKeys?: Array;\n}\n\nexport class Waku {\n public libp2p: Libp2p;\n public relay: WakuRelay;\n public store: WakuStore;\n public filter: WakuFilter;\n public lightPush: WakuLightPush;\n\n private pingKeepAliveTimers: {\n [peer: string]: ReturnType;\n };\n private relayKeepAliveTimers: {\n [peer: string]: ReturnType;\n };\n\n constructor(\n options: WakuOptions,\n libp2p: Libp2p,\n store: WakuStore,\n lightPush: WakuLightPush,\n filter: WakuFilter\n ) {\n this.libp2p = libp2p;\n this.relay = libp2p.pubsub as unknown as WakuRelay;\n this.store = store;\n this.filter = filter;\n this.lightPush = lightPush;\n this.pingKeepAliveTimers = {};\n this.relayKeepAliveTimers = {};\n\n const pingKeepAlive =\n options.pingKeepAlive || DefaultPingKeepAliveValueSecs;\n const relayKeepAlive =\n options.relayKeepAlive || DefaultRelayKeepAliveValueSecs;\n\n libp2p.connectionManager.addEventListener(\"peer:connect\", (evt) => {\n this.startKeepAlive(evt.detail.remotePeer, pingKeepAlive, relayKeepAlive);\n });\n\n /**\n * NOTE: Event is not being emitted on closing nor losing a connection.\n * @see https://github.com/libp2p/js-libp2p/issues/939\n * @see https://github.com/status-im/js-waku/issues/252\n *\n * >This event will be triggered anytime we are disconnected from another peer,\n * >regardless of the circumstances of that disconnection.\n * >If we happen to have multiple connections to a peer,\n * >this event will **only** be triggered when the last connection is closed.\n * @see https://github.com/libp2p/js-libp2p/blob/bad9e8c0ff58d60a78314077720c82ae331cc55b/doc/API.md?plain=1#L2100\n */\n libp2p.connectionManager.addEventListener(\"peer:disconnect\", (evt) => {\n this.stopKeepAlive(evt.detail.remotePeer);\n });\n\n options?.decryptionKeys?.forEach((key) => {\n this.addDecryptionKey(key);\n });\n }\n\n /**\n * Dials to the provided peer.\n *\n * @param peer The peer to dial\n * @param protocols Waku protocols we expect from the peer; Default to Relay\n */\n async dial(\n peer: PeerId | Multiaddr,\n protocols?: Protocols[]\n ): Promise {\n const _protocols = protocols ?? [Protocols.Relay];\n\n const codecs: string[] = [];\n if (_protocols.includes(Protocols.Relay)) {\n RelayCodecs.forEach((codec) => codecs.push(codec));\n }\n if (_protocols.includes(Protocols.Store)) {\n for (const codec of Object.values(StoreCodecs)) {\n codecs.push(codec);\n }\n }\n if (_protocols.includes(Protocols.LightPush)) {\n codecs.push(LightPushCodec);\n }\n if (_protocols.includes(Protocols.Filter)) {\n codecs.push(FilterCodec);\n }\n\n return this.libp2p.dialProtocol(peer, codecs);\n }\n\n /**\n * Add peer to address book, it will be auto-dialed in the background.\n */\n addPeerToAddressBook(\n peerId: PeerId | string,\n multiaddrs: Multiaddr[] | string[]\n ): void {\n let peer;\n if (typeof peerId === \"string\") {\n peer = peerIdFromString(peerId);\n } else {\n peer = peerId;\n }\n const addresses = multiaddrs.map((addr: Multiaddr | string) => {\n if (typeof addr === \"string\") {\n return multiaddr(addr);\n } else {\n return addr;\n }\n });\n this.libp2p.peerStore.addressBook.set(peer, addresses);\n }\n\n async start(): Promise {\n await this.libp2p.start();\n }\n\n async stop(): Promise {\n this.stopAllKeepAlives();\n await this.libp2p.stop();\n }\n\n isStarted(): boolean {\n return this.libp2p.isStarted();\n }\n\n /**\n * Register a decryption key to attempt decryption of messages received via\n * { @link WakuRelay } and { @link WakuStore }. This can either be a private key for\n * asymmetric encryption or a symmetric key.\n *\n * Strings must be in hex format.\n */\n addDecryptionKey(\n key: Uint8Array | string,\n options?: { method?: DecryptionMethod; contentTopics?: string[] }\n ): void {\n this.relay.addDecryptionKey(key, options);\n this.store.addDecryptionKey(key, options);\n this.filter.addDecryptionKey(key, options);\n }\n\n /**\n * Delete a decryption key that was used to attempt decryption of messages\n * received via { @link WakuRelay } or { @link WakuStore }.\n *\n * Strings must be in hex format.\n */\n deleteDecryptionKey(key: Uint8Array | string): void {\n this.relay.deleteDecryptionKey(key);\n this.store.deleteDecryptionKey(key);\n this.filter.deleteDecryptionKey(key);\n }\n\n /**\n * Return the local multiaddr with peer id on which libp2p is listening.\n *\n * @throws if libp2p is not listening on localhost.\n */\n getLocalMultiaddrWithID(): string {\n const localMultiaddr = this.libp2p\n .getMultiaddrs()\n .find((addr) => addr.toString().match(/127\\.0\\.0\\.1/));\n if (!localMultiaddr || localMultiaddr.toString() === \"\") {\n throw \"Not listening on localhost\";\n }\n return localMultiaddr + \"/p2p/\" + this.libp2p.peerId.toString();\n }\n\n private startKeepAlive(\n peerId: PeerId,\n pingPeriodSecs: number,\n relayPeriodSecs: number\n ): void {\n // Just in case a timer already exist for this peer\n this.stopKeepAlive(peerId);\n\n const peerIdStr = peerId.toString();\n\n if (pingPeriodSecs !== 0) {\n this.pingKeepAliveTimers[peerIdStr] = setInterval(() => {\n this.libp2p.ping(peerId).catch((e) => {\n log(`Ping failed (${peerIdStr})`, e);\n });\n }, pingPeriodSecs * 1000);\n }\n\n if (relayPeriodSecs !== 0) {\n this.relayKeepAliveTimers[peerIdStr] = setInterval(() => {\n log(\"Sending Waku Relay ping message\");\n WakuMessage.fromBytes(new Uint8Array(), RelayPingContentTopic).then(\n (wakuMsg) => this.relay.send(wakuMsg)\n );\n }, relayPeriodSecs * 1000);\n }\n }\n\n private stopKeepAlive(peerId: PeerId): void {\n const peerIdStr = peerId.toString();\n\n if (this.pingKeepAliveTimers[peerIdStr]) {\n clearInterval(this.pingKeepAliveTimers[peerIdStr]);\n delete this.pingKeepAliveTimers[peerIdStr];\n }\n\n if (this.relayKeepAliveTimers[peerIdStr]) {\n clearInterval(this.relayKeepAliveTimers[peerIdStr]);\n delete this.relayKeepAliveTimers[peerIdStr];\n }\n }\n\n private stopAllKeepAlives(): void {\n for (const timer of [\n ...Object.values(this.pingKeepAliveTimers),\n ...Object.values(this.relayKeepAliveTimers),\n ]) {\n clearInterval(timer);\n }\n\n this.pingKeepAliveTimers = {};\n this.relayKeepAliveTimers = {};\n }\n}\n","\nexport const codes = {\n ERR_SIGNATURE_NOT_VALID: 'ERR_SIGNATURE_NOT_VALID'\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface Envelope {\n publicKey: Uint8Array\n payloadType: Uint8Array\n payload: Uint8Array\n signature: Uint8Array\n}\n\nexport namespace Envelope {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.publicKey != null) {\n writer.uint32(10)\n writer.bytes(obj.publicKey)\n } else {\n throw new Error('Protocol error: required field \"publicKey\" was not found in object')\n }\n\n if (obj.payloadType != null) {\n writer.uint32(18)\n writer.bytes(obj.payloadType)\n } else {\n throw new Error('Protocol error: required field \"payloadType\" was not found in object')\n }\n\n if (obj.payload != null) {\n writer.uint32(26)\n writer.bytes(obj.payload)\n } else {\n throw new Error('Protocol error: required field \"payload\" was not found in object')\n }\n\n if (obj.signature != null) {\n writer.uint32(42)\n writer.bytes(obj.signature)\n } else {\n throw new Error('Protocol error: required field \"signature\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n publicKey: new Uint8Array(0),\n payloadType: new Uint8Array(0),\n payload: new Uint8Array(0),\n signature: new Uint8Array(0)\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.publicKey = reader.bytes()\n break\n case 2:\n obj.payloadType = reader.bytes()\n break\n case 3:\n obj.payload = reader.bytes()\n break\n case 5:\n obj.signature = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.publicKey == null) {\n throw new Error('Protocol error: value for required field \"publicKey\" was not found in protobuf')\n }\n\n if (obj.payloadType == null) {\n throw new Error('Protocol error: value for required field \"payloadType\" was not found in protobuf')\n }\n\n if (obj.payload == null) {\n throw new Error('Protocol error: value for required field \"payload\" was not found in protobuf')\n }\n\n if (obj.signature == null) {\n throw new Error('Protocol error: value for required field \"signature\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Envelope): Uint8Array => {\n return encodeMessage(obj, Envelope.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Envelope => {\n return decodeMessage(buf, Envelope.codec())\n }\n}\n","import errCode from 'err-code'\nimport { fromString as uint8arraysFromString } from 'uint8arrays/from-string'\nimport { equals as uint8ArrayEquals } from 'uint8arrays/equals'\nimport { unmarshalPrivateKey, unmarshalPublicKey } from '@libp2p/crypto/keys'\nimport { codes } from '../errors.js'\nimport { Envelope as Protobuf } from './envelope.js'\nimport { peerIdFromKeys } from '@libp2p/peer-id'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Record, Envelope } from '@libp2p/interface-record'\nimport { Uint8ArrayList } from 'uint8arraylist'\nimport { unsigned } from 'uint8-varint'\n\nexport interface EnvelopeInit {\n peerId: PeerId\n payloadType: Uint8Array\n payload: Uint8Array\n signature: Uint8Array\n}\n\nexport class RecordEnvelope implements Envelope {\n /**\n * Unmarshal a serialized Envelope protobuf message\n */\n static createFromProtobuf = async (data: Uint8Array | Uint8ArrayList) => {\n const envelopeData = Protobuf.decode(data)\n const peerId = await peerIdFromKeys(envelopeData.publicKey)\n\n return new RecordEnvelope({\n peerId,\n payloadType: envelopeData.payloadType,\n payload: envelopeData.payload,\n signature: envelopeData.signature\n })\n }\n\n /**\n * Seal marshals the given Record, places the marshaled bytes inside an Envelope\n * and signs it with the given peerId's private key\n */\n static seal = async (record: Record, peerId: PeerId) => {\n if (peerId.privateKey == null) {\n throw new Error('Missing private key')\n }\n\n const domain = record.domain\n const payloadType = record.codec\n const payload = record.marshal()\n const signData = formatSignaturePayload(domain, payloadType, payload)\n const key = await unmarshalPrivateKey(peerId.privateKey)\n const signature = await key.sign(signData.subarray())\n\n return new RecordEnvelope({\n peerId,\n payloadType,\n payload,\n signature\n })\n }\n\n /**\n * Open and certify a given marshalled envelope.\n * Data is unmarshalled and the signature validated for the given domain.\n */\n static openAndCertify = async (data: Uint8Array | Uint8ArrayList, domain: string) => {\n const envelope = await RecordEnvelope.createFromProtobuf(data)\n const valid = await envelope.validate(domain)\n\n if (!valid) {\n throw errCode(new Error('envelope signature is not valid for the given domain'), codes.ERR_SIGNATURE_NOT_VALID)\n }\n\n return envelope\n }\n\n public peerId: PeerId\n public payloadType: Uint8Array\n public payload: Uint8Array\n public signature: Uint8Array\n public marshaled?: Uint8Array\n\n /**\n * The Envelope is responsible for keeping an arbitrary signed record\n * by a libp2p peer.\n */\n constructor (init: EnvelopeInit) {\n const { peerId, payloadType, payload, signature } = init\n\n this.peerId = peerId\n this.payloadType = payloadType\n this.payload = payload\n this.signature = signature\n }\n\n /**\n * Marshal the envelope content\n */\n marshal (): Uint8Array {\n if (this.peerId.publicKey == null) {\n throw new Error('Missing public key')\n }\n\n if (this.marshaled == null) {\n this.marshaled = Protobuf.encode({\n publicKey: this.peerId.publicKey,\n payloadType: this.payloadType,\n payload: this.payload.subarray(),\n signature: this.signature\n })\n }\n\n return this.marshaled\n }\n\n /**\n * Verifies if the other Envelope is identical to this one\n */\n equals (other: Envelope) {\n return uint8ArrayEquals(this.marshal(), other.marshal())\n }\n\n /**\n * Validate envelope data signature for the given domain\n */\n async validate (domain: string) {\n const signData = formatSignaturePayload(domain, this.payloadType, this.payload)\n\n if (this.peerId.publicKey == null) {\n throw new Error('Missing public key')\n }\n\n const key = unmarshalPublicKey(this.peerId.publicKey)\n\n return await key.verify(signData.subarray(), this.signature)\n }\n}\n\n/**\n * Helper function that prepares a Uint8Array to sign or verify a signature\n */\nconst formatSignaturePayload = (domain: string, payloadType: Uint8Array, payload: Uint8Array | Uint8ArrayList): Uint8ArrayList => {\n // When signing, a peer will prepare a Uint8Array by concatenating the following:\n // - The length of the domain separation string string in bytes\n // - The domain separation string, encoded as UTF-8\n // - The length of the payload_type field in bytes\n // - The value of the payload_type field\n // - The length of the payload field in bytes\n // - The value of the payload field\n\n const domainUint8Array = uint8arraysFromString(domain)\n const domainLength = unsigned.encode(domainUint8Array.byteLength)\n const payloadTypeLength = unsigned.encode(payloadType.length)\n const payloadLength = unsigned.encode(payload.length)\n\n return new Uint8ArrayList(\n domainLength,\n domainUint8Array,\n payloadTypeLength,\n payloadType,\n payloadLength,\n payload\n )\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface PeerRecord {\n peerId: Uint8Array\n seq: bigint\n addresses: PeerRecord.AddressInfo[]\n}\n\nexport namespace PeerRecord {\n export interface AddressInfo {\n multiaddr: Uint8Array\n }\n\n export namespace AddressInfo {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.multiaddr != null) {\n writer.uint32(10)\n writer.bytes(obj.multiaddr)\n } else {\n throw new Error('Protocol error: required field \"multiaddr\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n multiaddr: new Uint8Array(0)\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.multiaddr = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.multiaddr == null) {\n throw new Error('Protocol error: value for required field \"multiaddr\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: AddressInfo): Uint8Array => {\n return encodeMessage(obj, AddressInfo.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): AddressInfo => {\n return decodeMessage(buf, AddressInfo.codec())\n }\n }\n\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.peerId != null) {\n writer.uint32(10)\n writer.bytes(obj.peerId)\n } else {\n throw new Error('Protocol error: required field \"peerId\" was not found in object')\n }\n\n if (obj.seq != null) {\n writer.uint32(16)\n writer.uint64(obj.seq)\n } else {\n throw new Error('Protocol error: required field \"seq\" was not found in object')\n }\n\n if (obj.addresses != null) {\n for (const value of obj.addresses) {\n writer.uint32(26)\n PeerRecord.AddressInfo.codec().encode(value, writer)\n }\n } else {\n throw new Error('Protocol error: required field \"addresses\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n peerId: new Uint8Array(0),\n seq: 0n,\n addresses: []\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.peerId = reader.bytes()\n break\n case 2:\n obj.seq = reader.uint64()\n break\n case 3:\n obj.addresses.push(PeerRecord.AddressInfo.codec().decode(reader, reader.uint32()))\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.peerId == null) {\n throw new Error('Protocol error: value for required field \"peerId\" was not found in protobuf')\n }\n\n if (obj.seq == null) {\n throw new Error('Protocol error: value for required field \"seq\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: PeerRecord): Uint8Array => {\n return encodeMessage(obj, PeerRecord.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): PeerRecord => {\n return decodeMessage(buf, PeerRecord.codec())\n }\n}\n","\n// The domain string used for peer records contained in a Envelope.\nexport const ENVELOPE_DOMAIN_PEER_RECORD = 'libp2p-peer-record'\n\n// The type hint used to identify peer records in a Envelope.\n// Defined in https://github.com/multiformats/multicodec/blob/master/table.csv\n// with name \"libp2p-peer-record\"\nexport const ENVELOPE_PAYLOAD_TYPE_PEER_RECORD = Uint8Array.from([3, 1])\n","import { Multiaddr } from '@multiformats/multiaddr'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport { arrayEquals } from '@libp2p/utils/array-equals'\nimport { peerIdFromBytes } from '@libp2p/peer-id'\nimport { PeerRecord as Protobuf } from './peer-record.js'\nimport {\n ENVELOPE_DOMAIN_PEER_RECORD,\n ENVELOPE_PAYLOAD_TYPE_PEER_RECORD\n} from './consts.js'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nexport interface PeerRecordInit {\n peerId: PeerId\n\n /**\n * Addresses of the associated peer.\n */\n multiaddrs?: Multiaddr[]\n\n /**\n * Monotonically-increasing sequence counter that's used to order PeerRecords in time.\n */\n seqNumber?: bigint\n}\n\n/**\n * The PeerRecord is used for distributing peer routing records across the network.\n * It contains the peer's reachable listen addresses.\n */\nexport class PeerRecord {\n /**\n * Unmarshal Peer Record Protobuf\n */\n static createFromProtobuf = (buf: Uint8Array | Uint8ArrayList): PeerRecord => {\n const peerRecord = Protobuf.decode(buf)\n const peerId = peerIdFromBytes(peerRecord.peerId)\n const multiaddrs = (peerRecord.addresses ?? []).map((a) => new Multiaddr(a.multiaddr))\n const seqNumber = peerRecord.seq\n\n return new PeerRecord({ peerId, multiaddrs, seqNumber })\n }\n\n static DOMAIN = ENVELOPE_DOMAIN_PEER_RECORD\n static CODEC = ENVELOPE_PAYLOAD_TYPE_PEER_RECORD\n\n public peerId: PeerId\n public multiaddrs: Multiaddr[]\n public seqNumber: bigint\n public domain = PeerRecord.DOMAIN\n public codec = PeerRecord.CODEC\n private marshaled?: Uint8Array\n\n constructor (init: PeerRecordInit) {\n const { peerId, multiaddrs, seqNumber } = init\n\n this.peerId = peerId\n this.multiaddrs = multiaddrs ?? []\n this.seqNumber = seqNumber ?? BigInt(Date.now())\n }\n\n /**\n * Marshal a record to be used in an envelope\n */\n marshal () {\n if (this.marshaled == null) {\n this.marshaled = Protobuf.encode({\n peerId: this.peerId.toBytes(),\n seq: BigInt(this.seqNumber),\n addresses: this.multiaddrs.map((m) => ({\n multiaddr: m.bytes\n }))\n })\n }\n\n return this.marshaled\n }\n\n /**\n * Returns true if `this` record equals the `other`\n */\n equals (other: unknown) {\n if (!(other instanceof PeerRecord)) {\n return false\n }\n\n // Validate PeerId\n if (!this.peerId.equals(other.peerId)) {\n return false\n }\n\n // Validate seqNumber\n if (this.seqNumber !== other.seqNumber) {\n return false\n }\n\n // Validate multiaddrs\n if (!arrayEquals(this.multiaddrs, other.multiaddrs)) {\n return false\n }\n\n return true\n }\n}\n","/**\n * Verify if two arrays of non primitive types with the \"equals\" function are equal.\n * Compatible with multiaddr, peer-id and others.\n */\nexport function arrayEquals (a: any[], b: any[]) {\n const sort = (a: any, b: any) => a.toString().localeCompare(b.toString())\n return a.length === b.length && b.sort(sort) && a.sort(sort).every((item, index) => b[index].equals(item))\n}\n","import debug from 'debug'\nimport { base58btc } from 'multiformats/bases/base58'\nimport { base32 } from 'multiformats/bases/base32'\nimport { base64 } from 'multiformats/bases/base64'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { CID } from 'multiformats/cid'\nimport type { Key } from 'interface-datastore'\n\n// Add a formatter for converting to a base58 string\ndebug.formatters.b = (v?: Uint8Array) => {\n return v == null ? 'undefined' : base58btc.baseEncode(v)\n}\n\n// Add a formatter for converting to a base32 string\ndebug.formatters.t = (v?: Uint8Array) => {\n return v == null ? 'undefined' : base32.baseEncode(v)\n}\n\n// Add a formatter for converting to a base64 string\ndebug.formatters.m = (v?: Uint8Array) => {\n return v == null ? 'undefined' : base64.baseEncode(v)\n}\n\n// Add a formatter for stringifying peer ids\ndebug.formatters.p = (v?: PeerId) => {\n return v == null ? 'undefined' : v.toString()\n}\n\n// Add a formatter for stringifying CIDs\ndebug.formatters.c = (v?: CID) => {\n return v == null ? 'undefined' : v.toString()\n}\n\n// Add a formatter for stringifying Datastore keys\ndebug.formatters.k = (v: Key) => {\n return v == null ? 'undefined' : v.toString()\n}\n\nexport interface Logger {\n (formatter: any, ...args: any[]): void\n error: (formatter: any, ...args: any[]) => void\n trace: (formatter: any, ...args: any[]) => void\n enabled: boolean\n}\n\nexport function logger (name: string): Logger {\n return Object.assign(debug(name), {\n error: debug(`${name}:error`),\n trace: debug(`${name}:trace`)\n })\n}\n\nexport function disable () {\n debug.disable()\n}\n\nexport function enable (namespaces: string) {\n debug.enable(namespaces)\n}\n\nexport function enabled (namespaces: string) {\n return debug.enabled(namespaces)\n}\n","import type { Connection, Stream } from '@libp2p/interface-connection'\nimport type { PeerId } from '@libp2p/interface-peer-id'\n\nexport interface IncomingStreamData {\n stream: Stream\n connection: Connection\n}\n\nexport interface StreamHandler {\n (data: IncomingStreamData): void\n}\n\nexport interface StreamHandlerOptions {\n /**\n * How many incoming streams can be open for this protocol at the same time on each connection (default: 1)\n */\n maxInboundStreams?: number\n\n /**\n * How many outgoing streams can be open for this protocol at the same time on each connection (default: 1)\n */\n maxOutboundStreams?: number\n}\n\nexport interface StreamHandlerRecord {\n handler: StreamHandler\n options: StreamHandlerOptions\n}\n\nexport interface Registrar {\n getProtocols: () => string[]\n handle: (protocol: string, handler: StreamHandler, options?: StreamHandlerOptions) => Promise\n unhandle: (protocol: string) => Promise\n getHandler: (protocol: string) => StreamHandlerRecord\n\n register: (protocol: string, topology: Topology) => Promise\n unregister: (id: string) => void\n getTopologies: (protocol: string) => Topology[]\n}\n\nexport interface onConnectHandler {\n (peerId: PeerId, conn: Connection): void\n}\n\nexport interface onDisconnectHandler {\n (peerId: PeerId, conn?: Connection): void\n}\n\nexport interface TopologyInit {\n /**\n * minimum needed connections\n */\n min?: number\n\n /**\n * maximum needed connections\n */\n max?: number\n onConnect?: onConnectHandler\n onDisconnect?: onDisconnectHandler\n}\n\nexport interface Topology {\n min: number\n max: number\n peers: Set\n\n onConnect: (peerId: PeerId, conn: Connection) => void\n onDisconnect: (peerId: PeerId) => void\n setRegistrar: (registrar: Registrar) => Promise\n}\n\nexport const topologySymbol = Symbol.for('@libp2p/topology')\n\nexport function isTopology (other: any): other is Topology {\n return other != null && Boolean(other[topologySymbol])\n}\n","import { topologySymbol as symbol } from '@libp2p/interface-registrar'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Topology, TopologyInit, onConnectHandler, onDisconnectHandler, Registrar } from '@libp2p/interface-registrar'\n\nconst noop = () => {}\n\nclass TopologyImpl implements Topology {\n public min: number\n public max: number\n\n /**\n * Set of peers that support the protocol\n */\n public peers: Set\n public onConnect: onConnectHandler\n public onDisconnect: onDisconnectHandler\n\n protected registrar: Registrar | undefined\n\n constructor (init: TopologyInit) {\n this.min = init.min ?? 0\n this.max = init.max ?? Infinity\n this.peers = new Set()\n\n this.onConnect = init.onConnect ?? noop\n this.onDisconnect = init.onDisconnect ?? noop\n }\n\n get [Symbol.toStringTag] () {\n return symbol.toString()\n }\n\n get [symbol] () {\n return true\n }\n\n async setRegistrar (registrar: Registrar) {\n this.registrar = registrar\n }\n\n /**\n * Notify about peer disconnected event\n */\n disconnect (peerId: PeerId) {\n this.onDisconnect(peerId)\n }\n}\n\nexport function createTopology (init: TopologyInit): Topology {\n return new TopologyImpl(init)\n}\n","\nexport interface EventCallback { (evt: EventType): void }\nexport interface EventObject { handleEvent: EventCallback }\nexport type EventHandler = EventCallback | EventObject\n\ninterface Listener {\n once: boolean\n callback: any\n}\n\n/**\n * Adds types to the EventTarget class. Hopefully this won't be necessary forever.\n *\n * https://github.com/microsoft/TypeScript/issues/28357\n * https://github.com/microsoft/TypeScript/issues/43477\n * https://github.com/microsoft/TypeScript/issues/299\n * etc\n */\nexport class EventEmitter extends EventTarget {\n #listeners: Map = new Map()\n\n listenerCount (type: string) {\n const listeners = this.#listeners.get(type)\n\n if (listeners == null) {\n return 0\n }\n\n return listeners.length\n }\n\n addEventListener(type: K, listener: EventHandler | null, options?: boolean | AddEventListenerOptions): void\n addEventListener (type: string, listener: EventHandler, options?: boolean | AddEventListenerOptions): void {\n super.addEventListener(type, listener, options)\n\n let list = this.#listeners.get(type)\n\n if (list == null) {\n list = []\n this.#listeners.set(type, list)\n }\n\n list.push({\n callback: listener,\n once: (options !== true && options !== false && options?.once) ?? false\n })\n }\n\n removeEventListener(type: K, listener?: EventHandler | null, options?: boolean | EventListenerOptions): void\n removeEventListener (type: string, listener?: EventHandler, options?: boolean | EventListenerOptions): void {\n super.removeEventListener(type.toString(), listener ?? null, options)\n\n let list = this.#listeners.get(type)\n\n if (list == null) {\n return\n }\n\n list = list.filter(({ callback }) => callback !== listener)\n this.#listeners.set(type, list)\n }\n\n dispatchEvent (event: Event): boolean {\n const result = super.dispatchEvent(event)\n\n let list = this.#listeners.get(event.type)\n\n if (list == null) {\n return result\n }\n\n list = list.filter(({ once }) => !once)\n this.#listeners.set(event.type, list)\n\n return result\n }\n}\n\n/**\n * CustomEvent is a standard event but it's not supported by node.\n *\n * Remove this when https://github.com/nodejs/node/issues/40678 is closed.\n *\n * Ref: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent\n */\nclass CustomEventPolyfill extends Event {\n /** Returns any custom data event was created with. Typically used for synthetic events. */\n public detail: T\n\n constructor (message: string, data?: EventInit & { detail: T }) {\n super(message, data)\n // @ts-expect-error could be undefined\n this.detail = data?.detail\n }\n}\n\nexport const CustomEvent = globalThis.CustomEvent ?? CustomEventPolyfill\n",null,null,null,null,null,null,"import type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Pushable } from 'it-pushable'\nimport type { EventEmitter } from '@libp2p/interfaces/events'\nimport type { Stream } from '@libp2p/interface-connection'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\n/**\n * On the producing side:\n * * Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.\n *\n * On the consuming side:\n * * Enforce the fields to be present, reject otherwise.\n * * Propagate only if the fields are valid and signature can be verified, reject otherwise.\n */\nexport const StrictSign = 'StrictSign'\n\n/**\n * On the producing side:\n * * Build messages without the signature, key, from and seqno fields.\n * * The corresponding protobuf key-value pairs are absent from the marshalled message, not just empty.\n *\n * On the consuming side:\n * * Enforce the fields to be absent, reject otherwise.\n * * Propagate only if the fields are absent, reject otherwise.\n * * A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash.\n */\nexport const StrictNoSign = 'StrictNoSign'\n\nexport type SignaturePolicy = typeof StrictSign | typeof StrictNoSign\n\nexport interface SignedMessage {\n type: 'signed'\n from: PeerId\n topic: string\n data: Uint8Array\n sequenceNumber: bigint\n signature: Uint8Array\n key: Uint8Array\n}\n\nexport interface UnsignedMessage {\n type: 'unsigned'\n topic: string\n data: Uint8Array\n}\n\nexport type Message = SignedMessage | UnsignedMessage\n\nexport interface PubSubRPCMessage {\n from?: Uint8Array\n topic?: string\n data?: Uint8Array\n sequenceNumber?: Uint8Array\n signature?: Uint8Array\n key?: Uint8Array\n}\n\nexport interface PubSubRPCSubscription {\n subscribe?: boolean\n topic?: string\n}\n\nexport interface PubSubRPC {\n subscriptions: PubSubRPCSubscription[]\n messages: PubSubRPCMessage[]\n}\n\nexport interface PeerStreams extends EventEmitter {\n id: PeerId\n protocol: string\n outboundStream?: Pushable\n inboundStream?: AsyncIterable\n isWritable: boolean\n\n close: () => void\n write: (buf: Uint8Array | Uint8ArrayList) => void\n attachInboundStream: (stream: Stream) => AsyncIterable\n attachOutboundStream: (stream: Stream) => Promise>\n}\n\nexport interface PubSubInit {\n enabled?: boolean\n\n multicodecs?: string[]\n\n /**\n * defines how signatures should be handled\n */\n globalSignaturePolicy?: SignaturePolicy\n\n /**\n * if can relay messages not subscribed\n */\n canRelayMessage?: boolean\n\n /**\n * if publish should emit to self, if subscribed\n */\n emitSelf?: boolean\n\n /**\n * handle this many incoming pubsub messages concurrently\n */\n messageProcessingConcurrency?: number\n\n /**\n * How many parallel incoming streams to allow on the pubsub protocol per-connection\n */\n maxInboundStreams?: number\n\n /**\n * How many parallel outgoing streams to allow on the pubsub protocol per-connection\n */\n maxOutboundStreams?: number\n}\n\ninterface Subscription {\n topic: string\n subscribe: boolean\n}\n\nexport interface SubscriptionChangeData {\n peerId: PeerId\n subscriptions: Subscription[]\n}\n\nexport interface PubSubEvents {\n 'subscription-change': CustomEvent\n 'message': CustomEvent\n}\n\nexport interface PublishResult {\n recipients: PeerId[]\n}\n\nexport interface PubSub extends EventEmitter {\n globalSignaturePolicy: typeof StrictSign | typeof StrictNoSign\n multicodecs: string[]\n\n getPeers: () => PeerId[]\n getTopics: () => string[]\n subscribe: (topic: string) => void\n unsubscribe: (topic: string) => void\n getSubscribers: (topic: string) => PeerId[]\n publish: (topic: string, data: Uint8Array) => Promise\n}\n\nexport interface PeerStreamEvents {\n 'stream:inbound': CustomEvent\n 'stream:outbound': CustomEvent\n 'close': CustomEvent\n}\n",null,null,null,null,null,null,"\n/**\n * Implemented by components that have a lifecycle\n */\nexport interface Startable {\n isStarted: () => boolean\n\n /**\n * If implemented, this method will be invoked before the start method.\n *\n * It should not assume any other components have been started.\n */\n beforeStart?: () => void | Promise\n\n /**\n * This method will be invoked to start the component.\n *\n * It should not assume that any other components have been started.\n */\n start: () => void | Promise\n\n /**\n * If implemented, this method will be invoked after the start method.\n *\n * All other components will have had their start method invoked before this method is called.\n */\n afterStart?: () => void | Promise\n\n /**\n * If implemented, this method will be invoked before the stop method.\n *\n * Any other components will still be running when this method is called.\n */\n beforeStop?: () => void | Promise\n\n /**\n * This method will be invoked to stop the component.\n *\n * It should not assume any other components are running when it is called.\n */\n stop: () => void | Promise\n\n /**\n * If implemented, this method will be invoked after the stop method.\n *\n * All other components will have had their stop method invoked before this method is called.\n */\n afterStop?: () => void | Promise\n}\n\nexport function isStartable (obj: any): obj is Startable {\n return obj != null && typeof obj.start === 'function' && typeof obj.stop === 'function'\n}\n\nexport async function start (...objs: any[]) {\n const startables: Startable[] = []\n\n for (const obj of objs) {\n if (isStartable(obj)) {\n startables.push(obj)\n }\n }\n\n await Promise.all(\n startables.map(async s => {\n if (s.beforeStart != null) {\n await s.beforeStart()\n }\n })\n )\n\n await Promise.all(\n startables.map(async s => {\n await s.start()\n })\n )\n\n await Promise.all(\n startables.map(async s => {\n if (s.afterStart != null) {\n await s.afterStart()\n }\n })\n )\n}\n\nexport async function stop (...objs: any[]) {\n const startables: Startable[] = []\n\n for (const obj of objs) {\n if (isStartable(obj)) {\n startables.push(obj)\n }\n }\n\n await Promise.all(\n startables.map(async s => {\n if (s.beforeStop != null) {\n await s.beforeStop()\n }\n })\n )\n\n await Promise.all(\n startables.map(async s => {\n await s.stop()\n })\n )\n\n await Promise.all(\n startables.map(async s => {\n if (s.afterStop != null) {\n await s.afterStop()\n }\n })\n )\n}\n","import errCode from 'err-code'\nimport type { ConnectionGater, ConnectionProtector } from '@libp2p/interface-connection'\nimport type { ContentRouting } from '@libp2p/interface-content-routing'\nimport type { AddressManager } from '@libp2p/interface-address-manager'\nimport { isStartable, Startable } from '@libp2p/interfaces/startable'\nimport type { Metrics } from '@libp2p/interface-metrics'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { PeerRouting } from '@libp2p/interface-peer-routing'\nimport type { PeerStore } from '@libp2p/interface-peer-store'\nimport type { Registrar } from '@libp2p/interface-registrar'\nimport type { TransportManager, Upgrader } from '@libp2p/interface-transport'\nimport type { Datastore } from 'interface-datastore'\nimport type { PubSub } from '@libp2p/interface-pubsub'\nimport type { DualDHT } from '@libp2p/interface-dht'\nimport type { ConnectionManager } from '@libp2p/interface-connection-manager'\n\nexport interface Initializable {\n init: (components: Components) => void\n}\n\nexport function isInitializable (obj: any): obj is Initializable {\n return obj != null && typeof obj.init === 'function'\n}\n\nexport interface ComponentsInit {\n peerId?: PeerId\n addressManager?: AddressManager\n peerStore?: PeerStore\n upgrader?: Upgrader\n metrics?: Metrics\n registrar?: Registrar\n connectionManager?: ConnectionManager\n transportManager?: TransportManager\n connectionGater?: ConnectionGater\n contentRouting?: ContentRouting\n peerRouting?: PeerRouting\n datastore?: Datastore\n connectionProtector?: ConnectionProtector\n dht?: DualDHT\n pubsub?: PubSub\n}\n\nexport class Components implements Startable {\n private peerId?: PeerId\n private addressManager?: AddressManager\n private peerStore?: PeerStore\n private upgrader?: Upgrader\n private metrics?: Metrics\n private registrar?: Registrar\n private connectionManager?: ConnectionManager\n private transportManager?: TransportManager\n private connectionGater?: ConnectionGater\n private contentRouting?: ContentRouting\n private peerRouting?: PeerRouting\n private datastore?: Datastore\n private connectionProtector?: ConnectionProtector\n private dht?: DualDHT\n private pubsub?: PubSub\n private started = false\n\n constructor (init: ComponentsInit = {}) {\n if (init.peerId != null) {\n this.setPeerId(init.peerId)\n }\n\n if (init.addressManager != null) {\n this.setAddressManager(init.addressManager)\n }\n\n if (init.peerStore != null) {\n this.setPeerStore(init.peerStore)\n }\n\n if (init.upgrader != null) {\n this.setUpgrader(init.upgrader)\n }\n\n if (init.metrics != null) {\n this.setMetrics(init.metrics)\n }\n\n if (init.registrar != null) {\n this.setRegistrar(init.registrar)\n }\n\n if (init.connectionManager != null) {\n this.setConnectionManager(init.connectionManager)\n }\n\n if (init.transportManager != null) {\n this.setTransportManager(init.transportManager)\n }\n\n if (init.connectionGater != null) {\n this.setConnectionGater(init.connectionGater)\n }\n\n if (init.contentRouting != null) {\n this.setContentRouting(init.contentRouting)\n }\n\n if (init.peerRouting != null) {\n this.setPeerRouting(init.peerRouting)\n }\n\n if (init.datastore != null) {\n this.setDatastore(init.datastore)\n }\n\n if (init.connectionProtector != null) {\n this.setConnectionProtector(init.connectionProtector)\n }\n\n if (init.dht != null) {\n this.setDHT(init.dht)\n }\n\n if (init.pubsub != null) {\n this.setPubSub(init.pubsub)\n }\n }\n\n isStarted () {\n return this.started\n }\n\n async beforeStart () {\n await Promise.all(\n Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {\n if (startable.beforeStart != null) {\n await startable.beforeStart()\n }\n })\n )\n }\n\n async start () {\n await Promise.all(\n Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {\n await startable.start()\n })\n )\n\n this.started = true\n }\n\n async afterStart () {\n await Promise.all(\n Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {\n if (startable.afterStart != null) {\n await startable.afterStart()\n }\n })\n )\n }\n\n async beforeStop () {\n await Promise.all(\n Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {\n if (startable.beforeStop != null) {\n await startable.beforeStop()\n }\n })\n )\n }\n\n async stop () {\n await Promise.all(\n Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {\n await startable.stop()\n })\n )\n\n this.started = false\n }\n\n async afterStop () {\n await Promise.all(\n Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {\n if (startable.afterStop != null) {\n await startable.afterStop()\n }\n })\n )\n }\n\n setPeerId (peerId: PeerId) {\n this.peerId = peerId\n\n return peerId\n }\n\n getPeerId (): PeerId {\n if (this.peerId == null) {\n throw errCode(new Error('peerId not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.peerId\n }\n\n setMetrics (metrics: Metrics) {\n this.metrics = metrics\n\n if (isInitializable(metrics)) {\n metrics.init(this)\n }\n\n return metrics\n }\n\n getMetrics (): Metrics | undefined {\n return this.metrics\n }\n\n setAddressManager (addressManager: AddressManager) {\n this.addressManager = addressManager\n\n if (isInitializable(addressManager)) {\n addressManager.init(this)\n }\n\n return addressManager\n }\n\n getAddressManager (): AddressManager {\n if (this.addressManager == null) {\n throw errCode(new Error('addressManager not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.addressManager\n }\n\n setPeerStore (peerStore: PeerStore) {\n this.peerStore = peerStore\n\n if (isInitializable(peerStore)) {\n peerStore.init(this)\n }\n\n return peerStore\n }\n\n getPeerStore (): PeerStore {\n if (this.peerStore == null) {\n throw errCode(new Error('peerStore not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.peerStore\n }\n\n setUpgrader (upgrader: Upgrader) {\n this.upgrader = upgrader\n\n if (isInitializable(upgrader)) {\n upgrader.init(this)\n }\n\n return upgrader\n }\n\n getUpgrader (): Upgrader {\n if (this.upgrader == null) {\n throw errCode(new Error('upgrader not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.upgrader\n }\n\n setRegistrar (registrar: Registrar) {\n this.registrar = registrar\n\n if (isInitializable(registrar)) {\n registrar.init(this)\n }\n\n return registrar\n }\n\n getRegistrar (): Registrar {\n if (this.registrar == null) {\n throw errCode(new Error('registrar not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.registrar\n }\n\n setConnectionManager (connectionManager: ConnectionManager) {\n this.connectionManager = connectionManager\n\n if (isInitializable(connectionManager)) {\n connectionManager.init(this)\n }\n\n return connectionManager\n }\n\n getConnectionManager (): ConnectionManager {\n if (this.connectionManager == null) {\n throw errCode(new Error('connectionManager not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.connectionManager\n }\n\n setTransportManager (transportManager: TransportManager) {\n this.transportManager = transportManager\n\n if (isInitializable(transportManager)) {\n transportManager.init(this)\n }\n\n return transportManager\n }\n\n getTransportManager (): TransportManager {\n if (this.transportManager == null) {\n throw errCode(new Error('transportManager not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.transportManager\n }\n\n setConnectionGater (connectionGater: ConnectionGater) {\n this.connectionGater = connectionGater\n\n if (isInitializable(connectionGater)) {\n connectionGater.init(this)\n }\n\n return connectionGater\n }\n\n getConnectionGater (): ConnectionGater {\n if (this.connectionGater == null) {\n throw errCode(new Error('connectionGater not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.connectionGater\n }\n\n setContentRouting (contentRouting: ContentRouting) {\n this.contentRouting = contentRouting\n\n if (isInitializable(contentRouting)) {\n contentRouting.init(this)\n }\n\n return contentRouting\n }\n\n getContentRouting (): ContentRouting {\n if (this.contentRouting == null) {\n throw errCode(new Error('contentRouting not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.contentRouting\n }\n\n setPeerRouting (peerRouting: PeerRouting) {\n this.peerRouting = peerRouting\n\n if (isInitializable(peerRouting)) {\n peerRouting.init(this)\n }\n\n return peerRouting\n }\n\n getPeerRouting (): PeerRouting {\n if (this.peerRouting == null) {\n throw errCode(new Error('peerRouting not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.peerRouting\n }\n\n setDatastore (datastore: Datastore) {\n this.datastore = datastore\n\n if (isInitializable(datastore)) {\n datastore.init(this)\n }\n\n return datastore\n }\n\n getDatastore (): Datastore {\n if (this.datastore == null) {\n throw errCode(new Error('datastore not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.datastore\n }\n\n setConnectionProtector (connectionProtector: ConnectionProtector) {\n this.connectionProtector = connectionProtector\n\n if (isInitializable(connectionProtector)) {\n connectionProtector.init(this)\n }\n\n return connectionProtector\n }\n\n getConnectionProtector (): ConnectionProtector | undefined {\n return this.connectionProtector\n }\n\n setDHT (dht: DualDHT) {\n this.dht = dht\n\n if (isInitializable(dht)) {\n dht.init(this)\n }\n\n return dht\n }\n\n getDHT (): DualDHT {\n if (this.dht == null) {\n throw errCode(new Error('dht not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.dht\n }\n\n setPubSub (pubsub: PubSub) {\n this.pubsub = pubsub\n\n if (isInitializable(pubsub)) {\n pubsub.init(this)\n }\n\n return pubsub\n }\n\n getPubSub (): PubSub {\n if (this.pubsub == null) {\n throw errCode(new Error('pubsub not set'), 'ERR_SERVICE_MISSING')\n }\n\n return this.pubsub\n }\n}\n",null,null,null,null,"// @ts-expect-error types are missing\nimport forgePbkdf2 from 'node-forge/lib/pbkdf2.js'\n// @ts-expect-error types are missing\nimport forgeUtil from 'node-forge/lib/util.js'\nimport errcode from 'err-code'\n\n/**\n * Maps an IPFS hash name to its node-forge equivalent.\n *\n * See https://github.com/multiformats/multihash/blob/master/hashtable.csv\n *\n * @private\n */\nconst hashName = {\n sha1: 'sha1',\n 'sha2-256': 'sha256',\n 'sha2-512': 'sha512'\n}\n\n/**\n * Computes the Password-Based Key Derivation Function 2.\n */\nexport default function pbkdf2 (password: string, salt: string, iterations: number, keySize: number, hash: string): string {\n if (hash !== 'sha1' && hash !== 'sha2-256' && hash !== 'sha2-512') {\n const types = Object.keys(hashName).join(' / ')\n throw errcode(new Error(`Hash '${hash}' is unknown or not supported. Must be ${types}`), 'ERR_UNSUPPORTED_HASH_TYPE')\n }\n\n const hasher = hashName[hash]\n const dek = forgePbkdf2(\n password,\n salt,\n iterations,\n keySize,\n hasher\n )\n\n return forgeUtil.encode64(dek, null)\n}\n",null,null,"import { randomBytes } from '@libp2p/crypto'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { toString as uint8ArrayToString } from 'uint8arrays/to-string'\nimport { sha256 } from 'multiformats/hashes/sha2'\nimport type { Message, PubSubRPCMessage } from '@libp2p/interface-pubsub'\nimport { peerIdFromBytes } from '@libp2p/peer-id'\nimport { codes } from './errors.js'\nimport errcode from 'err-code'\n\n/**\n * Generate a random sequence number\n */\nexport function randomSeqno (): bigint {\n return BigInt(`0x${uint8ArrayToString(randomBytes(8), 'base16')}`)\n}\n\n/**\n * Generate a message id, based on the `key` and `seqno`\n */\nexport const msgId = (key: Uint8Array, seqno: bigint) => {\n const seqnoBytes = uint8ArrayFromString(seqno.toString(16).padStart(16, '0'), 'base16')\n\n const msgId = new Uint8Array(key.length + seqnoBytes.length)\n msgId.set(key, 0)\n msgId.set(seqnoBytes, key.length)\n\n return msgId\n}\n\n/**\n * Generate a message id, based on message `data`\n */\nexport const noSignMsgId = (data: Uint8Array) => {\n return sha256.encode(data)\n}\n\n/**\n * Check if any member of the first set is also a member\n * of the second set\n */\nexport const anyMatch = (a: Set | number[], b: Set | number[]) => {\n let bHas\n if (Array.isArray(b)) {\n bHas = (val: number) => b.includes(val)\n } else {\n bHas = (val: number) => b.has(val)\n }\n\n for (const val of a) {\n if (bHas(val)) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Make everything an array\n */\nexport const ensureArray = function (maybeArray: T | T[]) {\n if (!Array.isArray(maybeArray)) {\n return [maybeArray]\n }\n\n return maybeArray\n}\n\nexport const toMessage = (message: PubSubRPCMessage): Message => {\n if (message.from == null) {\n throw errcode(new Error('RPC message was missing from'), codes.ERR_MISSING_FROM)\n }\n\n if (message.sequenceNumber == null || message.from == null || message.signature == null || message.key == null) {\n return {\n type: 'unsigned',\n topic: message.topic ?? '',\n data: message.data ?? new Uint8Array(0)\n }\n }\n\n return {\n type: 'signed',\n from: peerIdFromBytes(message.from),\n topic: message.topic ?? '',\n sequenceNumber: bigIntFromBytes(message.sequenceNumber),\n data: message.data ?? new Uint8Array(0),\n signature: message.signature,\n key: message.key\n }\n}\n\nexport const toRpcMessage = (message: Message): PubSubRPCMessage => {\n if (message.type === 'signed') {\n return {\n from: message.from.multihash.bytes,\n data: message.data,\n sequenceNumber: bigIntToBytes(message.sequenceNumber),\n topic: message.topic,\n signature: message.signature,\n key: message.key\n }\n }\n\n return {\n data: message.data,\n topic: message.topic\n }\n}\n\nexport const bigIntToBytes = (num: bigint): Uint8Array => {\n let str = num.toString(16)\n\n if (str.length % 2 !== 0) {\n str = `0${str}`\n }\n\n return uint8ArrayFromString(str, 'base16')\n}\n\nexport const bigIntFromBytes = (num: Uint8Array): bigint => {\n return BigInt(`0x${uint8ArrayToString(num, 'base16')}`)\n}\n",null,null,"\nexport class AbortError extends Error {\n type: string\n code: string\n\n constructor (message?: string, code?: string) {\n super(message ?? 'The operation was aborted')\n this.type = 'aborted'\n this.code = code ?? 'ABORT_ERR'\n }\n}\n","import { AbortError } from './abort-error.js'\nimport { getIterator } from 'get-iterator'\nimport type { Duplex, Source, Sink } from 'it-stream-types'\n\nexport interface Options {\n onReturnError?: (err: Error) => void\n onAbort?: (source: Source) => void\n abortMessage?: string\n abortCode?: string\n returnOnAbort?: boolean\n}\n\n// Wrap an iterator to make it abortable, allow cleanup when aborted via onAbort\nexport function abortableSource (source: Source, signal: AbortSignal, options?: Options) {\n const opts: Options = options ?? {}\n const iterator = getIterator(source)\n\n async function * abortable () {\n let nextAbortHandler: (() => void) | null\n const abortHandler = () => {\n if (nextAbortHandler != null) nextAbortHandler()\n }\n\n signal.addEventListener('abort', abortHandler)\n\n while (true) {\n let result: IteratorResult\n try {\n if (signal.aborted) {\n const { abortMessage, abortCode } = opts\n throw new AbortError(abortMessage, abortCode)\n }\n\n const abort = new Promise((resolve, reject) => { // eslint-disable-line no-loop-func\n nextAbortHandler = () => {\n const { abortMessage, abortCode } = opts\n reject(new AbortError(abortMessage, abortCode))\n }\n })\n\n // Race the iterator and the abort signals\n result = await Promise.race([abort, iterator.next()])\n nextAbortHandler = null\n } catch (err: any) {\n signal.removeEventListener('abort', abortHandler)\n\n // Might not have been aborted by a known signal\n const isKnownAborter = err.type === 'aborted' && signal.aborted\n\n if (isKnownAborter && (opts.onAbort != null)) {\n // Do any custom abort handling for the iterator\n await opts.onAbort(source)\n }\n\n // End the iterator if it is a generator\n if (typeof iterator.return === 'function') {\n try {\n const p = iterator.return()\n\n if (p instanceof Promise) { // eslint-disable-line max-depth\n p.catch(err => {\n if (opts.onReturnError != null) {\n opts.onReturnError(err)\n }\n })\n }\n } catch (err: any) {\n if (opts.onReturnError != null) { // eslint-disable-line max-depth\n opts.onReturnError(err)\n }\n }\n }\n\n if (isKnownAborter && opts.returnOnAbort === true) {\n return\n }\n\n throw err\n }\n\n if (result.done === true) {\n break\n }\n\n yield result.value\n }\n\n signal.removeEventListener('abort', abortHandler)\n }\n\n return abortable()\n}\n\nexport function abortableSink (sink: Sink, signal: AbortSignal, options?: Options): Sink {\n return (source: Source) => sink(abortableSource(source, signal, options))\n}\n\nexport function abortableDuplex > (duplex: Duplex, signal: AbortSignal, options?: Options) {\n return {\n sink: abortableSink(duplex.sink, signal, {\n ...options,\n onAbort: undefined\n }),\n source: abortableSource(duplex.source, signal, options)\n }\n}\n\nexport { AbortError }\nexport { abortableSink as abortableTransform }\n","\n// If the passed object is an (async) iterable, then get the iterator\n// If it's probably an iterator already (i.e. has next function) return it\n// else throw\nexport function getIterator (obj: AsyncIterable): AsyncIterator\nexport function getIterator (obj: AsyncIterator): AsyncIterator\nexport function getIterator (obj: Iterable): Iterator\nexport function getIterator (obj: Iterator): Iterator\nexport function getIterator (obj: any): AsyncIterator | Iterator \nexport function getIterator (obj: any): AsyncIterator | Iterator {\n if (obj != null) {\n if (typeof obj[Symbol.iterator] === 'function') {\n return obj[Symbol.iterator]()\n }\n if (typeof obj[Symbol.asyncIterator] === 'function') {\n return obj[Symbol.asyncIterator]()\n }\n if (typeof obj.next === 'function') {\n return obj // probably an iterator\n }\n }\n throw new Error('argument is not an iterator or iterable')\n}\n",null,null,null,"import {\n GossipSub,\n GossipsubMessage,\n GossipsubOpts,\n} from \"@chainsafe/libp2p-gossipsub\";\nimport {\n PeerIdStr,\n TopicStr,\n} from \"@chainsafe/libp2p-gossipsub/dist/src/types\";\nimport { SignaturePolicy } from \"@chainsafe/libp2p-gossipsub/types\";\nimport debug from \"debug\";\n\nimport { DefaultPubSubTopic } from \"../constants\";\nimport { hexToBytes } from \"../utils\";\nimport { DecryptionMethod, WakuMessage } from \"../waku_message\";\n\nimport * as constants from \"./constants\";\n\nconst dbg = debug(\"waku:relay\");\n\nexport interface CreateOptions {\n /**\n * The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}.\n *\n * One and only one pubsub topic is used by Waku. This is used by:\n * - WakuRelay to receive, route and send messages,\n * - WakuLightPush to send messages,\n * - WakuStore to retrieve messages.\n *\n * The usage of the default pubsub topic is recommended.\n * See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for details.\n *\n * @default {@link DefaultPubSubTopic}\n */\n pubSubTopic?: string;\n decryptionKeys?: Array;\n}\n\n/**\n * Implements the [Waku v2 Relay protocol](https://rfc.vac.dev/spec/11/).\n * Must be passed as a `pubsub` module to a `Libp2p` instance.\n *\n * @implements {require('libp2p-interfaces/src/pubsub')}\n */\nexport class WakuRelay extends GossipSub {\n pubSubTopic: string;\n public static multicodec: string = constants.RelayCodecs[0];\n\n public decryptionKeys: Map<\n Uint8Array,\n { method?: DecryptionMethod; contentTopics?: string[] }\n >;\n\n /**\n * observers called when receiving new message.\n * Observers under key `\"\"` are always called.\n */\n public observers: {\n [contentTopic: string]: Set<(message: WakuMessage) => void>;\n };\n\n constructor(options?: Partial) {\n options = Object.assign(options ?? {}, {\n // Ensure that no signature is included nor expected in the messages.\n globalSignaturePolicy: SignaturePolicy.StrictNoSign,\n fallbackToFloodsub: false,\n });\n super(options);\n this.multicodecs = constants.RelayCodecs;\n\n this.observers = {};\n this.decryptionKeys = new Map();\n\n this.pubSubTopic = options?.pubSubTopic ?? DefaultPubSubTopic;\n\n options?.decryptionKeys?.forEach((key) => {\n this.addDecryptionKey(key);\n });\n }\n\n /**\n * Mounts the gossipsub protocol onto the libp2p node\n * and subscribes to the default topic.\n *\n * @override\n * @returns {void}\n */\n public async start(): Promise {\n await super.start();\n this.subscribe(this.pubSubTopic);\n }\n\n /**\n * Send Waku message.\n *\n * @param {WakuMessage} message\n * @returns {Promise}\n */\n public async send(message: WakuMessage): Promise {\n const msg = message.encode();\n await this.publish(this.pubSubTopic, msg);\n }\n\n /**\n * Register a decryption key to attempt decryption of received messages.\n * This can either be a private key for asymmetric encryption or a symmetric\n * key. `WakuRelay` will attempt to decrypt messages using both methods.\n *\n * Strings must be in hex format.\n */\n addDecryptionKey(\n key: Uint8Array | string,\n options?: { method?: DecryptionMethod; contentTopics?: string[] }\n ): void {\n this.decryptionKeys.set(hexToBytes(key), options ?? {});\n }\n\n /**\n * Delete a decryption key that was used to attempt decryption of received\n * messages.\n *\n * Strings must be in hex format.\n */\n deleteDecryptionKey(key: Uint8Array | string): void {\n this.decryptionKeys.delete(hexToBytes(key));\n }\n\n /**\n * Register an observer of new messages received via waku relay\n *\n * @param callback called when a new message is received via waku relay\n * @param contentTopics Content Topics for which the callback with be called,\n * all of them if undefined, [] or [\"\",..] is passed.\n * @returns {void}\n */\n addObserver(\n callback: (message: WakuMessage) => void,\n contentTopics: string[] = []\n ): void {\n if (contentTopics.length === 0) {\n if (!this.observers[\"\"]) {\n this.observers[\"\"] = new Set();\n }\n this.observers[\"\"].add(callback);\n } else {\n contentTopics.forEach((contentTopic) => {\n if (!this.observers[contentTopic]) {\n this.observers[contentTopic] = new Set();\n }\n this.observers[contentTopic].add(callback);\n });\n }\n }\n\n /**\n * Remove an observer of new messages received via waku relay.\n * Useful to ensure the same observer is not registered several time\n * (e.g when loading React components)\n */\n deleteObserver(\n callback: (message: WakuMessage) => void,\n contentTopics: string[] = []\n ): void {\n if (contentTopics.length === 0) {\n if (this.observers[\"\"]) {\n this.observers[\"\"].delete(callback);\n }\n } else {\n contentTopics.forEach((contentTopic) => {\n if (this.observers[contentTopic]) {\n this.observers[contentTopic].delete(callback);\n }\n });\n }\n }\n\n /**\n * Subscribe to a pubsub topic and start emitting Waku messages to observers.\n *\n * @override\n */\n subscribe(pubSubTopic: string): void {\n this.addEventListener(\n \"gossipsub:message\",\n (event: CustomEvent) => {\n if (event.detail.msg.topic === pubSubTopic) {\n const decryptionKeys = Array.from(this.decryptionKeys).map(\n ([key, { method, contentTopics }]) => {\n return {\n key,\n method,\n contentTopics,\n };\n }\n );\n\n dbg(`Message received on ${pubSubTopic}`);\n WakuMessage.decode(event.detail.msg.data, decryptionKeys)\n .then((wakuMsg) => {\n if (!wakuMsg) {\n dbg(\"Failed to decode Waku Message\");\n return;\n }\n\n if (this.observers[\"\"]) {\n this.observers[\"\"].forEach((callbackFn) => {\n callbackFn(wakuMsg);\n });\n }\n if (wakuMsg.contentTopic) {\n if (this.observers[wakuMsg.contentTopic]) {\n this.observers[wakuMsg.contentTopic].forEach((callbackFn) => {\n callbackFn(wakuMsg);\n });\n }\n }\n })\n .catch((e) => {\n dbg(\"Failed to decode Waku Message\", e);\n });\n }\n }\n );\n\n super.subscribe(pubSubTopic);\n }\n\n getMeshPeers(topic?: TopicStr): PeerIdStr[] {\n return super.getMeshPeers(topic ?? this.pubSubTopic);\n }\n}\n","import { HKDF } from '@stablelib/hkdf'\nimport * as x25519 from '@stablelib/x25519'\nimport { SHA256, hash } from '@stablelib/sha256'\nimport { ChaCha20Poly1305 } from '@stablelib/chacha20poly1305'\nimport type { bytes32, bytes } from '../@types/basic.js'\nimport type { Hkdf } from '../@types/handshake.js'\nimport type { KeyPair } from '../@types/libp2p.js'\nimport type { ICryptoInterface } from '../crypto.js'\n\nexport const stablelib: ICryptoInterface = {\n hashSHA256 (data: Uint8Array): Uint8Array {\n return hash(data)\n },\n\n getHKDF (ck: bytes32, ikm: Uint8Array): Hkdf {\n const hkdf = new HKDF(SHA256, ikm, ck)\n const okmU8Array = hkdf.expand(96)\n const okm = okmU8Array\n\n const k1 = okm.subarray(0, 32)\n const k2 = okm.subarray(32, 64)\n const k3 = okm.subarray(64, 96)\n\n return [k1, k2, k3]\n },\n\n generateX25519KeyPair (): KeyPair {\n const keypair = x25519.generateKeyPair()\n\n return {\n publicKey: keypair.publicKey,\n privateKey: keypair.secretKey\n }\n },\n\n generateX25519KeyPairFromSeed (seed: Uint8Array): KeyPair {\n const keypair = x25519.generateKeyPairFromSeed(seed)\n\n return {\n publicKey: keypair.publicKey,\n privateKey: keypair.secretKey\n }\n },\n\n generateX25519SharedKey (privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array {\n return x25519.sharedKey(privateKey, publicKey)\n },\n\n chaCha20Poly1305Encrypt (plaintext: Uint8Array, nonce: Uint8Array, ad: Uint8Array, k: bytes32): bytes {\n const ctx = new ChaCha20Poly1305(k)\n\n return ctx.seal(nonce, plaintext, ad)\n },\n\n chaCha20Poly1305Decrypt (ciphertext: Uint8Array, nonce: Uint8Array, ad: Uint8Array, k: bytes32): bytes | null {\n const ctx = new ChaCha20Poly1305(k)\n\n return ctx.open(nonce, ciphertext, ad)\n }\n}\n","export default function pDefer() {\n\tconst deferred = {};\n\n\tdeferred.promise = new Promise((resolve, reject) => {\n\t\tdeferred.resolve = resolve;\n\t\tdeferred.reject = reject;\n\t});\n\n\treturn deferred;\n}\n","import { Reader, reader } from 'it-reader'\nimport { pushable } from 'it-pushable'\nimport defer from 'p-defer'\nimport type { Duplex, Source } from 'it-stream-types'\nimport type { Pushable } from 'it-pushable'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nexport interface Handshake {\n reader: Reader\n writer: Pushable\n stream: Duplex\n rest: () => Source\n write: (data: TSink) => void\n read: () => Promise\n}\n\n// Convert a duplex stream into a reader and writer and rest stream\nexport function handshake (stream: Duplex): Handshake {\n const writer = pushable() // Write bytes on demand to the sink\n const source = reader(stream.source) // Read bytes on demand from the source\n\n // Waits for a source to be passed to the rest stream's sink\n const sourcePromise = defer>()\n let sinkErr: Error\n\n const sinkPromise = stream.sink((async function * () {\n yield * writer\n const source = await sourcePromise.promise\n yield * source\n })())\n\n sinkPromise.catch(err => {\n sinkErr = err\n })\n\n const rest: Duplex = {\n sink: async source => {\n if (sinkErr != null) {\n return await Promise.reject(sinkErr)\n }\n\n sourcePromise.resolve(source)\n return await sinkPromise\n },\n source\n }\n\n return {\n reader: source,\n writer,\n stream: rest,\n rest: () => writer.end(),\n write: writer.push,\n read: async () => {\n const res = await source.next()\n\n if (res.value != null) {\n return res.value\n }\n }\n }\n}\n","import { Uint8ArrayList } from 'uint8arraylist'\nimport type { Source } from 'it-stream-types'\n\nexport interface Reader extends AsyncGenerator {\n next: (...args: [] | [number | undefined]) => Promise>\n}\n\nexport function reader (source: Source) {\n const reader: Reader = (async function * (): AsyncGenerator {\n // @ts-expect-error first yield in stream is ignored\n let bytes: number | undefined = yield // Allows us to receive 8 when reader.next(8) is called\n let bl = new Uint8ArrayList()\n\n for await (const chunk of source) {\n if (bytes == null) {\n bl.append(chunk)\n bytes = yield bl\n bl = new Uint8ArrayList()\n continue\n }\n\n bl.append(chunk)\n\n while (bl.length >= bytes) {\n const data = bl.sublist(0, bytes)\n bl.consume(bytes)\n bytes = yield data\n\n // If we no longer want a specific byte length, we yield the rest now\n if (bytes == null) {\n if (bl.length > 0) {\n bytes = yield bl\n bl = new Uint8ArrayList()\n }\n break // bytes is null and/or no more buffer to yield\n }\n }\n }\n\n // Consumer wants more bytes but the source has ended and our buffer\n // is not big enough to satisfy.\n if (bytes != null) {\n throw Object.assign(\n new Error(`stream ended before ${bytes} bytes became available`),\n { code: 'ERR_UNDER_READ', buffer: bl }\n )\n }\n })()\n\n void reader.next()\n return reader\n}\n","import { handshake } from 'it-handshake'\nimport * as lp from 'it-length-prefixed'\nimport type { Duplex } from 'it-stream-types'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\ninterface Decoder {\n (data: Uint8Array | Uint8ArrayList): T\n}\n\ninterface Encoder {\n (data: T): Uint8Array\n}\n\nexport interface ProtobufStream {\n read: (bytes?: number) => Promise\n readLP: () => Promise\n readPB: (proto: { decode: Decoder }) => Promise\n write: (input: Uint8Array | Uint8ArrayList) => void\n writeLP: (input: Uint8Array | Uint8ArrayList) => void\n writePB: (data: Uint8Array | Uint8ArrayList, proto: {encode: Encoder}) => void\n pb: (proto: {encode: Encoder, decode: Decoder }) => {read: () => Promise, write: (d: Uint8Array | Uint8ArrayList) => void}\n\n // return vanilla duplex\n unwrap: () => Duplex\n}\n\nexport interface Opts {\n // encoding opts\n poolSize: number\n minPoolSize: number\n lengthEncoder: lp.LengthEncoderFunction\n\n // decoding opts\n lengthDecoder: lp.LengthDecoderFunction\n maxLengthLength: number\n maxDataLength: number\n}\n\nexport function pbStream (duplex: Duplex, opts = {}): ProtobufStream {\n const shake = handshake(duplex)\n const lpReader = lp.decode.fromReader(\n shake.reader,\n opts\n )\n\n const W: ProtobufStream = {\n read: async (bytes) => {\n // just read\n const { value } = await shake.reader.next(bytes)\n\n if (value == null) {\n throw new Error('Value is null')\n }\n\n return value\n },\n readLP: async () => {\n // read, decode\n // @ts-expect-error .next is part of the generator interface\n const { value } = await lpReader.next()\n\n if (value == null) {\n throw new Error('Value is null')\n }\n\n return value\n },\n readPB: async (proto) => {\n // readLP, decode\n const value = await W.readLP()\n\n if (value == null) {\n throw new Error('Value is null')\n }\n\n // Is this a buffer?\n const buf = value instanceof Uint8Array ? value : value.slice()\n\n return proto.decode(buf)\n },\n write: (data) => {\n // just write\n if (data instanceof Uint8Array) {\n shake.writer.push(data)\n } else {\n shake.writer.push(data.slice())\n }\n },\n writeLP: (data) => {\n // encode, write\n W.write(lp.encode.single(data, opts))\n },\n writePB: (data, proto) => {\n // encode, writeLP\n W.writeLP(proto.encode(data))\n },\n pb: (proto) => {\n return {\n read: async () => await W.readPB(proto),\n write: (d) => W.writePB(d, proto)\n }\n },\n unwrap: () => {\n // returns vanilla duplex again, terminates all reads/writes from this object\n shake.rest()\n return shake.stream\n }\n }\n\n return W\n}\n","import defer from 'p-defer'\nimport type { Source, Duplex } from 'it-stream-types'\n\n/**\n * A pair of streams where one drains from the other\n */\nexport function pair (): Duplex {\n const deferred = defer>()\n let piped = false\n\n return {\n sink: async source => {\n if (piped) {\n throw new Error('already piped')\n }\n\n piped = true\n deferred.resolve(source)\n },\n source: (async function * () {\n const source = await deferred.promise\n\n yield * source\n }())\n }\n}\n","export const NOISE_MSG_MAX_LENGTH_BYTES = 65535\nexport const NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG = NOISE_MSG_MAX_LENGTH_BYTES - 16\n\nexport const DUMP_SESSION_KEYS = Boolean(globalThis.process?.env?.DUMP_SESSION_KEYS)\n","import { concat as uint8ArrayConcat } from 'uint8arrays/concat'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { bytes } from './@types/basic.js'\nimport type { MessageBuffer } from './@types/handshake.js'\nimport type { LengthDecoderFunction, LengthEncoderFunction } from 'it-length-prefixed'\n\nconst allocUnsafe = (len: number): Uint8Array => {\n if (globalThis.Buffer) {\n return globalThis.Buffer.allocUnsafe(len)\n }\n\n return new Uint8Array(len)\n}\n\nexport const uint16BEEncode: LengthEncoderFunction = (value: number) => {\n const target = allocUnsafe(2)\n new DataView(target.buffer, target.byteOffset, target.byteLength).setUint16(0, value, false)\n return target\n}\nuint16BEEncode.bytes = 2\n\nexport const uint16BEDecode: LengthDecoderFunction = (data: Uint8Array | Uint8ArrayList): number => {\n if (data.length < 2) throw RangeError('Could not decode int16BE')\n\n if (data instanceof Uint8Array) {\n return new DataView(data.buffer, data.byteOffset, data.byteLength).getUint16(0, false)\n }\n\n return data.getUint16(0)\n}\nuint16BEDecode.bytes = 2\n\n// Note: IK and XX encoder usage is opposite (XX uses in stages encode0 where IK uses encode1)\n\nexport function encode0 (message: MessageBuffer): bytes {\n return uint8ArrayConcat([message.ne, message.ciphertext], message.ne.length + message.ciphertext.length)\n}\n\nexport function encode1 (message: MessageBuffer): bytes {\n return uint8ArrayConcat([message.ne, message.ns, message.ciphertext], message.ne.length + message.ns.length + message.ciphertext.length)\n}\n\nexport function encode2 (message: MessageBuffer): bytes {\n return uint8ArrayConcat([message.ns, message.ciphertext], message.ns.length + message.ciphertext.length)\n}\n\nexport function decode0 (input: bytes): MessageBuffer {\n if (input.length < 32) {\n throw new Error('Cannot decode stage 0 MessageBuffer: length less than 32 bytes.')\n }\n\n return {\n ne: input.subarray(0, 32),\n ciphertext: input.subarray(32, input.length),\n ns: new Uint8Array(0)\n }\n}\n\nexport function decode1 (input: bytes): MessageBuffer {\n if (input.length < 80) {\n throw new Error('Cannot decode stage 1 MessageBuffer: length less than 80 bytes.')\n }\n\n return {\n ne: input.subarray(0, 32),\n ns: input.subarray(32, 80),\n ciphertext: input.subarray(80, input.length)\n }\n}\n\nexport function decode2 (input: bytes): MessageBuffer {\n if (input.length < 48) {\n throw new Error('Cannot decode stage 2 MessageBuffer: length less than 48 bytes.')\n }\n\n return {\n ne: new Uint8Array(0),\n ns: input.subarray(0, 48),\n ciphertext: input.subarray(48, input.length)\n }\n}\n","\nexport class UnexpectedPeerError extends Error {\n public code: string\n\n constructor (message = 'Unexpected Peer') {\n super(message)\n this.code = UnexpectedPeerError.code\n }\n\n static get code () {\n return 'ERR_UNEXPECTED_PEER'\n }\n}\n\nexport class InvalidCryptoExchangeError extends Error {\n public code: string\n\n constructor (message = 'Invalid crypto exchange') {\n super(message)\n this.code = InvalidCryptoExchangeError.code\n }\n\n static get code () {\n return 'ERR_INVALID_CRYPTO_EXCHANGE'\n }\n}\n\nexport class InvalidCryptoTransmissionError extends Error {\n public code: string\n\n constructor (message = 'Invalid crypto transmission') {\n super(message)\n this.code = InvalidCryptoTransmissionError.code\n }\n\n static get code () {\n return 'ERR_INVALID_CRYPTO_TRANSMISSION'\n }\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport namespace pb {\n export interface NoiseHandshakePayload {\n identityKey: Uint8Array\n identitySig: Uint8Array\n data: Uint8Array\n }\n\n export namespace NoiseHandshakePayload {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.identityKey != null) {\n writer.uint32(10)\n writer.bytes(obj.identityKey)\n } else {\n throw new Error('Protocol error: required field \"identityKey\" was not found in object')\n }\n\n if (obj.identitySig != null) {\n writer.uint32(18)\n writer.bytes(obj.identitySig)\n } else {\n throw new Error('Protocol error: required field \"identitySig\" was not found in object')\n }\n\n if (obj.data != null) {\n writer.uint32(26)\n writer.bytes(obj.data)\n } else {\n throw new Error('Protocol error: required field \"data\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n identityKey: new Uint8Array(0),\n identitySig: new Uint8Array(0),\n data: new Uint8Array(0)\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.identityKey = reader.bytes()\n break\n case 2:\n obj.identitySig = reader.bytes()\n break\n case 3:\n obj.data = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.identityKey == null) {\n throw new Error('Protocol error: value for required field \"identityKey\" was not found in protobuf')\n }\n\n if (obj.identitySig == null) {\n throw new Error('Protocol error: value for required field \"identitySig\" was not found in protobuf')\n }\n\n if (obj.data == null) {\n throw new Error('Protocol error: value for required field \"data\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: NoiseHandshakePayload): Uint8Array => {\n return encodeMessage(obj, NoiseHandshakePayload.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): NoiseHandshakePayload => {\n return decodeMessage(buf, NoiseHandshakePayload.codec())\n }\n }\n}\n","import { unmarshalPublicKey, unmarshalPrivateKey } from '@libp2p/crypto/keys'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport { peerIdFromKeys } from '@libp2p/peer-id'\nimport { concat as uint8ArrayConcat } from 'uint8arrays/concat'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport type { bytes } from './@types/basic.js'\nimport { pb } from './proto/payload.js'\n\nconst NoiseHandshakePayloadProto = pb.NoiseHandshakePayload\n\nexport async function getPayload (\n localPeer: PeerId,\n staticPublicKey: bytes,\n earlyData?: bytes\n): Promise {\n const signedPayload = await signPayload(localPeer, getHandshakePayload(staticPublicKey))\n const earlyDataPayload = earlyData ?? new Uint8Array(0)\n\n if (localPeer.publicKey == null) {\n throw new Error('PublicKey was missing from local PeerId')\n }\n\n return createHandshakePayload(\n localPeer.publicKey,\n signedPayload,\n earlyDataPayload\n )\n}\n\nexport function createHandshakePayload (\n libp2pPublicKey: Uint8Array,\n signedPayload: Uint8Array,\n earlyData?: Uint8Array\n): bytes {\n return NoiseHandshakePayloadProto.encode({\n identityKey: libp2pPublicKey,\n identitySig: signedPayload,\n data: earlyData ?? new Uint8Array(0)\n }).subarray()\n}\n\nexport async function signPayload (peerId: PeerId, payload: bytes): Promise {\n if (peerId.privateKey == null) {\n throw new Error('PrivateKey was missing from PeerId')\n }\n\n const privateKey = await unmarshalPrivateKey(peerId.privateKey)\n\n return await privateKey.sign(payload)\n}\n\nexport async function getPeerIdFromPayload (payload: pb.NoiseHandshakePayload): Promise {\n return await peerIdFromKeys(payload.identityKey)\n}\n\nexport function decodePayload (payload: bytes|Uint8Array): pb.NoiseHandshakePayload {\n return NoiseHandshakePayloadProto.decode(payload)\n}\n\nexport function getHandshakePayload (publicKey: bytes): bytes {\n const prefix = uint8ArrayFromString('noise-libp2p-static-key:')\n return uint8ArrayConcat([prefix, publicKey], prefix.length + publicKey.length)\n}\n\n/**\n * Verifies signed payload, throws on any irregularities.\n *\n * @param {bytes} noiseStaticKey - owner's noise static key\n * @param {bytes} payload - decoded payload\n * @param {PeerId} remotePeer - owner's libp2p peer ID\n * @returns {Promise} - peer ID of payload owner\n */\nexport async function verifySignedPayload (\n noiseStaticKey: bytes,\n payload: pb.NoiseHandshakePayload,\n remotePeer: PeerId\n): Promise {\n // Unmarshaling from PublicKey protobuf\n const payloadPeerId = await peerIdFromKeys(payload.identityKey)\n if (!payloadPeerId.equals(remotePeer)) {\n throw new Error(\"Peer ID doesn't match libp2p public key.\")\n }\n const generatedPayload = getHandshakePayload(noiseStaticKey)\n\n if (payloadPeerId.publicKey == null) {\n throw new Error('PublicKey was missing from PeerId')\n }\n\n if (payload.identitySig == null) {\n throw new Error('Signature was missing from message')\n }\n\n const publicKey = unmarshalPublicKey(payloadPeerId.publicKey)\n\n const valid = await publicKey.verify(generatedPayload, payload.identitySig)\n\n if (!valid) {\n throw new Error(\"Static key doesn't match to peer that signed payload!\")\n }\n\n return payloadPeerId\n}\n\nexport function isValidPublicKey (pk: bytes): boolean {\n if (!(pk instanceof Uint8Array)) {\n return false\n }\n\n if (pk.length !== 32) {\n return false\n }\n\n return true\n}\n","import { Logger, logger } from '@libp2p/logger'\nimport { toString as uint8ArrayToString } from 'uint8arrays/to-string'\nimport type { NoiseSession } from './@types/handshake.js'\nimport type { KeyPair } from './@types/libp2p.js'\nimport { DUMP_SESSION_KEYS } from './constants.js'\n\nconst log = logger('libp2p:noise')\n\nexport { log as logger }\n\nlet keyLogger: Logger\nif (DUMP_SESSION_KEYS) {\n keyLogger = log\n} else {\n keyLogger = Object.assign(() => { /* do nothing */ }, {\n enabled: false,\n trace: () => {},\n error: () => {}\n })\n}\n\nexport function logLocalStaticKeys (s: KeyPair): void {\n keyLogger(`LOCAL_STATIC_PUBLIC_KEY ${uint8ArrayToString(s.publicKey, 'hex')}`)\n keyLogger(`LOCAL_STATIC_PRIVATE_KEY ${uint8ArrayToString(s.privateKey, 'hex')}`)\n}\n\nexport function logLocalEphemeralKeys (e: KeyPair|undefined): void {\n if (e) {\n keyLogger(`LOCAL_PUBLIC_EPHEMERAL_KEY ${uint8ArrayToString(e.publicKey, 'hex')}`)\n keyLogger(`LOCAL_PRIVATE_EPHEMERAL_KEY ${uint8ArrayToString(e.privateKey, 'hex')}`)\n } else {\n keyLogger('Missing local ephemeral keys.')\n }\n}\n\nexport function logRemoteStaticKey (rs: Uint8Array): void {\n keyLogger(`REMOTE_STATIC_PUBLIC_KEY ${uint8ArrayToString(rs, 'hex')}`)\n}\n\nexport function logRemoteEphemeralKey (re: Uint8Array): void {\n keyLogger(`REMOTE_EPHEMERAL_PUBLIC_KEY ${uint8ArrayToString(re, 'hex')}`)\n}\n\nexport function logCipherState (session: NoiseSession): void {\n if (session.cs1 && session.cs2) {\n keyLogger(`CIPHER_STATE_1 ${session.cs1.n.getUint64()} ${uint8ArrayToString(session.cs1.k, 'hex')}`)\n keyLogger(`CIPHER_STATE_2 ${session.cs2.n.getUint64()} ${uint8ArrayToString(session.cs2.k, 'hex')}`)\n } else {\n keyLogger('Missing cipher state.')\n }\n}\n","import type { bytes, uint64 } from './@types/basic'\n\nexport const MIN_NONCE = 0\n// For performance reasons, the nonce is represented as a JS `number`\n// Although JS `number` can safely represent integers up to 2 ** 53 - 1, we choose to only use\n// 4 bytes to store the data for performance reason.\n// This is a slight deviation from the noise spec, which describes the max nonce as 2 ** 64 - 2\n// The effect is that this implementation will need a new handshake to be performed after fewer messages are exchanged than other implementations with full uint64 nonces.\n// this MAX_NONCE is still a large number of messages, so the practical effect of this is negligible.\nexport const MAX_NONCE = 0xffffffff\n\nconst ERR_MAX_NONCE = 'Cipherstate has reached maximum n, a new handshake must be performed'\n\n/**\n * The nonce is an uint that's increased over time.\n * Maintaining different representations help improve performance.\n */\nexport class Nonce {\n private n: uint64\n private readonly bytes: bytes\n private readonly view: DataView\n\n constructor (n = MIN_NONCE) {\n this.n = n\n this.bytes = new Uint8Array(12)\n this.view = new DataView(this.bytes.buffer, this.bytes.byteOffset, this.bytes.byteLength)\n this.view.setUint32(4, n, true)\n }\n\n increment (): void {\n this.n++\n // Even though we're treating the nonce as 8 bytes, RFC7539 specifies 12 bytes for a nonce.\n this.view.setUint32(4, this.n, true)\n }\n\n getBytes (): bytes {\n return this.bytes\n }\n\n getUint64 (): uint64 {\n return this.n\n }\n\n assertValue (): void {\n if (this.n > MAX_NONCE) {\n throw new Error(ERR_MAX_NONCE)\n }\n }\n}\n","import type { bytes32, bytes } from '../@types/basic.js'\nimport type { KeyPair } from '../@types/libp2p.js'\nimport { isValidPublicKey } from '../utils.js'\nimport type { CipherState, HandshakeState, MessageBuffer, NoiseSession } from '../@types/handshake.js'\nimport { AbstractHandshake } from './abstract-handshake.js'\n\nexport class XX extends AbstractHandshake {\n private initializeInitiator (prologue: bytes32, s: KeyPair, rs: bytes32, psk: bytes32): HandshakeState {\n const name = 'Noise_XX_25519_ChaChaPoly_SHA256'\n const ss = this.initializeSymmetric(name)\n this.mixHash(ss, prologue)\n const re = new Uint8Array(32)\n\n return { ss, s, rs, psk, re }\n }\n\n private initializeResponder (prologue: bytes32, s: KeyPair, rs: bytes32, psk: bytes32): HandshakeState {\n const name = 'Noise_XX_25519_ChaChaPoly_SHA256'\n const ss = this.initializeSymmetric(name)\n this.mixHash(ss, prologue)\n const re = new Uint8Array(32)\n\n return { ss, s, rs, psk, re }\n }\n\n private writeMessageA (hs: HandshakeState, payload: bytes, e?: KeyPair): MessageBuffer {\n const ns = new Uint8Array(0)\n\n if (e !== undefined) {\n hs.e = e\n } else {\n hs.e = this.crypto.generateX25519KeyPair()\n }\n\n const ne = hs.e.publicKey\n\n this.mixHash(hs.ss, ne)\n const ciphertext = this.encryptAndHash(hs.ss, payload)\n\n return { ne, ns, ciphertext }\n }\n\n private writeMessageB (hs: HandshakeState, payload: bytes): MessageBuffer {\n hs.e = this.crypto.generateX25519KeyPair()\n const ne = hs.e.publicKey\n this.mixHash(hs.ss, ne)\n\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.re))\n const spk = hs.s.publicKey\n const ns = this.encryptAndHash(hs.ss, spk)\n\n this.mixKey(hs.ss, this.dh(hs.s.privateKey, hs.re))\n const ciphertext = this.encryptAndHash(hs.ss, payload)\n\n return { ne, ns, ciphertext }\n }\n\n private writeMessageC (hs: HandshakeState, payload: bytes): { messageBuffer: MessageBuffer, cs1: CipherState, cs2: CipherState, h: bytes } {\n const spk = hs.s.publicKey\n const ns = this.encryptAndHash(hs.ss, spk)\n this.mixKey(hs.ss, this.dh(hs.s.privateKey, hs.re))\n const ciphertext = this.encryptAndHash(hs.ss, payload)\n const ne = this.createEmptyKey()\n const messageBuffer: MessageBuffer = { ne, ns, ciphertext }\n const { cs1, cs2 } = this.split(hs.ss)\n\n return { h: hs.ss.h, messageBuffer, cs1, cs2 }\n }\n\n private readMessageA (hs: HandshakeState, message: MessageBuffer): {plaintext: bytes, valid: boolean} {\n if (isValidPublicKey(message.ne)) {\n hs.re = message.ne\n }\n\n this.mixHash(hs.ss, hs.re)\n return this.decryptAndHash(hs.ss, message.ciphertext)\n }\n\n private readMessageB (hs: HandshakeState, message: MessageBuffer): {plaintext: bytes, valid: boolean} {\n if (isValidPublicKey(message.ne)) {\n hs.re = message.ne\n }\n\n this.mixHash(hs.ss, hs.re)\n if (!hs.e) {\n throw new Error('Handshake state `e` param is missing.')\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.re))\n const { plaintext: ns, valid: valid1 } = this.decryptAndHash(hs.ss, message.ns)\n if (valid1 && isValidPublicKey(ns)) {\n hs.rs = ns\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.rs))\n const { plaintext, valid: valid2 } = this.decryptAndHash(hs.ss, message.ciphertext)\n return { plaintext, valid: (valid1 && valid2) }\n }\n\n private readMessageC (hs: HandshakeState, message: MessageBuffer): {h: bytes, plaintext: bytes, valid: boolean, cs1: CipherState, cs2: CipherState} {\n const { plaintext: ns, valid: valid1 } = this.decryptAndHash(hs.ss, message.ns)\n if (valid1 && isValidPublicKey(ns)) {\n hs.rs = ns\n }\n if (!hs.e) {\n throw new Error('Handshake state `e` param is missing.')\n }\n this.mixKey(hs.ss, this.dh(hs.e.privateKey, hs.rs))\n\n const { plaintext, valid: valid2 } = this.decryptAndHash(hs.ss, message.ciphertext)\n const { cs1, cs2 } = this.split(hs.ss)\n\n return { h: hs.ss.h, plaintext, valid: (valid1 && valid2), cs1, cs2 }\n }\n\n public initSession (initiator: boolean, prologue: bytes32, s: KeyPair): NoiseSession {\n const psk = this.createEmptyKey()\n const rs = new Uint8Array(32) // no static key yet\n let hs\n\n if (initiator) {\n hs = this.initializeInitiator(prologue, s, rs, psk)\n } else {\n hs = this.initializeResponder(prologue, s, rs, psk)\n }\n\n return {\n hs,\n i: initiator,\n mc: 0\n }\n }\n\n public sendMessage (session: NoiseSession, message: bytes, ephemeral?: KeyPair): MessageBuffer {\n let messageBuffer: MessageBuffer\n if (session.mc === 0) {\n messageBuffer = this.writeMessageA(session.hs, message, ephemeral)\n } else if (session.mc === 1) {\n messageBuffer = this.writeMessageB(session.hs, message)\n } else if (session.mc === 2) {\n const { h, messageBuffer: resultingBuffer, cs1, cs2 } = this.writeMessageC(session.hs, message)\n messageBuffer = resultingBuffer\n session.h = h\n session.cs1 = cs1\n session.cs2 = cs2\n } else if (session.mc > 2) {\n if (session.i) {\n if (!session.cs1) {\n throw new Error('CS1 (cipher state) is not defined')\n }\n\n messageBuffer = this.writeMessageRegular(session.cs1, message)\n } else {\n if (!session.cs2) {\n throw new Error('CS2 (cipher state) is not defined')\n }\n\n messageBuffer = this.writeMessageRegular(session.cs2, message)\n }\n } else {\n throw new Error('Session invalid.')\n }\n\n session.mc++\n return messageBuffer\n }\n\n public recvMessage (session: NoiseSession, message: MessageBuffer): {plaintext: bytes, valid: boolean} {\n let plaintext: bytes = new Uint8Array(0)\n let valid = false\n if (session.mc === 0) {\n ({ plaintext, valid } = this.readMessageA(session.hs, message))\n } else if (session.mc === 1) {\n ({ plaintext, valid } = this.readMessageB(session.hs, message))\n } else if (session.mc === 2) {\n const { h, plaintext: resultingPlaintext, valid: resultingValid, cs1, cs2 } = this.readMessageC(session.hs, message)\n plaintext = resultingPlaintext\n valid = resultingValid\n session.h = h\n session.cs1 = cs1\n session.cs2 = cs2\n }\n session.mc++\n return { plaintext, valid }\n }\n}\n","import { equals as uint8ArrayEquals } from 'uint8arrays/equals'\nimport { concat as uint8ArrayConcat } from 'uint8arrays/concat'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays'\nimport type { bytes, bytes32 } from '../@types/basic.js'\nimport type { CipherState, MessageBuffer, SymmetricState } from '../@types/handshake.js'\nimport type { ICryptoInterface } from '../crypto.js'\nimport { logger } from '../logger.js'\nimport { Nonce } from '../nonce.js'\n\nexport abstract class AbstractHandshake {\n public crypto: ICryptoInterface\n\n constructor (crypto: ICryptoInterface) {\n this.crypto = crypto\n }\n\n public encryptWithAd (cs: CipherState, ad: Uint8Array, plaintext: Uint8Array): bytes {\n const e = this.encrypt(cs.k, cs.n, ad, plaintext)\n cs.n.increment()\n\n return e\n }\n\n public decryptWithAd (cs: CipherState, ad: Uint8Array, ciphertext: Uint8Array): {plaintext: bytes, valid: boolean} {\n const { plaintext, valid } = this.decrypt(cs.k, cs.n, ad, ciphertext)\n if (valid) cs.n.increment()\n\n return { plaintext, valid }\n }\n\n // Cipher state related\n protected hasKey (cs: CipherState): boolean {\n return !this.isEmptyKey(cs.k)\n }\n\n protected createEmptyKey (): bytes32 {\n return new Uint8Array(32)\n }\n\n protected isEmptyKey (k: bytes32): boolean {\n const emptyKey = this.createEmptyKey()\n return uint8ArrayEquals(emptyKey, k)\n }\n\n protected encrypt (k: bytes32, n: Nonce, ad: Uint8Array, plaintext: Uint8Array): bytes {\n n.assertValue()\n\n return this.crypto.chaCha20Poly1305Encrypt(plaintext, n.getBytes(), ad, k)\n }\n\n protected encryptAndHash (ss: SymmetricState, plaintext: bytes): bytes {\n let ciphertext\n if (this.hasKey(ss.cs)) {\n ciphertext = this.encryptWithAd(ss.cs, ss.h, plaintext)\n } else {\n ciphertext = plaintext\n }\n\n this.mixHash(ss, ciphertext)\n return ciphertext\n }\n\n protected decrypt (k: bytes32, n: Nonce, ad: bytes, ciphertext: bytes): {plaintext: bytes, valid: boolean} {\n n.assertValue()\n\n const encryptedMessage = this.crypto.chaCha20Poly1305Decrypt(ciphertext, n.getBytes(), ad, k)\n\n if (encryptedMessage) {\n return {\n plaintext: encryptedMessage,\n valid: true\n }\n } else {\n return {\n plaintext: new Uint8Array(0),\n valid: false\n }\n }\n }\n\n protected decryptAndHash (ss: SymmetricState, ciphertext: bytes): {plaintext: bytes, valid: boolean} {\n let plaintext: bytes; let valid = true\n if (this.hasKey(ss.cs)) {\n ({ plaintext, valid } = this.decryptWithAd(ss.cs, ss.h, ciphertext))\n } else {\n plaintext = ciphertext\n }\n\n this.mixHash(ss, ciphertext)\n return { plaintext, valid }\n }\n\n protected dh (privateKey: bytes32, publicKey: bytes32): bytes32 {\n try {\n const derivedU8 = this.crypto.generateX25519SharedKey(privateKey, publicKey)\n\n if (derivedU8.length === 32) {\n return derivedU8\n }\n\n return derivedU8.subarray(0, 32)\n } catch (e) {\n const err = e as Error\n logger(err.message)\n return new Uint8Array(32)\n }\n }\n\n protected mixHash (ss: SymmetricState, data: bytes): void {\n ss.h = this.getHash(ss.h, data)\n }\n\n protected getHash (a: Uint8Array, b: Uint8Array): bytes32 {\n const u = this.crypto.hashSHA256(uint8ArrayConcat([a, b], a.length + b.length))\n return u\n }\n\n protected mixKey (ss: SymmetricState, ikm: bytes32): void {\n const [ck, tempK] = this.crypto.getHKDF(ss.ck, ikm)\n ss.cs = this.initializeKey(tempK)\n ss.ck = ck\n }\n\n protected initializeKey (k: bytes32): CipherState {\n return { k, n: new Nonce() }\n }\n\n // Symmetric state related\n\n protected initializeSymmetric (protocolName: string): SymmetricState {\n const protocolNameBytes = uint8ArrayFromString(protocolName, 'utf-8')\n const h = this.hashProtocolName(protocolNameBytes)\n\n const ck = h\n const key = this.createEmptyKey()\n const cs: CipherState = this.initializeKey(key)\n\n return { cs, ck, h }\n }\n\n protected hashProtocolName (protocolName: Uint8Array): bytes32 {\n if (protocolName.length <= 32) {\n const h = new Uint8Array(32)\n h.set(protocolName)\n return h\n } else {\n return this.getHash(protocolName, new Uint8Array(0))\n }\n }\n\n protected split (ss: SymmetricState): {cs1: CipherState, cs2: CipherState} {\n const [tempk1, tempk2] = this.crypto.getHKDF(ss.ck, new Uint8Array(0))\n const cs1 = this.initializeKey(tempk1)\n const cs2 = this.initializeKey(tempk2)\n\n return { cs1, cs2 }\n }\n\n protected writeMessageRegular (cs: CipherState, payload: bytes): MessageBuffer {\n const ciphertext = this.encryptWithAd(cs, new Uint8Array(0), payload)\n const ne = this.createEmptyKey()\n const ns = new Uint8Array(0)\n\n return { ne, ns, ciphertext }\n }\n\n protected readMessageRegular (cs: CipherState, message: MessageBuffer): {plaintext: bytes, valid: boolean} {\n return this.decryptWithAd(cs, new Uint8Array(0), message.ciphertext)\n }\n}\n","import type { PeerId } from '@libp2p/interface-peer-id'\nimport { InvalidCryptoExchangeError, UnexpectedPeerError } from '@libp2p/interface-connection-encrypter/errors'\nimport type { ProtobufStream } from 'it-pb-stream'\nimport type { bytes, bytes32 } from './@types/basic.js'\nimport type { CipherState, NoiseSession } from './@types/handshake.js'\nimport type { KeyPair } from './@types/libp2p.js'\nimport type { IHandshake } from './@types/handshake-interface.js'\nimport type { ICryptoInterface } from './crypto.js'\nimport { decode0, decode1, decode2, encode0, encode1, encode2 } from './encoder.js'\nimport { XX } from './handshakes/xx.js'\nimport {\n logger,\n logLocalStaticKeys,\n logLocalEphemeralKeys,\n logRemoteEphemeralKey,\n logRemoteStaticKey,\n logCipherState\n} from './logger.js'\nimport {\n decodePayload,\n getPeerIdFromPayload,\n verifySignedPayload\n} from './utils.js'\n\nexport class XXHandshake implements IHandshake {\n public isInitiator: boolean\n public session: NoiseSession\n public remotePeer!: PeerId\n public remoteEarlyData: bytes\n\n protected payload: bytes\n protected connection: ProtobufStream\n protected xx: XX\n protected staticKeypair: KeyPair\n\n private readonly prologue: bytes32\n\n constructor (\n isInitiator: boolean,\n payload: bytes,\n prologue: bytes32,\n crypto: ICryptoInterface,\n staticKeypair: KeyPair,\n connection: ProtobufStream,\n remotePeer?: PeerId,\n handshake?: XX\n ) {\n this.isInitiator = isInitiator\n this.payload = payload\n this.prologue = prologue\n this.staticKeypair = staticKeypair\n this.connection = connection\n if (remotePeer) {\n this.remotePeer = remotePeer\n }\n this.xx = handshake ?? new XX(crypto)\n this.session = this.xx.initSession(this.isInitiator, this.prologue, this.staticKeypair)\n this.remoteEarlyData = new Uint8Array(0)\n }\n\n // stage 0\n public async propose (): Promise {\n logLocalStaticKeys(this.session.hs.s)\n if (this.isInitiator) {\n logger('Stage 0 - Initiator starting to send first message.')\n const messageBuffer = this.xx.sendMessage(this.session, new Uint8Array(0))\n this.connection.writeLP(encode0(messageBuffer))\n logger('Stage 0 - Initiator finished sending first message.')\n logLocalEphemeralKeys(this.session.hs.e)\n } else {\n logger('Stage 0 - Responder waiting to receive first message...')\n const receivedMessageBuffer = decode0((await this.connection.readLP()).subarray())\n const { valid } = this.xx.recvMessage(this.session, receivedMessageBuffer)\n if (!valid) {\n throw new InvalidCryptoExchangeError('xx handshake stage 0 validation fail')\n }\n logger('Stage 0 - Responder received first message.')\n logRemoteEphemeralKey(this.session.hs.re)\n }\n }\n\n // stage 1\n public async exchange (): Promise {\n if (this.isInitiator) {\n logger('Stage 1 - Initiator waiting to receive first message from responder...')\n const receivedMessageBuffer = decode1((await this.connection.readLP()).subarray())\n const { plaintext, valid } = this.xx.recvMessage(this.session, receivedMessageBuffer)\n if (!valid) {\n throw new InvalidCryptoExchangeError('xx handshake stage 1 validation fail')\n }\n logger('Stage 1 - Initiator received the message.')\n logRemoteEphemeralKey(this.session.hs.re)\n logRemoteStaticKey(this.session.hs.rs)\n\n logger(\"Initiator going to check remote's signature...\")\n try {\n const decodedPayload = decodePayload(plaintext)\n this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload)\n await verifySignedPayload(this.session.hs.rs, decodedPayload, this.remotePeer)\n this.setRemoteEarlyData(decodedPayload.data)\n } catch (e) {\n const err = e as Error\n throw new UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`)\n }\n logger('All good with the signature!')\n } else {\n logger('Stage 1 - Responder sending out first message with signed payload and static key.')\n const messageBuffer = this.xx.sendMessage(this.session, this.payload)\n this.connection.writeLP(encode1(messageBuffer))\n logger('Stage 1 - Responder sent the second handshake message with signed payload.')\n logLocalEphemeralKeys(this.session.hs.e)\n }\n }\n\n // stage 2\n public async finish (): Promise {\n if (this.isInitiator) {\n logger('Stage 2 - Initiator sending third handshake message.')\n const messageBuffer = this.xx.sendMessage(this.session, this.payload)\n this.connection.writeLP(encode2(messageBuffer))\n logger('Stage 2 - Initiator sent message with signed payload.')\n } else {\n logger('Stage 2 - Responder waiting for third handshake message...')\n const receivedMessageBuffer = decode2((await this.connection.readLP()).subarray())\n const { plaintext, valid } = this.xx.recvMessage(this.session, receivedMessageBuffer)\n if (!valid) {\n throw new InvalidCryptoExchangeError('xx handshake stage 2 validation fail')\n }\n logger('Stage 2 - Responder received the message, finished handshake.')\n\n try {\n const decodedPayload = decodePayload(plaintext)\n this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload)\n await verifySignedPayload(this.session.hs.rs, decodedPayload, this.remotePeer)\n this.setRemoteEarlyData(decodedPayload.data)\n } catch (e) {\n const err = e as Error\n throw new UnexpectedPeerError(`Error occurred while verifying signed payload: ${err.message}`)\n }\n }\n logCipherState(this.session)\n }\n\n public encrypt (plaintext: Uint8Array, session: NoiseSession): bytes {\n const cs = this.getCS(session)\n\n return this.xx.encryptWithAd(cs, new Uint8Array(0), plaintext)\n }\n\n public decrypt (ciphertext: Uint8Array, session: NoiseSession): {plaintext: bytes, valid: boolean} {\n const cs = this.getCS(session, false)\n\n return this.xx.decryptWithAd(cs, new Uint8Array(0), ciphertext)\n }\n\n public getRemoteStaticKey (): bytes {\n return this.session.hs.rs\n }\n\n private getCS (session: NoiseSession, encryption = true): CipherState {\n if (!session.cs1 || !session.cs2) {\n throw new InvalidCryptoExchangeError('Handshake not completed properly, cipher state does not exist.')\n }\n\n if (this.isInitiator) {\n return encryption ? session.cs1 : session.cs2\n } else {\n return encryption ? session.cs2 : session.cs1\n }\n }\n\n protected setRemoteEarlyData (data: Uint8Array|null|undefined): void {\n if (data) {\n this.remoteEarlyData = data\n }\n }\n}\n","import type { PeerId } from '@libp2p/interface-peer-id'\nimport type { SecuredConnection } from '@libp2p/interface-connection-encrypter'\nimport { pbStream, ProtobufStream } from 'it-pb-stream'\nimport { duplexPair } from 'it-pair/duplex'\nimport { pipe } from 'it-pipe'\nimport { encode, decode } from 'it-length-prefixed'\nimport type { Duplex } from 'it-stream-types'\nimport type { bytes } from './@types/basic.js'\nimport type { IHandshake } from './@types/handshake-interface.js'\nimport type { INoiseConnection, KeyPair } from './@types/libp2p.js'\nimport { NOISE_MSG_MAX_LENGTH_BYTES } from './constants.js'\nimport type { ICryptoInterface } from './crypto.js'\nimport { stablelib } from './crypto/stablelib.js'\nimport { decryptStream, encryptStream } from './crypto/streaming.js'\nimport { uint16BEDecode, uint16BEEncode } from './encoder.js'\nimport { XXHandshake } from './handshake-xx.js'\nimport { getPayload } from './utils.js'\n\ninterface HandshakeParams {\n connection: ProtobufStream\n isInitiator: boolean\n localPeer: PeerId\n remotePeer?: PeerId\n}\n\nexport class Noise implements INoiseConnection {\n public protocol = '/noise'\n public crypto: ICryptoInterface\n\n private readonly prologue: Uint8Array\n private readonly staticKeys: KeyPair\n private readonly earlyData?: bytes\n\n /**\n * @param {bytes} staticNoiseKey - x25519 private key, reuse for faster handshakes\n * @param {bytes} earlyData\n */\n constructor (staticNoiseKey?: bytes, earlyData?: bytes, crypto: ICryptoInterface = stablelib, prologueBytes?: Uint8Array) {\n this.earlyData = earlyData ?? new Uint8Array(0)\n this.crypto = crypto\n\n if (staticNoiseKey) {\n // accepts x25519 private key of length 32\n this.staticKeys = this.crypto.generateX25519KeyPairFromSeed(staticNoiseKey)\n } else {\n this.staticKeys = this.crypto.generateX25519KeyPair()\n }\n this.prologue = prologueBytes ?? new Uint8Array(0)\n }\n\n /**\n * Encrypt outgoing data to the remote party (handshake as initiator)\n *\n * @param {PeerId} localPeer - PeerId of the receiving peer\n * @param {Duplex} connection - streaming iterable duplex that will be encrypted\n * @param {PeerId} remotePeer - PeerId of the remote peer. Used to validate the integrity of the remote peer.\n * @returns {Promise}\n */\n public async secureOutbound (localPeer: PeerId, connection: Duplex, remotePeer: PeerId): Promise {\n const wrappedConnection = pbStream(\n connection,\n {\n lengthEncoder: uint16BEEncode,\n lengthDecoder: uint16BEDecode,\n maxDataLength: NOISE_MSG_MAX_LENGTH_BYTES\n }\n )\n const handshake = await this.performHandshake({\n connection: wrappedConnection,\n isInitiator: true,\n localPeer,\n remotePeer\n })\n const conn = await this.createSecureConnection(wrappedConnection, handshake)\n\n return {\n conn,\n remoteEarlyData: handshake.remoteEarlyData,\n remotePeer: handshake.remotePeer\n }\n }\n\n /**\n * Decrypt incoming data (handshake as responder).\n *\n * @param {PeerId} localPeer - PeerId of the receiving peer.\n * @param {Duplex} connection - streaming iterable duplex that will be encryption.\n * @param {PeerId} remotePeer - optional PeerId of the initiating peer, if known. This may only exist during transport upgrades.\n * @returns {Promise}\n */\n public async secureInbound (localPeer: PeerId, connection: Duplex, remotePeer?: PeerId): Promise {\n const wrappedConnection = pbStream(\n connection,\n {\n lengthEncoder: uint16BEEncode,\n lengthDecoder: uint16BEDecode,\n maxDataLength: NOISE_MSG_MAX_LENGTH_BYTES\n }\n )\n const handshake = await this.performHandshake({\n connection: wrappedConnection,\n isInitiator: false,\n localPeer,\n remotePeer\n })\n const conn = await this.createSecureConnection(wrappedConnection, handshake)\n\n return {\n conn,\n remoteEarlyData: handshake.remoteEarlyData,\n remotePeer: handshake.remotePeer\n }\n }\n\n /**\n * If Noise pipes supported, tries IK handshake first with XX as fallback if it fails.\n * If noise pipes disabled or remote peer static key is unknown, use XX.\n *\n * @param {HandshakeParams} params\n */\n private async performHandshake (params: HandshakeParams): Promise {\n const payload = await getPayload(params.localPeer, this.staticKeys.publicKey, this.earlyData)\n\n // run XX handshake\n return await this.performXXHandshake(params, payload)\n }\n\n private async performXXHandshake (\n params: HandshakeParams,\n payload: bytes\n ): Promise {\n const { isInitiator, remotePeer, connection } = params\n const handshake = new XXHandshake(\n isInitiator,\n payload,\n this.prologue,\n this.crypto,\n this.staticKeys,\n connection,\n remotePeer\n )\n\n try {\n await handshake.propose()\n await handshake.exchange()\n await handshake.finish()\n } catch (e: unknown) {\n if (e instanceof Error) {\n e.message = `Error occurred during XX handshake: ${e.message}`\n throw e\n }\n }\n\n return handshake\n }\n\n private async createSecureConnection (\n connection: ProtobufStream,\n handshake: IHandshake\n ): Promise> {\n // Create encryption box/unbox wrapper\n const [secure, user] = duplexPair()\n const network = connection.unwrap()\n\n await pipe(\n secure, // write to wrapper\n encryptStream(handshake), // data is encrypted\n encode({ lengthEncoder: uint16BEEncode }), // prefix with message length\n network, // send to the remote peer\n decode({ lengthDecoder: uint16BEDecode }), // read message length prefix\n decryptStream(handshake), // decrypt the incoming data\n secure // pipe to the wrapper\n )\n\n return user\n }\n}\n","import { pair } from './index.js'\nimport type { Duplex } from 'it-stream-types'\n\n/**\n * Two duplex streams that are attached to each other\n */\nexport function duplexPair (): [Duplex, Duplex] {\n const a = pair()\n const b = pair()\n return [\n {\n source: a.source,\n sink: b.sink\n },\n {\n source: b.source,\n sink: a.sink\n }\n ]\n}\n","import type { Transform } from 'it-stream-types'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { IHandshake } from '../@types/handshake-interface.js'\nimport { NOISE_MSG_MAX_LENGTH_BYTES, NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG } from '../constants.js'\n\n// Returns generator that encrypts payload from the user\nexport function encryptStream (handshake: IHandshake): Transform {\n return async function * (source) {\n for await (const chunk of source) {\n for (let i = 0; i < chunk.length; i += NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG) {\n let end = i + NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG\n if (end > chunk.length) {\n end = chunk.length\n }\n\n const data = handshake.encrypt(chunk.subarray(i, end), handshake.session)\n yield data\n }\n }\n }\n}\n\n// Decrypt received payload to the user\nexport function decryptStream (handshake: IHandshake): Transform {\n return async function * (source) {\n for await (const chunk of source) {\n for (let i = 0; i < chunk.length; i += NOISE_MSG_MAX_LENGTH_BYTES) {\n let end = i + NOISE_MSG_MAX_LENGTH_BYTES\n if (end > chunk.length) {\n end = chunk.length\n }\n\n const { plaintext: decrypted, valid } = await handshake.decrypt(chunk.subarray(i, end), handshake.session)\n if (!valid) {\n throw new Error('Failed to validate decrypted chunk')\n }\n yield decrypted\n }\n }\n }\n}\n","export function allocUnsafe (size: number) {\n return new Uint8Array(size)\n}\n","import type { Uint8ArrayList } from 'uint8arraylist'\n\ntype INITIATOR_NAME = 'NEW_STREAM' | 'MESSAGE' | 'CLOSE' | 'RESET'\ntype RECEIVER_NAME = 'MESSAGE' | 'CLOSE' | 'RESET'\ntype NAME = 'NEW_STREAM' | 'MESSAGE_INITIATOR' | 'CLOSE_INITIATOR' | 'RESET_INITIATOR' | 'MESSAGE_RECEIVER' | 'CLOSE_RECEIVER' | 'RESET_RECEIVER'\ntype CODE = 0 | 1 | 2 | 3 | 4 | 5 | 6\n\nexport enum MessageTypes {\n NEW_STREAM = 0,\n MESSAGE_RECEIVER = 1,\n MESSAGE_INITIATOR = 2,\n CLOSE_RECEIVER = 3,\n CLOSE_INITIATOR = 4,\n RESET_RECEIVER = 5,\n RESET_INITIATOR = 6\n}\n\nexport const MessageTypeNames: Record = Object.freeze({\n 0: 'NEW_STREAM',\n 1: 'MESSAGE_RECEIVER',\n 2: 'MESSAGE_INITIATOR',\n 3: 'CLOSE_RECEIVER',\n 4: 'CLOSE_INITIATOR',\n 5: 'RESET_RECEIVER',\n 6: 'RESET_INITIATOR'\n})\n\nexport const InitiatorMessageTypes: Record = Object.freeze({\n NEW_STREAM: MessageTypes.NEW_STREAM,\n MESSAGE: MessageTypes.MESSAGE_INITIATOR,\n CLOSE: MessageTypes.CLOSE_INITIATOR,\n RESET: MessageTypes.RESET_INITIATOR\n})\n\nexport const ReceiverMessageTypes: Record = Object.freeze({\n MESSAGE: MessageTypes.MESSAGE_RECEIVER,\n CLOSE: MessageTypes.CLOSE_RECEIVER,\n RESET: MessageTypes.RESET_RECEIVER\n})\n\nexport interface NewStreamMessage {\n id: number\n type: MessageTypes.NEW_STREAM\n data: Uint8ArrayList\n}\n\nexport interface MessageReceiverMessage {\n id: number\n type: MessageTypes.MESSAGE_RECEIVER\n data: Uint8ArrayList\n}\n\nexport interface MessageInitiatorMessage {\n id: number\n type: MessageTypes.MESSAGE_INITIATOR\n data: Uint8ArrayList\n}\n\nexport interface CloseReceiverMessage {\n id: number\n type: MessageTypes.CLOSE_RECEIVER\n}\n\nexport interface CloseInitiatorMessage {\n id: number\n type: MessageTypes.CLOSE_INITIATOR\n}\n\nexport interface ResetReceiverMessage {\n id: number\n type: MessageTypes.RESET_RECEIVER\n}\n\nexport interface ResetInitiatorMessage {\n id: number\n type: MessageTypes.RESET_INITIATOR\n}\n\nexport type Message = NewStreamMessage | MessageReceiverMessage | MessageInitiatorMessage | CloseReceiverMessage | CloseInitiatorMessage | ResetReceiverMessage | ResetInitiatorMessage\n","import type { Source } from 'it-stream-types'\nimport varint from 'varint'\nimport { allocUnsafe } from './alloc-unsafe.js'\nimport { Message, MessageTypes } from './message-types.js'\n\nconst POOL_SIZE = 10 * 1024\n\nclass Encoder {\n private _pool: Uint8Array\n private _poolOffset: number\n\n constructor () {\n this._pool = allocUnsafe(POOL_SIZE)\n this._poolOffset = 0\n }\n\n /**\n * Encodes the given message and returns it and its header\n */\n write (msg: Message): Uint8Array[] {\n const pool = this._pool\n let offset = this._poolOffset\n\n varint.encode(msg.id << 3 | msg.type, pool, offset)\n offset += varint.encode.bytes\n\n if ((msg.type === MessageTypes.NEW_STREAM || msg.type === MessageTypes.MESSAGE_INITIATOR || msg.type === MessageTypes.MESSAGE_RECEIVER) && msg.data != null) {\n varint.encode(msg.data.length, pool, offset)\n } else {\n varint.encode(0, pool, offset)\n }\n\n offset += varint.encode.bytes\n\n const header = pool.subarray(this._poolOffset, offset)\n\n if (POOL_SIZE - offset < 100) {\n this._pool = allocUnsafe(POOL_SIZE)\n this._poolOffset = 0\n } else {\n this._poolOffset = offset\n }\n\n if ((msg.type === MessageTypes.NEW_STREAM || msg.type === MessageTypes.MESSAGE_INITIATOR || msg.type === MessageTypes.MESSAGE_RECEIVER) && msg.data != null) {\n return [\n header,\n msg.data instanceof Uint8Array ? msg.data : msg.data.subarray()\n ]\n }\n\n return [\n header\n ]\n }\n}\n\nconst encoder = new Encoder()\n\n/**\n * Encode and yield one or more messages\n */\nexport async function * encode (source: Source) {\n for await (const msg of source) {\n if (Array.isArray(msg)) {\n for (const m of msg) {\n yield * encoder.write(m)\n }\n } else {\n yield * encoder.write(msg)\n }\n }\n}\n","import { MessageTypeNames, MessageTypes } from './message-types.js'\nimport { Uint8ArrayList } from 'uint8arraylist'\nimport type { Source } from 'it-stream-types'\nimport type { Message } from './message-types.js'\n\ninterface MessageHeader {\n id: number\n type: keyof typeof MessageTypeNames\n offset: number\n length: number\n}\n\nclass Decoder {\n private readonly _buffer: Uint8ArrayList\n private _headerInfo: MessageHeader | null\n\n constructor () {\n this._buffer = new Uint8ArrayList()\n this._headerInfo = null\n }\n\n write (chunk: Uint8Array) {\n if (chunk == null || chunk.length === 0) {\n return []\n }\n\n this._buffer.append(chunk)\n const msgs: Message[] = []\n\n while (this._buffer.length !== 0) {\n if (this._headerInfo == null) {\n try {\n this._headerInfo = this._decodeHeader(this._buffer)\n } catch (_) {\n break // We haven't received enough data yet\n }\n }\n\n const { id, type, length, offset } = this._headerInfo\n const bufferedDataLength = this._buffer.length - offset\n\n if (bufferedDataLength < length) {\n break // not enough data yet\n }\n\n const msg: any = {\n id,\n type\n }\n\n if (type === MessageTypes.NEW_STREAM || type === MessageTypes.MESSAGE_INITIATOR || type === MessageTypes.MESSAGE_RECEIVER) {\n msg.data = this._buffer.sublist(offset, offset + length)\n }\n\n msgs.push(msg)\n\n this._buffer.consume(offset + length)\n this._headerInfo = null\n }\n\n return msgs\n }\n\n /**\n * Attempts to decode the message header from the buffer\n */\n _decodeHeader (data: Uint8ArrayList): MessageHeader {\n const {\n value: h,\n offset\n } = readVarInt(data)\n const {\n value: length,\n offset: end\n } = readVarInt(data, offset)\n\n const type = h & 7\n\n // @ts-expect-error h is a number not a CODE\n if (MessageTypeNames[type] == null) {\n throw new Error(`Invalid type received: ${type}`)\n }\n\n // @ts-expect-error h is a number not a CODE\n return { id: h >> 3, type, offset: offset + end, length }\n }\n}\n\nconst MSB = 0x80\nconst REST = 0x7F\n\nfunction readVarInt (buf: Uint8ArrayList, offset: number = 0) {\n let res = 0\n let shift = 0\n let counter = offset\n let b: number\n const l = buf.length\n\n do {\n if (counter >= l || shift > 49) {\n offset = 0\n throw new RangeError('Could not decode varint')\n }\n b = buf.get(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 offset = counter - offset\n\n return {\n value: res,\n offset\n }\n}\n\n/**\n * Decode a chunk and yield an _array_ of decoded messages\n */\nexport async function * decode (source: Source) {\n const decoder = new Decoder()\n\n for await (const chunk of source) {\n const msgs = decoder.write(chunk)\n\n if (msgs.length > 0) {\n yield msgs\n }\n }\n}\n","import { Message, MessageTypes } from './message-types.js'\nimport type { Source, Transform } from 'it-stream-types'\n\nexport const MAX_MSG_SIZE = 1 << 20 // 1MB\n\n/**\n * Creates an iterable transform that restricts message sizes to\n * the given maximum size.\n */\nexport function restrictSize (max?: number): Transform {\n const maxSize = max ?? MAX_MSG_SIZE\n\n const checkSize = (msg: Message) => {\n if (msg.type !== MessageTypes.NEW_STREAM && msg.type !== MessageTypes.MESSAGE_INITIATOR && msg.type !== MessageTypes.MESSAGE_RECEIVER) {\n return\n }\n\n if (msg.data.byteLength > maxSize) {\n throw Object.assign(new Error('message size too large!'), { code: 'ERR_MSG_TOO_BIG' })\n }\n }\n\n return (source: Source) => {\n return (async function * restrictSize () {\n for await (const msg of source) {\n if (Array.isArray(msg)) {\n msg.forEach(checkSize)\n yield * msg\n } else {\n checkSize(msg)\n yield msg\n }\n }\n })()\n }\n}\n","import { abortableSource } from 'abortable-iterator'\nimport { pushable } from 'it-pushable'\nimport errCode from 'err-code'\nimport { MAX_MSG_SIZE } from './restrict-size.js'\nimport { anySignal } from 'any-signal'\nimport { InitiatorMessageTypes, ReceiverMessageTypes } from './message-types.js'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { Uint8ArrayList } from 'uint8arraylist'\nimport { logger } from '@libp2p/logger'\nimport type { Message } from './message-types.js'\nimport type { StreamTimeline } from '@libp2p/interface-connection'\nimport type { Source } from 'it-stream-types'\nimport type { MplexStream } from './mplex.js'\n\nconst log = logger('libp2p:mplex:stream')\n\nconst ERR_STREAM_RESET = 'ERR_STREAM_RESET'\nconst ERR_STREAM_ABORT = 'ERR_STREAM_ABORT'\nconst ERR_SINK_ENDED = 'ERR_SINK_ENDED'\nconst ERR_DOUBLE_SINK = 'ERR_DOUBLE_SINK'\n\nexport interface Options {\n id: number\n send: (msg: Message) => void\n name?: string\n onEnd?: (err?: Error) => void\n type?: 'initiator' | 'receiver'\n maxMsgSize?: number\n}\n\nexport function createStream (options: Options): MplexStream {\n const { id, name, send, onEnd, type = 'initiator', maxMsgSize = MAX_MSG_SIZE } = options\n\n const abortController = new AbortController()\n const resetController = new AbortController()\n const closeController = new AbortController()\n const Types = type === 'initiator' ? InitiatorMessageTypes : ReceiverMessageTypes\n const externalId = type === 'initiator' ? (`i${id}`) : `r${id}`\n const streamName = `${name == null ? id : name}`\n\n let sourceEnded = false\n let sinkEnded = false\n let sinkSunk = false\n let endErr: Error | undefined\n\n const timeline: StreamTimeline = {\n open: Date.now()\n }\n\n const onSourceEnd = (err?: Error) => {\n if (sourceEnded) {\n return\n }\n\n sourceEnded = true\n log.trace('%s stream %s source end - err: %o', type, streamName, err)\n\n if (err != null && endErr == null) {\n endErr = err\n }\n\n if (sinkEnded) {\n stream.stat.timeline.close = Date.now()\n\n if (onEnd != null) {\n onEnd(endErr)\n }\n }\n }\n\n const onSinkEnd = (err?: Error) => {\n if (sinkEnded) {\n return\n }\n\n sinkEnded = true\n log.trace('%s stream %s sink end - err: %o', type, streamName, err)\n\n if (err != null && endErr == null) {\n endErr = err\n }\n\n if (sourceEnded) {\n timeline.close = Date.now()\n\n if (onEnd != null) {\n onEnd(endErr)\n }\n }\n }\n\n const stream: MplexStream = {\n // Close for both Reading and Writing\n close: () => {\n log.trace('%s stream %s close', type, streamName)\n\n stream.closeRead()\n stream.closeWrite()\n },\n\n // Close for reading\n closeRead: () => {\n log.trace('%s stream %s closeRead', type, streamName)\n\n if (sourceEnded) {\n return\n }\n\n stream.source.end()\n },\n\n // Close for writing\n closeWrite: () => {\n log.trace('%s stream %s closeWrite', type, streamName)\n\n if (sinkEnded) {\n return\n }\n\n closeController.abort()\n\n try {\n send({ id, type: Types.CLOSE })\n } catch (err) {\n log.trace('%s stream %s error sending close', type, name, err)\n }\n\n onSinkEnd()\n },\n\n // Close for reading and writing (local error)\n abort: (err: Error) => {\n log.trace('%s stream %s abort', type, streamName, err)\n // End the source with the passed error\n stream.source.end(err)\n abortController.abort()\n onSinkEnd(err)\n },\n\n // Close immediately for reading and writing (remote error)\n reset: () => {\n const err = errCode(new Error('stream reset'), ERR_STREAM_RESET)\n resetController.abort()\n stream.source.end(err)\n onSinkEnd(err)\n },\n\n sink: async (source: Source) => {\n if (sinkSunk) {\n throw errCode(new Error('sink already called on stream'), ERR_DOUBLE_SINK)\n }\n\n sinkSunk = true\n\n if (sinkEnded) {\n throw errCode(new Error('stream closed for writing'), ERR_SINK_ENDED)\n }\n\n source = abortableSource(source, anySignal([\n abortController.signal,\n resetController.signal,\n closeController.signal\n ]))\n\n try {\n if (type === 'initiator') { // If initiator, open a new stream\n send({ id, type: InitiatorMessageTypes.NEW_STREAM, data: new Uint8ArrayList(uint8ArrayFromString(streamName)) })\n }\n\n const uint8ArrayList = new Uint8ArrayList()\n\n for await (const data of source) {\n uint8ArrayList.append(data)\n\n while (uint8ArrayList.length !== 0) {\n if (uint8ArrayList.length <= maxMsgSize) {\n send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist() })\n uint8ArrayList.consume(uint8ArrayList.length)\n break\n }\n\n const toSend = uint8ArrayList.length - maxMsgSize\n send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, toSend) })\n uint8ArrayList.consume(toSend)\n }\n }\n } catch (err: any) {\n if (err.type === 'aborted' && err.message === 'The operation was aborted') {\n if (closeController.signal.aborted) {\n return\n }\n\n if (resetController.signal.aborted) {\n err.message = 'stream reset'\n err.code = ERR_STREAM_RESET\n }\n\n if (abortController.signal.aborted) {\n err.message = 'stream aborted'\n err.code = ERR_STREAM_ABORT\n }\n }\n\n // Send no more data if this stream was remotely reset\n if (err.code === ERR_STREAM_RESET) {\n log.trace('%s stream %s reset', type, name)\n } else {\n log.trace('%s stream %s error', type, name, err)\n try {\n send({ id, type: Types.RESET })\n } catch (err) {\n log.trace('%s stream %s error sending reset', type, name, err)\n }\n }\n\n stream.source.end(err)\n onSinkEnd(err)\n return\n }\n\n try {\n send({ id, type: Types.CLOSE })\n } catch (err) {\n log.trace('%s stream %s error sending close', type, name, err)\n }\n\n onSinkEnd()\n },\n\n source: pushable({\n onEnd: onSourceEnd\n }),\n\n stat: {\n direction: type === 'initiator' ? 'outbound' : 'inbound',\n timeline\n },\n\n metadata: {},\n\n id: externalId\n }\n\n return stream\n}\n","import type { ComponentMetricsTracker } from '@libp2p/interface-metrics'\n\nexport interface TrackedMapInit {\n metrics: ComponentMetricsTracker\n system?: string\n component: string\n metric: string\n}\n\nclass TrackedMap extends Map {\n private readonly system: string\n private readonly component: string\n private readonly metric: string\n private readonly metrics: ComponentMetricsTracker\n\n constructor (init: TrackedMapInit) {\n super()\n\n const { system, component, metric, metrics } = init\n this.system = system ?? 'libp2p'\n this.component = component\n this.metric = metric\n this.metrics = metrics\n\n this.updateComponentMetric()\n }\n\n set (key: K, value: V) {\n super.set(key, value)\n this.updateComponentMetric()\n return this\n }\n\n delete (key: K) {\n const deleted = super.delete(key)\n this.updateComponentMetric()\n return deleted\n }\n\n clear () {\n super.clear()\n this.updateComponentMetric()\n }\n\n private updateComponentMetric () {\n this.metrics.updateComponentMetric({\n system: this.system,\n component: this.component,\n metric: this.metric,\n value: this.size\n })\n }\n}\n\nexport interface CreateTrackedMapOptions {\n metrics?: ComponentMetricsTracker\n system?: string\n component: string\n metric: string\n}\n\nexport function trackedMap (config: CreateTrackedMapOptions): Map {\n const { system, component, metric, metrics } = config\n let map: Map\n\n if (metrics != null) {\n map = new TrackedMap({ system, component, metric, metrics })\n } else {\n map = new Map()\n }\n\n return map\n}\n","import { pipe } from 'it-pipe'\nimport { Pushable, pushableV } from 'it-pushable'\nimport { abortableSource } from 'abortable-iterator'\nimport { encode } from './encode.js'\nimport { decode } from './decode.js'\nimport { restrictSize } from './restrict-size.js'\nimport { MessageTypes, MessageTypeNames, Message } from './message-types.js'\nimport { createStream } from './stream.js'\nimport { toString as uint8ArrayToString } from 'uint8arrays'\nimport { trackedMap } from '@libp2p/tracked-map'\nimport { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport type { Components } from '@libp2p/components'\nimport type { Sink } from 'it-stream-types'\nimport type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface-stream-muxer'\nimport type { Stream } from '@libp2p/interface-connection'\nimport type { MplexInit } from './index.js'\nimport anySignal from 'any-signal'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nconst log = logger('libp2p:mplex')\n\nconst MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION = 1024\nconst MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION = 1024\nconst MAX_STREAM_BUFFER_SIZE = 1024 * 1024 * 4 // 4MB\n\nfunction printMessage (msg: Message) {\n const output: any = {\n ...msg,\n type: `${MessageTypeNames[msg.type]} (${msg.type})`\n }\n\n if (msg.type === MessageTypes.NEW_STREAM) {\n output.data = uint8ArrayToString(msg.data instanceof Uint8Array ? msg.data : msg.data.subarray())\n }\n\n if (msg.type === MessageTypes.MESSAGE_INITIATOR || msg.type === MessageTypes.MESSAGE_RECEIVER) {\n output.data = uint8ArrayToString(msg.data instanceof Uint8Array ? msg.data : msg.data.subarray(), 'base16')\n }\n\n return output\n}\n\nexport interface MplexStream extends Stream {\n source: Pushable\n}\n\ninterface MplexStreamMuxerInit extends MplexInit, StreamMuxerInit {}\n\nexport class MplexStreamMuxer implements StreamMuxer {\n public protocol = '/mplex/6.7.0'\n\n public sink: Sink\n public source: AsyncIterable\n\n private _streamId: number\n private readonly _streams: { initiators: Map, receivers: Map }\n private readonly _init: MplexStreamMuxerInit\n private readonly _source: { push: (val: Message) => void, end: (err?: Error) => void }\n private readonly closeController: AbortController\n\n constructor (components: Components, init?: MplexStreamMuxerInit) {\n init = init ?? {}\n\n this._streamId = 0\n this._streams = {\n /**\n * Stream to ids map\n */\n initiators: trackedMap({ metrics: components.getMetrics(), component: 'mplex', metric: 'initiatorStreams' }),\n /**\n * Stream to ids map\n */\n receivers: trackedMap({ metrics: components.getMetrics(), component: 'mplex', metric: 'receiverStreams' })\n }\n this._init = init\n\n /**\n * An iterable sink\n */\n this.sink = this._createSink()\n\n /**\n * An iterable source\n */\n const source = this._createSource()\n this._source = source\n this.source = source\n\n /**\n * Close controller\n */\n this.closeController = new AbortController()\n }\n\n init (components: Components) {}\n\n /**\n * Returns a Map of streams and their ids\n */\n get streams () {\n // Inbound and Outbound streams may have the same ids, so we need to make those unique\n const streams: Stream[] = []\n this._streams.initiators.forEach(stream => {\n streams.push(stream)\n })\n this._streams.receivers.forEach(stream => {\n streams.push(stream)\n })\n return streams\n }\n\n /**\n * Initiate a new stream with the given name. If no name is\n * provided, the id of the stream will be used.\n */\n newStream (name?: string): Stream {\n if (this.closeController.signal.aborted) {\n throw new Error('Muxer already closed')\n }\n const id = this._streamId++\n name = name == null ? id.toString() : name.toString()\n const registry = this._streams.initiators\n return this._newStream({ id, name, type: 'initiator', registry })\n }\n\n /**\n * Close or abort all tracked streams and stop the muxer\n */\n close (err?: Error | undefined): void {\n if (this.closeController.signal.aborted) return\n\n if (err != null) {\n this.streams.forEach(s => s.abort(err))\n } else {\n this.streams.forEach(s => s.close())\n }\n this.closeController.abort()\n }\n\n /**\n * Called whenever an inbound stream is created\n */\n _newReceiverStream (options: { id: number, name: string }) {\n const { id, name } = options\n const registry = this._streams.receivers\n return this._newStream({ id, name, type: 'receiver', registry })\n }\n\n _newStream (options: { id: number, name: string, type: 'initiator' | 'receiver', registry: Map }) {\n const { id, name, type, registry } = options\n\n log('new %s stream %s %s', type, id, name)\n\n if (type === 'initiator' && this._streams.initiators.size === (this._init.maxOutboundStreams ?? MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION)) {\n throw errCode(new Error('Too many outbound streams open'), 'ERR_TOO_MANY_OUTBOUND_STREAMS')\n }\n\n if (registry.has(id)) {\n throw new Error(`${type} stream ${id} already exists!`)\n }\n\n const send = (msg: Message) => {\n if (log.enabled) {\n log.trace('%s stream %s send', type, id, printMessage(msg))\n }\n\n this._source.push(msg)\n }\n\n const onEnd = () => {\n log('%s stream %s ended', type, id, name)\n registry.delete(id)\n\n if (this._init.onStreamEnd != null) {\n this._init.onStreamEnd(stream)\n }\n }\n\n const stream = createStream({ id, name, send, type, onEnd, maxMsgSize: this._init.maxMsgSize })\n registry.set(id, stream)\n return stream\n }\n\n /**\n * Creates a sink with an abortable source. Incoming messages will\n * also have their size restricted. All messages will be varint decoded.\n */\n _createSink () {\n const sink: Sink = async source => {\n // see: https://github.com/jacobheun/any-signal/pull/18\n const abortSignals = [this.closeController.signal]\n if (this._init.signal != null) {\n abortSignals.push(this._init.signal)\n }\n source = abortableSource(source, anySignal(abortSignals))\n\n try {\n await pipe(\n source,\n decode,\n restrictSize(this._init.maxMsgSize),\n async source => {\n for await (const msg of source) {\n this._handleIncoming(msg)\n }\n }\n )\n\n this._source.end()\n } catch (err: any) {\n log('error in sink', err)\n this._source.end(err) // End the source with an error\n }\n }\n\n return sink\n }\n\n /**\n * Creates a source that restricts outgoing message sizes\n * and varint encodes them\n */\n _createSource () {\n const onEnd = (err?: Error) => {\n this.close(err)\n }\n const source = pushableV({\n objectMode: true,\n onEnd\n })\n\n return Object.assign(encode(source), {\n push: source.push,\n end: source.end,\n return: source.return\n })\n }\n\n _handleIncoming (message: Message) {\n const { id, type } = message\n\n if (log.enabled) {\n log.trace('incoming message', printMessage(message))\n }\n\n // Create a new stream?\n if (message.type === MessageTypes.NEW_STREAM) {\n if (this._streams.receivers.size === (this._init.maxInboundStreams ?? MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION)) {\n log.error('Too many inbound streams open')\n\n // not going to allow this stream, send the reset message manually\n // instead of setting it up just to tear it down\n\n this._source.push({\n id,\n type: MessageTypes.RESET_RECEIVER\n })\n\n return\n }\n\n const stream = this._newReceiverStream({ id, name: uint8ArrayToString(message.data instanceof Uint8Array ? message.data : message.data.subarray()) })\n\n if (this._init.onIncomingStream != null) {\n this._init.onIncomingStream(stream)\n }\n\n return\n }\n\n const list = (type & 1) === 1 ? this._streams.initiators : this._streams.receivers\n const stream = list.get(id)\n\n if (stream == null) {\n log('missing stream %s', id)\n\n return\n }\n\n const maxBufferSize = this._init.maxStreamBufferSize ?? MAX_STREAM_BUFFER_SIZE\n\n switch (type) {\n case MessageTypes.MESSAGE_INITIATOR:\n case MessageTypes.MESSAGE_RECEIVER:\n if (stream.source.readableLength > maxBufferSize) {\n // Stream buffer has got too large, reset the stream\n this._source.push({\n id: message.id,\n type: type === MessageTypes.MESSAGE_INITIATOR ? MessageTypes.RESET_RECEIVER : MessageTypes.RESET_INITIATOR\n })\n\n // Inform the stream consumer they are not fast enough\n const error = errCode(new Error('Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers'), 'ERR_STREAM_INPUT_BUFFER_FULL')\n stream.abort(error)\n\n return\n }\n\n // We got data from the remote, push it into our local stream\n stream.source.push(message.data)\n break\n case MessageTypes.CLOSE_INITIATOR:\n case MessageTypes.CLOSE_RECEIVER:\n // We should expect no more data from the remote, stop reading\n stream.closeRead()\n break\n case MessageTypes.RESET_INITIATOR:\n case MessageTypes.RESET_RECEIVER:\n // Stop reading and writing to the stream immediately\n stream.reset()\n break\n default:\n log('unknown message type %s', type)\n }\n }\n}\n","import { Components, Initializable } from '@libp2p/components'\nimport type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer'\nimport { MplexStreamMuxer } from './mplex.js'\n\nexport interface MplexInit {\n /**\n * The maximum size of message that can be sent in one go in bytes.\n * Messages larger than this will be split into multiple smaller\n * messages.\n */\n maxMsgSize?: number\n\n /**\n * The maximum number of multiplexed streams that can be open at any\n * one time. An attempt to open more than this will throw.\n */\n maxInboundStreams?: number\n\n /**\n * The maximum number of multiplexed streams that can be open at any\n * one time. An attempt to open more than this will throw.\n */\n maxOutboundStreams?: number\n\n /**\n * Incoming stream messages are buffered until processed by the stream\n * handler. If the buffer reaches this size in bytes the stream will\n * be reset.\n */\n maxStreamBufferSize?: number\n}\n\nexport class Mplex implements StreamMuxerFactory, Initializable {\n public protocol = '/mplex/6.7.0'\n private readonly _init: MplexInit\n private components: Components = new Components()\n\n constructor (init: MplexInit = {}) {\n this._init = init\n }\n\n init (components: Components): void {\n this.components = components\n }\n\n createStreamMuxer (init: StreamMuxerInit = {}): StreamMuxer {\n return new MplexStreamMuxer(this.components, {\n ...init,\n ...this._init\n })\n }\n}\n","/* eslint-env browser */\n\nexport default WebSocket\n","\nimport { EventIterator } from 'event-iterator'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport type { WebSocket, ErrorEvent, MessageEvent } from 'ws'\n\n// copied from github.com/feross/buffer\n// Some ArrayBuffers are not passing the instanceof check, so we need to do a bit more work :(\nfunction isArrayBuffer (obj: any): obj is ArrayBuffer {\n return (obj instanceof ArrayBuffer) ||\n (obj?.constructor?.name === 'ArrayBuffer' && typeof obj?.byteLength === 'number')\n}\n\nexport interface ConnectedSource extends AsyncIterable {\n connected: () => Promise\n}\n\nexport default (socket: WebSocket): ConnectedSource => {\n socket.binaryType = 'arraybuffer'\n\n const connected = async () => await new Promise((resolve, reject) => {\n if (isConnected) {\n return resolve()\n }\n if (connError != null) {\n return reject(connError)\n }\n\n const cleanUp = (cont: () => void) => {\n socket.removeEventListener('open', onOpen)\n socket.removeEventListener('error', onError)\n cont()\n }\n\n const onOpen = () => cleanUp(resolve)\n const onError = (event: ErrorEvent) => {\n cleanUp(() => reject(event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`)))\n }\n\n socket.addEventListener('open', onOpen)\n socket.addEventListener('error', onError)\n })\n\n const source = (async function * () {\n const messages = new EventIterator(\n ({ push, stop, fail }) => {\n const onMessage = (event: MessageEvent) => {\n let data: Uint8Array | null = null\n\n if (typeof event.data === 'string') {\n data = uint8ArrayFromString(event.data)\n }\n\n if (isArrayBuffer(event.data)) {\n data = new Uint8Array(event.data)\n }\n\n if (event.data instanceof Uint8Array) {\n data = event.data\n }\n\n if (data == null) {\n return\n }\n\n push(data)\n }\n const onError = (event: ErrorEvent) => fail(event.error ?? new Error('Socket error'))\n\n socket.addEventListener('message', onMessage)\n socket.addEventListener('error', onError)\n socket.addEventListener('close', stop)\n\n return () => {\n socket.removeEventListener('message', onMessage)\n socket.removeEventListener('error', onError)\n socket.removeEventListener('close', stop)\n }\n },\n { highWaterMark: Infinity }\n )\n\n await connected()\n\n for await (const chunk of messages) {\n yield isArrayBuffer(chunk) ? new Uint8Array(chunk) : chunk\n }\n }())\n\n let isConnected = socket.readyState === 1\n let connError: Error | null\n\n socket.addEventListener('open', () => {\n isConnected = true\n connError = null\n })\n\n socket.addEventListener('close', () => {\n isConnected = false\n connError = null\n })\n\n socket.addEventListener('error', event => {\n if (!isConnected) {\n connError = event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`)\n }\n })\n\n return Object.assign(source, {\n connected\n })\n}\n","import type { ErrorEvent, WebSocket } from 'ws'\n\nexport default (socket: WebSocket) => {\n // if the socket is closing or closed, return end\n if (socket.readyState >= 2) {\n throw new Error('socket closed')\n }\n\n // if open, return\n if (socket.readyState === 1) {\n return\n }\n\n return new Promise((resolve, reject) => {\n function cleanup () {\n socket.removeEventListener('open', handleOpen)\n socket.removeEventListener('error', handleErr)\n }\n\n function handleOpen () {\n cleanup()\n resolve()\n }\n\n function handleErr (event: ErrorEvent) {\n cleanup()\n reject(event.error ?? new Error(`connect ECONNREFUSED ${socket.url}`))\n }\n\n socket.addEventListener('open', handleOpen)\n socket.addEventListener('error', handleErr)\n })\n}\n","import ready from './ready.js'\nimport type { WebSocket } from 'ws'\nimport type { Sink } from 'it-stream-types'\n\nexport interface SinkOptions {\n closeOnEnd?: boolean\n}\n\nexport default (socket: WebSocket, options: SinkOptions) => {\n options = options ?? {}\n options.closeOnEnd = options.closeOnEnd !== false\n\n const sink: Sink> = async source => {\n for await (const data of source) {\n try {\n await ready(socket)\n } catch (err: any) {\n if (err.message === 'socket closed') break\n throw err\n }\n\n socket.send(data)\n }\n\n if (options.closeOnEnd != null && socket.readyState <= 1) {\n return await new Promise((resolve, reject) => {\n socket.addEventListener('close', event => {\n if (event.wasClean || event.code === 1006) {\n resolve()\n } else {\n const err = Object.assign(new Error('ws error'), { event })\n reject(err)\n }\n })\n\n setTimeout(() => socket.close())\n })\n }\n }\n\n return sink\n}\n","import source from './source.js'\nimport sink from './sink.js'\nimport type WebSocket from './web-socket.js'\nimport type { SinkOptions } from './sink.js'\nimport type { Duplex } from 'it-stream-types'\n\nexport interface DuplexWebSocket extends Duplex> {\n connected: () => Promise\n localAddress?: string\n localPort?: number\n remoteAddress: string\n remotePort: number\n close: () => Promise\n destroy: () => void\n socket: WebSocket\n}\n\nexport interface DuplexWebSocketOptions extends SinkOptions {\n remoteAddress?: string\n remotePort?: number\n}\n\nexport default (socket: WebSocket, options?: DuplexWebSocketOptions): DuplexWebSocket => {\n options = options ?? {}\n\n const connectedSource = source(socket)\n let remoteAddress: string | undefined = options.remoteAddress\n let remotePort: number | undefined = options.remotePort\n\n if (socket.url != null) {\n // only client->server sockets have urls, server->client connections do not\n try {\n const url = new URL(socket.url)\n remoteAddress = url.hostname\n remotePort = parseInt(url.port, 10)\n } catch {}\n }\n\n if (remoteAddress == null || remotePort == null) {\n throw new Error('Remote connection did not have address and/or port')\n }\n\n const duplex: DuplexWebSocket = {\n sink: sink(socket, options),\n source: connectedSource,\n connected: async () => await connectedSource.connected(),\n close: async () => {\n if (socket.readyState === socket.CONNECTING || socket.readyState === socket.OPEN) {\n await new Promise((resolve) => {\n socket.addEventListener('close', () => {\n resolve()\n })\n socket.close()\n })\n }\n },\n destroy: () => {\n if (socket.terminate != null) {\n socket.terminate()\n } else {\n socket.close()\n }\n },\n remoteAddress,\n remotePort,\n socket\n }\n\n return duplex\n}\n","import { relative } from 'iso-url'\n\nconst map = { http: 'ws', https: 'wss' }\nconst def = 'ws'\n\nexport default (url: string, location: string | Partial) => relative(url, location, map, def)\n","// load websocket library if we are not in the browser\nimport WebSocket from './web-socket.js'\nimport duplex from './duplex.js'\nimport wsurl from './ws-url.js'\nimport type { ClientOptions } from 'ws'\nimport type { DuplexWebSocket } from './duplex.js'\nimport type { SinkOptions } from './sink.js'\n\nexport interface WebSocketOptions extends SinkOptions {\n websocket?: ClientOptions\n}\n\nexport function connect (addr: string, opts?: WebSocketOptions): DuplexWebSocket {\n const location = typeof window === 'undefined' ? '' : window.location\n opts = opts ?? {}\n\n const url = wsurl(addr, location.toString())\n const socket = new WebSocket(url, opts.websocket)\n\n return duplex(socket, opts)\n}\n","import { Multiaddr } from '@multiformats/multiaddr'\n\nexport interface MultiaddrToUriOpts {\n assumeHttp?: boolean\n}\n\ninterface Reducer { (str: string, content: string, i: number, parts: Part[], opts?: MultiaddrToUriOpts): string }\n\nconst reduceValue: Reducer = (_, v) => v\nconst tcpUri = (str: string, port: string, parts: Part[], opts?: MultiaddrToUriOpts) => {\n // return tcp when explicitly requested\n if ((opts != null) && opts.assumeHttp === false) return `tcp://${str}:${port}`\n // check if tcp is the last protocol in multiaddr\n let protocol = 'tcp'\n let explicitPort = `:${port}`\n const last = parts[parts.length - 1]\n if (last.protocol === 'tcp') {\n // assume http and produce clean urls\n protocol = port === '443' ? 'https' : 'http'\n explicitPort = port === '443' || port === '80' ? '' : explicitPort\n }\n return `${protocol}://${str}${explicitPort}`\n}\n\nconst Reducers: Record = {\n ip4: reduceValue,\n ip6: (str, content, i, parts) => (\n parts.length === 1 && parts[0].protocol === 'ip6'\n ? content\n : `[${content}]`\n ),\n tcp: (str, content, i, parts, opts) => (\n parts.some(p => ['http', 'https', 'ws', 'wss'].includes(p.protocol))\n ? `${str}:${content}`\n : tcpUri(str, content, parts, opts)\n ),\n udp: (str, content) => `udp://${str}:${content}`,\n dnsaddr: reduceValue,\n dns4: reduceValue,\n dns6: reduceValue,\n ipfs: (str, content) => `${str}/ipfs/${content}`,\n p2p: (str, content) => `${str}/p2p/${content}`,\n http: str => `http://${str}`,\n https: str => `https://${str}`,\n ws: str => `ws://${str}`,\n wss: str => `wss://${str}`,\n 'p2p-websocket-star': str => `${str}/p2p-websocket-star`,\n 'p2p-webrtc-star': str => `${str}/p2p-webrtc-star`,\n 'p2p-webrtc-direct': str => `${str}/p2p-webrtc-direct`\n}\n\ninterface Part {\n protocol: string\n content: string\n}\n\nexport function multiaddrToUri (multiaddr: Multiaddr | string | Uint8Array, opts?: MultiaddrToUriOpts) {\n const ma = new Multiaddr(multiaddr)\n const parts = multiaddr.toString().split('/').slice(1)\n return ma\n .tuples()\n .map(tuple => ({\n protocol: parts.shift() ?? '',\n content: (tuple[1] != null) ? parts.shift() ?? '' : ''\n }))\n .reduce((str: string, part: Part, i: number, parts: Part[]) => {\n const reduce = Reducers[part.protocol]\n if (reduce == null) {\n throw new Error(`Unsupported protocol ${part.protocol}`)\n }\n return reduce(str, part.content, i, parts, opts)\n }, '')\n}\n","\nexport class AbortError extends Error {\n public readonly code: string\n public readonly type: string\n\n constructor (message: string = 'The operation was aborted') {\n super(message)\n this.code = AbortError.code\n this.type = AbortError.type\n }\n\n static get code () {\n return 'ABORT_ERR'\n }\n\n static get type () {\n return 'aborted'\n }\n}\n","import detectElectron from 'is-electron'\n\nexport const isEnvWithDom = typeof window === 'object' && typeof document === 'object' && document.nodeType === 9\nexport const isElectron = detectElectron()\n\n/**\n * Detects browser main thread **NOT** web worker or service worker\n */\nexport const isBrowser = isEnvWithDom && !isElectron\nexport const isElectronMain = isElectron && !isEnvWithDom\nexport const isElectronRenderer = isElectron && isEnvWithDom\nexport const isNode = typeof globalThis.process !== 'undefined' && typeof globalThis.process.release !== 'undefined' && globalThis.process.release.name === 'node' && !isElectron\n// @ts-ignore\n// eslint-disable-next-line no-undef\nexport const isWebWorker = typeof importScripts === 'function' && typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope\n\n// defeat bundlers replacing process.env.NODE_ENV with \"development\" or whatever\nexport const isTest = typeof globalThis.process !== 'undefined' && typeof globalThis.process.env !== 'undefined' && globalThis.process.env['NODE' + (() => '_')() + 'ENV'] === 'test'\nexport const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative'\n","export class TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined\n\t? new AbortError(errorMessage)\n\t: new DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined\n\t\t? getDOMException('This operation was aborted.')\n\t\t: signal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t} = options;\n\n\tlet timer;\n\n\tconst cancelablePromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tresolve(promise);\n\t\t\treturn;\n\t\t}\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst errorMessage = typeof message === 'string' ? message : `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\tconst timeoutError = message instanceof Error ? message : new TimeoutError(errorMessage);\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\treject(timeoutError);\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t} finally {\n\t\t\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\t\t}\n\t\t})();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n","import { abortableSource } from 'abortable-iterator'\nimport { CLOSE_TIMEOUT } from './constants.js'\nimport pTimeout from 'p-timeout'\nimport { logger } from '@libp2p/logger'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { MultiaddrConnection } from '@libp2p/interface-connection'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { DuplexWebSocket } from 'it-ws/duplex'\n\nconst log = logger('libp2p:websockets:socket')\n\nexport interface SocketToConnOptions extends AbortOptions {\n localAddr?: Multiaddr\n}\n\n// Convert a stream into a MultiaddrConnection\n// https://github.com/libp2p/interface-transport#multiaddrconnection\nexport function socketToMaConn (stream: DuplexWebSocket, remoteAddr: Multiaddr, options?: SocketToConnOptions): MultiaddrConnection {\n options = options ?? {}\n\n const maConn: MultiaddrConnection = {\n async sink (source) {\n if ((options?.signal) != null) {\n source = abortableSource(source, options.signal)\n }\n\n try {\n await stream.sink(source)\n } catch (err: any) {\n if (err.type !== 'aborted') {\n log.error(err)\n }\n }\n },\n\n source: (options.signal != null) ? abortableSource(stream.source, options.signal) : stream.source,\n\n remoteAddr,\n\n timeline: { open: Date.now() },\n\n async close () {\n const start = Date.now()\n\n try {\n await pTimeout(stream.close(), {\n milliseconds: CLOSE_TIMEOUT\n })\n } catch (err) {\n const { host, port } = maConn.remoteAddr.toOptions()\n log('timeout closing stream to %s:%s after %dms, destroying it manually',\n host, port, Date.now() - start)\n\n stream.destroy()\n } finally {\n maConn.timeline.close = Date.now()\n }\n }\n }\n\n stream.socket.once != null && stream.socket.once('close', () => { // eslint-disable-line @typescript-eslint/prefer-optional-chain\n // In instances where `close` was not explicitly called,\n // such as an iterable stream ending, ensure we have set the close\n // timeline\n if (maConn.timeline.close == null) {\n maConn.timeline.close = Date.now()\n }\n })\n\n return maConn\n}\n","// p2p multi-address code\nexport const CODE_P2P = 421\nexport const CODE_CIRCUIT = 290\n\nexport const CODE_TCP = 6\nexport const CODE_WS = 477\nexport const CODE_WSS = 478\n\n// Time to wait for a connection to close gracefully before destroying it manually\nexport const CLOSE_TIMEOUT = 2000\n","import { Multiaddr } from '@multiformats/multiaddr'\n\nexport interface MatchesFunction { (a: string | Uint8Array | Multiaddr): boolean }\nexport interface PartialMatchesFunction { (protos: string[]): boolean | string[] | null }\n\nexport interface Mafmt {\n toString: () => string\n input?: Array<(Mafmt | (() => Mafmt))>\n matches: MatchesFunction\n partialMatch: PartialMatchesFunction\n}\n\n/*\n * Valid combinations\n */\nexport const DNS4 = base('dns4')\nexport const DNS6 = base('dns6')\nexport const DNSADDR = base('dnsaddr')\nexport const DNS = or(\n base('dns'),\n DNSADDR,\n DNS4,\n DNS6\n)\n\nexport const IP = or(base('ip4'), base('ip6'))\nexport const TCP = or(\n and(IP, base('tcp')),\n and(DNS, base('tcp'))\n)\nexport const UDP = and(IP, base('udp'))\nexport const UTP = and(UDP, base('utp'))\n\nexport const QUIC = and(UDP, base('quic'))\n\nexport const WebSockets = or(\n and(TCP, base('ws')),\n and(DNS, base('ws'))\n)\n\nexport const WebSocketsSecure = or(\n and(TCP, base('wss')),\n and(DNS, base('wss'))\n)\n\nexport const HTTP = or(\n and(TCP, base('http')),\n and(IP, base('http')),\n and(DNS, base('http'))\n)\n\nexport const HTTPS = or(\n and(TCP, base('https')),\n and(IP, base('https')),\n and(DNS, base('https'))\n)\n\nexport const WebRTCStar = or(\n and(WebSockets, base('p2p-webrtc-star'), base('p2p')),\n and(WebSocketsSecure, base('p2p-webrtc-star'), base('p2p')),\n and(WebSockets, base('p2p-webrtc-star')),\n and(WebSocketsSecure, base('p2p-webrtc-star'))\n)\n\nexport const WebSocketStar = or(\n and(WebSockets, base('p2p-websocket-star'), base('p2p')),\n and(WebSocketsSecure, base('p2p-websocket-star'), base('p2p')),\n and(WebSockets, base('p2p-websocket-star')),\n and(WebSocketsSecure, base('p2p-websocket-star'))\n)\n\nexport const WebRTCDirect = or(\n and(HTTP, base('p2p-webrtc-direct'), base('p2p')),\n and(HTTPS, base('p2p-webrtc-direct'), base('p2p')),\n and(HTTP, base('p2p-webrtc-direct')),\n and(HTTPS, base('p2p-webrtc-direct'))\n)\n\nexport const Reliable = or(\n WebSockets,\n WebSocketsSecure,\n HTTP,\n HTTPS,\n WebRTCStar,\n WebRTCDirect,\n TCP,\n UTP,\n QUIC,\n DNS\n)\n\n// Unlike ws-star, stardust can run over any transport thus removing the requirement for websockets (but don't even think about running a stardust server over webrtc-star ;) )\nexport const Stardust = or(\n and(Reliable, base('p2p-stardust'), base('p2p')),\n and(Reliable, base('p2p-stardust'))\n)\n\nconst _P2P = or(\n and(Reliable, base('p2p')),\n WebRTCStar,\n WebRTCDirect,\n base('p2p')\n)\n\nconst _Circuit = or(\n and(_P2P, base('p2p-circuit'), _P2P),\n and(_P2P, base('p2p-circuit')),\n and(base('p2p-circuit'), _P2P),\n and(Reliable, base('p2p-circuit')),\n and(base('p2p-circuit'), Reliable),\n base('p2p-circuit')\n)\n\nconst CircuitRecursive = () => or(\n and(_Circuit, CircuitRecursive),\n _Circuit\n)\n\nexport const Circuit = CircuitRecursive()\n\nexport const P2P = or(\n and(Circuit, _P2P, Circuit),\n and(_P2P, Circuit),\n and(Circuit, _P2P),\n Circuit,\n _P2P\n)\n\nexport const IPFS = P2P\n\n/*\n * Validation funcs\n */\n\nfunction makeMatchesFunction (partialMatch: PartialMatchesFunction) {\n function matches (a: string | Uint8Array | Multiaddr): boolean {\n let ma\n\n try {\n ma = new Multiaddr(a)\n } catch (err: any) { // catch error\n return false // also if it's invalid it's propably not matching as well so return false\n }\n\n const out = partialMatch(ma.protoNames())\n if (out === null) {\n return false\n }\n\n if (out === true || out === false) {\n return out\n }\n\n return out.length === 0\n }\n\n return matches\n}\n\nfunction and (...args: Array Mafmt)>): Mafmt {\n function partialMatch (a: string[]): boolean | string[] | null {\n if (a.length < args.length) {\n return null\n }\n\n let out: boolean | string[] | null = a\n\n args.some((arg) => {\n out = typeof arg === 'function'\n ? arg().partialMatch(a)\n : arg.partialMatch(a)\n\n if (Array.isArray(out)) {\n a = out\n }\n\n if (out === null) {\n return true\n }\n\n return false\n })\n\n return out\n }\n\n return {\n toString: function () { return '{ ' + args.join(' ') + ' }' },\n input: args,\n matches: makeMatchesFunction(partialMatch),\n partialMatch: partialMatch\n }\n}\n\nfunction or (...args: Array Mafmt)>): Mafmt {\n function partialMatch (a: string[]): boolean | string[] | null {\n let out = null\n args.some((arg) => {\n const res = typeof arg === 'function'\n ? arg().partialMatch(a)\n : arg.partialMatch(a)\n if (res != null) {\n out = res\n return true\n }\n return false\n })\n\n return out\n }\n\n const result = {\n toString: function () { return '{ ' + args.join(' ') + ' }' },\n input: args,\n matches: makeMatchesFunction(partialMatch),\n partialMatch: partialMatch\n }\n\n return result\n}\n\nfunction base (n: string): Mafmt {\n const name = n\n\n function matches (a: string | Uint8Array | Multiaddr) {\n let ma: Multiaddr\n\n try {\n ma = new Multiaddr(a)\n } catch (err: any) { // catch error\n return false // also if it's invalid it's probably not matching as well so return false\n }\n\n const pnames = ma.protoNames()\n if (pnames.length === 1 && pnames[0] === name) {\n return true\n }\n return false\n }\n\n function partialMatch (protos: string[]): boolean | string[] | null {\n if (protos.length === 0) {\n return null\n }\n\n if (protos[0] === name) {\n return protos.slice(1)\n }\n return null\n }\n\n return {\n toString: function () { return name },\n matches: matches,\n partialMatch: partialMatch\n }\n}\n","import * as mafmt from '@multiformats/mafmt'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport {\n CODE_CIRCUIT,\n CODE_P2P,\n CODE_TCP,\n CODE_WS,\n CODE_WSS\n} from './constants.js'\n\nexport function all (multiaddrs: Multiaddr[]) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(CODE_CIRCUIT)) {\n return false\n }\n\n const testMa = ma.decapsulateCode(CODE_P2P)\n\n return mafmt.WebSockets.matches(testMa) ||\n mafmt.WebSocketsSecure.matches(testMa)\n })\n}\n\nexport function dnsWss (multiaddrs: Multiaddr[]) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(CODE_CIRCUIT)) {\n return false\n }\n\n const testMa = ma.decapsulateCode(CODE_P2P)\n\n return mafmt.WebSocketsSecure.matches(testMa) &&\n mafmt.DNS.matches(testMa.decapsulateCode(CODE_TCP).decapsulateCode(CODE_WSS))\n })\n}\n\nexport function dnsWsOrWss (multiaddrs: Multiaddr[]) {\n return multiaddrs.filter((ma) => {\n if (ma.protoCodes().includes(CODE_CIRCUIT)) {\n return false\n }\n\n const testMa = ma.decapsulateCode(CODE_P2P)\n\n // WS\n if (mafmt.WebSockets.matches(testMa)) {\n return mafmt.DNS.matches(testMa.decapsulateCode(CODE_TCP).decapsulateCode(CODE_WS))\n }\n\n // WSS\n return mafmt.WebSocketsSecure.matches(testMa) &&\n mafmt.DNS.matches(testMa.decapsulateCode(CODE_TCP).decapsulateCode(CODE_WSS))\n })\n}\n","import type { AbortOptions } from '@libp2p/interfaces'\nimport type { EventEmitter } from '@libp2p/interfaces/events'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { Connection, MultiaddrConnection } from '@libp2p/interface-connection'\nimport type { Duplex } from 'it-stream-types'\n\nexport const symbol = Symbol.for('@libp2p/transport')\n\nexport interface ConnectionHandler { (connection: Connection): void }\n\nexport interface MultiaddrFilter { (multiaddrs: Multiaddr[]): Multiaddr[] }\n\nexport interface CreateListenerOptions {\n handler?: ConnectionHandler\n upgrader: Upgrader\n}\n\nexport interface DialOptions extends AbortOptions {\n upgrader: Upgrader\n}\n\n/**\n * A libp2p transport is understood as something that offers a dial and listen interface to establish connections.\n */\nexport interface Transport {\n /**\n * Used to identify the transport\n */\n [Symbol.toStringTag]: string\n\n /**\n * Used by the isTransport function\n */\n [symbol]: true\n\n /**\n * Dial a given multiaddr.\n */\n dial: (ma: Multiaddr, options: DialOptions) => Promise\n\n /**\n * Create transport listeners.\n */\n createListener: (options: CreateListenerOptions) => Listener\n\n /**\n * Takes a list of `Multiaddr`s and returns only valid addresses for the transport\n */\n filter: MultiaddrFilter\n}\n\nexport interface ListenerEvents {\n 'connection': CustomEvent\n 'listening': CustomEvent\n 'error': CustomEvent\n 'close': CustomEvent\n}\n\nexport interface Listener extends EventEmitter {\n /**\n * Start a listener\n */\n listen: (multiaddr: Multiaddr) => Promise\n /**\n * Get listen addresses\n */\n getAddrs: () => Multiaddr[]\n /**\n * Close listener\n *\n * @returns {Promise}\n */\n close: () => Promise\n}\n\nexport interface UpgraderEvents {\n 'connection': CustomEvent\n 'connectionEnd': CustomEvent\n}\n\nexport interface Upgrader extends EventEmitter {\n /**\n * Upgrades an outbound connection on `transport.dial`.\n */\n upgradeOutbound: (maConn: MultiaddrConnection) => Promise\n\n /**\n * Upgrades an inbound connection on transport listener.\n */\n upgradeInbound: (maConn: MultiaddrConnection) => Promise\n}\n\nexport interface ProtocolHandler {\n (stream: Duplex, connection: Connection): void\n}\n\nexport function isTransport (other: any): other is Transport {\n return other != null && Boolean(other[symbol])\n}\n\nexport interface TransportManagerEvents {\n 'listener:listening': CustomEvent\n 'listener:close': CustomEvent\n}\n\nexport interface TransportManager extends EventEmitter {\n add: (transport: Transport) => void\n dial: (ma: Multiaddr, options?: any) => Promise\n getAddrs: () => Multiaddr[]\n getTransports: () => Transport[]\n transportForMultiaddr: (ma: Multiaddr) => Transport | undefined\n listen: (addrs: Multiaddr[]) => Promise\n remove: (key: string) => Promise\n removeAll: () => Promise\n}\n","import { connect, WebSocketOptions } from 'it-ws/client'\nimport { multiaddrToUri as toUri } from '@multiformats/multiaddr-to-uri'\nimport { AbortError } from '@libp2p/interfaces/errors'\nimport pDefer from 'p-defer'\nimport { logger } from '@libp2p/logger'\nimport { isBrowser, isWebWorker } from 'wherearewe'\nimport { createListener } from './listener.js'\nimport { socketToMaConn } from './socket-to-conn.js'\nimport * as filters from './filters.js'\nimport { Transport, MultiaddrFilter, symbol, CreateListenerOptions, DialOptions } from '@libp2p/interface-transport'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { DuplexWebSocket } from 'it-ws/duplex'\nimport type { ClientOptions } from 'ws'\nimport type { Server } from 'http'\n\nconst log = logger('libp2p:websockets')\n\nexport interface WebSocketsInit extends AbortOptions, WebSocketOptions {\n filter?: MultiaddrFilter\n websocket?: ClientOptions\n server?: Server\n}\n\nexport class WebSockets implements Transport {\n private readonly init?: WebSocketsInit\n\n constructor (init?: WebSocketsInit) {\n this.init = init\n }\n\n get [Symbol.toStringTag] () {\n return '@libp2p/websockets'\n }\n\n get [symbol] (): true {\n return true\n }\n\n async dial (ma: Multiaddr, options: DialOptions): Promise {\n log('dialing %s', ma)\n options = options ?? {}\n\n const socket = await this._connect(ma, options)\n const maConn = socketToMaConn(socket, ma)\n log('new outbound connection %s', maConn.remoteAddr)\n\n const conn = await options.upgrader.upgradeOutbound(maConn)\n log('outbound connection %s upgraded', maConn.remoteAddr)\n return conn\n }\n\n async _connect (ma: Multiaddr, options: AbortOptions): Promise {\n if (options?.signal?.aborted === true) {\n throw new AbortError()\n }\n const cOpts = ma.toOptions()\n log('dialing %s:%s', cOpts.host, cOpts.port)\n\n const errorPromise = pDefer()\n const errfn = (err: any) => {\n log.error('connection error:', err)\n\n errorPromise.reject(err)\n }\n\n const rawSocket = connect(toUri(ma), this.init)\n\n if (rawSocket.socket.on != null) {\n rawSocket.socket.on('error', errfn)\n } else {\n rawSocket.socket.onerror = errfn\n }\n\n if (options.signal == null) {\n await Promise.race([rawSocket.connected(), errorPromise.promise])\n\n log('connected %s', ma)\n return rawSocket\n }\n\n // Allow abort via signal during connect\n let onAbort\n const abort = new Promise((resolve, reject) => {\n onAbort = () => {\n reject(new AbortError())\n // FIXME: https://github.com/libp2p/js-libp2p-websockets/issues/121\n setTimeout(() => {\n rawSocket.close().catch(err => {\n log.error('error closing raw socket', err)\n })\n })\n }\n\n // Already aborted?\n if (options?.signal?.aborted === true) {\n return onAbort()\n }\n\n options?.signal?.addEventListener('abort', onAbort)\n })\n\n try {\n await Promise.race([abort, errorPromise.promise, rawSocket.connected()])\n } finally {\n if (onAbort != null) {\n options?.signal?.removeEventListener('abort', onAbort)\n }\n }\n\n log('connected %s', ma)\n return rawSocket\n }\n\n /**\n * Creates a Websockets listener. The provided `handler` function will be called\n * anytime a new incoming Connection has been successfully upgraded via\n * `upgrader.upgradeInbound`\n */\n createListener (options: CreateListenerOptions) {\n return createListener({ ...this.init, ...options })\n }\n\n /**\n * Takes a list of `Multiaddr`s and returns only valid Websockets addresses.\n * By default, in a browser environment only DNS+WSS multiaddr is accepted,\n * while in a Node.js environment DNS+{WS, WSS} multiaddrs are accepted.\n */\n filter (multiaddrs: Multiaddr[]) {\n multiaddrs = Array.isArray(multiaddrs) ? multiaddrs : [multiaddrs]\n\n if (this.init?.filter != null) {\n return this.init?.filter(multiaddrs)\n }\n\n // Browser\n if (isBrowser || isWebWorker) {\n return filters.dnsWss(multiaddrs)\n }\n\n return filters.all(multiaddrs)\n }\n}\n","\nexport function createListener () {\n throw new Error('WebSocket Servers can not be created in the browser!')\n}\n","\nimport all from 'it-all'\n\n/**\n * Collect all values from the iterable and sort them using\n * the passed sorter function\n *\n * @template T\n * @param {AsyncIterable | Iterable} iterable\n * @param {(a: T, b: T) => -1 | 0 | 1} sorter\n * @returns {AsyncIterable}\n */\nexport const sortAll = (iterable, sorter) => {\n return (async function * () {\n const values = await all(iterable)\n yield * values.sort(sorter)\n })()\n}\n\n/**\n * @param {string} s\n * @param {string} r\n */\nexport const replaceStartWith = (s, r) => {\n const matcher = new RegExp('^' + r)\n return s.replace(matcher, '')\n}\n","\nimport { nanoid } from 'nanoid'\nimport { SupportedEncodings, toString as uint8ArrayToString } from 'uint8arrays/to-string'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\n\nconst pathSepS = '/'\nconst pathSepB = new TextEncoder().encode(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 */\nexport class Key {\n private _buf: Uint8Array\n\n /**\n * @param {string | Uint8Array} s\n * @param {boolean} [clean]\n */\n constructor (s: string | Uint8Array, clean?: boolean) {\n if (typeof s === 'string') {\n this._buf = uint8ArrayFromString(s)\n } else if (s instanceof Uint8Array) {\n this._buf = s\n } else {\n throw new Error('Invalid key, should be String of Uint8Array')\n }\n\n if (clean == null) {\n clean = true\n }\n\n if (clean) {\n this.clean()\n }\n\n if (this._buf.byteLength === 0 || this._buf[0] !== pathSep) {\n throw new Error('Invalid key')\n }\n }\n\n /**\n * Convert to the string representation\n *\n * @param {import('uint8arrays/to-string').SupportedEncodings} [encoding='utf8'] - The encoding to use.\n * @returns {string}\n */\n toString (encoding: SupportedEncodings = 'utf8'): string {\n return uint8ArrayToString(this._buf, encoding)\n }\n\n /**\n * Return the Uint8Array representation of the key\n *\n * @returns {Uint8Array}\n */\n uint8Array (): Uint8Array {\n return this._buf\n }\n\n /**\n * Return string representation of the key\n *\n * @returns {string}\n */\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 - The array of namespaces\n * @returns {Key}\n *\n * @example\n * ```js\n * Key.withNamespaces(['one', 'two'])\n * // => Key('/one/two')\n * ```\n */\n static withNamespaces (list: string[]): 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 * ```js\n * Key.random()\n * // => Key('/f98719ea086343f7b71f32ea9d9d521d')\n * ```\n */\n static random (): Key {\n return new Key(nanoid().replace(/-/g, ''))\n }\n\n /**\n * @param {*} other\n */\n static asKey (other: any): Key | null {\n if (other instanceof Uint8Array || typeof other === 'string') {\n // we can create a key from this\n return new Key(other)\n }\n\n if (typeof other.uint8Array === 'function') {\n // this is an older version or may have crossed the esm/cjs boundary\n return new Key(other.uint8Array())\n }\n\n return null\n }\n\n /**\n * Cleanup the current key\n *\n * @returns {void}\n */\n clean (): void {\n if (this._buf == null || this._buf.byteLength === 0) {\n this._buf = pathSepB\n }\n\n if (this._buf[0] !== pathSep) {\n const bytes = new Uint8Array(this._buf.byteLength + 1)\n bytes.fill(pathSep, 0, 1)\n bytes.set(this._buf, 1)\n this._buf = bytes\n }\n\n // normalize does not remove trailing slashes\n while (this._buf.byteLength > 1 && this._buf[this._buf.byteLength - 1] === pathSep) {\n this._buf = this._buf.subarray(0, -1)\n }\n }\n\n /**\n * Check if the given key is sorted lower than ourself.\n *\n * @param {Key} key - The other Key to check against\n * @returns {boolean}\n */\n less (key: Key): boolean {\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 * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').reverse()\n * // => Key('/Actor:JohnCleese/MontyPython/Comedy')\n * ```\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 (): string[] {\n return this.list()\n }\n\n /** Returns the \"base\" namespace of this key.\n *\n * @returns {string}\n *\n * @example\n * ```js\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 * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').list()\n * // => ['Comedy', 'MontyPythong', 'Actor:JohnCleese']\n * ```\n */\n list (): string[] {\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 * ```js\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 * ```js\n * new Key('/Comedy/MontyPython/Actor:JohnCleese').name()\n * // => 'JohnCleese'\n * ```\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 - The string to append.\n * @returns {Key}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython/Actor').instance('JohnClesse')\n * // => Key('/Comedy/MontyPython/Actor:JohnCleese')\n * ```\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 * ```js\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 * ```js\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 - The child Key to add\n * @returns {Key}\n *\n * @example\n * ```js\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 - The other key to test against\n * @returns {boolean}\n *\n * @example\n * ```js\n * new Key('/Comedy').isAncestorOf('/Comedy/MontyPython')\n * // => true\n * ```\n */\n isAncestorOf (other: Key): boolean {\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 - The other Key to test against\n * @returns {boolean}\n *\n * @example\n * ```js\n * new Key('/Comedy/MontyPython').isDecendantOf('/Comedy')\n * // => true\n * ```\n */\n isDecendantOf (other: Key): boolean {\n if (other.toString() === this.toString()) {\n return false\n }\n\n return this.toString().startsWith(other.toString())\n }\n\n /**\n * Checks if this key has only one namespace.\n *\n * @returns {boolean}\n *\n */\n isTopLevel (): boolean {\n return this.list().length === 1\n }\n\n /**\n * Concats one or more Keys into one new Key.\n *\n * @param {Array} keys - The array of keys to concatenate\n * @returns {Key}\n */\n concat (...keys: Key[]): Key {\n return Key.withNamespaces([...this.namespaces(), ...flatten(keys.map(key => key.namespaces()))])\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\n/**\n * Flatten array of arrays (only one level)\n *\n * @template T\n * @param {Array} arr\n * @returns {T[]}\n */\nfunction flatten (arr: any[]): string[] {\n return ([]).concat(...arr)\n}\n","import { urlAlphabet } from './url-alphabet/index.js'\nlet random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nlet customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nlet customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nlet nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\nexport { nanoid, customAlphabet, customRandom, urlAlphabet, random }\n","import { BaseDatastore } from './base.js'\nimport { Key } from 'interface-datastore/key'\nimport * as Errors from './errors.js'\n\n/**\n * @typedef {import('interface-datastore').Pair} Pair\n * @typedef {import('interface-datastore').Datastore} Datastore\n * @typedef {import('interface-store').Options} Options\n */\n\n/**\n * @class MemoryDatastore\n * @implements {Datastore}\n */\nexport class MemoryDatastore extends BaseDatastore {\n constructor () {\n super()\n\n /** @type {Record} */\n this.data = {}\n }\n\n open () {\n return Promise.resolve()\n }\n\n close () {\n return Promise.resolve()\n }\n\n /**\n * @param {Key} key\n * @param {Uint8Array} val\n */\n async put (key, val) { // eslint-disable-line require-await\n this.data[key.toString()] = val\n }\n\n /**\n * @param {Key} key\n */\n async get (key) {\n const exists = await this.has(key)\n if (!exists) throw Errors.notFoundError()\n return this.data[key.toString()]\n }\n\n /**\n * @param {Key} key\n */\n async has (key) { // eslint-disable-line require-await\n return this.data[key.toString()] !== undefined\n }\n\n /**\n * @param {Key} key\n */\n async delete (key) { // eslint-disable-line require-await\n delete this.data[key.toString()]\n }\n\n async * _all () {\n yield * Object.entries(this.data)\n .map(([key, value]) => ({ key: new Key(key), value }))\n }\n\n async * _allKeys () {\n yield * Object.entries(this.data)\n .map(([key]) => new Key(key))\n }\n}\n","import { sortAll } from './utils.js'\nimport drain from 'it-drain'\nimport filter from 'it-filter'\nimport take from 'it-take'\n\n/**\n * @typedef {import('interface-store').Options} Options\n * @typedef {import('interface-datastore').Key} Key\n * @typedef {import('interface-datastore').Pair} Pair\n * @typedef {import('interface-datastore').Datastore} Datastore\n * @typedef {import('interface-datastore').Query} Query\n * @typedef {import('interface-datastore').KeyQuery} KeyQuery\n * @typedef {import('interface-datastore').Batch} Batch\n */\n\n/**\n * @template O\n * @typedef {import('interface-store').AwaitIterable} AwaitIterable\n */\n\n/**\n * @implements {Datastore}\n */\nexport class BaseDatastore {\n /**\n * @returns {Promise}\n */\n open () {\n return Promise.reject(new Error('.open is not implemented'))\n }\n\n /**\n * @returns {Promise}\n */\n close () {\n return Promise.reject(new Error('.close is not implemented'))\n }\n\n /**\n * @param {Key} key\n * @param {Uint8Array} val\n * @param {Options} [options]\n * @returns {Promise}\n */\n put (key, val, options) {\n return Promise.reject(new Error('.put is not implemented'))\n }\n\n /**\n * @param {Key} key\n * @param {Options} [options]\n * @returns {Promise}\n */\n get (key, options) {\n return Promise.reject(new Error('.get is not implemented'))\n }\n\n /**\n * @param {Key} key\n * @param {Options} [options]\n * @returns {Promise}\n */\n has (key, options) {\n return Promise.reject(new Error('.has is not implemented'))\n }\n\n /**\n * @param {Key} key\n * @param {Options} [options]\n * @returns {Promise}\n */\n delete (key, options) {\n return Promise.reject(new Error('.delete is not implemented'))\n }\n\n /**\n * @param {AwaitIterable} source\n * @param {Options} [options]\n * @returns {AsyncIterable}\n */\n async * putMany (source, options = {}) {\n for await (const { key, value } of source) {\n await this.put(key, value, options)\n yield { key, value }\n }\n }\n\n /**\n * @param {AwaitIterable} source\n * @param {Options} [options]\n * @returns {AsyncIterable}\n */\n async * getMany (source, options = {}) {\n for await (const key of source) {\n yield this.get(key, options)\n }\n }\n\n /**\n * @param {AwaitIterable} source\n * @param {Options} [options]\n * @returns {AsyncIterable}\n */\n async * deleteMany (source, options = {}) {\n for await (const key of source) {\n await this.delete(key, options)\n yield key\n }\n }\n\n /**\n * @returns {Batch}\n */\n batch () {\n /** @type {Pair[]} */\n let puts = []\n /** @type {Key[]} */\n let dels = []\n\n return {\n put (key, value) {\n puts.push({ key, value })\n },\n\n delete (key) {\n dels.push(key)\n },\n commit: async (options) => {\n await drain(this.putMany(puts, options))\n puts = []\n await drain(this.deleteMany(dels, options))\n dels = []\n }\n }\n }\n\n /**\n * Extending classes should override `query` or implement this method\n *\n * @param {Query} q\n * @param {Options} [options]\n * @returns {AsyncIterable}\n */\n // eslint-disable-next-line require-yield\n async * _all (q, options) {\n throw new Error('._all is not implemented')\n }\n\n /**\n * Extending classes should override `queryKeys` or implement this method\n *\n * @param {KeyQuery} q\n * @param {Options} [options]\n * @returns {AsyncIterable}\n */\n // eslint-disable-next-line require-yield\n async * _allKeys (q, options) {\n throw new Error('._allKeys is not implemented')\n }\n\n /**\n * @param {Query} q\n * @param {Options} [options]\n */\n query (q, options) {\n let it = this._all(q, options)\n\n if (q.prefix != null) {\n it = filter(it, (e) =>\n e.key.toString().startsWith(/** @type {string} */ (q.prefix))\n )\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++ >= /** @type {number} */ (q.offset))\n }\n\n if (q.limit != null) {\n it = take(it, q.limit)\n }\n\n return it\n }\n\n /**\n * @param {KeyQuery} q\n * @param {Options} [options]\n */\n queryKeys (q, options) {\n let it = this._allKeys(q, options)\n\n if (q.prefix != null) {\n it = filter(it, (key) =>\n key.toString().startsWith(/** @type {string} */ (q.prefix))\n )\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++ >= /** @type {number} */ (q.offset))\n }\n\n if (q.limit != null) {\n it = take(it, q.limit)\n }\n\n return it\n }\n}\n","import errCode from 'err-code'\n\n/**\n * @param {Error} [err]\n */\nexport function dbOpenFailedError (err) {\n err = err || new Error('Cannot open database')\n return errCode(err, 'ERR_DB_OPEN_FAILED')\n}\n\n/**\n * @param {Error} [err]\n */\nexport function dbDeleteFailedError (err) {\n err = err || new Error('Delete failed')\n return errCode(err, 'ERR_DB_DELETE_FAILED')\n}\n\n/**\n * @param {Error} [err]\n */\nexport function dbWriteFailedError (err) {\n err = err || new Error('Write failed')\n return errCode(err, 'ERR_DB_WRITE_FAILED')\n}\n\n/**\n * @param {Error} [err]\n */\nexport function notFoundError (err) {\n err = err || new Error('Not Found')\n return errCode(err, 'ERR_NOT_FOUND')\n}\n\n/**\n * @param {Error} [err]\n */\nexport function abortedError (err) {\n err = err || new Error('Aborted')\n return errCode(err, 'ERR_ABORTED')\n}\n","export enum messages {\n NOT_STARTED_YET = 'The libp2p node is not started yet',\n DHT_DISABLED = 'DHT is not available',\n PUBSUB_DISABLED = 'PubSub is not available',\n CONN_ENCRYPTION_REQUIRED = 'At least one connection encryption module is required',\n ERR_TRANSPORTS_REQUIRED = 'At least one transport module is required',\n ERR_PROTECTOR_REQUIRED = 'Private network is enforced, but no protector was provided',\n NOT_FOUND = 'Not found'\n}\n\nexport enum codes {\n DHT_DISABLED = 'ERR_DHT_DISABLED',\n ERR_PUBSUB_DISABLED = 'ERR_PUBSUB_DISABLED',\n PUBSUB_NOT_STARTED = 'ERR_PUBSUB_NOT_STARTED',\n DHT_NOT_STARTED = 'ERR_DHT_NOT_STARTED',\n CONN_ENCRYPTION_REQUIRED = 'ERR_CONN_ENCRYPTION_REQUIRED',\n ERR_TRANSPORTS_REQUIRED = 'ERR_TRANSPORTS_REQUIRED',\n ERR_PROTECTOR_REQUIRED = 'ERR_PROTECTOR_REQUIRED',\n ERR_PEER_DIAL_INTERCEPTED = 'ERR_PEER_DIAL_INTERCEPTED',\n ERR_CONNECTION_INTERCEPTED = 'ERR_CONNECTION_INTERCEPTED',\n ERR_INVALID_PROTOCOLS_FOR_STREAM = 'ERR_INVALID_PROTOCOLS_FOR_STREAM',\n ERR_CONNECTION_ENDED = 'ERR_CONNECTION_ENDED',\n ERR_CONNECTION_FAILED = 'ERR_CONNECTION_FAILED',\n ERR_NODE_NOT_STARTED = 'ERR_NODE_NOT_STARTED',\n ERR_ALREADY_ABORTED = 'ERR_ALREADY_ABORTED',\n ERR_TOO_MANY_ADDRESSES = 'ERR_TOO_MANY_ADDRESSES',\n ERR_NO_VALID_ADDRESSES = 'ERR_NO_VALID_ADDRESSES',\n ERR_RELAYED_DIAL = 'ERR_RELAYED_DIAL',\n ERR_DIALED_SELF = 'ERR_DIALED_SELF',\n ERR_DISCOVERED_SELF = 'ERR_DISCOVERED_SELF',\n ERR_DUPLICATE_TRANSPORT = 'ERR_DUPLICATE_TRANSPORT',\n ERR_ENCRYPTION_FAILED = 'ERR_ENCRYPTION_FAILED',\n ERR_HOP_REQUEST_FAILED = 'ERR_HOP_REQUEST_FAILED',\n ERR_INVALID_KEY = 'ERR_INVALID_KEY',\n ERR_INVALID_MESSAGE = 'ERR_INVALID_MESSAGE',\n ERR_INVALID_PARAMETERS = 'ERR_INVALID_PARAMETERS',\n ERR_INVALID_PEER = 'ERR_INVALID_PEER',\n ERR_MUXER_UNAVAILABLE = 'ERR_MUXER_UNAVAILABLE',\n ERR_NOT_FOUND = 'ERR_NOT_FOUND',\n ERR_TIMEOUT = 'ERR_TIMEOUT',\n ERR_TRANSPORT_UNAVAILABLE = 'ERR_TRANSPORT_UNAVAILABLE',\n ERR_TRANSPORT_DIAL_FAILED = 'ERR_TRANSPORT_DIAL_FAILED',\n ERR_UNSUPPORTED_PROTOCOL = 'ERR_UNSUPPORTED_PROTOCOL',\n ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED = 'ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED',\n ERR_INVALID_MULTIADDR = 'ERR_INVALID_MULTIADDR',\n ERR_SIGNATURE_NOT_VALID = 'ERR_SIGNATURE_NOT_VALID',\n ERR_FIND_SELF = 'ERR_FIND_SELF',\n ERR_NO_ROUTERS_AVAILABLE = 'ERR_NO_ROUTERS_AVAILABLE',\n ERR_CONNECTION_NOT_MULTIPLEXED = 'ERR_CONNECTION_NOT_MULTIPLEXED',\n ERR_NO_DIAL_TOKENS = 'ERR_NO_DIAL_TOKENS',\n ERR_KEYCHAIN_REQUIRED = 'ERR_KEYCHAIN_REQUIRED',\n ERR_INVALID_CMS = 'ERR_INVALID_CMS',\n ERR_MISSING_KEYS = 'ERR_MISSING_KEYS',\n ERR_NO_KEY = 'ERR_NO_KEY',\n ERR_INVALID_KEY_NAME = 'ERR_INVALID_KEY_NAME',\n ERR_INVALID_KEY_TYPE = 'ERR_INVALID_KEY_TYPE',\n ERR_KEY_ALREADY_EXISTS = 'ERR_KEY_ALREADY_EXISTS',\n ERR_INVALID_KEY_SIZE = 'ERR_INVALID_KEY_SIZE',\n ERR_KEY_NOT_FOUND = 'ERR_KEY_NOT_FOUND',\n ERR_OLD_KEY_NAME_INVALID = 'ERR_OLD_KEY_NAME_INVALID',\n ERR_NEW_KEY_NAME_INVALID = 'ERR_NEW_KEY_NAME_INVALID',\n ERR_PASSWORD_REQUIRED = 'ERR_PASSWORD_REQUIRED',\n ERR_PEM_REQUIRED = 'ERR_PEM_REQUIRED',\n ERR_CANNOT_READ_KEY = 'ERR_CANNOT_READ_KEY',\n ERR_MISSING_PRIVATE_KEY = 'ERR_MISSING_PRIVATE_KEY',\n ERR_MISSING_PUBLIC_KEY = 'ERR_MISSING_PUBLIC_KEY',\n ERR_INVALID_OLD_PASS_TYPE = 'ERR_INVALID_OLD_PASS_TYPE',\n ERR_INVALID_NEW_PASS_TYPE = 'ERR_INVALID_NEW_PASS_TYPE',\n ERR_INVALID_PASS_LENGTH = 'ERR_INVALID_PASS_LENGTH',\n ERR_NOT_IMPLEMENTED = 'ERR_NOT_IMPLEMENTED',\n ERR_WRONG_PING_ACK = 'ERR_WRONG_PING_ACK',\n ERR_INVALID_RECORD = 'ERR_INVALID_RECORD',\n ERR_ALREADY_SUCCEEDED = 'ERR_ALREADY_SUCCEEDED',\n ERR_NO_HANDLER_FOR_PROTOCOL = 'ERR_NO_HANDLER_FOR_PROTOCOL',\n ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS = 'ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS',\n ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS = 'ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS'\n}\n","import errCode from 'err-code'\nimport filter from 'it-filter'\nimport map from 'it-map'\nimport type { Source } from 'it-stream-types'\nimport type { PeerInfo } from '@libp2p/interface-peer-info'\nimport type { PeerStore } from '@libp2p/interface-peer-store'\n\n/**\n * Store the multiaddrs from every peer in the passed peer store\n */\nexport async function * storeAddresses (source: Source, peerStore: PeerStore) {\n yield * map(source, async (peer) => {\n // ensure we have the addresses for a given peer\n await peerStore.addressBook.add(peer.id, peer.multiaddrs)\n\n return peer\n })\n}\n\n/**\n * Filter peers by unique peer id\n */\nexport function uniquePeers (source: Source) {\n /** @type Set */\n const seen = new Set()\n\n return filter(source, (peer) => {\n // dedupe by peer id\n if (seen.has(peer.id.toString())) {\n return false\n }\n\n seen.add(peer.id.toString())\n\n return true\n })\n}\n\n/**\n * Require at least `min` peers to be yielded from `source`\n */\nexport async function * requirePeers (source: Source, min: number = 1) {\n let seen = 0\n\n for await (const peer of source) {\n seen++\n\n yield peer\n }\n\n if (seen < min) {\n throw errCode(new Error('not found'), 'NOT_FOUND')\n }\n}\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport { codes, messages } from './errors.js'\nimport {\n storeAddresses,\n uniquePeers,\n requirePeers\n} from './content-routing/utils.js'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport merge from 'it-merge'\nimport { pipe } from 'it-pipe'\nimport first from 'it-first'\nimport drain from 'it-drain'\nimport filter from 'it-filter'\nimport {\n setDelayedInterval,\n clearDelayedInterval\n// @ts-expect-error module with no types\n} from 'set-delayed-interval'\nimport { setMaxListeners } from 'events'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { PeerRouting } from '@libp2p/interface-peer-routing'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { PeerInfo } from '@libp2p/interface-peer-info'\nimport type { Components } from '@libp2p/components'\n\nconst log = logger('libp2p:peer-routing')\n\nexport interface RefreshManagerInit {\n /**\n * Whether to enable the Refresh manager\n */\n enabled?: boolean\n\n /**\n * Boot delay to start the Refresh Manager (in ms)\n */\n bootDelay?: number\n\n /**\n * Interval between each Refresh Manager run (in ms)\n */\n interval?: number\n\n /**\n * How long to let each refresh run (in ms)\n */\n timeout?: number\n}\n\nexport interface PeerRoutingInit {\n routers: PeerRouting[]\n refreshManager?: RefreshManagerInit\n}\n\nexport class DefaultPeerRouting implements PeerRouting, Startable {\n private readonly components: Components\n private readonly routers: PeerRouting[]\n private readonly refreshManagerInit: RefreshManagerInit\n private timeoutId?: ReturnType\n private started: boolean\n private abortController?: TimeoutController\n\n constructor (components: Components, init: PeerRoutingInit) {\n this.components = components\n this.routers = init.routers\n this.refreshManagerInit = init.refreshManager ?? {}\n this.started = false\n\n this._findClosestPeersTask = this._findClosestPeersTask.bind(this)\n }\n\n isStarted () {\n return this.started\n }\n\n /**\n * Start peer routing service.\n */\n async start () {\n if (this.started || this.routers.length === 0 || this.timeoutId != null || this.refreshManagerInit.enabled === false) {\n return\n }\n\n this.timeoutId = setDelayedInterval(\n this._findClosestPeersTask, this.refreshManagerInit.interval, this.refreshManagerInit.bootDelay\n )\n\n this.started = true\n }\n\n /**\n * Recurrent task to find closest peers and add their addresses to the Address Book.\n */\n async _findClosestPeersTask () {\n if (this.abortController != null) {\n // we are already running the query\n return\n }\n\n try {\n this.abortController = new TimeoutController(this.refreshManagerInit.timeout ?? 10e3)\n\n // this controller may be used while dialing lots of peers so prevent MaxListenersExceededWarning\n // appearing in the console\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, this.abortController.signal)\n } catch {}\n\n // nb getClosestPeers adds the addresses to the address book\n await drain(this.getClosestPeers(this.components.getPeerId().toBytes(), { signal: this.abortController.signal }))\n } catch (err: any) {\n log.error(err)\n } finally {\n this.abortController?.clear()\n this.abortController = undefined\n }\n }\n\n /**\n * Stop peer routing service.\n */\n async stop () {\n clearDelayedInterval(this.timeoutId)\n\n // abort query if it is in-flight\n this.abortController?.abort()\n\n this.started = false\n }\n\n /**\n * Iterates over all peer routers in parallel to find the given peer\n */\n async findPeer (id: PeerId, options?: AbortOptions): Promise {\n if (this.routers.length === 0) {\n throw errCode(new Error('No peer routers available'), codes.ERR_NO_ROUTERS_AVAILABLE)\n }\n\n if (id.toString() === this.components.getPeerId().toString()) {\n throw errCode(new Error('Should not try to find self'), codes.ERR_FIND_SELF)\n }\n\n const output = await pipe(\n merge(\n ...this.routers.map(router => (async function * () {\n try {\n yield await router.findPeer(id, options)\n } catch (err) {\n log.error(err)\n }\n })())\n ),\n (source) => filter(source, Boolean),\n (source) => storeAddresses(source, this.components.getPeerStore()),\n async (source) => await first(source)\n )\n\n if (output != null) {\n return output\n }\n\n throw errCode(new Error(messages.NOT_FOUND), codes.ERR_NOT_FOUND)\n }\n\n /**\n * Attempt to find the closest peers on the network to the given key\n */\n async * getClosestPeers (key: Uint8Array, options?: AbortOptions): AsyncIterable {\n if (this.routers.length === 0) {\n throw errCode(new Error('No peer routers available'), codes.ERR_NO_ROUTERS_AVAILABLE)\n }\n\n yield * pipe(\n merge(\n ...this.routers.map(router => router.getClosestPeers(key, options))\n ),\n (source) => storeAddresses(source, this.components.getPeerStore()),\n (source) => uniquePeers(source),\n (source) => requirePeers(source)\n )\n }\n}\n","import errCode from 'err-code'\nimport { messages, codes } from '../errors.js'\nimport {\n storeAddresses,\n uniquePeers,\n requirePeers\n} from './utils.js'\nimport drain from 'it-drain'\nimport merge from 'it-merge'\nimport { pipe } from 'it-pipe'\nimport type { ContentRouting } from '@libp2p/interface-content-routing'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { CID } from 'multiformats/cid'\nimport type { Components } from '@libp2p/components'\n\nexport interface CompoundContentRoutingInit {\n routers: ContentRouting[]\n}\n\nexport class CompoundContentRouting implements ContentRouting, Startable {\n private readonly routers: ContentRouting[]\n private started: boolean\n private readonly components: Components\n\n constructor (components: Components, init: CompoundContentRoutingInit) {\n this.routers = init.routers ?? []\n this.started = false\n this.components = components\n }\n\n isStarted () {\n return this.started\n }\n\n async start () {\n this.started = true\n }\n\n async stop () {\n this.started = false\n }\n\n /**\n * Iterates over all content routers in parallel to find providers of the given key\n */\n async * findProviders (key: CID, options: AbortOptions = {}) {\n if (this.routers.length === 0) {\n throw errCode(new Error('No content this.routers available'), codes.ERR_NO_ROUTERS_AVAILABLE)\n }\n\n yield * pipe(\n merge(\n ...this.routers.map(router => router.findProviders(key, options))\n ),\n (source) => storeAddresses(source, this.components.getPeerStore()),\n (source) => uniquePeers(source),\n (source) => requirePeers(source)\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 async provide (key: CID, options: AbortOptions = {}) {\n if (this.routers.length === 0) {\n throw errCode(new Error('No content routers available'), codes.ERR_NO_ROUTERS_AVAILABLE)\n }\n\n await Promise.all(this.routers.map(async (router) => await router.provide(key, options)))\n }\n\n /**\n * Store the given key/value pair in the available content routings\n */\n async put (key: Uint8Array, value: Uint8Array, options?: AbortOptions) {\n if (!this.isStarted()) {\n throw errCode(new Error(messages.NOT_STARTED_YET), codes.DHT_NOT_STARTED)\n }\n\n const dht = this.components.getDHT()\n\n if (dht != null) {\n await drain(dht.put(key, value, options))\n }\n }\n\n /**\n * Get the value to the given key.\n * Times out after 1 minute by default.\n */\n async get (key: Uint8Array, options?: AbortOptions): Promise {\n if (!this.isStarted()) {\n throw errCode(new Error(messages.NOT_STARTED_YET), codes.DHT_NOT_STARTED)\n }\n\n const dht = this.components.getDHT()\n\n if (dht != null) {\n for await (const event of dht.get(key, options)) {\n if (event.name === 'VALUE') {\n return event.value\n }\n }\n }\n\n throw errCode(new Error(messages.NOT_FOUND), codes.ERR_NOT_FOUND)\n }\n\n /**\n * Get the `n` values to the given key without sorting\n */\n async * getMany (key: Uint8Array, nVals: number, options: AbortOptions) { // eslint-disable-line require-await\n if (!this.isStarted()) {\n throw errCode(new Error(messages.NOT_STARTED_YET), codes.DHT_NOT_STARTED)\n }\n\n if (nVals == null || nVals === 0) {\n return\n }\n\n let gotValues = 0\n const dht = this.components.getDHT()\n\n if (dht != null) {\n for await (const event of dht.get(key, options)) {\n if (event.name === 'VALUE') {\n yield { from: event.from, val: event.value }\n\n gotValues++\n\n if (gotValues === nVals) {\n break\n }\n }\n }\n }\n\n if (gotValues === 0) {\n throw errCode(new Error(messages.NOT_FOUND), codes.ERR_NOT_FOUND)\n }\n }\n}\n","import { peerIdFromString } from '@libp2p/peer-id'\nimport { Multiaddr } from '@multiformats/multiaddr'\nimport errCode from 'err-code'\nimport { codes } from './errors.js'\nimport { isPeerId } from '@libp2p/interface-peer-id'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { PeerInfo } from '@libp2p/interface-peer-info'\n\nfunction peerIdFromMultiaddr (ma: Multiaddr) {\n const idStr = ma.getPeerId()\n\n if (idStr == null) {\n throw errCode(\n new Error(`${ma.toString()} does not have a valid peer type`),\n codes.ERR_INVALID_MULTIADDR\n )\n }\n\n try {\n return peerIdFromString(idStr)\n } catch (err: any) {\n throw errCode(\n new Error(`${ma.toString()} is not a valid peer type`),\n codes.ERR_INVALID_MULTIADDR\n )\n }\n}\n\n/**\n * Converts the given `peer` to a `Peer` object.\n */\nexport function getPeer (peer: PeerId | Multiaddr | string): PeerInfo {\n if (isPeerId(peer)) {\n return {\n id: peer,\n multiaddrs: [],\n protocols: []\n }\n }\n\n if (typeof peer === 'string') {\n peer = new Multiaddr(peer)\n }\n\n let addr\n\n if (Multiaddr.isMultiaddr(peer)) {\n addr = peer\n peer = peerIdFromMultiaddr(peer)\n }\n\n return {\n id: peer,\n multiaddrs: addr != null ? [addr] : [],\n protocols: []\n }\n}\n","import type { AddressManagerEvents } from '@libp2p/interface-address-manager'\nimport { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport { Multiaddr } from '@multiformats/multiaddr'\nimport { peerIdFromString } from '@libp2p/peer-id'\nimport type { Components } from '@libp2p/components'\n\nexport interface AddressManagerInit {\n announceFilter?: AddressFilter\n\n /**\n * list of multiaddrs string representation to listen\n */\n listen?: string[]\n\n /**\n * list of multiaddrs string representation to announce\n */\n announce?: string[]\n\n /**\n * list of multiaddrs string representation to never announce\n */\n noAnnounce?: string[]\n}\n\nexport interface AddressFilter {\n (addrs: Multiaddr[]): Multiaddr[]\n}\n\nconst defaultAddressFilter = (addrs: Multiaddr[]): Multiaddr[] => addrs\n\nexport class DefaultAddressManager extends EventEmitter {\n private readonly components: Components\n private readonly listen: Set\n private readonly announce: Set\n private readonly observed: Set\n private readonly announceFilter: AddressFilter\n\n /**\n * Responsible for managing the peer addresses.\n * Peers can specify their listen and announce addresses.\n * The listen addresses will be used by the libp2p transports to listen for new connections,\n * while the announce addresses will be used for the peer addresses' to other peers in the network.\n */\n constructor (components: Components, init: AddressManagerInit) {\n super()\n\n const { listen = [], announce = [] } = init\n\n this.components = components\n this.listen = new Set(listen.map(ma => ma.toString()))\n this.announce = new Set(announce.map(ma => ma.toString()))\n this.observed = new Set()\n this.announceFilter = init.announceFilter ?? defaultAddressFilter\n }\n\n /**\n * Get peer listen multiaddrs\n */\n getListenAddrs (): Multiaddr[] {\n return Array.from(this.listen).map((a) => new Multiaddr(a))\n }\n\n /**\n * Get peer announcing multiaddrs\n */\n getAnnounceAddrs (): Multiaddr[] {\n return Array.from(this.announce).map((a) => new Multiaddr(a))\n }\n\n /**\n * Get observed multiaddrs\n */\n getObservedAddrs (): Multiaddr[] {\n return Array.from(this.observed).map((a) => new Multiaddr(a))\n }\n\n /**\n * Add peer observed addresses\n */\n addObservedAddr (addr: string | Multiaddr): void {\n let ma = new Multiaddr(addr)\n const remotePeer = ma.getPeerId()\n\n // strip our peer id if it has been passed\n if (remotePeer != null) {\n const remotePeerId = peerIdFromString(remotePeer)\n\n // use same encoding for comparison\n if (remotePeerId.equals(this.components.getPeerId())) {\n ma = ma.decapsulate(new Multiaddr(`/p2p/${this.components.getPeerId().toString()}`))\n }\n }\n\n const addrString = ma.toString()\n\n // do not trigger the change:addresses event if we already know about this address\n if (this.observed.has(addrString)) {\n return\n }\n\n this.observed.add(addrString)\n this.dispatchEvent(new CustomEvent('change:addresses'))\n }\n\n getAddresses (): Multiaddr[] {\n let addrs = this.getAnnounceAddrs().map(ma => ma.toString())\n\n if (addrs.length === 0) {\n // no configured announce addrs, add configured listen addresses\n addrs = this.components.getTransportManager().getAddrs().map(ma => ma.toString())\n }\n\n addrs = addrs.concat(this.getObservedAddrs().map(ma => ma.toString()))\n\n // dedupe multiaddrs\n const addrSet = new Set(addrs)\n\n // Create advertising list\n return this.announceFilter(Array.from(addrSet)\n .map(str => new Multiaddr(str)))\n .map(ma => {\n if (ma.getPeerId() === this.components.getPeerId().toString()) {\n return ma\n }\n\n return ma.encapsulate(`/p2p/${this.components.getPeerId().toString()}`)\n })\n }\n}\n","/**\n * Thin ESM wrapper for CJS named exports.\n *\n * Ref: https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1\n */\n\nimport mergeOptions from './index.js';\nexport default mergeOptions;\n","/**\n * This code is based on `latency-monitor` (https://github.com/mlucool/latency-monitor) by `mlucool` (https://github.com/mlucool), available under Apache License 2.0 (https://github.com/mlucool/latency-monitor/blob/master/LICENSE)\n */\n\nimport { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport { logger } from '@libp2p/logger'\n\nconst log = logger('libp2p:connection-manager:latency-monitor:visibility-change-emitter')\n\ninterface VisibilityChangeEmitterEvents {\n 'visibilityChange': CustomEvent\n}\n\ntype Hidden = 'hidden' | 'mozHidden' | 'msHidden' | 'webkitHidden'\n\n/**\n * Listen to page visibility change events (i.e. when the page is focused / blurred) by an event emitter.\n *\n * Warning: This does not work on all browsers, but should work on all modern browsers\n *\n * @example\n *\n * const myVisibilityEmitter = new VisibilityChangeEmitter();\n *\n * myVisibilityEmitter.on('visibilityChange', (pageInFocus) => {\n * if ( pageInFocus ){\n * // Page is in focus\n * console.log('In focus');\n * }\n * else {\n * // Page is blurred\n * console.log('Out of focus');\n * }\n * });\n * // To access the visibility state directly, call:\n * console.log('Am I focused now? ' + myVisibilityEmitter.isVisible());\n */\nexport class VisibilityChangeEmitter extends EventEmitter {\n private hidden: Hidden\n private visibilityChange: string\n\n constructor () {\n super()\n\n this.hidden = 'hidden'\n this.visibilityChange = 'visibilityChange'\n\n if (globalThis.document != null) {\n this._initializeVisibilityVarNames()\n this._addVisibilityChangeListener()\n }\n }\n\n /**\n * document.hidden and document.visibilityChange are the two variables we need to check for;\n * Since these variables are named differently in different browsers, this function sets\n * the appropriate name based on the browser being used. Once executed, tha actual names of\n * document.hidden and document.visibilityChange are found in this._hidden and this._visibilityChange\n * respectively\n *\n * @private\n */\n _initializeVisibilityVarNames () {\n let hidden: Hidden = 'hidden'\n let visibilityChange = 'visibilitychange'\n\n if (typeof globalThis.document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support\n hidden = 'hidden'\n visibilityChange = 'visibilitychange'\n // @ts-expect-error mozHidden is a non-standard field name\n } else if (typeof globalThis.document.mozHidden !== 'undefined') {\n hidden = 'mozHidden'\n visibilityChange = 'mozvisibilitychange'\n // @ts-expect-error msHidden is a non-standard field name\n } else if (typeof globalThis.document.msHidden !== 'undefined') {\n hidden = 'msHidden'\n visibilityChange = 'msvisibilitychange'\n // @ts-expect-error webkitHidden is a non-standard field name\n } else if (typeof globalThis.document.webkitHidden !== 'undefined') {\n hidden = 'webkitHidden'\n visibilityChange = 'webkitvisibilitychange'\n }\n\n this.hidden = hidden\n this.visibilityChange = visibilityChange\n }\n\n /**\n * Adds an event listener on the document that listens to changes in document.visibilityChange\n * (or whatever name by which the visibilityChange variable is known in the browser)\n *\n * @private\n */\n _addVisibilityChangeListener () {\n // @ts-expect-error cannot index document object with string key\n if (typeof globalThis.document.addEventListener === 'undefined' || typeof document[this.hidden] === 'undefined') {\n log('Checking page visibility requires a browser that supports the Page Visibility API.')\n } else {\n // Handle page visibility change\n globalThis.document.addEventListener(this.visibilityChange, this._handleVisibilityChange.bind(this), false)\n }\n }\n\n /**\n * The function returns ```true``` if the page is visible or ```false``` if the page is not visible and\n * ```undefined``` if the page visibility API is not supported by the browser.\n */\n isVisible () {\n // @ts-expect-error cannot index document object with string key\n if (this.hidden === undefined || document[this.hidden] === undefined) {\n return undefined\n }\n\n // @ts-expect-error cannot index document object with string key\n return document[this.hidden] == null\n }\n\n /**\n * The function that is called when document.visibilityChange has changed\n * It emits an event called visibilityChange and sends the value of document.hidden as a\n * parameter\n *\n * @private\n */\n _handleVisibilityChange () {\n // @ts-expect-error cannot index document object with string key\n const visible = globalThis.document[this.hidden] === false\n log(visible ? 'Page Visible' : 'Page Hidden')\n\n // Emit the event\n this.dispatchEvent(new CustomEvent('visibilityChange', {\n detail: visible\n }))\n }\n}\n","/**\n * This code is based on `latency-monitor` (https://github.com/mlucool/latency-monitor) by `mlucool` (https://github.com/mlucool), available under Apache License 2.0 (https://github.com/mlucool/latency-monitor/blob/master/LICENSE)\n */\n\nimport { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport { VisibilityChangeEmitter } from './visibility-change-emitter.js'\nimport { logger } from '@libp2p/logger'\n\nconst log = logger('libp2p:connection-manager:latency-monitor')\n\nexport interface LatencyMonitorEvents {\n 'data': CustomEvent\n}\n\nexport interface LatencyMonitorInit {\n /**\n * How often to add a latency check event (ms)\n */\n latencyCheckIntervalMs?: number\n\n /**\n * How often to summarize latency check events. null or 0 disables event firing\n */\n dataEmitIntervalMs?: number\n\n /**\n * What cb-style async function to use\n */\n asyncTestFn?: (cb: () => void) => void\n\n /**\n * What percent (+/-) of latencyCheckIntervalMs should we randomly use? This helps avoid alignment to other events.\n */\n latencyRandomPercentage?: number\n}\n\nexport interface SummaryObject {\n /**\n * How many events were called\n */\n events: number\n\n /**\n * What was the min time for a cb to be called\n */\n minMs: number\n\n /**\n * What was the max time for a cb to be called\n */\n maxMs: number\n\n /**\n * What was the average time for a cb to be called\n */\n avgMs: number\n\n /**\n * How long this interval was in ms\n */\n lengthMs: number\n}\n\ninterface LatencyData {\n startTime: number\n events: number\n minMs: number\n maxMs: number\n totalMs: number\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 * @extends {EventEmitter}\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 */\nexport class LatencyMonitor extends EventEmitter {\n private readonly latencyCheckIntervalMs: number\n private readonly latencyRandomPercentage: number\n private readonly latencyCheckMultiply: number\n private readonly latencyCheckSubtract: number\n private readonly dataEmitIntervalMs?: number\n private readonly asyncTestFn?: (cb: () => void) => void\n\n private readonly now: (num?: any) => any\n private readonly getDeltaMS: (num: number) => number\n private visibilityChangeEmitter?: VisibilityChangeEmitter\n private latencyData: LatencyData\n private checkLatencyID?: NodeJS.Timeout\n private emitIntervalID?: NodeJS.Timeout\n\n constructor (init: LatencyMonitorInit = {}) {\n super()\n\n const { latencyCheckIntervalMs, dataEmitIntervalMs, asyncTestFn, latencyRandomPercentage } = init\n\n // 0 isn't valid here, so its ok to use ||\n this.latencyCheckIntervalMs = latencyCheckIntervalMs ?? 500 // 0.5s\n this.latencyRandomPercentage = latencyRandomPercentage ?? 10\n this.latencyCheckMultiply = 2 * (this.latencyRandomPercentage / 100.0) * this.latencyCheckIntervalMs\n this.latencyCheckSubtract = this.latencyCheckMultiply / 2\n\n this.dataEmitIntervalMs = (dataEmitIntervalMs === null || dataEmitIntervalMs === 0)\n ? undefined\n : dataEmitIntervalMs ?? 5 * 1000 // 5s\n log('latencyCheckIntervalMs: %s dataEmitIntervalMs: %s',\n this.latencyCheckIntervalMs, this.dataEmitIntervalMs)\n if (this.dataEmitIntervalMs != null) {\n log('Expecting ~%s events per summary', this.latencyCheckIntervalMs / this.dataEmitIntervalMs)\n } else {\n log('Not emitting summaries')\n }\n\n this.asyncTestFn = asyncTestFn // If there is no asyncFn, we measure latency\n\n // If process: use high resolution timer\n if (globalThis.process?.hrtime != null) {\n log('Using process.hrtime for timing')\n this.now = globalThis.process.hrtime // eslint-disable-line no-undef\n this.getDeltaMS = (startTime) => {\n const hrtime = this.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' && window.performance?.now != null) {\n log('Using performance.now for timing')\n this.now = window.performance.now.bind(window.performance)\n this.getDeltaMS = (startTime) => Math.round(this.now() - startTime)\n } else {\n log('Using Date.now for timing')\n this.now = Date.now\n this.getDeltaMS = (startTime) => this.now() - startTime\n }\n\n this.latencyData = this.initLatencyData()\n }\n\n start () {\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 this.visibilityChangeEmitter = new VisibilityChangeEmitter()\n\n this.visibilityChangeEmitter.addEventListener('visibilityChange', (evt) => {\n const { detail: pageInFocus } = evt\n\n if (pageInFocus) {\n this._startTimers()\n } else {\n this._emitSummary()\n this._stopTimers()\n }\n })\n }\n\n if (this.visibilityChangeEmitter?.isVisible() === true) {\n this._startTimers()\n }\n }\n\n stop () {\n this._stopTimers()\n }\n\n /**\n * Start internal timers\n *\n * @private\n */\n _startTimers () {\n // Timer already started, ignore this\n if (this.checkLatencyID != null) {\n return\n }\n\n this.checkLatency()\n\n if (this.dataEmitIntervalMs != null) {\n this.emitIntervalID = setInterval(() => this._emitSummary(), this.dataEmitIntervalMs)\n if (typeof this.emitIntervalID.unref === 'function') {\n this.emitIntervalID.unref() // Doesn't block exit\n }\n }\n }\n\n /**\n * Stop internal timers\n *\n * @private\n */\n _stopTimers () {\n if (this.checkLatencyID != null) {\n clearTimeout(this.checkLatencyID)\n this.checkLatencyID = undefined\n }\n if (this.emitIntervalID != null) {\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 *\n * @private\n */\n _emitSummary () {\n const summary = this.getSummary()\n if (summary.events > 0) {\n this.dispatchEvent(new CustomEvent('data', {\n detail: summary\n }))\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 */\n getSummary (): SummaryObject {\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 const latency = {\n events: this.latencyData.events,\n minMs: this.latencyData.minMs,\n maxMs: this.latencyData.maxMs,\n avgMs: this.latencyData.events > 0\n ? this.latencyData.totalMs / this.latencyData.events\n : Number.POSITIVE_INFINITY,\n lengthMs: this.getDeltaMS(this.latencyData.startTime)\n }\n this.latencyData = this.initLatencyData() // Clear\n\n log.trace('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 checkLatency () {\n // Randomness is needed to avoid alignment by accident to regular things in the event loop\n const randomness = (Math.random() * this.latencyCheckMultiply) - this.latencyCheckSubtract\n\n // We use this to ensure that in case some overlap somehow, we don't take the wrong startTime/offset\n const localData = {\n deltaOffset: Math.ceil(this.latencyCheckIntervalMs + randomness),\n startTime: this.now()\n }\n\n const cb = () => {\n // We are already stopped, ignore this datapoint\n if (this.checkLatencyID == null) {\n return\n }\n const deltaMS = this.getDeltaMS(localData.startTime) - localData.deltaOffset\n this.checkLatency() // Start again ASAP\n\n // Add the data point. If this gets complex, refactor it\n this.latencyData.events++\n this.latencyData.minMs = Math.min(this.latencyData.minMs, deltaMS)\n this.latencyData.maxMs = Math.max(this.latencyData.maxMs, deltaMS)\n this.latencyData.totalMs += deltaMS\n log.trace('MS: %s Data: %O', deltaMS, this.latencyData)\n }\n log.trace('localData: %O', localData)\n\n this.checkLatencyID = setTimeout(() => {\n // This gets rid of including event loop\n if (this.asyncTestFn != null) {\n // Clear timing related things\n localData.deltaOffset = 0\n localData.startTime = this.now()\n this.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 (typeof this.checkLatencyID.unref === 'function') {\n this.checkLatencyID.unref() // Doesn't block exit\n }\n }\n\n initLatencyData (): LatencyData {\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\nfunction isBrowser () {\n return typeof globalThis.window !== 'undefined'\n}\n","\nexport const OPEN = 'OPEN'\nexport const CLOSING = 'CLOSING'\nexport const CLOSED = 'CLOSED'\n","import errCode from 'err-code'\nimport { anySignal } from 'any-signal'\nimport FIFO from 'p-fifo'\nimport { setMaxListeners } from 'events'\nimport { codes } from '../../errors.js'\nimport { logger } from '@libp2p/logger'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Dialer } from './index.js'\n\nconst log = logger('libp2p:dialer:dial-request')\n\nexport interface DialAction {\n (m: Multiaddr, options: AbortOptions): Promise\n}\n\nexport interface DialRequestOptions {\n addrs: Multiaddr[]\n dialAction: DialAction\n dialer: Dialer\n}\n\nexport class DialRequest {\n private readonly addrs: Multiaddr[]\n private readonly dialer: Dialer\n private readonly dialAction: DialAction\n\n /**\n * Manages running the `dialAction` on multiple provided `addrs` in parallel\n * up to a maximum determined by the number of tokens returned\n * from `dialer.getTokens`. Once a DialRequest is created, it can be\n * started using `DialRequest.run(options)`. Once a single dial has succeeded,\n * all other dials in the request will be cancelled.\n */\n constructor (options: DialRequestOptions) {\n const {\n addrs,\n dialAction,\n dialer\n } = options\n\n this.addrs = addrs\n this.dialer = dialer\n this.dialAction = dialAction\n }\n\n async run (options: AbortOptions = {}): Promise {\n const tokens = this.dialer.getTokens(this.addrs.length)\n\n // If no tokens are available, throw\n if (tokens.length < 1) {\n throw errCode(new Error('No dial tokens available'), codes.ERR_NO_DIAL_TOKENS)\n }\n\n const tokenHolder = new FIFO()\n\n for (const token of tokens) {\n void tokenHolder.push(token).catch(err => {\n log.error(err)\n })\n }\n\n const dialAbortControllers: Array<(AbortController | undefined)> = this.addrs.map(() => {\n const controller = new AbortController()\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, controller.signal)\n } catch {}\n\n return controller\n })\n\n if (options.signal != null) {\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, options.signal)\n } catch {}\n }\n\n let completedDials = 0\n let done = false\n\n try {\n return await Promise.any(this.addrs.map(async (addr, i) => {\n const token = await tokenHolder.shift() // get token\n // End attempt once another attempt succeeded\n if (done) {\n this.dialer.releaseToken(tokens.splice(tokens.indexOf(token), 1)[0])\n throw errCode(new Error('dialAction already succeeded'), codes.ERR_ALREADY_SUCCEEDED)\n }\n\n const controller = dialAbortControllers[i]\n if (controller == null) {\n throw errCode(new Error('dialAction did not come with an AbortController'), codes.ERR_INVALID_PARAMETERS)\n }\n let conn\n try {\n const signal = controller.signal\n conn = await this.dialAction(addr, { ...options, signal: (options.signal != null) ? anySignal([signal, options.signal]) : signal })\n // Remove the successful AbortController so it is not aborted\n dialAbortControllers[i] = undefined\n } finally {\n completedDials++\n // If we have more or equal dials remaining than tokens, recycle the token, otherwise release it\n if (this.addrs.length - completedDials >= tokens.length) {\n void tokenHolder.push(token).catch(err => {\n log.error(err)\n })\n } else {\n this.dialer.releaseToken(tokens.splice(tokens.indexOf(token), 1)[0])\n }\n }\n\n if (conn == null) {\n // Notify Promise.any that attempt was not successful\n // to prevent from returning undefined despite there\n // were successful dial attempts\n throw errCode(new Error('dialAction led to empty object'), codes.ERR_TRANSPORT_DIAL_FAILED)\n } else {\n // This dial succeeded, don't attempt anything else\n done = true\n }\n\n return conn\n }))\n } finally {\n // success/failure happened, abort everything else\n dialAbortControllers.forEach(c => {\n if (c !== undefined) {\n c.abort()\n }\n })\n tokens.forEach(token => this.dialer.releaseToken(token)) // release tokens back to the dialer\n }\n }\n}\n","import type { Multiaddr } from '@multiformats/multiaddr'\nimport isIpPrivate from 'private-ip'\n\n/**\n * Check if a given multiaddr has a private address.\n */\nexport function isPrivate (ma: Multiaddr) {\n const { address } = ma.nodeAddress()\n\n return Boolean(isIpPrivate(address))\n}\n","import type { Address } from '@libp2p/interface-peer-store'\nimport { isPrivate } from './multiaddr/is-private.js'\n\n/**\n * Compare function for array.sort().\n * This sort aims to move the private addresses to the end of the array.\n * In case of equality, a certified address will come first.\n */\nexport function publicAddressesFirst (a: Address, b: Address): -1 | 0 | 1 {\n const isAPrivate = isPrivate(a.multiaddr)\n const isBPrivate = isPrivate(b.multiaddr)\n\n if (isAPrivate && !isBPrivate) {\n return 1\n } else if (!isAPrivate && isBPrivate) {\n return -1\n }\n // Check certified?\n if (a.isCertified && !b.isCertified) {\n return -1\n } else if (!a.isCertified && b.isCertified) {\n return 1\n }\n\n return 0\n}\n","\n/**\n * How long in ms a dial attempt is allowed to take\n */\nexport const DIAL_TIMEOUT = 30e3\n\n/**\n * How long in ms an inbound connection upgrade is allowed to take\n */\nexport const INBOUND_UPGRADE_TIMEOUT = 30e3\n\n/**\n * Maximum allowed concurrent dials\n */\nexport const MAX_PARALLEL_DIALS = 100\n\n/**\n * Allowed parallel dials per DialRequest\n */\nexport const MAX_PER_PEER_DIALS = 4\n\n/**\n * Maximum number of allowed addresses to attempt to dial\n */\nexport const MAX_ADDRS_TO_DIAL = 25\n\nexport const METRICS = {\n computeThrottleMaxQueueSize: 1000,\n computeThrottleTimeout: 2000,\n movingAverageIntervals: [\n 60 * 1000, // 1 minute\n 5 * 60 * 1000, // 5 minutes\n 15 * 60 * 1000 // 15 minutes\n ],\n maxOldPeersRetention: 50\n}\n","import { logger } from '@libp2p/logger'\nimport all from 'it-all'\nimport filter from 'it-filter'\nimport { pipe } from 'it-pipe'\nimport errCode from 'err-code'\nimport { Multiaddr, Resolver } from '@multiformats/multiaddr'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport { AbortError } from '@libp2p/interfaces/errors'\nimport { anySignal } from 'any-signal'\nimport { setMaxListeners } from 'events'\nimport { DialAction, DialRequest } from './dial-request.js'\nimport { publicAddressesFirst } from '@libp2p/utils/address-sort'\nimport { trackedMap } from '@libp2p/tracked-map'\nimport { codes } from '../../errors.js'\nimport {\n DIAL_TIMEOUT,\n MAX_PARALLEL_DIALS,\n MAX_PER_PEER_DIALS,\n MAX_ADDRS_TO_DIAL\n} from '../../constants.js'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport { getPeer } from '../../get-peer.js'\nimport sort from 'it-sort'\nimport { Components, Initializable } from '@libp2p/components'\nimport map from 'it-map'\nimport type { AddressSorter } from '@libp2p/interface-peer-store'\nimport type { ComponentMetricsTracker } from '@libp2p/interface-metrics'\n\nconst log = logger('libp2p:dialer')\n\nconst METRICS_COMPONENT = 'dialler'\nconst METRICS_PENDING_DIALS = 'pending-dials'\nconst METRICS_PENDING_DIAL_TARGETS = 'pending-dial-targets'\n\nexport interface DialTarget {\n id: string\n addrs: Multiaddr[]\n}\n\nexport interface PendingDial {\n dialRequest: DialRequest\n controller: TimeoutController\n promise: Promise\n destroy: () => void\n}\n\nexport interface PendingDialTarget {\n resolve: (value: any) => void\n reject: (err: Error) => void\n}\n\nexport interface DialerInit {\n /**\n * Sort the known addresses of a peer before trying to dial\n */\n addressSorter?: AddressSorter\n\n /**\n * Number of max concurrent dials\n */\n maxParallelDials?: number\n\n /**\n * Number of max addresses to dial for a given peer\n */\n maxAddrsToDial?: number\n\n /**\n * How long a dial attempt is allowed to take\n */\n dialTimeout?: number\n\n /**\n * Number of max concurrent dials per peer\n */\n maxDialsPerPeer?: number\n\n /**\n * Multiaddr resolvers to use when dialing\n */\n resolvers?: Record\n metrics?: ComponentMetricsTracker\n}\n\nexport class Dialer implements Startable, Initializable {\n private components: Components = new Components()\n private readonly addressSorter: AddressSorter\n private readonly maxAddrsToDial: number\n private readonly timeout: number\n private readonly maxDialsPerPeer: number\n public tokens: number[]\n public pendingDials: Map\n public pendingDialTargets: Map\n private started: boolean\n\n constructor (init: DialerInit = {}) {\n this.started = false\n this.addressSorter = init.addressSorter ?? publicAddressesFirst\n this.maxAddrsToDial = init.maxAddrsToDial ?? MAX_ADDRS_TO_DIAL\n this.timeout = init.dialTimeout ?? DIAL_TIMEOUT\n this.maxDialsPerPeer = init.maxDialsPerPeer ?? MAX_PER_PEER_DIALS\n this.tokens = [...new Array(init.maxParallelDials ?? MAX_PARALLEL_DIALS)].map((_, index) => index)\n this.pendingDials = trackedMap({\n component: METRICS_COMPONENT,\n metric: METRICS_PENDING_DIALS,\n metrics: init.metrics\n })\n this.pendingDialTargets = trackedMap({\n component: METRICS_COMPONENT,\n metric: METRICS_PENDING_DIAL_TARGETS,\n metrics: init.metrics\n })\n\n for (const [key, value] of Object.entries(init.resolvers ?? {})) {\n Multiaddr.resolvers.set(key, value)\n }\n }\n\n init (components: Components): void {\n this.components = components\n }\n\n isStarted () {\n return this.started\n }\n\n async start () {\n this.started = true\n }\n\n /**\n * Clears any pending dials\n */\n async stop () {\n this.started = false\n\n for (const dial of this.pendingDials.values()) {\n try {\n dial.controller.abort()\n } catch (err: any) {\n log.error(err)\n }\n }\n this.pendingDials.clear()\n\n for (const pendingTarget of this.pendingDialTargets.values()) {\n pendingTarget.reject(new AbortError('Dialer was destroyed'))\n }\n this.pendingDialTargets.clear()\n }\n\n /**\n * Connects to a given `peer` by dialing all of its known addresses.\n * The dial to the first address that is successfully able to upgrade a connection\n * will be used.\n */\n async dial (peer: PeerId | Multiaddr, options: AbortOptions = {}): Promise {\n const { id, multiaddrs } = getPeer(peer)\n\n if (this.components.getPeerId().equals(id)) {\n throw errCode(new Error('Tried to dial self'), codes.ERR_DIALED_SELF)\n }\n\n log('check multiaddrs %p', id)\n\n if (multiaddrs != null && multiaddrs.length > 0) {\n log('storing multiaddrs %p', id, multiaddrs)\n await this.components.getPeerStore().addressBook.add(id, multiaddrs)\n }\n\n if (await this.components.getConnectionGater().denyDialPeer(id)) {\n throw errCode(new Error('The dial request is blocked by gater.allowDialPeer'), codes.ERR_PEER_DIAL_INTERCEPTED)\n }\n\n log('creating dial target for %p', id)\n\n const dialTarget = await this._createCancellableDialTarget(id, options)\n\n if (dialTarget.addrs.length === 0) {\n throw errCode(new Error('The dial request has no valid addresses'), codes.ERR_NO_VALID_ADDRESSES)\n }\n\n const pendingDial = this.pendingDials.get(dialTarget.id) ?? this._createPendingDial(dialTarget, options)\n\n try {\n const connection = await pendingDial.promise\n log('dial succeeded to %s', dialTarget.id)\n return connection\n } catch (err: any) {\n log('dial failed to %s', dialTarget.id, err)\n // Error is a timeout\n if (pendingDial.controller.signal.aborted) {\n err.code = codes.ERR_TIMEOUT\n }\n log.error(err)\n throw err\n } finally {\n pendingDial.destroy()\n }\n }\n\n /**\n * Connects to a given `peer` by dialing all of its known addresses.\n * The dial to the first address that is successfully able to upgrade a connection\n * will be used.\n */\n async _createCancellableDialTarget (peer: PeerId, options: AbortOptions): Promise {\n // Make dial target promise cancellable\n const id = `${(parseInt(String(Math.random() * 1e9), 10)).toString()}${Date.now()}`\n const cancellablePromise = new Promise((resolve, reject) => {\n this.pendingDialTargets.set(id, { resolve, reject })\n })\n\n try {\n const dialTarget = await Promise.race([\n this._createDialTarget(peer, options),\n cancellablePromise\n ])\n\n return dialTarget\n } finally {\n this.pendingDialTargets.delete(id)\n }\n }\n\n /**\n * Creates a DialTarget. The DialTarget is used to create and track\n * the DialRequest to a given peer.\n * If a multiaddr is received it should be the first address attempted.\n * Multiaddrs not supported by the available transports will be filtered out.\n */\n async _createDialTarget (peer: PeerId, options: AbortOptions): Promise {\n const knownAddrs = await pipe(\n await this.components.getPeerStore().addressBook.get(peer),\n (source) => filter(source, async (address) => {\n return !(await this.components.getConnectionGater().denyDialMultiaddr(peer, address.multiaddr))\n }),\n (source) => sort(source, this.addressSorter),\n (source) => map(source, (address) => {\n const ma = address.multiaddr\n\n if (peer.toString() === ma.getPeerId()) {\n return ma\n }\n\n return ma.encapsulate(`/p2p/${peer.toString()}`)\n }),\n async (source) => await all(source)\n )\n\n const addrs: Multiaddr[] = []\n for (const a of knownAddrs) {\n const resolvedAddrs = await this._resolve(a, options)\n resolvedAddrs.forEach(ra => addrs.push(ra))\n }\n\n // Multiaddrs not supported by the available transports will be filtered out.\n const supportedAddrs = addrs.filter(a => this.components.getTransportManager().transportForMultiaddr(a))\n\n if (supportedAddrs.length > this.maxAddrsToDial) {\n await this.components.getPeerStore().delete(peer)\n throw errCode(new Error('dial with more addresses than allowed'), codes.ERR_TOO_MANY_ADDRESSES)\n }\n\n return {\n id: peer.toString(),\n addrs: supportedAddrs\n }\n }\n\n /**\n * Creates a PendingDial that wraps the underlying DialRequest\n */\n _createPendingDial (dialTarget: DialTarget, options: AbortOptions = {}): PendingDial {\n /**\n * @param {Multiaddr} addr\n * @param {{ signal: { aborted: any; }; }} options\n */\n const dialAction: DialAction = async (addr, options = {}) => {\n if (options.signal?.aborted === true) {\n throw errCode(new Error('already aborted'), codes.ERR_ALREADY_ABORTED)\n }\n\n return await this.components.getTransportManager().dial(addr, options)\n }\n\n const dialRequest = new DialRequest({\n addrs: dialTarget.addrs,\n dialAction,\n dialer: this\n })\n\n // Combine the timeout signal and options.signal, if provided\n const timeoutController = new TimeoutController(this.timeout)\n\n const signals = [timeoutController.signal]\n ;(options.signal != null) && signals.push(options.signal)\n const signal = anySignal(signals)\n\n // this signal will potentially be used while dialing lots of\n // peers so prevent MaxListenersExceededWarning appearing in the console\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, signal)\n } catch {}\n\n const pendingDial = {\n dialRequest,\n controller: timeoutController,\n promise: dialRequest.run({ ...options, signal }),\n destroy: () => {\n timeoutController.clear()\n this.pendingDials.delete(dialTarget.id)\n }\n }\n this.pendingDials.set(dialTarget.id, pendingDial)\n\n return pendingDial\n }\n\n getTokens (num: number) {\n const total = Math.min(num, this.maxDialsPerPeer, this.tokens.length)\n const tokens = this.tokens.splice(0, total)\n log('%d tokens request, returning %d, %d remaining', num, total, this.tokens.length)\n return tokens\n }\n\n releaseToken (token: number) {\n // Guard against duplicate releases\n if (this.tokens.includes(token)) {\n return\n }\n\n log('token %d released', token)\n this.tokens.push(token)\n }\n\n /**\n * Resolve multiaddr recursively\n */\n async _resolve (ma: Multiaddr, options: AbortOptions): Promise {\n // TODO: recursive logic should live in multiaddr once dns4/dns6 support is in place\n // Now only supporting resolve for dnsaddr\n const resolvableProto = ma.protoNames().includes('dnsaddr')\n\n // Multiaddr is not resolvable? End recursion!\n if (!resolvableProto) {\n return [ma]\n }\n\n const resolvedMultiaddrs = await this._resolveRecord(ma, options)\n const recursiveMultiaddrs = await Promise.all(resolvedMultiaddrs.map(async (nm) => {\n return await this._resolve(nm, options)\n }))\n\n const addrs = recursiveMultiaddrs.flat()\n return addrs.reduce((array, newM) => {\n if (array.find(m => m.equals(newM)) == null) {\n array.push(newM)\n }\n return array\n }, ([]))\n }\n\n /**\n * Resolve a given multiaddr. If this fails, an empty array will be returned\n */\n async _resolveRecord (ma: Multiaddr, options: AbortOptions): Promise {\n try {\n ma = new Multiaddr(ma.toString()) // Use current multiaddr module\n const multiaddrs = await ma.resolve(options)\n return multiaddrs\n } catch (err) {\n log.error(`multiaddr ${ma.toString()} could not be resolved`, err)\n return []\n }\n }\n}\n","\nexport function mapIterable (iter: IterableIterator, map: (val: T) => R): IterableIterator {\n const iterator: IterableIterator = {\n [Symbol.iterator]: () => {\n return iterator\n },\n next: () => {\n const next = iter.next()\n const val = next.value\n\n if (next.done === true || val == null) {\n const result: IteratorReturnResult = {\n done: true,\n value: undefined\n }\n\n return result\n }\n\n return {\n done: false,\n value: map(val)\n }\n }\n }\n\n return iterator\n}\n","import type { PeerId } from '@libp2p/interface-peer-id'\nimport { peerIdFromString } from '@libp2p/peer-id'\nimport { mapIterable } from './util.js'\n\n/**\n * We can't use PeerIds as map keys because map keys are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n */\nexport class PeerMap {\n private readonly map: Map\n\n constructor (map?: PeerMap) {\n this.map = new Map()\n\n if (map != null) {\n for (const [key, value] of map.entries()) {\n this.map.set(key.toString(), value)\n }\n }\n }\n\n [Symbol.iterator] () {\n return this.entries()\n }\n\n clear () {\n this.map.clear()\n }\n\n delete (peer: PeerId) {\n this.map.delete(peer.toString())\n }\n\n entries (): IterableIterator<[PeerId, T]> {\n return mapIterable<[string, T], [PeerId, T]>(\n this.map.entries(),\n (val) => {\n return [peerIdFromString(val[0]), val[1]]\n }\n )\n }\n\n forEach (fn: (value: T, key: PeerId, map: PeerMap) => void): void {\n this.map.forEach((value, key) => {\n fn(value, peerIdFromString(key), this)\n })\n }\n\n get (peer: PeerId): T | undefined {\n return this.map.get(peer.toString())\n }\n\n has (peer: PeerId): boolean {\n return this.map.has(peer.toString())\n }\n\n set (peer: PeerId, value: T) {\n this.map.set(peer.toString(), value)\n }\n\n keys (): IterableIterator {\n return mapIterable(\n this.map.keys(),\n (val) => {\n return peerIdFromString(val)\n }\n )\n }\n\n values () {\n return this.map.values()\n }\n\n get size () {\n return this.map.size\n }\n}\n","import type { PeerId } from '@libp2p/interface-peer-id'\nimport { peerIdFromString } from '@libp2p/peer-id'\nimport { mapIterable } from './util.js'\n\n/**\n * We can't use PeerIds as set entries because set entries are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n */\nexport class PeerSet {\n private readonly set: Set\n\n constructor (set?: PeerSet | Iterable) {\n this.set = new Set()\n\n if (set != null) {\n for (const key of set) {\n this.set.add(key.toString())\n }\n }\n }\n\n get size () {\n return this.set.size\n }\n\n [Symbol.iterator] () {\n return this.values()\n }\n\n add (peer: PeerId) {\n this.set.add(peer.toString())\n }\n\n clear () {\n this.set.clear()\n }\n\n delete (peer: PeerId) {\n this.set.delete(peer.toString())\n }\n\n entries (): IterableIterator<[PeerId, PeerId]> {\n return mapIterable<[string, string], [PeerId, PeerId]>(\n this.set.entries(),\n (val) => {\n const peerId = peerIdFromString(val[0])\n\n return [peerId, peerId]\n }\n )\n }\n\n forEach (predicate: (peerId: PeerId, index: PeerId, set: PeerSet) => void): void {\n this.set.forEach((str) => {\n const id = peerIdFromString(str)\n\n predicate(id, id, this)\n })\n }\n\n has (peer: PeerId): boolean {\n return this.set.has(peer.toString())\n }\n\n values () {\n return mapIterable(\n this.set.values(),\n (val) => {\n return peerIdFromString(val)\n }\n )\n }\n}\n","import type { PeerId } from '@libp2p/interface-peer-id'\nimport { peerIdFromString } from '@libp2p/peer-id'\nimport { mapIterable } from './util.js'\n\n/**\n * We can't use PeerIds as list entries because list entries are\n * compared using same-value-zero equality, so this is just\n * a map that stringifies the PeerIds before storing them.\n *\n * PeerIds cache stringified versions of themselves so this\n * should be a cheap operation.\n */\nexport class PeerList {\n private readonly list: string[]\n\n constructor (list?: PeerList) {\n this.list = []\n\n if (list != null) {\n for (const value of list) {\n this.list.push(value.toString())\n }\n }\n }\n\n [Symbol.iterator] () {\n return mapIterable<[number, string], PeerId>(\n this.list.entries(),\n (val) => {\n return peerIdFromString(val[1])\n }\n )\n }\n\n concat (list: PeerList) {\n const output = new PeerList(this)\n\n for (const value of list) {\n output.push(value)\n }\n\n return output\n }\n\n entries (): IterableIterator<[number, PeerId]> {\n return mapIterable<[number, string], [number, PeerId]>(\n this.list.entries(),\n (val) => {\n return [val[0], peerIdFromString(val[1])]\n }\n )\n }\n\n every (predicate: (peerId: PeerId, index: number, arr: PeerList) => boolean): boolean {\n return this.list.every((str, index) => {\n return predicate(peerIdFromString(str), index, this)\n })\n }\n\n filter (predicate: (peerId: PeerId, index: number, arr: PeerList) => boolean): PeerList {\n const output = new PeerList()\n\n this.list.forEach((str, index) => {\n const peerId = peerIdFromString(str)\n\n if (predicate(peerId, index, this)) {\n output.push(peerId)\n }\n })\n\n return output\n }\n\n find (predicate: (peerId: PeerId, index: number, arr: PeerList) => boolean): PeerId | undefined {\n const str = this.list.find((str, index) => {\n return predicate(peerIdFromString(str), index, this)\n })\n\n if (str == null) {\n return undefined\n }\n\n return peerIdFromString(str)\n }\n\n findIndex (predicate: (peerId: PeerId, index: number, arr: PeerList) => boolean): number {\n return this.list.findIndex((str, index) => {\n return predicate(peerIdFromString(str), index, this)\n })\n }\n\n forEach (predicate: (peerId: PeerId, index: number, arr: PeerList) => void): void {\n this.list.forEach((str, index) => {\n predicate(peerIdFromString(str), index, this)\n })\n }\n\n includes (peerId: PeerId): boolean {\n return this.list.includes(peerId.toString())\n }\n\n indexOf (peerId: PeerId): number {\n return this.list.indexOf(peerId.toString())\n }\n\n pop (): PeerId | undefined {\n const str = this.list.pop()\n\n if (str == null) {\n return undefined\n }\n\n return peerIdFromString(str)\n }\n\n push (...peerIds: PeerId[]) {\n for (const peerId of peerIds) {\n this.list.push(peerId.toString())\n }\n }\n\n shift (): PeerId | undefined {\n const str = this.list.shift()\n\n if (str == null) {\n return undefined\n }\n\n return peerIdFromString(str)\n }\n\n unshift (...peerIds: PeerId[]) {\n let len = this.list.length\n\n for (let i = peerIds.length - 1; i > -1; i--) {\n len = this.list.unshift(peerIds[i].toString())\n }\n\n return len\n }\n\n get length () {\n return this.list.length\n }\n}\n","\nexport const KEEP_ALIVE = 'keep-alive'\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport mergeOptions from 'merge-options'\nimport { LatencyMonitor, SummaryObject } from './latency-monitor.js'\n// @ts-expect-error retimer does not have types\nimport retimer from 'retimer'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport { codes } from '../errors.js'\nimport { isPeerId, PeerId } from '@libp2p/interface-peer-id'\nimport { setMaxListeners } from 'events'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { ConnectionManager } from '@libp2p/interface-connection-manager'\nimport { Components, Initializable } from '@libp2p/components'\nimport * as STATUS from '@libp2p/interface-connection/status'\nimport { Dialer } from './dialer/index.js'\nimport type { AddressSorter } from '@libp2p/interface-peer-store'\nimport type { Resolver } from '@multiformats/multiaddr'\nimport { PeerMap } from '@libp2p/peer-collections'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport { KEEP_ALIVE } from '@libp2p/interface-peer-store/tags'\n\nconst log = logger('libp2p:connection-manager')\n\nconst defaultOptions: Partial = {\n maxConnections: Infinity,\n minConnections: 0,\n maxData: Infinity,\n maxSentData: Infinity,\n maxReceivedData: Infinity,\n maxEventLoopDelay: Infinity,\n pollInterval: 2000,\n autoDialInterval: 10000,\n movingAverageInterval: 60000\n}\n\nconst METRICS_SYSTEM = 'libp2p'\nconst METRICS_COMPONENT = 'connection-manager'\nconst STARTUP_RECONNECT_TIMEOUT = 60000\n\nexport interface ConnectionManagerInit {\n /**\n * The maximum number of connections to keep open\n */\n maxConnections: number\n\n /**\n * The minimum number of connections to keep open\n */\n minConnections: number\n\n /**\n * The max data (in and out), per average interval to allow\n */\n maxData?: number\n\n /**\n * The max outgoing data, per average interval to allow\n */\n maxSentData?: number\n\n /**\n * The max incoming data, per average interval to allow\n */\n maxReceivedData?: number\n\n /**\n * The upper limit the event loop can take to run\n */\n maxEventLoopDelay?: number\n\n /**\n * How often, in milliseconds, metrics and latency should be checked\n */\n pollInterval?: number\n\n /**\n * How often, in milliseconds, to compute averages\n */\n movingAverageInterval?: number\n\n /**\n * If true, try to connect to all discovered peers up to the connection manager limit\n */\n autoDial?: boolean\n\n /**\n * How long to wait between attempting to keep our number of concurrent connections\n * above minConnections\n */\n autoDialInterval: number\n\n /**\n * Sort the known addresses of a peer before trying to dial\n */\n addressSorter?: AddressSorter\n\n /**\n * Number of max concurrent dials\n */\n maxParallelDials?: number\n\n /**\n * Number of max addresses to dial for a given peer\n */\n maxAddrsToDial?: number\n\n /**\n * How long a dial attempt is allowed to take, including DNS resolution\n * of the multiaddr, opening a socket and upgrading it to a Connection.\n */\n dialTimeout?: number\n\n /**\n * When a new inbound connection is opened, the upgrade process (e.g. protect,\n * encrypt, multiplex etc) must complete within this number of ms.\n */\n inboundUpgradeTimeout: number\n\n /**\n * Number of max concurrent dials per peer\n */\n maxDialsPerPeer?: number\n\n /**\n * Multiaddr resolvers to use when dialing\n */\n resolvers?: Record\n\n /**\n * On startup we try to dial any peer that has previously been\n * tagged with KEEP_ALIVE up to this timeout in ms. (default: 60000)\n */\n startupReconnectTimeout?: number\n}\n\nexport interface ConnectionManagerEvents {\n 'peer:connect': CustomEvent\n 'peer:disconnect': CustomEvent\n}\n\n/**\n * Responsible for managing known connections.\n */\nexport class DefaultConnectionManager extends EventEmitter implements ConnectionManager, Startable, Initializable {\n public readonly dialer: Dialer\n private components = new Components()\n private readonly opts: Required\n private readonly connections: Map\n private started: boolean\n private timer?: ReturnType\n private readonly latencyMonitor: LatencyMonitor\n private readonly startupReconnectTimeout: number\n private connectOnStartupController?: TimeoutController\n private readonly dialTimeout: number\n\n constructor (init: ConnectionManagerInit) {\n super()\n\n this.opts = mergeOptions.call({ ignoreUndefined: true }, defaultOptions, init)\n\n if (this.opts.maxConnections < this.opts.minConnections) {\n throw errCode(new Error('Connection Manager maxConnections must be greater than minConnections'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log('options: %o', this.opts)\n\n /**\n * Map of connections per peer\n */\n this.connections = new Map()\n\n this.started = false\n this._checkMetrics = this._checkMetrics.bind(this)\n\n this.latencyMonitor = new LatencyMonitor({\n latencyCheckIntervalMs: init.pollInterval,\n dataEmitIntervalMs: init.pollInterval\n })\n\n try {\n // This emitter gets listened to a lot\n setMaxListeners?.(Infinity, this)\n } catch {}\n\n this.dialer = new Dialer(this.opts)\n\n this.onConnect = this.onConnect.bind(this)\n this.onDisconnect = this.onDisconnect.bind(this)\n\n this.startupReconnectTimeout = init.startupReconnectTimeout ?? STARTUP_RECONNECT_TIMEOUT\n this.dialTimeout = init.dialTimeout ?? 30000\n }\n\n init (components: Components): void {\n this.components = components\n\n this.dialer.init(components)\n\n // track inbound/outbound connections\n this.components.getMetrics()?.updateComponentMetric({\n system: METRICS_SYSTEM,\n component: METRICS_COMPONENT,\n metric: 'connections',\n label: 'direction',\n value: () => {\n const metric = {\n inbound: 0,\n outbound: 0\n }\n\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n if (conn.stat.direction === 'inbound') {\n metric.inbound++\n } else {\n metric.outbound++\n }\n }\n }\n\n return metric\n }\n })\n\n // track total number of streams per protocol\n this.components.getMetrics()?.updateComponentMetric({\n system: METRICS_SYSTEM,\n component: METRICS_COMPONENT,\n metric: 'protocol-streams-total',\n label: 'protocol',\n value: () => {\n const metric: Record = {}\n\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n for (const stream of conn.streams) {\n const key = `${stream.stat.direction} ${stream.stat.protocol ?? 'unnegotiated'}`\n\n metric[key] = (metric[key] ?? 0) + 1\n }\n }\n }\n\n return metric\n }\n })\n\n // track 90th percentile of streams per protocol\n this.components.getMetrics()?.updateComponentMetric({\n system: METRICS_SYSTEM,\n component: METRICS_COMPONENT,\n metric: 'protocol-streams-per-connection-90th-percentile',\n label: 'protocol',\n value: () => {\n const allStreams: Record = {}\n\n for (const conns of this.connections.values()) {\n for (const conn of conns) {\n const streams: Record = {}\n\n for (const stream of conn.streams) {\n const key = `${stream.stat.direction} ${stream.stat.protocol ?? 'unnegotiated'}`\n\n streams[key] = (streams[key] ?? 0) + 1\n }\n\n for (const [protocol, count] of Object.entries(streams)) {\n allStreams[protocol] = allStreams[protocol] ?? []\n allStreams[protocol].push(count)\n }\n }\n }\n\n const metric: Record = {}\n\n for (let [protocol, counts] of Object.entries(allStreams)) {\n counts = counts.sort((a, b) => a - b)\n\n const index = Math.floor(counts.length * 0.9)\n metric[protocol] = counts[index]\n }\n\n return metric\n }\n })\n }\n\n isStarted () {\n return this.started\n }\n\n /**\n * Starts the Connection Manager. If Metrics are not enabled on libp2p\n * only event loop and connection limits will be monitored.\n */\n async start () {\n if (this.components.getMetrics() != null) {\n this.timer = this.timer ?? retimer(this._checkMetrics, this.opts.pollInterval)\n }\n\n // latency monitor\n this.latencyMonitor.start()\n this._onLatencyMeasure = this._onLatencyMeasure.bind(this)\n this.latencyMonitor.addEventListener('data', this._onLatencyMeasure)\n await this.dialer.start()\n\n this.started = true\n log('started')\n }\n\n async afterStart () {\n this.components.getUpgrader().addEventListener('connection', this.onConnect)\n this.components.getUpgrader().addEventListener('connectionEnd', this.onDisconnect)\n\n // re-connect to any peers with the KEEP_ALIVE tag\n void Promise.resolve()\n .then(async () => {\n const keepAlivePeers: PeerId[] = []\n\n for (const peer of await this.components.getPeerStore().all()) {\n const tags = await this.components.getPeerStore().getTags(peer.id)\n const hasKeepAlive = tags.filter(tag => tag.name === KEEP_ALIVE).length > 0\n\n if (hasKeepAlive) {\n keepAlivePeers.push(peer.id)\n }\n }\n\n this.connectOnStartupController?.clear()\n this.connectOnStartupController = new TimeoutController(this.startupReconnectTimeout)\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, this.connectOnStartupController.signal)\n } catch {}\n\n await Promise.all(\n keepAlivePeers.map(async peer => {\n await this.openConnection(peer, {\n signal: this.connectOnStartupController?.signal\n })\n .catch(err => {\n log.error(err)\n })\n })\n )\n })\n .catch(err => {\n log.error(err)\n })\n .finally(() => {\n this.connectOnStartupController?.clear()\n })\n }\n\n async beforeStop () {\n // if we are still dialing KEEP_ALIVE peers, abort those dials\n this.connectOnStartupController?.abort()\n this.components.getUpgrader().removeEventListener('connection', this.onConnect)\n this.components.getUpgrader().removeEventListener('connectionEnd', this.onDisconnect)\n }\n\n /**\n * Stops the Connection Manager\n */\n async stop () {\n this.timer?.clear()\n\n this.latencyMonitor.removeEventListener('data', this._onLatencyMeasure)\n this.latencyMonitor.stop()\n await this.dialer.stop()\n\n this.started = false\n await this._close()\n log('stopped')\n }\n\n /**\n * Cleans up the connections\n */\n async _close () {\n // Close all connections we're tracking\n const tasks: Array> = []\n for (const connectionList of this.connections.values()) {\n for (const connection of connectionList) {\n tasks.push((async () => {\n try {\n await connection.close()\n } catch (err) {\n log.error(err)\n }\n })())\n }\n }\n\n log('closing %d connections', tasks.length)\n await Promise.all(tasks)\n this.connections.clear()\n }\n\n /**\n * Checks the libp2p metrics to determine if any values have exceeded\n * the configured maximums.\n *\n * @private\n */\n async _checkMetrics () {\n const metrics = this.components.getMetrics()\n\n if (metrics != null) {\n try {\n const movingAverages = metrics.getGlobal().getMovingAverages()\n const received = movingAverages.dataReceived[this.opts.movingAverageInterval].movingAverage\n await this._checkMaxLimit('maxReceivedData', received)\n const sent = movingAverages.dataSent[this.opts.movingAverageInterval].movingAverage\n await this._checkMaxLimit('maxSentData', sent)\n const total = received + sent\n await this._checkMaxLimit('maxData', total)\n log.trace('metrics update', total)\n } finally {\n this.timer = retimer(this._checkMetrics, this.opts.pollInterval)\n }\n }\n }\n\n onConnect (evt: CustomEvent) {\n void this._onConnect(evt).catch(err => {\n log.error(err)\n })\n }\n\n /**\n * Tracks the incoming connection and check the connection limit\n */\n async _onConnect (evt: CustomEvent) {\n const { detail: connection } = evt\n\n if (!this.started) {\n // This can happen when we are in the process of shutting down the node\n await connection.close()\n return\n }\n\n const peerId = connection.remotePeer\n const peerIdStr = peerId.toString()\n const storedConns = this.connections.get(peerIdStr)\n\n if (storedConns != null) {\n storedConns.push(connection)\n } else {\n this.connections.set(peerIdStr, [connection])\n }\n\n if (peerId.publicKey != null) {\n await this.components.getPeerStore().keyBook.set(peerId, peerId.publicKey)\n }\n\n const numConnections = this.getConnections().length\n const toPrune = numConnections - this.opts.maxConnections\n\n await this._checkMaxLimit('maxConnections', numConnections, toPrune)\n this.dispatchEvent(new CustomEvent('peer:connect', { detail: connection }))\n }\n\n /**\n * Removes the connection from tracking\n */\n onDisconnect (evt: CustomEvent) {\n const { detail: connection } = evt\n\n if (!this.started) {\n // This can happen when we are in the process of shutting down the node\n return\n }\n\n const peerId = connection.remotePeer.toString()\n let storedConn = this.connections.get(peerId)\n\n if (storedConn != null && storedConn.length > 1) {\n storedConn = storedConn.filter((conn) => conn.id !== connection.id)\n this.connections.set(peerId, storedConn)\n } else if (storedConn != null) {\n this.connections.delete(peerId)\n this.dispatchEvent(new CustomEvent('peer:disconnect', { detail: connection }))\n\n this.components.getMetrics()?.onPeerDisconnected(connection.remotePeer)\n }\n }\n\n getConnections (peerId?: PeerId): Connection[] {\n if (peerId != null) {\n return this.connections.get(peerId.toString()) ?? []\n }\n\n let conns: Connection[] = []\n\n for (const c of this.connections.values()) {\n conns = conns.concat(c)\n }\n\n return conns\n }\n\n async openConnection (peerId: PeerId, options: AbortOptions = {}): Promise {\n log('dial to %p', peerId)\n const existingConnections = this.getConnections(peerId)\n\n if (existingConnections.length > 0) {\n log('had an existing connection to %p', peerId)\n\n return existingConnections[0]\n }\n\n let timeoutController: TimeoutController | undefined\n\n if (options?.signal == null) {\n timeoutController = new TimeoutController(this.dialTimeout)\n options.signal = timeoutController.signal\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n }\n\n try {\n const connection = await this.dialer.dial(peerId, options)\n let peerConnections = this.connections.get(peerId.toString())\n\n if (peerConnections == null) {\n peerConnections = []\n this.connections.set(peerId.toString(), peerConnections)\n }\n\n // we get notified of connections via the Upgrader emitting \"connection\"\n // events, double check we aren't already tracking this connection before\n // storing it\n let trackedConnection = false\n\n for (const conn of peerConnections) {\n if (conn.id === connection.id) {\n trackedConnection = true\n }\n }\n\n if (!trackedConnection) {\n peerConnections.push(connection)\n }\n\n return connection\n } finally {\n if (timeoutController != null) {\n timeoutController.clear()\n }\n }\n }\n\n async closeConnections (peerId: PeerId): Promise {\n const connections = this.connections.get(peerId.toString()) ?? []\n\n await Promise.all(\n connections.map(async connection => {\n return await connection.close()\n })\n )\n }\n\n /**\n * Get all open connections with a peer\n */\n getAll (peerId: PeerId): Connection[] {\n if (!isPeerId(peerId)) {\n throw errCode(new Error('peerId must be an instance of peer-id'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const id = peerId.toString()\n const connections = this.connections.get(id)\n\n // Return all open connections\n if (connections != null) {\n return connections.filter(connection => connection.stat.status === STATUS.OPEN)\n }\n\n return []\n }\n\n /**\n * If the event loop is slow, maybe close a connection\n */\n _onLatencyMeasure (evt: CustomEvent) {\n const { detail: summary } = evt\n\n this._checkMaxLimit('maxEventLoopDelay', summary.avgMs, 1)\n .catch(err => {\n log.error(err)\n })\n }\n\n /**\n * If the `value` of `name` has exceeded its limit, maybe close a connection\n */\n async _checkMaxLimit (name: keyof ConnectionManagerInit, value: number, toPrune: number = 1) {\n const limit = this.opts[name]\n log.trace('checking limit of %s. current value: %d of %d', name, value, limit)\n if (value > limit) {\n log('%s: limit exceeded: %p, %d/%d, pruning %d connection(s)', this.components.getPeerId(), name, value, limit, toPrune)\n await this._maybePruneConnections(toPrune)\n }\n }\n\n /**\n * If we have more connections than our maximum, select some excess connections\n * to prune based on peer value\n */\n async _maybePruneConnections (toPrune: number) {\n const connections = this.getConnections()\n\n if (connections.length <= this.opts.minConnections || toPrune < 1) {\n return\n }\n\n const peerValues = new PeerMap()\n\n // work out peer values\n for (const connection of connections) {\n const remotePeer = connection.remotePeer\n\n if (peerValues.has(remotePeer)) {\n continue\n }\n\n const tags = await this.components.getPeerStore().getTags(remotePeer)\n\n // sum all tag values\n peerValues.set(remotePeer, tags.reduce((acc, curr) => {\n return acc + curr.value\n }, 0))\n }\n\n // sort by value, lowest to highest\n const sortedConnections = connections.sort((a, b) => {\n const peerAValue = peerValues.get(a.remotePeer) ?? 0\n const peerBValue = peerValues.get(b.remotePeer) ?? 0\n\n if (peerAValue > peerBValue) {\n return 1\n }\n\n if (peerAValue < peerBValue) {\n return -1\n }\n\n return 0\n })\n\n // close some connections\n const toClose = []\n\n for (const connection of sortedConnections) {\n log('too many connections open - closing a connection to %p', connection.remotePeer)\n toClose.push(connection)\n\n if (toClose.length === toPrune) {\n break\n }\n }\n\n // close connections\n await Promise.all(\n toClose.map(async connection => {\n try {\n await connection.close()\n } catch (err) {\n log.error(err)\n }\n\n // TODO: should not need to invoke this manually\n this.onDisconnect(new CustomEvent('connectionEnd', {\n detail: connection\n }))\n })\n )\n }\n}\n","import { logger } from '@libp2p/logger'\nimport mergeOptions from 'merge-options'\n// @ts-expect-error retimer does not have types\nimport retimer from 'retimer'\nimport all from 'it-all'\nimport { pipe } from 'it-pipe'\nimport filter from 'it-filter'\nimport sort from 'it-sort'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { Components } from '@libp2p/components'\n\nconst log = logger('libp2p:connection-manager:auto-dialler')\n\nexport interface AutoDiallerInit {\n /**\n * Should preemptively guarantee connections are above the low watermark\n */\n enabled?: boolean\n\n /**\n * The minimum number of connections to avoid pruning\n */\n minConnections?: number\n\n /**\n * How often, in milliseconds, it should preemptively guarantee connections are above the low watermark\n */\n autoDialInterval?: number\n}\n\nconst defaultOptions: Partial = {\n enabled: true,\n minConnections: 0,\n autoDialInterval: 10000\n}\n\nexport class AutoDialler implements Startable {\n private readonly components: Components\n private readonly options: Required\n private running: boolean\n private autoDialTimeout?: ReturnType\n\n /**\n * Proactively tries to connect to known peers stored in the PeerStore.\n * It will keep the number of connections below the upper limit and sort\n * the peers to connect based on wether we know their keys and protocols.\n */\n constructor (components: Components, init: AutoDiallerInit) {\n this.components = components\n this.options = mergeOptions.call({ ignoreUndefined: true }, defaultOptions, init)\n this.running = false\n this._autoDial = this._autoDial.bind(this)\n\n log('options: %j', this.options)\n }\n\n isStarted () {\n return this.running\n }\n\n /**\n * Starts the auto dialer\n */\n async start () {\n if (!this.options.enabled) {\n log('not enabled')\n return\n }\n\n this.running = true\n\n void this._autoDial().catch(err => {\n log.error('could start autodial', err)\n })\n\n log('started')\n }\n\n /**\n * Stops the auto dialler\n */\n async stop () {\n if (!this.options.enabled) {\n log('not enabled')\n return\n }\n\n this.running = false\n\n if (this.autoDialTimeout != null) {\n this.autoDialTimeout.clear()\n }\n\n log('stopped')\n }\n\n async _autoDial () {\n if (this.autoDialTimeout != null) {\n this.autoDialTimeout.clear()\n }\n\n const minConnections = this.options.minConnections\n\n // Already has enough connections\n if (this.components.getConnectionManager().getConnections().length >= minConnections) {\n this.autoDialTimeout = retimer(this._autoDial, this.options.autoDialInterval)\n\n return\n }\n\n // Sort peers on whether we know protocols or public keys for them\n const allPeers = await this.components.getPeerStore().all()\n\n const peers = await pipe(\n // shuffle the peers\n allPeers.sort(() => Math.random() > 0.5 ? 1 : -1),\n (source) => filter(source, (peer) => !peer.id.equals(this.components.getPeerId())),\n (source) => sort(source, (a, b) => {\n if (b.protocols.length > a.protocols.length) {\n return 1\n } else if (b.id.publicKey != null && a.id.publicKey == null) {\n return 1\n }\n return -1\n }),\n async (source) => await all(source)\n )\n\n for (let i = 0; this.running && i < peers.length && this.components.getConnectionManager().getConnections().length < minConnections; i++) {\n // Connection Manager was stopped during async dial\n if (!this.running) {\n return\n }\n\n const peer = peers[i]\n\n if (this.components.getConnectionManager().getConnections(peer.id).length === 0) {\n log('connecting to a peerStore stored peer %p', peer.id)\n try {\n await this.components.getConnectionManager().openConnection(peer.id)\n } catch (err: any) {\n log.error('could not connect to peerStore stored peer', err)\n }\n }\n }\n\n // Connection Manager was stopped\n if (!this.running) {\n return\n }\n\n this.autoDialTimeout = retimer(this._autoDial, this.options.autoDialInterval)\n }\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface CircuitRelay {\n type?: CircuitRelay.Type\n srcPeer?: CircuitRelay.Peer\n dstPeer?: CircuitRelay.Peer\n code?: CircuitRelay.Status\n}\n\nexport namespace CircuitRelay {\n export enum Status {\n SUCCESS = 'SUCCESS',\n HOP_SRC_ADDR_TOO_LONG = 'HOP_SRC_ADDR_TOO_LONG',\n HOP_DST_ADDR_TOO_LONG = 'HOP_DST_ADDR_TOO_LONG',\n HOP_SRC_MULTIADDR_INVALID = 'HOP_SRC_MULTIADDR_INVALID',\n HOP_DST_MULTIADDR_INVALID = 'HOP_DST_MULTIADDR_INVALID',\n HOP_NO_CONN_TO_DST = 'HOP_NO_CONN_TO_DST',\n HOP_CANT_DIAL_DST = 'HOP_CANT_DIAL_DST',\n HOP_CANT_OPEN_DST_STREAM = 'HOP_CANT_OPEN_DST_STREAM',\n HOP_CANT_SPEAK_RELAY = 'HOP_CANT_SPEAK_RELAY',\n HOP_CANT_RELAY_TO_SELF = 'HOP_CANT_RELAY_TO_SELF',\n STOP_SRC_ADDR_TOO_LONG = 'STOP_SRC_ADDR_TOO_LONG',\n STOP_DST_ADDR_TOO_LONG = 'STOP_DST_ADDR_TOO_LONG',\n STOP_SRC_MULTIADDR_INVALID = 'STOP_SRC_MULTIADDR_INVALID',\n STOP_DST_MULTIADDR_INVALID = 'STOP_DST_MULTIADDR_INVALID',\n STOP_RELAY_REFUSED = 'STOP_RELAY_REFUSED',\n MALFORMED_MESSAGE = 'MALFORMED_MESSAGE'\n }\n\n enum __StatusValues {\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 export namespace Status {\n export const codec = () => {\n return enumeration(__StatusValues)\n }\n }\n\n export enum Type {\n HOP = 'HOP',\n STOP = 'STOP',\n STATUS = 'STATUS',\n CAN_HOP = 'CAN_HOP'\n }\n\n enum __TypeValues {\n HOP = 1,\n STOP = 2,\n STATUS = 3,\n CAN_HOP = 4\n }\n\n export namespace Type {\n export const codec = () => {\n return enumeration(__TypeValues)\n }\n }\n\n export interface Peer {\n id: Uint8Array\n addrs: Uint8Array[]\n }\n\n export namespace Peer {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.id != null) {\n writer.uint32(10)\n writer.bytes(obj.id)\n } else {\n throw new Error('Protocol error: required field \"id\" was not found in object')\n }\n\n if (obj.addrs != null) {\n for (const value of obj.addrs) {\n writer.uint32(18)\n writer.bytes(value)\n }\n } else {\n throw new Error('Protocol error: required field \"addrs\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {}\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.id = reader.bytes()\n break\n case 2:\n obj.addrs = obj.addrs ?? []\n obj.addrs.push(reader.bytes())\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n obj.addrs = obj.addrs ?? []\n\n if (obj.id == null) {\n throw new Error('Protocol error: value for required field \"id\" was not found in protobuf')\n }\n\n if (obj.addrs == null) {\n throw new Error('Protocol error: value for required field \"addrs\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Peer): Uint8Array => {\n return encodeMessage(obj, Peer.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Peer => {\n return decodeMessage(buf, Peer.codec())\n }\n }\n\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.type != null) {\n writer.uint32(8)\n CircuitRelay.Type.codec().encode(obj.type, writer)\n }\n\n if (obj.srcPeer != null) {\n writer.uint32(18)\n CircuitRelay.Peer.codec().encode(obj.srcPeer, writer)\n }\n\n if (obj.dstPeer != null) {\n writer.uint32(26)\n CircuitRelay.Peer.codec().encode(obj.dstPeer, writer)\n }\n\n if (obj.code != null) {\n writer.uint32(32)\n CircuitRelay.Status.codec().encode(obj.code, writer)\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {}\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.type = CircuitRelay.Type.codec().decode(reader)\n break\n case 2:\n obj.srcPeer = CircuitRelay.Peer.codec().decode(reader, reader.uint32())\n break\n case 3:\n obj.dstPeer = CircuitRelay.Peer.codec().decode(reader, reader.uint32())\n break\n case 4:\n obj.code = CircuitRelay.Status.codec().decode(reader)\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: CircuitRelay): Uint8Array => {\n return encodeMessage(obj, CircuitRelay.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): CircuitRelay => {\n return decodeMessage(buf, CircuitRelay.codec())\n }\n}\n","import { abortableSource } from 'abortable-iterator'\nimport { logger } from '@libp2p/logger'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { MultiaddrConnection } from '@libp2p/interface-connection'\nimport type { Duplex } from 'it-stream-types'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nconst log = logger('libp2p:stream:converter')\n\nexport interface Timeline {\n /**\n * Connection opening timestamp\n */\n open: number\n\n /**\n * Connection upgraded timestamp\n */\n upgraded?: number\n\n /**\n * Connection closed timestamp\n */\n close?: number\n}\n\ninterface StreamOptions {\n signal?: AbortSignal\n\n}\n\ninterface StreamProperties {\n stream: Duplex\n remoteAddr: Multiaddr\n localAddr: Multiaddr\n}\n\n/**\n * Convert a duplex iterable into a MultiaddrConnection.\n * https://github.com/libp2p/interface-transport#multiaddrconnection\n */\nexport function streamToMaConnection (props: StreamProperties, options: StreamOptions = {}) {\n const { stream, remoteAddr } = props\n const { sink, source } = stream\n\n const mapSource = (async function * () {\n for await (const list of source) {\n yield * list\n }\n }())\n\n const maConn: MultiaddrConnection = {\n async sink (source) {\n if (options.signal != null) {\n source = abortableSource(source, options.signal)\n }\n\n try {\n await sink(source)\n await close()\n } catch (err: any) {\n // If aborted we can safely ignore\n if (err.type !== 'aborted') {\n // If the source errored the socket will already have been destroyed by\n // toIterable.duplex(). If the socket errored it will already be\n // destroyed. There's nothing to do here except log the error & return.\n log(err)\n }\n }\n },\n source: (options.signal != null) ? abortableSource(mapSource, options.signal) : mapSource,\n remoteAddr,\n /** @type {Timeline} */\n timeline: { open: Date.now(), close: undefined },\n async close () {\n await sink(async function * () {\n yield new Uint8Array(0)\n }())\n await close()\n }\n }\n\n async function close () {\n if (maConn.timeline.close == null) {\n maConn.timeline.close = Date.now()\n }\n return await Promise.resolve()\n }\n\n return maConn\n}\n","\nexport const RELAY_CODEC = '/libp2p/circuit/relay/0.1.0'\n","import { Multiaddr } from '@multiformats/multiaddr'\nimport { CircuitRelay } from '../pb/index.js'\nimport type { StreamHandler } from './stream-handler.js'\n\n/**\n * Write a response\n */\nfunction writeResponse (streamHandler: StreamHandler, status: CircuitRelay.Status) {\n streamHandler.write({\n type: CircuitRelay.Type.STATUS,\n code: status\n })\n}\n\n/**\n * Validate incomming HOP/STOP message\n */\nexport function validateAddrs (msg: CircuitRelay, streamHandler: StreamHandler) {\n try {\n if (msg.dstPeer?.addrs != null) {\n msg.dstPeer.addrs.forEach((addr) => {\n return new Multiaddr(addr)\n })\n }\n } catch (err: any) {\n writeResponse(streamHandler, msg.type === CircuitRelay.Type.HOP\n ? CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID\n : CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID)\n throw err\n }\n\n try {\n if (msg.srcPeer?.addrs != null) {\n msg.srcPeer.addrs.forEach((addr) => {\n return new Multiaddr(addr)\n })\n }\n } catch (err: any) {\n writeResponse(streamHandler, msg.type === CircuitRelay.Type.HOP\n ? CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID\n : CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID)\n throw err\n }\n}\n","import { logger } from '@libp2p/logger'\nimport * as lp from 'it-length-prefixed'\nimport { Handshake, handshake } from 'it-handshake'\nimport { CircuitRelay } from '../pb/index.js'\nimport type { Stream } from '@libp2p/interface-connection'\nimport type { Source } from 'it-stream-types'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nconst log = logger('libp2p:circuit:stream-handler')\n\nexport interface StreamHandlerOptions {\n /**\n * A duplex iterable\n */\n stream: Stream\n\n /**\n * max bytes length of message\n */\n maxLength?: number\n}\n\nexport class StreamHandler {\n private readonly stream: Stream\n private readonly shake: Handshake\n private readonly decoder: Source\n\n constructor (options: StreamHandlerOptions) {\n const { stream, maxLength = 4096 } = options\n\n this.stream = stream\n this.shake = handshake(this.stream)\n this.decoder = lp.decode.fromReader(this.shake.reader, { maxDataLength: maxLength })\n }\n\n /**\n * Read and decode message\n */\n async read () {\n // @ts-expect-error FIXME is a source, needs to be a generator\n const msg = await this.decoder.next()\n\n if (msg.value != null) {\n const value = CircuitRelay.decode(msg.value)\n log('read message type', value.type)\n return value\n }\n\n log('read received no value, closing stream')\n // End the stream, we didn't get data\n this.close()\n }\n\n /**\n * Encode and write array of buffers\n */\n write (msg: CircuitRelay) {\n log('write message type %s', msg.type)\n this.shake.write(lp.encode.single(CircuitRelay.encode(msg)))\n }\n\n /**\n * Return the handshake rest stream and invalidate handler\n */\n rest () {\n this.shake.rest()\n return this.shake.stream\n }\n\n /**\n * @param {CircuitRelay} msg - An unencoded CircuitRelay protobuf message\n */\n end (msg: CircuitRelay) {\n this.write(msg)\n this.close()\n }\n\n /**\n * Close the stream\n */\n close () {\n log('closing the stream')\n void this.rest().sink([]).catch(err => {\n log.error(err)\n })\n }\n}\n","import { logger } from '@libp2p/logger'\nimport { CircuitRelay as CircuitPB } from '../pb/index.js'\nimport { RELAY_CODEC } from '../multicodec.js'\nimport { StreamHandler } from './stream-handler.js'\nimport { validateAddrs } from './utils.js'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { Duplex } from 'it-stream-types'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nconst log = logger('libp2p:circuit:stop')\n\nexport interface HandleStopOptions {\n connection: Connection\n request: CircuitPB\n streamHandler: StreamHandler\n}\n\n/**\n * Handles incoming STOP requests\n */\nexport function handleStop (options: HandleStopOptions): Duplex | undefined {\n const {\n connection,\n request,\n streamHandler\n } = options\n\n // Validate the STOP request has the required input\n try {\n validateAddrs(request, streamHandler)\n } catch (err: any) {\n log.error('invalid stop request via peer %p %o', connection.remotePeer, err)\n return\n }\n\n // The request is valid\n log('stop request is valid')\n streamHandler.write({\n type: CircuitPB.Type.STATUS,\n code: CircuitPB.Status.SUCCESS\n })\n\n return streamHandler.rest()\n}\n\nexport interface StopOptions extends AbortOptions {\n connection: Connection\n request: CircuitPB\n}\n\n/**\n * Creates a STOP request\n */\nexport async function stop (options: StopOptions) {\n const {\n connection,\n request,\n signal\n } = options\n\n const stream = await connection.newStream(RELAY_CODEC, {\n signal\n })\n log('starting stop request to %p', connection.remotePeer)\n const streamHandler = new StreamHandler({ stream })\n\n streamHandler.write(request)\n const response = await streamHandler.read()\n\n if (response == null) {\n streamHandler.close()\n return\n }\n\n if (response.code === CircuitPB.Status.SUCCESS) {\n log('stop request to %p was successful', connection.remotePeer)\n return streamHandler.rest()\n }\n\n log('stop request failed with code %d', response.code)\n streamHandler.close()\n}\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport { validateAddrs } from './utils.js'\nimport { StreamHandler } from './stream-handler.js'\nimport { CircuitRelay as CircuitPB } from '../pb/index.js'\nimport { pipe } from 'it-pipe'\nimport { codes as Errors } from '../../errors.js'\nimport { stop } from './stop.js'\nimport { RELAY_CODEC } from '../multicodec.js'\nimport type { Connection } from '@libp2p/interface-connection'\nimport { peerIdFromBytes } from '@libp2p/peer-id'\nimport type { Duplex } from 'it-stream-types'\nimport type { Circuit } from '../transport.js'\nimport type { ConnectionManager } from '@libp2p/interface-connection-manager'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nconst log = logger('libp2p:circuit:hop')\n\nexport interface HopRequest {\n connection: Connection\n request: CircuitPB\n streamHandler: StreamHandler\n circuit: Circuit\n connectionManager: ConnectionManager\n}\n\nexport async function handleHop (hopRequest: HopRequest): Promise {\n const {\n connection,\n request,\n streamHandler,\n circuit,\n connectionManager\n } = hopRequest\n\n // Ensure hop is enabled\n if (!circuit.hopEnabled()) {\n log('HOP request received but we are not acting as a relay')\n return streamHandler.end({\n type: CircuitPB.Type.STATUS,\n code: CircuitPB.Status.HOP_CANT_SPEAK_RELAY\n })\n }\n\n // Validate the HOP request has the required input\n try {\n validateAddrs(request, streamHandler)\n } catch (err: any) {\n log.error('invalid hop request via peer %p %o', connection.remotePeer, err)\n\n return\n }\n\n if (request.dstPeer == null) {\n log('HOP request received but we do not receive a dstPeer')\n return\n }\n\n // Get the connection to the destination (stop) peer\n const destinationPeer = peerIdFromBytes(request.dstPeer.id)\n\n const destinationConnections = connectionManager.getConnections(destinationPeer)\n if (destinationConnections.length === 0 && !circuit.hopActive()) {\n log('HOP request received but we are not connected to the destination peer')\n return streamHandler.end({\n type: CircuitPB.Type.STATUS,\n code: CircuitPB.Status.HOP_NO_CONN_TO_DST\n })\n }\n\n // TODO: Handle being an active relay\n if (destinationConnections.length === 0) {\n log('did not have connection to remote peer')\n return streamHandler.end({\n type: CircuitPB.Type.STATUS,\n code: CircuitPB.Status.HOP_NO_CONN_TO_DST\n })\n }\n\n // Handle the incoming HOP request by performing a STOP request\n const stopRequest = {\n type: CircuitPB.Type.STOP,\n dstPeer: request.dstPeer,\n srcPeer: request.srcPeer\n }\n\n let destinationStream: Duplex\n try {\n log('performing STOP request')\n const result = await stop({\n connection: destinationConnections[0],\n request: stopRequest\n })\n\n if (result == null) {\n throw new Error('Could not stop')\n }\n\n destinationStream = result\n } catch (err: any) {\n log.error(err)\n\n return\n }\n\n log('hop request from %p is valid', connection.remotePeer)\n streamHandler.write({\n type: CircuitPB.Type.STATUS,\n code: CircuitPB.Status.SUCCESS\n })\n const sourceStream = streamHandler.rest()\n\n log('creating related connections')\n // Short circuit the two streams to create the relayed connection\n return await pipe(\n sourceStream,\n destinationStream,\n sourceStream\n )\n}\n\nexport interface HopConfig extends AbortOptions {\n connection: Connection\n request: CircuitPB\n}\n\n/**\n * Performs a HOP request to a relay peer, to request a connection to another\n * peer. A new, virtual, connection will be created between the two via the relay.\n */\nexport async function hop (options: HopConfig): Promise> {\n const {\n connection,\n request,\n signal\n } = options\n\n // Create a new stream to the relay\n const stream = await connection.newStream(RELAY_CODEC, {\n signal\n })\n // Send the HOP request\n const streamHandler = new StreamHandler({ stream })\n streamHandler.write(request)\n\n const response = await streamHandler.read()\n\n if (response == null) {\n throw errCode(new Error('HOP request had no response'), Errors.ERR_HOP_REQUEST_FAILED)\n }\n\n if (response.code === CircuitPB.Status.SUCCESS) {\n log('hop request was successful')\n\n return streamHandler.rest()\n }\n\n log('hop request failed with code %d, closing stream', response.code)\n streamHandler.close()\n\n throw errCode(new Error(`HOP request failed with code \"${response.code ?? 'unknown'}\"`), Errors.ERR_HOP_REQUEST_FAILED)\n}\n\nexport interface CanHopOptions extends AbortOptions {\n connection: Connection\n}\n\n/**\n * Performs a CAN_HOP request to a relay peer, in order to understand its capabilities\n */\nexport async function canHop (options: CanHopOptions) {\n const {\n connection,\n signal\n } = options\n\n // Create a new stream to the relay\n const stream = await connection.newStream(RELAY_CODEC, {\n signal\n })\n\n // Send the HOP request\n const streamHandler = new StreamHandler({ stream })\n streamHandler.write({\n type: CircuitPB.Type.CAN_HOP\n })\n\n const response = await streamHandler.read()\n await streamHandler.close()\n\n if (response == null || response.code !== CircuitPB.Status.SUCCESS) {\n return false\n }\n\n return true\n}\n\nexport interface HandleCanHopOptions {\n connection: Connection\n streamHandler: StreamHandler\n circuit: Circuit\n}\n\n/**\n * Creates an unencoded CAN_HOP response based on the Circuits configuration\n */\nexport function handleCanHop (options: HandleCanHopOptions) {\n const {\n connection,\n streamHandler,\n circuit\n } = options\n const canHop = circuit.hopEnabled()\n log('can hop (%s) request from %p', canHop, connection.remotePeer)\n streamHandler.end({\n type: CircuitPB.Type.STATUS,\n code: canHop ? CircuitPB.Status.SUCCESS : CircuitPB.Status.HOP_CANT_SPEAK_RELAY\n })\n}\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport * as mafmt from '@multiformats/mafmt'\nimport { Multiaddr } from '@multiformats/multiaddr'\nimport { CircuitRelay as CircuitPB } from './pb/index.js'\nimport { codes } from '../errors.js'\nimport { streamToMaConnection } from '@libp2p/utils/stream-to-ma-conn'\nimport { RELAY_CODEC } from './multicodec.js'\nimport { createListener } from './listener.js'\nimport { handleCanHop, handleHop, hop } from './circuit/hop.js'\nimport { handleStop } from './circuit/stop.js'\nimport { StreamHandler } from './circuit/stream-handler.js'\nimport { symbol } from '@libp2p/interface-transport'\nimport { peerIdFromString } from '@libp2p/peer-id'\nimport { Components, Initializable } from '@libp2p/components'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { IncomingStreamData } from '@libp2p/interface-registrar'\nimport type { Listener, Transport, CreateListenerOptions, ConnectionHandler } from '@libp2p/interface-transport'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { RelayConfig } from '../index.js'\nimport { abortableDuplex } from 'abortable-iterator'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport { setMaxListeners } from 'events'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Duplex } from 'it-stream-types'\n\nconst log = logger('libp2p:circuit')\n\nexport class Circuit implements Transport, Initializable {\n private handler?: ConnectionHandler\n private components: Components = new Components()\n private readonly _init: RelayConfig\n\n constructor (init: RelayConfig) {\n this._init = init\n }\n\n init (components: Components): void {\n this.components = components\n void this.components.getRegistrar().handle(RELAY_CODEC, (data) => {\n void this._onProtocol(data).catch(err => {\n log.error(err)\n })\n })\n .catch(err => {\n log.error(err)\n })\n }\n\n hopEnabled () {\n return true\n }\n\n hopActive () {\n return true\n }\n\n get [symbol] (): true {\n return true\n }\n\n get [Symbol.toStringTag] () {\n return 'libp2p/circuit-relay-v1'\n }\n\n async _onProtocol (data: IncomingStreamData) {\n const { connection, stream } = data\n const controller = new TimeoutController(this._init.hop.timeout)\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, controller.signal)\n } catch {}\n\n try {\n const source = abortableDuplex(stream, controller.signal)\n const streamHandler = new StreamHandler({\n stream: {\n ...stream,\n ...source\n }\n })\n const request = await streamHandler.read()\n\n if (request == null) {\n log('request was invalid, could not read from stream')\n streamHandler.write({\n type: CircuitPB.Type.STATUS,\n code: CircuitPB.Status.MALFORMED_MESSAGE\n })\n streamHandler.close()\n return\n }\n\n let virtualConnection: Duplex | undefined\n\n switch (request.type) {\n case CircuitPB.Type.CAN_HOP: {\n log('received CAN_HOP request from %p', connection.remotePeer)\n await handleCanHop({ circuit: this, connection, streamHandler })\n break\n }\n case CircuitPB.Type.HOP: {\n log('received HOP request from %p', connection.remotePeer)\n await handleHop({\n connection,\n request,\n streamHandler,\n circuit: this,\n connectionManager: this.components.getConnectionManager()\n })\n break\n }\n case CircuitPB.Type.STOP: {\n log('received STOP request from %p', connection.remotePeer)\n virtualConnection = await handleStop({\n connection,\n request,\n streamHandler\n })\n break\n }\n default: {\n log('Request of type %s not supported', request.type)\n streamHandler.write({\n type: CircuitPB.Type.STATUS,\n code: CircuitPB.Status.MALFORMED_MESSAGE\n })\n streamHandler.close()\n return\n }\n }\n\n if (virtualConnection != null) {\n const remoteAddr = connection.remoteAddr\n .encapsulate('/p2p-circuit')\n .encapsulate(new Multiaddr(request.dstPeer?.addrs[0]))\n const localAddr = new Multiaddr(request.srcPeer?.addrs[0])\n const maConn = streamToMaConnection({\n stream: virtualConnection,\n remoteAddr,\n localAddr\n })\n const type = request.type === CircuitPB.Type.HOP ? 'relay' : 'inbound'\n log('new %s connection %s', type, maConn.remoteAddr)\n\n const conn = await this.components.getUpgrader().upgradeInbound(maConn)\n log('%s connection %s upgraded', type, maConn.remoteAddr)\n\n if (this.handler != null) {\n this.handler(conn)\n }\n }\n } finally {\n controller.clear()\n }\n }\n\n /**\n * Dial a peer over a relay\n */\n async dial (ma: Multiaddr, options: AbortOptions = {}): Promise {\n // Check the multiaddr to see if it contains a relay and a destination peer\n const addrs = ma.toString().split('/p2p-circuit')\n const relayAddr = new Multiaddr(addrs[0])\n const destinationAddr = new Multiaddr(addrs[addrs.length - 1])\n const relayId = relayAddr.getPeerId()\n const destinationId = destinationAddr.getPeerId()\n\n if (relayId == null || destinationId == null) {\n const errMsg = 'Circuit relay dial failed as addresses did not have peer id'\n log.error(errMsg)\n throw errCode(new Error(errMsg), codes.ERR_RELAYED_DIAL)\n }\n\n const relayPeer = peerIdFromString(relayId)\n const destinationPeer = peerIdFromString(destinationId)\n\n let disconnectOnFailure = false\n const relayConnections = this.components.getConnectionManager().getConnections(relayPeer)\n let relayConnection = relayConnections[0]\n\n if (relayConnection == null) {\n await this.components.getPeerStore().addressBook.add(relayPeer, [relayAddr])\n relayConnection = await this.components.getConnectionManager().openConnection(relayPeer, options)\n disconnectOnFailure = true\n }\n\n try {\n const virtualConnection = await hop({\n ...options,\n connection: relayConnection,\n request: {\n type: CircuitPB.Type.HOP,\n srcPeer: {\n id: this.components.getPeerId().toBytes(),\n addrs: this.components.getAddressManager().getAddresses().map(addr => addr.bytes)\n },\n dstPeer: {\n id: destinationPeer.toBytes(),\n addrs: [new Multiaddr(destinationAddr).bytes]\n }\n }\n })\n\n const localAddr = relayAddr.encapsulate(`/p2p-circuit/p2p/${this.components.getPeerId().toString()}`)\n const maConn = streamToMaConnection({\n stream: virtualConnection,\n remoteAddr: ma,\n localAddr\n })\n log('new outbound connection %s', maConn.remoteAddr)\n\n return await this.components.getUpgrader().upgradeOutbound(maConn)\n } catch (err: any) {\n log.error('Circuit relay dial failed', err)\n disconnectOnFailure && await relayConnection.close()\n throw err\n }\n }\n\n /**\n * Create a listener\n */\n createListener (options: CreateListenerOptions): Listener {\n // Called on successful HOP and STOP requests\n this.handler = options.handler\n\n return createListener({\n connectionManager: this.components.getConnectionManager(),\n peerStore: this.components.getPeerStore()\n })\n }\n\n /**\n * Filter check for all Multiaddrs that this transport can dial on\n *\n * @param {Multiaddr[]} multiaddrs\n * @returns {Multiaddr[]}\n */\n filter (multiaddrs: Multiaddr[]): Multiaddr[] {\n multiaddrs = Array.isArray(multiaddrs) ? multiaddrs : [multiaddrs]\n\n return multiaddrs.filter((ma) => {\n return mafmt.Circuit.matches(ma)\n })\n }\n}\n","import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport type { ConnectionManager } from '@libp2p/interface-connection-manager'\nimport type { PeerStore } from '@libp2p/interface-peer-store'\nimport type { Listener } from '@libp2p/interface-transport'\nimport { peerIdFromString } from '@libp2p/peer-id'\nimport { Multiaddr } from '@multiformats/multiaddr'\n\nexport interface ListenerOptions {\n peerStore: PeerStore\n connectionManager: ConnectionManager\n}\n\nexport function createListener (options: ListenerOptions): Listener {\n const listeningAddrs = new Map()\n\n /**\n * Add swarm handler and listen for incoming connections\n */\n async function listen (addr: Multiaddr): Promise {\n const addrString = addr.toString().split('/p2p-circuit').find(a => a !== '')\n const ma = new Multiaddr(addrString)\n\n const relayPeerStr = ma.getPeerId()\n\n if (relayPeerStr == null) {\n throw new Error('Could not determine relay peer from multiaddr')\n }\n\n const relayPeerId = peerIdFromString(relayPeerStr)\n\n await options.peerStore.addressBook.add(relayPeerId, [ma])\n\n const relayConn = await options.connectionManager.openConnection(relayPeerId)\n const relayedAddr = relayConn.remoteAddr.encapsulate('/p2p-circuit')\n\n listeningAddrs.set(relayConn.remotePeer.toString(), relayedAddr)\n listener.dispatchEvent(new CustomEvent('listening'))\n }\n\n /**\n * Get fixed up multiaddrs\n *\n * NOTE: This method will grab the peers multiaddrs and expand them such that:\n *\n * a) If it's an existing /p2p-circuit address for a specific relay i.e.\n * `/ip4/0.0.0.0/tcp/0/ipfs/QmRelay/p2p-circuit` this method will expand the\n * address to `/ip4/0.0.0.0/tcp/0/ipfs/QmRelay/p2p-circuit/ipfs/QmPeer` where\n * `QmPeer` is this peers id\n * b) If it's not a /p2p-circuit address, it will encapsulate the address as a /p2p-circuit\n * addr, such when dialing over a relay with this address, it will create the circuit using\n * the encapsulated transport address. This is useful when for example, a peer should only\n * be dialed over TCP rather than any other transport\n *\n * @returns {Multiaddr[]}\n */\n function getAddrs () {\n const addrs = []\n for (const addr of listeningAddrs.values()) {\n addrs.push(addr)\n }\n return addrs\n }\n\n const listener: Listener = Object.assign(new EventEmitter(), {\n close: async () => await Promise.resolve(),\n listen,\n getAddrs\n })\n\n // Remove listeningAddrs when a peer disconnects\n options.connectionManager.addEventListener('peer:disconnect', (evt) => {\n const { detail: connection } = evt\n const deleted = listeningAddrs.delete(connection.remotePeer.toString())\n\n if (deleted) {\n // Announce listen addresses change\n listener.dispatchEvent(new CustomEvent('close'))\n }\n })\n\n return listener\n}\n","import { CID } from 'multiformats/cid'\nimport { sha256 } from 'multiformats/hashes/sha2'\n\n/**\n * Convert a namespace string into a cid\n */\nexport async function namespaceToCid (namespace: string): Promise {\n const bytes = new TextEncoder().encode(namespace)\n const hash = await sha256.digest(bytes)\n\n return CID.createV0(hash)\n}\n","const minute = 60 * 1000\n\n/**\n * Delay before HOP relay service is advertised on the network\n */\nexport const ADVERTISE_BOOT_DELAY = 15 * minute\n\n/**\n * Delay Between HOP relay service advertisements on the network\n */\nexport const ADVERTISE_TTL = 30 * minute\n\n/**\n * Multicodec code\n */\nexport const CIRCUIT_PROTO_CODE = 290\n\n/**\n * PeerStore metadaBook key for HOP relay service\n */\nexport const HOP_METADATA_KEY = 'hop_relay'\n\n/**\n * PeerStore metadaBook value for HOP relay service\n */\nexport const HOP_METADATA_VALUE = 'true'\n\n/**\n * Relay HOP relay service namespace for discovery\n */\nexport const RELAY_RENDEZVOUS_NS = '/libp2p/relay'\n","import { logger } from '@libp2p/logger'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { toString as uint8ArrayToString } from 'uint8arrays/to-string'\nimport { RELAY_CODEC } from './multicodec.js'\nimport { canHop } from './circuit/hop.js'\nimport { namespaceToCid } from './utils.js'\nimport {\n CIRCUIT_PROTO_CODE,\n HOP_METADATA_KEY,\n HOP_METADATA_VALUE,\n RELAY_RENDEZVOUS_NS\n} from './constants.js'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { AddressSorter, PeerProtocolsChangeData } from '@libp2p/interface-peer-store'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { Components } from '@libp2p/components'\nimport sort from 'it-sort'\nimport all from 'it-all'\nimport { pipe } from 'it-pipe'\nimport { publicAddressesFirst } from '@libp2p/utils/address-sort'\n\nconst log = logger('libp2p:auto-relay')\n\nconst noop = () => {}\n\nexport interface AutoRelayInit {\n addressSorter?: AddressSorter\n maxListeners?: number\n onError?: (error: Error, msg?: string) => void\n}\n\nexport class AutoRelay {\n private readonly components: Components\n private readonly addressSorter: AddressSorter\n private readonly maxListeners: number\n private readonly listenRelays: Set\n private readonly onError: (error: Error, msg?: string) => void\n\n constructor (components: Components, init: AutoRelayInit) {\n this.components = components\n this.addressSorter = init.addressSorter ?? publicAddressesFirst\n this.maxListeners = init.maxListeners ?? 1\n this.listenRelays = new Set()\n this.onError = init.onError ?? noop\n\n this._onProtocolChange = this._onProtocolChange.bind(this)\n this._onPeerDisconnected = this._onPeerDisconnected.bind(this)\n\n this.components.getPeerStore().addEventListener('change:protocols', (evt) => {\n void this._onProtocolChange(evt).catch(err => {\n log.error(err)\n })\n })\n this.components.getConnectionManager().addEventListener('peer:disconnect', this._onPeerDisconnected)\n }\n\n /**\n * Check if a peer supports the relay protocol.\n * If the protocol is not supported, check if it was supported before and remove it as a listen relay.\n * If the protocol is supported, check if the peer supports **HOP** and add it as a listener if\n * inside the threshold.\n */\n async _onProtocolChange (evt: CustomEvent) {\n const {\n peerId,\n protocols\n } = evt.detail\n const id = peerId.toString()\n\n // Check if it has the protocol\n const hasProtocol = protocols.find(protocol => protocol === RELAY_CODEC)\n\n // If no protocol, check if we were keeping the peer before as a listenRelay\n if (hasProtocol == null) {\n if (this.listenRelays.has(id)) {\n await this._removeListenRelay(id)\n }\n\n return\n }\n\n if (this.listenRelays.has(id)) {\n return\n }\n\n // If protocol, check if can hop, store info in the metadataBook and listen on it\n try {\n const connections = this.components.getConnectionManager().getConnections(peerId)\n\n if (connections.length === 0) {\n return\n }\n\n const connection = connections[0]\n\n // Do not hop on a relayed connection\n if (connection.remoteAddr.protoCodes().includes(CIRCUIT_PROTO_CODE)) {\n log(`relayed connection to ${id} will not be used to hop on`)\n return\n }\n\n const supportsHop = await canHop({ connection })\n\n if (supportsHop) {\n await this.components.getPeerStore().metadataBook.setValue(peerId, HOP_METADATA_KEY, uint8ArrayFromString(HOP_METADATA_VALUE))\n await this._addListenRelay(connection, id)\n }\n } catch (err: any) {\n this.onError(err)\n }\n }\n\n /**\n * Peer disconnects\n */\n _onPeerDisconnected (evt: CustomEvent) {\n const connection = evt.detail\n const peerId = connection.remotePeer\n const id = peerId.toString()\n\n // Not listening on this relay\n if (!this.listenRelays.has(id)) {\n return\n }\n\n this._removeListenRelay(id).catch(err => {\n log.error(err)\n })\n }\n\n /**\n * Attempt to listen on the given relay connection\n */\n async _addListenRelay (connection: Connection, id: string): Promise {\n try {\n // Check if already listening on enough relays\n if (this.listenRelays.size >= this.maxListeners) {\n return\n }\n\n // Get peer known addresses and sort them with public addresses first\n const remoteAddrs = await pipe(\n await this.components.getPeerStore().addressBook.get(connection.remotePeer),\n (source) => sort(source, this.addressSorter),\n async (source) => await all(source)\n )\n\n // Attempt to listen on relay\n const result = await Promise.all(\n remoteAddrs.map(async addr => {\n try {\n let multiaddr = addr.multiaddr\n\n if (multiaddr.getPeerId() == null) {\n multiaddr = multiaddr.encapsulate(`/p2p/${connection.remotePeer.toString()}`)\n }\n\n multiaddr = multiaddr.encapsulate('/p2p-circuit')\n\n // Announce multiaddrs will update on listen success by TransportManager event being triggered\n await this.components.getTransportManager().listen([multiaddr])\n return true\n } catch (err: any) {\n log.error('error listening on circuit address', err)\n this.onError(err)\n }\n\n return false\n })\n )\n\n if (result.includes(true)) {\n this.listenRelays.add(id)\n }\n } catch (err: any) {\n this.onError(err)\n this.listenRelays.delete(id)\n }\n }\n\n /**\n * Remove listen relay\n */\n async _removeListenRelay (id: string) {\n if (this.listenRelays.delete(id)) {\n // TODO: this should be responsibility of the connMgr\n await this._listenOnAvailableHopRelays([id])\n }\n }\n\n /**\n * Try to listen on available hop relay connections.\n * The following order will happen while we do not have enough relays.\n * 1. Check the metadata store for known relays, try to listen on the ones we are already connected.\n * 2. Dial and try to listen on the peers we know that support hop but are not connected.\n * 3. Search the network.\n */\n async _listenOnAvailableHopRelays (peersToIgnore: string[] = []) {\n // TODO: The peer redial issue on disconnect should be handled by connection gating\n // Check if already listening on enough relays\n if (this.listenRelays.size >= this.maxListeners) {\n return\n }\n\n const knownHopsToDial = []\n const peers = await this.components.getPeerStore().all()\n\n // Check if we have known hop peers to use and attempt to listen on the already connected\n for (const { id, metadata } of peers) {\n const idStr = id.toString()\n\n // Continue to next if listening on this or peer to ignore\n if (this.listenRelays.has(idStr)) {\n continue\n }\n\n if (peersToIgnore.includes(idStr)) {\n continue\n }\n\n const supportsHop = metadata.get(HOP_METADATA_KEY)\n\n // Continue to next if it does not support Hop\n if ((supportsHop == null) || uint8ArrayToString(supportsHop) !== HOP_METADATA_VALUE) {\n continue\n }\n\n const connections = this.components.getConnectionManager().getConnections(id)\n\n // If not connected, store for possible later use.\n if (connections.length === 0) {\n knownHopsToDial.push(id)\n continue\n }\n\n await this._addListenRelay(connections[0], idStr)\n\n // Check if already listening on enough relays\n if (this.listenRelays.size >= this.maxListeners) {\n return\n }\n }\n\n // Try to listen on known peers that are not connected\n for (const peerId of knownHopsToDial) {\n await this._tryToListenOnRelay(peerId)\n\n // Check if already listening on enough relays\n if (this.listenRelays.size >= this.maxListeners) {\n return\n }\n }\n\n // Try to find relays to hop on the network\n try {\n const cid = await namespaceToCid(RELAY_RENDEZVOUS_NS)\n for await (const provider of this.components.getContentRouting().findProviders(cid)) {\n if (provider.multiaddrs.length === 0) {\n continue\n }\n\n const peerId = provider.id\n await this.components.getPeerStore().addressBook.add(peerId, provider.multiaddrs)\n\n await this._tryToListenOnRelay(peerId)\n\n // Check if already listening on enough relays\n if (this.listenRelays.size >= this.maxListeners) {\n return\n }\n }\n } catch (err: any) {\n this.onError(err)\n }\n }\n\n async _tryToListenOnRelay (peerId: PeerId) {\n try {\n const connection = await this.components.getConnectionManager().openConnection(peerId)\n await this._addListenRelay(connection, peerId.toString())\n } catch (err: any) {\n log.error('Could not use %p as relay', peerId, err)\n this.onError(err, `could not connect and listen on known hop relay ${peerId.toString()}`)\n }\n }\n}\n","import { logger } from '@libp2p/logger'\nimport { codes } from '../errors.js'\nimport {\n setDelayedInterval,\n clearDelayedInterval\n// @ts-expect-error set-delayed-interval does not export types\n} from 'set-delayed-interval'\nimport { AutoRelay } from './auto-relay.js'\nimport { namespaceToCid } from './utils.js'\nimport {\n RELAY_RENDEZVOUS_NS\n} from './constants.js'\nimport type { AddressSorter } from '@libp2p/interface-peer-store'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { Components } from '@libp2p/components'\nimport type { RelayConfig } from '../index.js'\n\nconst log = logger('libp2p:relay')\n\nexport interface RelayAdvertiseConfig {\n bootDelay?: number\n enabled?: boolean\n ttl?: number\n}\n\nexport interface AutoRelayConfig {\n enabled?: boolean\n\n /**\n * maximum number of relays to listen\n */\n maxListeners: number\n}\n\nexport interface RelayInit extends RelayConfig {\n addressSorter?: AddressSorter\n}\n\nexport class Relay implements Startable {\n private readonly components: Components\n private readonly init: RelayInit\n // @ts-expect-error this field isn't used anywhere?\n private readonly autoRelay?: AutoRelay\n private timeout?: any\n private started: boolean\n\n /**\n * Creates an instance of Relay\n */\n constructor (components: Components, init: RelayInit) {\n this.components = components\n // Create autoRelay if enabled\n this.autoRelay = init.autoRelay?.enabled !== false\n ? new AutoRelay(components, {\n addressSorter: init.addressSorter,\n ...init.autoRelay\n })\n : undefined\n\n this.started = false\n this.init = init\n this._advertiseService = this._advertiseService.bind(this)\n }\n\n isStarted () {\n return this.started\n }\n\n /**\n * Start Relay service\n */\n async start () {\n // Advertise service if HOP enabled\n if (this.init.hop.enabled !== false && this.init.advertise.enabled !== false) {\n this.timeout = setDelayedInterval(\n this._advertiseService, this.init.advertise.ttl, this.init.advertise.bootDelay\n )\n }\n\n this.started = true\n }\n\n /**\n * Stop Relay service\n */\n async stop () {\n if (this.timeout != null) {\n clearDelayedInterval(this.timeout)\n }\n\n this.started = false\n }\n\n /**\n * Advertise hop relay service in the network.\n */\n async _advertiseService () {\n try {\n const cid = await namespaceToCid(RELAY_RENDEZVOUS_NS)\n await this.components.getContentRouting().provide(cid)\n } catch (err: any) {\n if (err.code === codes.ERR_NO_ROUTERS_AVAILABLE) {\n log.error('a content router, such as a DHT, must be provided in order to advertise the relay service', err)\n // Stop the advertise\n await this.stop()\n } else {\n log.error(err)\n }\n }\n }\n}\n","import 'node-forge/lib/x509.js'\n// @ts-expect-error types are missing\nimport forge from 'node-forge/lib/forge.js'\n\nconst pki = forge.pki\n\n/**\n * Gets a self-signed X.509 certificate for the key.\n *\n * The output Uint8Array contains the PKCS #7 message in DER.\n *\n * TODO: move to libp2p-crypto package\n */\nexport const certificateForKey = (key: any, privateKey: forge.pki.rsa.PrivateKey) => {\n const publicKey = pki.rsa.setPublicKey(privateKey.n, privateKey.e)\n const cert = pki.createCertificate()\n cert.publicKey = publicKey\n cert.serialNumber = '01'\n cert.validity.notBefore = new Date()\n cert.validity.notAfter = new Date()\n cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 10) // eslint-disable-line @typescript-eslint/restrict-plus-operands\n const attrs = [{\n name: 'organizationName',\n value: 'ipfs'\n }, {\n shortName: 'OU',\n value: 'keystore'\n }, {\n name: 'commonName',\n value: key.id\n }]\n cert.setSubject(attrs)\n cert.setIssuer(attrs)\n cert.setExtensions([{\n name: 'basicConstraints',\n cA: true\n }, {\n name: 'keyUsage',\n keyCertSign: true,\n digitalSignature: true,\n nonRepudiation: true,\n keyEncipherment: true,\n dataEncipherment: true\n }, {\n name: 'extKeyUsage',\n serverAuth: true,\n clientAuth: true,\n codeSigning: true,\n emailProtection: true,\n timeStamping: true\n }, {\n name: 'nsCertType',\n client: true,\n server: true,\n email: true,\n objsign: true,\n sslCA: true,\n emailCA: true,\n objCA: true\n }])\n // self-sign certificate\n cert.sign(privateKey)\n\n return cert\n}\n\n/**\n * Finds the first item in a collection that is matched in the\n * `asyncCompare` function.\n *\n * `asyncCompare` is an async function that must\n * resolve to either `true` or `false`.\n *\n * @param {Array} array\n * @param {function(*)} asyncCompare - An async function that returns a boolean\n */\nexport async function findAsync (array: T[], asyncCompare: (val: T) => Promise) {\n const promises = array.map(asyncCompare)\n const results = await Promise.all(promises)\n const index = results.findIndex(result => result)\n return array[index]\n}\n","import 'node-forge/lib/pkcs7.js'\nimport 'node-forge/lib/pbe.js'\n// @ts-expect-error types are missing\nimport forge from 'node-forge/lib/forge.js'\nimport { certificateForKey, findAsync } from './util.js'\nimport errCode from 'err-code'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { toString as uint8ArrayToString } from 'uint8arrays/to-string'\nimport { codes } from '../errors.js'\nimport { logger } from '@libp2p/logger'\nimport type { KeyChain } from './index.js'\n\nconst log = logger('libp2p:keychain:cms')\n\nconst privates = new WeakMap()\n\n/**\n * Cryptographic Message Syntax (aka PKCS #7)\n *\n * CMS describes an encapsulation syntax for data protection. It\n * is used to digitally sign, digest, authenticate, or encrypt\n * arbitrary message content.\n *\n * See RFC 5652 for all the details.\n */\nexport class CMS {\n private readonly keychain: KeyChain\n\n /**\n * Creates a new instance with a keychain\n */\n constructor (keychain: KeyChain, dek: string) {\n if (keychain == null) {\n throw errCode(new Error('keychain is required'), codes.ERR_KEYCHAIN_REQUIRED)\n }\n\n this.keychain = keychain\n privates.set(this, { dek })\n }\n\n /**\n * Creates some protected data.\n *\n * The output Uint8Array contains the PKCS #7 message in DER.\n */\n async encrypt (name: string, plain: Uint8Array): Promise {\n if (!(plain instanceof Uint8Array)) {\n throw errCode(new Error('Plain data must be a Uint8Array'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const key = await this.keychain.findKeyByName(name)\n const pem = await this.keychain.getPrivateKey(name)\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const dek = cached.dek\n const privateKey = forge.pki.decryptRsaPrivateKey(pem, dek)\n const certificate = await certificateForKey(key, privateKey)\n\n // create a p7 enveloped message\n const p7 = forge.pkcs7.createEnvelopedData()\n p7.addRecipient(certificate)\n p7.content = forge.util.createBuffer(plain)\n p7.encrypt()\n\n // convert message to DER\n const der = forge.asn1.toDer(p7.toAsn1()).getBytes()\n return uint8ArrayFromString(der, 'ascii')\n }\n\n /**\n * Reads some protected data.\n *\n * The keychain must contain one of the keys used to encrypt the data. If none of the keys\n * exists, an Error is returned with the property 'missingKeys'. It is array of key ids.\n */\n async decrypt (cmsData: Uint8Array): Promise {\n if (!(cmsData instanceof Uint8Array)) {\n throw errCode(new Error('CMS data is required'), codes.ERR_INVALID_PARAMETERS)\n }\n\n let cms: any\n try {\n const buf = forge.util.createBuffer(uint8ArrayToString(cmsData, 'ascii'))\n const obj = forge.asn1.fromDer(buf)\n\n cms = forge.pkcs7.messageFromAsn1(obj)\n } catch (err: any) {\n log.error(err)\n throw errCode(new Error('Invalid CMS'), codes.ERR_INVALID_CMS)\n }\n\n // Find a recipient whose key we hold. We only deal with recipient certs\n // issued by ipfs (O=ipfs).\n const recipients: any = cms.recipients\n // @ts-expect-error cms types not defined\n .filter(r => r.issuer.find(a => a.shortName === 'O' && a.value === 'ipfs'))\n // @ts-expect-error cms types not defined\n .filter(r => r.issuer.find(a => a.shortName === 'CN'))\n // @ts-expect-error cms types not defined\n .map(r => {\n return {\n recipient: r,\n // @ts-expect-error cms types not defined\n keyId: r.issuer.find(a => a.shortName === 'CN').value\n }\n })\n\n const r = await findAsync(recipients, async (recipient: any) => {\n try {\n const key = await this.keychain.findKeyById(recipient.keyId)\n if (key != null) {\n return true\n }\n } catch (err: any) {\n return false\n }\n return false\n })\n\n if (r == null) {\n // @ts-expect-error cms types not defined\n const missingKeys: string[] = recipients.map(r => r.keyId)\n throw errCode(new Error(`Decryption needs one of the key(s): ${missingKeys.join(', ')}`), codes.ERR_MISSING_KEYS, {\n missingKeys\n })\n }\n\n const key = await this.keychain.findKeyById(r.keyId)\n\n if (key == null) {\n throw errCode(new Error('No key available to decrypto'), codes.ERR_NO_KEY)\n }\n\n const pem = await this.keychain.getPrivateKey(key.name)\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const dek = cached.dek\n const privateKey = forge.pki.decryptRsaPrivateKey(pem, dek)\n cms.decrypt(r.recipient, privateKey)\n return uint8ArrayFromString(cms.content.getBytes(), 'ascii')\n }\n}\n","/* eslint max-nested-callbacks: [\"error\", 5] */\n\nimport { logger } from '@libp2p/logger'\nimport sanitize from 'sanitize-filename'\nimport mergeOptions from 'merge-options'\nimport { Key } from 'interface-datastore/key'\nimport { CMS } from './cms.js'\nimport errCode from 'err-code'\nimport { codes } from '../errors.js'\nimport { toString as uint8ArrayToString } from 'uint8arrays/to-string'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Components } from '@libp2p/components'\nimport { pbkdf2, randomBytes } from '@libp2p/crypto'\n\nconst log = logger('libp2p:keychain')\n\nexport interface DekOptions {\n hash: string\n salt: string\n iterationCount: number\n keyLength: number\n}\n\nexport interface KeyChainInit {\n pass?: string\n dek?: DekOptions\n}\n\n/**\n * Information about a key.\n */\nexport interface KeyInfo {\n /**\n * The universally unique key id\n */\n id: string\n\n /**\n * The local key name.\n */\n name: string\n}\n\nconst keyPrefix = '/pkcs8/'\nconst infoPrefix = '/info/'\nconst privates = new WeakMap()\n\n// NIST SP 800-132\nconst NIST = {\n minKeyLength: 112 / 8,\n minSaltLength: 128 / 8,\n minIterationCount: 1000\n}\n\nconst defaultOptions = {\n // See https://cryptosense.com/parametesr-choice-for-pbkdf2/\n dek: {\n keyLength: 512 / 8,\n iterationCount: 10000,\n salt: 'you should override this value with a crypto secure random number',\n hash: 'sha2-512'\n }\n}\n\nfunction validateKeyName (name: string) {\n if (name == null) {\n return false\n }\n if (typeof name !== 'string') {\n return false\n }\n return name === sanitize(name.trim()) && name.length > 0\n}\n\n/**\n * Throws an error after a delay\n *\n * This assumes than an error indicates that the keychain is under attack. Delay returning an\n * error to make brute force attacks harder.\n */\nasync function randomDelay () {\n const min = 200\n const max = 1000\n const delay = Math.random() * (max - min) + min\n\n await new Promise(resolve => setTimeout(resolve, delay))\n}\n\n/**\n * Converts a key name into a datastore name\n */\nfunction DsName (name: string) {\n return new Key(keyPrefix + name)\n}\n\n/**\n * Converts a key name into a datastore info name\n */\nfunction DsInfoName (name: string) {\n return new Key(infoPrefix + name)\n}\n\n/**\n * Manages the lifecycle of a key. Keys are encrypted at rest using PKCS #8.\n *\n * A key in the store has two entries\n * - '/info/*key-name*', contains the KeyInfo for the key\n * - '/pkcs8/*key-name*', contains the PKCS #8 for the key\n *\n */\nexport class KeyChain {\n private readonly components: Components\n private init: KeyChainInit\n\n /**\n * Creates a new instance of a key chain\n */\n constructor (components: Components, init: KeyChainInit) {\n this.components = components\n this.init = mergeOptions(defaultOptions, init)\n\n // Enforce NIST SP 800-132\n if (this.init.pass != null && this.init.pass?.length < 20) {\n throw new Error('pass must be least 20 characters')\n }\n if (this.init.dek?.keyLength != null && this.init.dek.keyLength < NIST.minKeyLength) {\n throw new Error(`dek.keyLength must be least ${NIST.minKeyLength} bytes`)\n }\n if (this.init.dek?.salt?.length != null && this.init.dek.salt.length < NIST.minSaltLength) {\n throw new Error(`dek.saltLength must be least ${NIST.minSaltLength} bytes`)\n }\n if (this.init.dek?.iterationCount != null && this.init.dek.iterationCount < NIST.minIterationCount) {\n throw new Error(`dek.iterationCount must be least ${NIST.minIterationCount}`)\n }\n\n const dek = this.init.pass != null && this.init.dek?.salt != null\n ? pbkdf2(\n this.init.pass,\n this.init.dek?.salt,\n this.init.dek?.iterationCount,\n this.init.dek?.keyLength,\n this.init.dek?.hash)\n : ''\n\n privates.set(this, { dek })\n }\n\n /**\n * Gets an object that can encrypt/decrypt protected data\n * using the Cryptographic Message Syntax (CMS).\n *\n * CMS describes an encapsulation syntax for data protection. It\n * is used to digitally sign, digest, authenticate, or encrypt\n * arbitrary message content\n */\n get cms () {\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const dek = cached.dek\n\n return new CMS(this, dek)\n }\n\n /**\n * Generates the options for a keychain. A random salt is produced.\n *\n * @returns {object}\n */\n static generateOptions (): KeyChainInit {\n const options = Object.assign({}, defaultOptions)\n const saltLength = Math.ceil(NIST.minSaltLength / 3) * 3 // no base64 padding\n options.dek.salt = uint8ArrayToString(randomBytes(saltLength), 'base64')\n return options\n }\n\n /**\n * Gets an object that can encrypt/decrypt protected data.\n * The default options for a keychain.\n *\n * @returns {object}\n */\n static get options () {\n return defaultOptions\n }\n\n /**\n * Create a new key.\n *\n * @param {string} name - The local key name; cannot already exist.\n * @param {string} type - One of the key types; 'rsa'.\n * @param {number} [size = 2048] - The key size in bits. Used for rsa keys only\n */\n async createKey (name: string, type: 'RSA' | 'Ed25519', size = 2048): Promise {\n if (!validateKeyName(name) || name === 'self') {\n await randomDelay()\n throw errCode(new Error('Invalid key name'), codes.ERR_INVALID_KEY_NAME)\n }\n\n if (typeof type !== 'string') {\n await randomDelay()\n throw errCode(new Error('Invalid key type'), codes.ERR_INVALID_KEY_TYPE)\n }\n\n const dsname = DsName(name)\n const exists = await this.components.getDatastore().has(dsname)\n if (exists) {\n await randomDelay()\n throw errCode(new Error('Key name already exists'), codes.ERR_KEY_ALREADY_EXISTS)\n }\n\n switch (type.toLowerCase()) {\n case 'rsa':\n if (!Number.isSafeInteger(size) || size < 2048) {\n await randomDelay()\n throw errCode(new Error('Invalid RSA key size'), codes.ERR_INVALID_KEY_SIZE)\n }\n break\n default:\n break\n }\n\n let keyInfo\n try {\n const keypair = await generateKeyPair(type, size)\n const kid = await keypair.id()\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const dek = cached.dek\n const pem = await keypair.export(dek)\n keyInfo = {\n name: name,\n id: kid\n }\n const batch = this.components.getDatastore().batch()\n batch.put(dsname, uint8ArrayFromString(pem))\n batch.put(DsInfoName(name), uint8ArrayFromString(JSON.stringify(keyInfo)))\n\n await batch.commit()\n } catch (err: any) {\n await randomDelay()\n throw err\n }\n\n return keyInfo\n }\n\n /**\n * List all the keys.\n *\n * @returns {Promise}\n */\n async listKeys () {\n const query = {\n prefix: infoPrefix\n }\n\n const info = []\n for await (const value of this.components.getDatastore().query(query)) {\n info.push(JSON.parse(uint8ArrayToString(value.value)))\n }\n\n return info\n }\n\n /**\n * Find a key by it's id\n */\n async findKeyById (id: string): Promise {\n try {\n const keys = await this.listKeys()\n return keys.find((k) => k.id === id)\n } catch (err: any) {\n await randomDelay()\n throw err\n }\n }\n\n /**\n * Find a key by it's name.\n *\n * @param {string} name - The local key name.\n * @returns {Promise}\n */\n async findKeyByName (name: string): Promise {\n if (!validateKeyName(name)) {\n await randomDelay()\n throw errCode(new Error(`Invalid key name '${name}'`), codes.ERR_INVALID_KEY_NAME)\n }\n\n const dsname = DsInfoName(name)\n try {\n const res = await this.components.getDatastore().get(dsname)\n return JSON.parse(uint8ArrayToString(res))\n } catch (err: any) {\n await randomDelay()\n log.error(err)\n throw errCode(new Error(`Key '${name}' does not exist.`), codes.ERR_KEY_NOT_FOUND)\n }\n }\n\n /**\n * Remove an existing key.\n *\n * @param {string} name - The local key name; must already exist.\n * @returns {Promise}\n */\n async removeKey (name: string) {\n if (!validateKeyName(name) || name === 'self') {\n await randomDelay()\n throw errCode(new Error(`Invalid key name '${name}'`), codes.ERR_INVALID_KEY_NAME)\n }\n const dsname = DsName(name)\n const keyInfo = await this.findKeyByName(name)\n const batch = this.components.getDatastore().batch()\n batch.delete(dsname)\n batch.delete(DsInfoName(name))\n await batch.commit()\n return keyInfo\n }\n\n /**\n * Rename a key\n *\n * @param {string} oldName - The old local key name; must already exist.\n * @param {string} newName - The new local key name; must not already exist.\n * @returns {Promise}\n */\n async renameKey (oldName: string, newName: string): Promise {\n if (!validateKeyName(oldName) || oldName === 'self') {\n await randomDelay()\n throw errCode(new Error(`Invalid old key name '${oldName}'`), codes.ERR_OLD_KEY_NAME_INVALID)\n }\n if (!validateKeyName(newName) || newName === 'self') {\n await randomDelay()\n throw errCode(new Error(`Invalid new key name '${newName}'`), codes.ERR_NEW_KEY_NAME_INVALID)\n }\n const oldDsname = DsName(oldName)\n const newDsname = DsName(newName)\n const oldInfoName = DsInfoName(oldName)\n const newInfoName = DsInfoName(newName)\n\n const exists = await this.components.getDatastore().has(newDsname)\n if (exists) {\n await randomDelay()\n throw errCode(new Error(`Key '${newName}' already exists`), codes.ERR_KEY_ALREADY_EXISTS)\n }\n\n try {\n const pem = await this.components.getDatastore().get(oldDsname)\n const res = await this.components.getDatastore().get(oldInfoName)\n\n const keyInfo = JSON.parse(uint8ArrayToString(res))\n keyInfo.name = newName\n const batch = this.components.getDatastore().batch()\n batch.put(newDsname, pem)\n batch.put(newInfoName, uint8ArrayFromString(JSON.stringify(keyInfo)))\n batch.delete(oldDsname)\n batch.delete(oldInfoName)\n await batch.commit()\n return keyInfo\n } catch (err: any) {\n await randomDelay()\n throw err\n }\n }\n\n /**\n * Export an existing key as a PEM encrypted PKCS #8 string\n */\n async exportKey (name: string, password: string) {\n if (!validateKeyName(name)) {\n await randomDelay()\n throw errCode(new Error(`Invalid key name '${name}'`), codes.ERR_INVALID_KEY_NAME)\n }\n if (password == null) {\n await randomDelay()\n throw errCode(new Error('Password is required'), codes.ERR_PASSWORD_REQUIRED)\n }\n\n const dsname = DsName(name)\n try {\n const res = await this.components.getDatastore().get(dsname)\n const pem = uint8ArrayToString(res)\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const dek = cached.dek\n const privateKey = await importKey(pem, dek)\n return await privateKey.export(password)\n } catch (err: any) {\n await randomDelay()\n throw err\n }\n }\n\n /**\n * Import a new key from a PEM encoded PKCS #8 string\n *\n * @param {string} name - The local key name; must not already exist.\n * @param {string} pem - The PEM encoded PKCS #8 string\n * @param {string} password - The password.\n * @returns {Promise}\n */\n async importKey (name: string, pem: string, password: string): Promise {\n if (!validateKeyName(name) || name === 'self') {\n await randomDelay()\n throw errCode(new Error(`Invalid key name '${name}'`), codes.ERR_INVALID_KEY_NAME)\n }\n if (pem == null) {\n await randomDelay()\n throw errCode(new Error('PEM encoded key is required'), codes.ERR_PEM_REQUIRED)\n }\n const dsname = DsName(name)\n const exists = await this.components.getDatastore().has(dsname)\n if (exists) {\n await randomDelay()\n throw errCode(new Error(`Key '${name}' already exists`), codes.ERR_KEY_ALREADY_EXISTS)\n }\n\n let privateKey\n try {\n privateKey = await importKey(pem, password)\n } catch (err: any) {\n await randomDelay()\n throw errCode(new Error('Cannot read the key, most likely the password is wrong'), codes.ERR_CANNOT_READ_KEY)\n }\n\n let kid\n try {\n kid = await privateKey.id()\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const dek = cached.dek\n pem = await privateKey.export(dek)\n } catch (err: any) {\n await randomDelay()\n throw err\n }\n\n const keyInfo = {\n name: name,\n id: kid\n }\n const batch = this.components.getDatastore().batch()\n batch.put(dsname, uint8ArrayFromString(pem))\n batch.put(DsInfoName(name), uint8ArrayFromString(JSON.stringify(keyInfo)))\n await batch.commit()\n\n return keyInfo\n }\n\n /**\n * Import a peer key\n */\n async importPeer (name: string, peer: PeerId): Promise {\n try {\n if (!validateKeyName(name)) {\n throw errCode(new Error(`Invalid key name '${name}'`), codes.ERR_INVALID_KEY_NAME)\n }\n if (peer == null || peer.privateKey == null) {\n throw errCode(new Error('Peer.privKey is required'), codes.ERR_MISSING_PRIVATE_KEY)\n }\n\n const privateKey = await unmarshalPrivateKey(peer.privateKey)\n\n const dsname = DsName(name)\n const exists = await this.components.getDatastore().has(dsname)\n if (exists) {\n await randomDelay()\n throw errCode(new Error(`Key '${name}' already exists`), codes.ERR_KEY_ALREADY_EXISTS)\n }\n\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const dek = cached.dek\n const pem = await privateKey.export(dek)\n const keyInfo: KeyInfo = {\n name: name,\n id: peer.toString()\n }\n const batch = this.components.getDatastore().batch()\n batch.put(dsname, uint8ArrayFromString(pem))\n batch.put(DsInfoName(name), uint8ArrayFromString(JSON.stringify(keyInfo)))\n await batch.commit()\n return keyInfo\n } catch (err: any) {\n await randomDelay()\n throw err\n }\n }\n\n /**\n * Gets the private key as PEM encoded PKCS #8 string\n */\n async getPrivateKey (name: string): Promise {\n if (!validateKeyName(name)) {\n await randomDelay()\n throw errCode(new Error(`Invalid key name '${name}'`), codes.ERR_INVALID_KEY_NAME)\n }\n\n try {\n const dsname = DsName(name)\n const res = await this.components.getDatastore().get(dsname)\n return uint8ArrayToString(res)\n } catch (err: any) {\n await randomDelay()\n log.error(err)\n throw errCode(new Error(`Key '${name}' does not exist.`), codes.ERR_KEY_NOT_FOUND)\n }\n }\n\n /**\n * Rotate keychain password and re-encrypt all associated keys\n */\n async rotateKeychainPass (oldPass: string, newPass: string) {\n if (typeof oldPass !== 'string') {\n await randomDelay()\n throw errCode(new Error(`Invalid old pass type '${typeof oldPass}'`), codes.ERR_INVALID_OLD_PASS_TYPE)\n }\n if (typeof newPass !== 'string') {\n await randomDelay()\n throw errCode(new Error(`Invalid new pass type '${typeof newPass}'`), codes.ERR_INVALID_NEW_PASS_TYPE)\n }\n if (newPass.length < 20) {\n await randomDelay()\n throw errCode(new Error(`Invalid pass length ${newPass.length}`), codes.ERR_INVALID_PASS_LENGTH)\n }\n log('recreating keychain')\n const cached = privates.get(this)\n\n if (cached == null) {\n throw errCode(new Error('dek missing'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const oldDek = cached.dek\n this.init.pass = newPass\n const newDek = newPass != null && this.init.dek?.salt != null\n ? pbkdf2(\n newPass,\n this.init.dek.salt,\n this.init.dek?.iterationCount,\n this.init.dek?.keyLength,\n this.init.dek?.hash)\n : ''\n privates.set(this, { dek: newDek })\n const keys = await this.listKeys()\n for (const key of keys) {\n const res = await this.components.getDatastore().get(DsName(key.name))\n const pem = uint8ArrayToString(res)\n const privateKey = await importKey(pem, oldDek)\n const password = newDek.toString()\n const keyAsPEM = await privateKey.export(password)\n\n // Update stored key\n const batch = this.components.getDatastore().batch()\n const keyInfo = {\n name: key.name,\n id: key.id\n }\n batch.put(DsName(key.name), uint8ArrayFromString(keyAsPEM))\n batch.put(DsInfoName(key.name), uint8ArrayFromString(JSON.stringify(keyInfo)))\n await batch.commit()\n }\n log('keychain reconstructed')\n }\n}\n","import type { MovingAverage } from '@libp2p/interface-metrics'\n\nexport class DefaultMovingAverage {\n public movingAverage: number\n public variance: number\n public deviation: number\n public forecast: number\n private readonly timespan: number\n private previousTime?: number\n\n constructor (timespan: number) {\n if (typeof timespan !== 'number') {\n throw new Error('must provide a timespan to the moving average constructor')\n }\n\n if (timespan <= 0) {\n throw new Error('must provide a timespan > 0 to the moving average constructor')\n }\n\n this.timespan = timespan\n this.movingAverage = 0\n this.variance = 0\n this.deviation = 0\n this.forecast = 0\n }\n\n alpha (t: number, pt: number) {\n return 1 - (Math.exp(-(t - pt) / this.timespan))\n }\n\n push (time: number, value: number) {\n if (this.previousTime != null) {\n // calculate moving average\n const a = this.alpha(time, this.previousTime)\n const diff = value - this.movingAverage\n const incr = a * diff\n this.movingAverage = a * value + (1 - a) * this.movingAverage\n // calculate variance & deviation\n this.variance = (1 - a) * (this.variance + diff * incr)\n this.deviation = Math.sqrt(this.variance)\n // calculate forecast\n this.forecast = this.movingAverage + a * diff\n } else {\n this.movingAverage = value\n }\n\n this.previousTime = time\n }\n}\n\nexport function createMovingAverage (timespan: number): MovingAverage {\n return new DefaultMovingAverage(timespan)\n}\n","import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport { createMovingAverage } from './moving-average.js'\n// @ts-expect-error no types\nimport retimer from 'retimer'\nimport type { MovingAverages, Stats, TransferStats } from '@libp2p/interface-metrics'\n\nexport interface StatsEvents {\n 'update': CustomEvent\n}\n\nexport interface StatsInit {\n enabled: boolean\n initialCounters: ['dataReceived', 'dataSent']\n movingAverageIntervals: number[]\n computeThrottleMaxQueueSize: number\n computeThrottleTimeout: number\n}\n\nexport class DefaultStats extends EventEmitter implements Stats {\n private readonly enabled: boolean\n public queue: Array<[string, number, number]>\n private stats: TransferStats\n private frequencyLastTime: number\n private frequencyAccumulators: Record\n private movingAverages: MovingAverages\n private timeout?: any\n private readonly computeThrottleMaxQueueSize: number\n private readonly computeThrottleTimeout: number\n private readonly movingAverageIntervals: number[]\n\n /**\n * A queue based manager for stat processing\n */\n constructor (init: StatsInit) {\n super()\n\n this.enabled = init.enabled\n this.queue = []\n this.stats = {\n dataReceived: 0n,\n dataSent: 0n\n }\n this.frequencyLastTime = Date.now()\n this.frequencyAccumulators = {}\n this.movingAverages = {\n dataReceived: [],\n dataSent: []\n }\n this.computeThrottleMaxQueueSize = init.computeThrottleMaxQueueSize\n this.computeThrottleTimeout = init.computeThrottleTimeout\n\n this._update = this._update.bind(this)\n\n this.movingAverageIntervals = init.movingAverageIntervals\n\n for (let i = 0; i < init.initialCounters.length; i++) {\n const key = init.initialCounters[i]\n this.stats[key] = 0n\n this.movingAverages[key] = []\n\n for (let k = 0; k < this.movingAverageIntervals.length; k++) {\n const interval = this.movingAverageIntervals[k]\n const ma = this.movingAverages[key][interval] = createMovingAverage(interval)\n ma.push(this.frequencyLastTime, 0)\n }\n }\n }\n\n /**\n * Initializes the internal timer if there are items in the queue. This\n * should only need to be called if `Stats.stop` was previously called, as\n * `Stats.push` will also start the processing\n */\n start () {\n if (!this.enabled) {\n return\n }\n\n if (this.queue.length > 0) {\n this._resetComputeTimeout()\n }\n }\n\n /**\n * Stops processing and computing of stats by clearing the internal\n * timer\n */\n stop () {\n if (this.timeout != null) {\n this.timeout.clear()\n this.timeout = null\n }\n }\n\n /**\n * Returns a clone of the current stats.\n */\n getSnapshot () {\n return Object.assign({}, this.stats)\n }\n\n /**\n * Returns a clone of the internal movingAverages\n */\n getMovingAverages (): MovingAverages {\n return Object.assign({}, this.movingAverages)\n }\n\n /**\n * Pushes the given operation data to the queue, along with the\n * current Timestamp, then resets the update timer.\n */\n push (counter: string, inc: number) {\n this.queue.push([counter, inc, Date.now()])\n this._resetComputeTimeout()\n }\n\n /**\n * Resets the timeout for triggering updates.\n */\n _resetComputeTimeout () {\n this.timeout = retimer(this._update, this._nextTimeout())\n }\n\n /**\n * Calculates and returns the timeout for the next update based on\n * the urgency of the update.\n */\n _nextTimeout () {\n // calculate the need for an update, depending on the queue length\n const urgency = this.queue.length / this.computeThrottleMaxQueueSize\n const timeout = Math.max(this.computeThrottleTimeout * (1 - urgency), 0)\n return timeout\n }\n\n /**\n * If there are items in the queue, they will will be processed and\n * the frequency for all items will be updated based on the Timestamp\n * of the last item in the queue. The `update` event will also be emitted\n * with the latest stats.\n *\n * If there are no items in the queue, no action is taken.\n */\n _update () {\n this.timeout = null\n if (this.queue.length > 0) {\n let last: [string, number, number] = ['', 0, 0]\n\n for (last of this.queue) {\n this._applyOp(last)\n }\n\n this.queue = []\n\n if (last.length > 2 && last[0] !== '') {\n this._updateFrequency(last[2]) // contains timestamp of last op\n }\n\n this.dispatchEvent(new CustomEvent('update', {\n detail: this.stats\n }))\n }\n }\n\n /**\n * For each key in the stats, the frequency and moving averages\n * will be updated via Stats._updateFrequencyFor based on the time\n * difference between calls to this method.\n */\n _updateFrequency (latestTime: number) {\n const timeDiff = latestTime - this.frequencyLastTime\n\n this._updateFrequencyFor('dataReceived', timeDiff, latestTime)\n this._updateFrequencyFor('dataSent', timeDiff, latestTime)\n\n this.frequencyLastTime = latestTime\n }\n\n /**\n * Updates the `movingAverages` for the given `key` and also\n * resets the `frequencyAccumulator` for the `key`.\n */\n _updateFrequencyFor (key: 'dataReceived' | 'dataSent', timeDiffMS: number, latestTime: number) {\n const count = this.frequencyAccumulators[key] ?? 0\n this.frequencyAccumulators[key] = 0\n // if `timeDiff` is zero, `hz` becomes Infinity, so we fallback to 1ms\n const safeTimeDiff = timeDiffMS ?? 1\n const hz = (count / safeTimeDiff) * 1000\n\n let movingAverages = this.movingAverages[key]\n if (movingAverages == null) {\n movingAverages = this.movingAverages[key] = []\n }\n\n const intervals = this.movingAverageIntervals\n\n for (let i = 0; i < intervals.length; i++) {\n const movingAverageInterval = intervals[i]\n let movingAverage = movingAverages[movingAverageInterval]\n if (movingAverage == null) {\n movingAverage = movingAverages[movingAverageInterval] = createMovingAverage(movingAverageInterval)\n }\n movingAverage.push(latestTime, hz)\n }\n }\n\n /**\n * For the given operation, `op`, the stats and `frequencyAccumulator`\n * will be updated or initialized if they don't already exist.\n */\n _applyOp (op: [string, number, number]) {\n const key = op[0]\n const inc = op[1]\n\n if (typeof inc !== 'number') {\n throw new Error('invalid increment number')\n }\n\n let n: bigint\n\n if (!Object.prototype.hasOwnProperty.call(this.stats, key)) {\n // @ts-expect-error cannot index type with key\n n = this.stats[key] = 0n\n } else {\n // @ts-expect-error cannot index type with key\n n = this.stats[key]\n }\n\n // @ts-expect-error cannot index type with key\n this.stats[key] = n + BigInt(inc)\n\n if (this.frequencyAccumulators[key] == null) {\n this.frequencyAccumulators[key] = 0\n }\n\n this.frequencyAccumulators[key] += inc\n }\n}\n","import { pipe } from 'it-pipe'\nimport each from 'it-foreach'\nimport LRU from 'hashlru'\nimport { METRICS as defaultOptions } from '../constants.js'\nimport { DefaultStats, StatsInit } from './stats.js'\nimport type { ComponentMetricsUpdate, Metrics, Stats, TrackedMetric, TrackStreamOptions } from '@libp2p/interface-metrics'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Startable } from '@libp2p/interfaces/startable'\n\nconst initialCounters: ['dataReceived', 'dataSent'] = [\n 'dataReceived',\n 'dataSent'\n]\n\nconst directionToEvent = {\n in: 'dataReceived',\n out: 'dataSent'\n}\n\nexport interface OnMessageOptions {\n remotePeer: PeerId\n protocol?: string\n direction: 'in' | 'out'\n dataLength: number\n}\n\nexport interface MetricsInit {\n enabled: boolean\n computeThrottleMaxQueueSize: number\n computeThrottleTimeout: number\n movingAverageIntervals: number[]\n maxOldPeersRetention: number\n}\n\nexport class DefaultMetrics implements Metrics, Startable {\n public globalStats: DefaultStats\n\n private readonly enabled: boolean\n private readonly peerStats: Map\n private readonly protocolStats: Map\n private readonly oldPeers: ReturnType\n private running: boolean\n private readonly systems: Map>>\n private readonly statsInit: StatsInit\n\n constructor (init: MetricsInit) {\n this.enabled = init.enabled\n this.statsInit = {\n ...init,\n initialCounters\n }\n this.globalStats = new DefaultStats(this.statsInit)\n this.peerStats = new Map()\n this.protocolStats = new Map()\n this.oldPeers = LRU(init.maxOldPeersRetention ?? defaultOptions.maxOldPeersRetention)\n this.running = false\n this._onMessage = this._onMessage.bind(this)\n this.systems = new Map()\n }\n\n isStarted () {\n return this.running\n }\n\n /**\n * Must be called for stats to saved. Any data pushed for tracking\n * will be ignored.\n */\n async start () {\n if (!this.enabled) {\n return\n }\n\n this.running = true\n }\n\n /**\n * Stops all averages timers and prevents new data from being tracked.\n * Once `stop` is called, `start` must be called to resume stats tracking.\n */\n async stop () {\n if (!this.running) {\n return\n }\n\n this.running = false\n this.globalStats.stop()\n\n for (const stats of this.peerStats.values()) {\n stats.stop()\n }\n\n for (const stats of this.protocolStats.values()) {\n stats.stop()\n }\n }\n\n /**\n * Gets the global `Stats` object\n */\n getGlobal () {\n return this.globalStats\n }\n\n /**\n * Returns a list of `PeerId` strings currently being tracked\n */\n getPeers () {\n return Array.from(this.peerStats.keys())\n }\n\n getComponentMetrics () {\n return this.systems\n }\n\n updateComponentMetric (update: ComponentMetricsUpdate) {\n const { system = 'libp2p', component, metric, value, label, help } = update\n\n if (!this.systems.has(system)) {\n this.systems.set(system, new Map())\n }\n\n const systemMetrics = this.systems.get(system)\n\n if (systemMetrics == null) {\n throw new Error('Unknown metric system')\n }\n\n if (!systemMetrics.has(component)) {\n systemMetrics.set(component, new Map())\n }\n\n const componentMetrics = systemMetrics.get(component)\n\n if (componentMetrics == null) {\n throw new Error('Unknown metric component')\n }\n\n componentMetrics.set(metric, {\n label,\n help,\n calculate: typeof value !== 'function' ? () => value : value\n })\n }\n\n /**\n * Returns the `Stats` object for the given `PeerId` whether it\n * is a live peer, or in the disconnected peer LRU cache.\n */\n forPeer (peerId: PeerId): Stats | undefined {\n const idString = peerId.toString()\n return this.peerStats.get(idString) ?? this.oldPeers.get(idString)\n }\n\n /**\n * Returns a list of all protocol strings currently being tracked\n */\n getProtocols (): string[] {\n return Array.from(this.protocolStats.keys())\n }\n\n /**\n * Returns the `Stats` object for the given `protocol`\n */\n forProtocol (protocol: string): Stats | undefined {\n return this.protocolStats.get(protocol)\n }\n\n /**\n * Should be called when all connections to a given peer\n * have closed. The `Stats` collection for the peer will\n * be stopped and moved to an LRU for temporary retention.\n */\n onPeerDisconnected (peerId: PeerId) {\n const idString = peerId.toString()\n const peerStats = this.peerStats.get(idString)\n\n if (peerStats != null) {\n peerStats.stop()\n\n this.peerStats.delete(idString)\n this.oldPeers.set(idString, peerStats)\n }\n }\n\n /**\n * Takes the metadata for a message and tracks it in the\n * appropriate categories. If the protocol is present, protocol\n * stats will also be tracked.\n */\n _onMessage (opts: OnMessageOptions) {\n if (!this.running) {\n return\n }\n\n const { remotePeer, protocol, direction, dataLength } = opts\n\n const key = directionToEvent[direction]\n\n let peerStats = this.forPeer(remotePeer)\n if (peerStats == null) {\n const stats = new DefaultStats(this.statsInit)\n this.peerStats.set(remotePeer.toString(), stats)\n peerStats = stats\n }\n\n // Peer and global stats\n peerStats.push(key, dataLength)\n this.globalStats.push(key, dataLength)\n\n // Protocol specific stats\n if (protocol != null) {\n let protocolStats = this.forProtocol(protocol)\n\n if (protocolStats == null) {\n const stats = new DefaultStats(this.statsInit)\n this.protocolStats.set(protocol, stats)\n protocolStats = stats\n }\n\n protocolStats.push(key, dataLength)\n }\n }\n\n /**\n * Replaces the `PeerId` string with the given `peerId`.\n * If stats are already being tracked for the given `peerId`, the\n * placeholder stats will be merged with the existing stats.\n *\n * @param {PeerId} placeholder - A peerId string\n * @param {PeerId} peerId\n * @returns {void}\n */\n updatePlaceholder (placeholder: PeerId, peerId: PeerId) {\n if (!this.running) {\n return\n }\n\n const placeholderString = placeholder.toString()\n const placeholderStats = this.peerStats.get(placeholderString) ?? this.oldPeers.get(placeholderString)\n const peerIdString = peerId.toString()\n const existingStats = this.peerStats.get(peerIdString) ?? this.oldPeers.get(peerIdString)\n let mergedStats = placeholderStats\n\n // If we already have stats, merge the two\n if (existingStats != null) {\n // If existing, merge\n mergedStats = mergeStats(existingStats, mergedStats)\n // Attempt to delete from the old peers list just in case it was tracked there\n this.oldPeers.remove(peerIdString)\n }\n\n this.peerStats.delete(placeholder.toString())\n this.peerStats.set(peerIdString, mergedStats)\n mergedStats.start()\n }\n\n /**\n * Tracks data running through a given Duplex Iterable `stream`. If\n * the `peerId` is not provided, a placeholder string will be created and\n * returned. This allows lazy tracking of a peer when the peer is not yet known.\n * When the `PeerId` is known, `Metrics.updatePlaceholder` should be called\n * with the placeholder string returned from here, and the known `PeerId`.\n */\n trackStream (opts: TrackStreamOptions): void {\n const { stream, remotePeer, protocol } = opts\n\n if (!this.running) {\n return\n }\n\n const source = stream.source\n stream.source = each(source, chunk => this._onMessage({\n remotePeer,\n protocol,\n direction: 'in',\n dataLength: chunk.byteLength\n }))\n\n const sink = stream.sink\n stream.sink = async source => {\n return await pipe(\n source,\n (source) => each(source, chunk => {\n this._onMessage({\n remotePeer,\n protocol,\n direction: 'out',\n dataLength: chunk.byteLength\n })\n }),\n sink\n )\n }\n }\n}\n\n/**\n * Merges `other` into `target`. `target` will be modified\n * and returned\n */\nfunction mergeStats (target: DefaultStats, other: DefaultStats) {\n target.stop()\n other.stop()\n\n // Merge queues\n target.queue = [...target.queue, ...other.queue]\n\n // TODO: how to merge moving averages?\n return target\n}\n","export default async function pReflect(promise) {\n\ttry {\n\t\tconst value = await promise;\n\n\t\treturn {\n\t\t\tstatus: 'fulfilled',\n\t\t\tvalue,\n\t\t\tisFulfilled: true,\n\t\t\tisRejected: false\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tstatus: 'rejected',\n\t\t\treason: error,\n\t\t\tisFulfilled: false,\n\t\t\tisRejected: true\n\t\t};\n\t}\n}\n\nexport function isFulfilled(promiseResult) {\n\treturn 'value' in promiseResult;\n}\n\nexport function isRejected(promiseResult) {\n\treturn 'reason' in promiseResult;\n}\n","import checkPrivateRedeclaration from \"./checkPrivateRedeclaration.js\";\nexport default function _classPrivateFieldInitSpec(obj, privateMap, value) {\n checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}","export default function _classExtractFieldDescriptor(receiver, privateMap, action) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}","import classApplyDescriptorSet from \"./classApplyDescriptorSet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n\n descriptor.value = value;\n }\n}","import classApplyDescriptorGet from \"./classApplyDescriptorGet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"get\");\n return classApplyDescriptorGet(receiver, descriptor);\n}","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n\n return descriptor.value;\n}","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (fn, resolve, args) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => fn(...args))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (fn, resolve, args) => {\n\t\tqueue.enqueue(run.bind(undefined, fn, resolve, args));\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (fn, ...args) => new Promise(resolve => {\n\t\tenqueue(fn, resolve, args);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue: () => {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n","import pReflect from 'p-reflect';\nimport pLimit from 'p-limit';\n\nexport default async function pSettle(array, options = {}) {\n\tconst {concurrency = Number.POSITIVE_INFINITY} = options;\n\tconst limit = pLimit(concurrency);\n\n\treturn Promise.all(array.map(element => {\n\t\tif (element && typeof element.then === 'function') {\n\t\t\treturn pReflect(element);\n\t\t}\n\n\t\tif (typeof element === 'function') {\n\t\t\treturn pReflect(limit(() => element()));\n\t\t}\n\n\t\treturn pReflect(Promise.resolve(element));\n\t}));\n}\n","import { logger } from '@libp2p/logger'\nimport pSettle from 'p-settle'\nimport { codes } from './errors.js'\nimport errCode from 'err-code'\nimport type { Listener, Transport, TransportManager, TransportManagerEvents } from '@libp2p/interface-transport'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { Components } from '@libp2p/components'\nimport { trackedMap } from '@libp2p/tracked-map'\n\nconst log = logger('libp2p:transports')\n\nexport interface TransportManagerInit {\n faultTolerance?: FaultTolerance\n}\n\nexport class DefaultTransportManager extends EventEmitter implements TransportManager, Startable {\n private readonly components: Components\n private readonly transports: Map\n private readonly listeners: Map\n private readonly faultTolerance: FaultTolerance\n private started: boolean\n\n constructor (components: Components, init: TransportManagerInit = {}) {\n super()\n\n this.components = components\n this.started = false\n this.transports = new Map()\n this.listeners = trackedMap({\n component: 'transport-manager',\n metric: 'listeners',\n metrics: this.components.getMetrics()\n })\n this.faultTolerance = init.faultTolerance ?? FaultTolerance.FATAL_ALL\n }\n\n /**\n * Adds a `Transport` to the manager\n */\n add (transport: Transport) {\n const tag = transport[Symbol.toStringTag]\n\n if (tag == null) {\n throw errCode(new Error('Transport must have a valid tag'), codes.ERR_INVALID_KEY)\n }\n\n if (this.transports.has(tag)) {\n throw errCode(new Error('There is already a transport with this tag'), codes.ERR_DUPLICATE_TRANSPORT)\n }\n\n log('adding transport %s', tag)\n\n this.transports.set(tag, transport)\n\n if (!this.listeners.has(tag)) {\n this.listeners.set(tag, [])\n }\n }\n\n isStarted () {\n return this.started\n }\n\n async start () {\n // Listen on the provided transports for the provided addresses\n const addrs = this.components.getAddressManager().getListenAddrs()\n\n await this.listen(addrs)\n\n this.started = true\n }\n\n /**\n * Stops all listeners\n */\n async stop () {\n const tasks = []\n for (const [key, listeners] of this.listeners) {\n log('closing listeners for %s', key)\n while (listeners.length > 0) {\n const listener = listeners.pop()\n\n if (listener == null) {\n continue\n }\n\n tasks.push(listener.close())\n }\n }\n\n await Promise.all(tasks)\n log('all listeners closed')\n for (const key of this.listeners.keys()) {\n this.listeners.set(key, [])\n }\n\n this.started = false\n }\n\n /**\n * Dials the given Multiaddr over it's supported transport\n */\n async dial (ma: Multiaddr, options?: AbortOptions): Promise {\n const transport = this.transportForMultiaddr(ma)\n\n if (transport == null) {\n throw errCode(new Error(`No transport available for address ${String(ma)}`), codes.ERR_TRANSPORT_UNAVAILABLE)\n }\n\n try {\n return await transport.dial(ma, {\n ...options,\n upgrader: this.components.getUpgrader()\n })\n } catch (err: any) {\n if (err.code == null) {\n err.code = codes.ERR_TRANSPORT_DIAL_FAILED\n }\n\n throw err\n }\n }\n\n /**\n * Returns all Multiaddr's the listeners are using\n */\n getAddrs (): Multiaddr[] {\n let addrs: Multiaddr[] = []\n for (const listeners of this.listeners.values()) {\n for (const listener of listeners) {\n addrs = [...addrs, ...listener.getAddrs()]\n }\n }\n return addrs\n }\n\n /**\n * Returns all the transports instances\n */\n getTransports () {\n return Array.of(...this.transports.values())\n }\n\n /**\n * Finds a transport that matches the given Multiaddr\n */\n transportForMultiaddr (ma: Multiaddr) {\n for (const transport of this.transports.values()) {\n const addrs = transport.filter([ma])\n\n if (addrs.length > 0) {\n return transport\n }\n }\n }\n\n /**\n * Starts listeners for each listen Multiaddr\n */\n async listen (addrs: Multiaddr[]) {\n if (addrs == null || addrs.length === 0) {\n log('no addresses were provided for listening, this node is dial only')\n return\n }\n\n const couldNotListen = []\n\n for (const [key, transport] of this.transports.entries()) {\n const supportedAddrs = transport.filter(addrs)\n const tasks = []\n\n // For each supported multiaddr, create a listener\n for (const addr of supportedAddrs) {\n log('creating listener for %s on %s', key, addr)\n const listener = transport.createListener({\n upgrader: this.components.getUpgrader()\n })\n\n let listeners = this.listeners.get(key)\n\n if (listeners == null) {\n listeners = []\n this.listeners.set(key, listeners)\n }\n\n listeners.push(listener)\n\n // Track listen/close events\n listener.addEventListener('listening', () => {\n this.dispatchEvent(new CustomEvent('listener:listening', {\n detail: listener\n }))\n })\n listener.addEventListener('close', () => {\n this.dispatchEvent(new CustomEvent('listener:close', {\n detail: listener\n }))\n })\n\n // We need to attempt to listen on everything\n tasks.push(listener.listen(addr))\n }\n\n // Keep track of transports we had no addresses for\n if (tasks.length === 0) {\n couldNotListen.push(key)\n continue\n }\n\n const results = await pSettle(tasks)\n // If we are listening on at least 1 address, succeed.\n // TODO: we should look at adding a retry (`p-retry`) here to better support\n // listening on remote addresses as they may be offline. We could then potentially\n // just wait for any (`p-any`) listener to succeed on each transport before returning\n const isListening = results.find(r => r.isFulfilled)\n if ((isListening == null) && this.faultTolerance !== FaultTolerance.NO_FATAL) {\n throw errCode(new Error(`Transport (${key}) could not listen on any available address`), codes.ERR_NO_VALID_ADDRESSES)\n }\n }\n\n // If no transports were able to listen, throw an error. This likely\n // means we were given addresses we do not have transports for\n if (couldNotListen.length === this.transports.size) {\n const message = `no valid addresses were provided for transports [${couldNotListen.join(', ')}]`\n if (this.faultTolerance === FaultTolerance.FATAL_ALL) {\n throw errCode(new Error(message), codes.ERR_NO_VALID_ADDRESSES)\n }\n log(`libp2p in dial mode only: ${message}`)\n }\n }\n\n /**\n * Removes the given transport from the manager.\n * If a transport has any running listeners, they will be closed.\n */\n async remove (key: string) {\n log('removing %s', key)\n\n // Close any running listeners\n for (const listener of this.listeners.get(key) ?? []) {\n await listener.close()\n }\n\n this.transports.delete(key)\n this.listeners.delete(key)\n }\n\n /**\n * Removes all transports from the manager.\n * If any listeners are running, they will be closed.\n *\n * @async\n */\n async removeAll () {\n const tasks = []\n for (const key of this.transports.keys()) {\n tasks.push(this.remove(key))\n }\n\n await Promise.all(tasks)\n }\n}\n\n/**\n * Enum Transport Manager Fault Tolerance values\n */\nexport enum FaultTolerance {\n /**\n * should be used for failing in any listen circumstance\n */\n FATAL_ALL = 0,\n\n /**\n * should be used for not failing when not listening\n */\n NO_FATAL\n}\n","\nexport const PROTOCOL_ID = '/multistream/1.0.0'\n","\nimport { Uint8ArrayList } from 'uint8arraylist'\nimport * as lp from 'it-length-prefixed'\nimport { pipe } from 'it-pipe'\nimport errCode from 'err-code'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport first from 'it-first'\nimport { abortableSource } from 'abortable-iterator'\nimport { toString as uint8ArrayToString } from 'uint8arrays/to-string'\nimport type { Pushable } from 'it-pushable'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Source } from 'it-stream-types'\nimport type { Reader } from 'it-reader'\nimport type { MultistreamSelectInit } from '.'\n\nconst NewLine = uint8ArrayFromString('\\n')\n\nexport function encode (buffer: Uint8Array | Uint8ArrayList): Uint8ArrayList {\n const list = new Uint8ArrayList(buffer, NewLine)\n\n return lp.encode.single(list)\n}\n\n/**\n * `write` encodes and writes a single buffer\n */\nexport function write (writer: Pushable, buffer: Uint8Array | Uint8ArrayList, options: MultistreamSelectInit = {}) {\n const encoded = encode(buffer)\n\n if (options.writeBytes === true) {\n writer.push(encoded.subarray())\n } else {\n writer.push(encoded)\n }\n}\n\n/**\n * `writeAll` behaves like `write`, except it encodes an array of items as a single write\n */\nexport function writeAll (writer: Pushable, buffers: Uint8Array[], options: MultistreamSelectInit = {}) {\n const list = new Uint8ArrayList()\n\n for (const buf of buffers) {\n list.append(encode(buf))\n }\n\n if (options.writeBytes === true) {\n writer.push(list.subarray())\n } else {\n writer.push(list)\n }\n}\n\nexport async function read (reader: Reader, options?: AbortOptions): Promise {\n let byteLength = 1 // Read single byte chunks until the length is known\n const varByteSource = { // No return impl - we want the reader to remain readable\n [Symbol.asyncIterator]: () => varByteSource,\n next: async () => await reader.next(byteLength)\n }\n\n let input: Source = varByteSource\n\n // If we have been passed an abort signal, wrap the input source in an abortable\n // iterator that will throw if the operation is aborted\n if (options?.signal != null) {\n input = abortableSource(varByteSource, options.signal)\n }\n\n // Once the length has been parsed, read chunk for that length\n const onLength = (l: number) => {\n byteLength = l\n }\n\n const buf = await pipe(\n input,\n lp.decode({ onLength }),\n async (source) => await first(source)\n )\n\n if (buf == null) {\n throw errCode(new Error('no buffer returned'), 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE')\n }\n\n if (buf.get(buf.byteLength - 1) !== NewLine[0]) {\n throw errCode(new Error('missing newline'), 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE')\n }\n\n return buf.sublist(0, -1) // Remove newline\n}\n\nexport async function readString (reader: Reader, options?: AbortOptions) {\n const buf = await read(reader, options)\n\n return uint8ArrayToString(buf.subarray())\n}\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport * as multistream from './multistream.js'\nimport { handshake } from 'it-handshake'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { PROTOCOL_ID } from './index.js'\nimport type { Duplex } from 'it-stream-types'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { ByteArrayInit, ByteListInit, MultistreamSelectInit, ProtocolStream } from './index.js'\n\nconst log = logger('libp2p:mss:select')\n\nexport async function select (stream: Duplex, protocols: string | string[], options: ByteArrayInit): Promise>\nexport async function select (stream: Duplex, protocols: string | string[], options?: ByteListInit): Promise>\nexport async function select (stream: Duplex, protocols: string | string[], options: MultistreamSelectInit = {}): Promise> {\n protocols = Array.isArray(protocols) ? [...protocols] : [protocols]\n const { reader, writer, rest, stream: shakeStream } = handshake(stream)\n\n const protocol = protocols.shift()\n\n if (protocol == null) {\n throw new Error('At least one protocol must be specified')\n }\n\n log('select: write [\"%s\", \"%s\"]', PROTOCOL_ID, protocol)\n const p1 = uint8ArrayFromString(PROTOCOL_ID)\n const p2 = uint8ArrayFromString(protocol)\n multistream.writeAll(writer, [p1, p2], options)\n\n let response = await multistream.readString(reader, options)\n log('select: read \"%s\"', response)\n\n // Read the protocol response if we got the protocolId in return\n if (response === PROTOCOL_ID) {\n response = await multistream.readString(reader, options)\n log('select: read \"%s\"', response)\n }\n\n // We're done\n if (response === protocol) {\n rest()\n return { stream: shakeStream, protocol }\n }\n\n // We haven't gotten a valid ack, try the other protocols\n for (const protocol of protocols) {\n log('select: write \"%s\"', protocol)\n multistream.write(writer, uint8ArrayFromString(protocol), options)\n const response = await multistream.readString(reader, options)\n log('select: read \"%s\" for \"%s\"', response, protocol)\n\n if (response === protocol) {\n rest() // End our writer so others can start writing to stream\n return { stream: shakeStream, protocol }\n }\n }\n\n rest()\n throw errCode(new Error('protocol selection failed'), 'ERR_UNSUPPORTED_PROTOCOL')\n}\n","import { logger } from '@libp2p/logger'\nimport * as multistream from './multistream.js'\nimport { handshake } from 'it-handshake'\nimport { PROTOCOL_ID } from './constants.js'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { Uint8ArrayList } from 'uint8arraylist'\nimport type { Duplex } from 'it-stream-types'\nimport type { ByteArrayInit, ByteListInit, MultistreamSelectInit, ProtocolStream } from './index.js'\n\nconst log = logger('libp2p:mss:handle')\n\nexport async function handle (stream: Duplex, protocols: string | string[], options: ByteArrayInit): Promise>\nexport async function handle (stream: Duplex, protocols: string | string[], options?: ByteListInit): Promise>\nexport async function handle (stream: Duplex, protocols: string | string[], options?: MultistreamSelectInit): Promise> {\n protocols = Array.isArray(protocols) ? protocols : [protocols]\n const { writer, reader, rest, stream: shakeStream } = handshake(stream)\n\n while (true) {\n const protocol = await multistream.readString(reader, options)\n log('read \"%s\"', protocol)\n\n if (protocol === PROTOCOL_ID) {\n log('respond with \"%s\" for \"%s\"', PROTOCOL_ID, protocol)\n multistream.write(writer, uint8ArrayFromString(PROTOCOL_ID), options)\n continue\n }\n\n if (protocols.includes(protocol)) {\n multistream.write(writer, uint8ArrayFromString(protocol), options)\n log('respond with \"%s\" for \"%s\"', protocol, protocol)\n rest()\n return { stream: shakeStream, protocol }\n }\n\n if (protocol === 'ls') {\n // \\n\\n\\n\n multistream.write(writer, new Uint8ArrayList(...protocols.map(p => multistream.encode(uint8ArrayFromString(p)))), options)\n // multistream.writeAll(writer, protocols.map(p => uint8ArrayFromString(p)))\n log('respond with \"%s\" for %s', protocols, protocol)\n continue\n }\n\n multistream.write(writer, uint8ArrayFromString('na'), options)\n log('respond with \"na\" for \"%s\"', protocol)\n }\n}\n","import type { Multiaddr } from '@multiformats/multiaddr'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type * as Status from './status.js'\nimport type { Duplex } from 'it-stream-types'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Uint8ArrayList } from 'uint8arraylist'\n\nexport interface ConnectionTimeline {\n open: number\n upgraded?: number\n close?: number\n}\n\n/**\n * Outbound conections are opened by the local node, inbound streams are opened by the remote\n */\nexport type Direction = 'inbound' | 'outbound'\n\nexport interface ConnectionStat {\n /**\n * Outbound conections are opened by the local node, inbound streams are opened by the remote\n */\n direction: Direction\n\n /**\n * Lifecycle times for the connection\n */\n timeline: ConnectionTimeline\n\n /**\n * Once a multiplexer has been negotiated for this stream, it will be set on the stat object\n */\n multiplexer?: string\n\n /**\n * Once a connection encrypter has been negotiated for this stream, it will be set on the stat object\n */\n encryption?: string\n\n /**\n * The current status of the connection\n */\n status: keyof typeof Status\n}\n\nexport interface StreamTimeline {\n open: number\n close?: number\n}\n\nexport interface StreamStat {\n /**\n * Outbound streams are opened by the local node, inbound streams are opened by the remote\n */\n direction: Direction\n\n /**\n * Lifecycle times for the stream\n */\n timeline: StreamTimeline\n\n /**\n * Once a protocol has been negotiated for this stream, it will be set on the stat object\n */\n protocol?: string\n}\n\n/**\n * A Stream is a data channel between two peers that\n * can be written to and read from at both ends.\n *\n * It may be encrypted and multiplexed depending on the\n * configuration of the nodes.\n */\nexport interface Stream extends Duplex {\n /**\n * Close a stream for reading and writing\n */\n close: () => void\n\n /**\n * Close a stream for reading only\n */\n closeRead: () => void\n\n /**\n * Close a stream for writing only\n */\n closeWrite: () => void\n\n /**\n * Call when a local error occurs, should close the stream for reading and writing\n */\n abort: (err: Error) => void\n\n /**\n * Call when a remote error occurs, should close the stream for reading and writing\n */\n reset: () => void\n\n /**\n * Unique identifier for a stream\n */\n id: string\n\n /**\n * Stats about this stream\n */\n stat: StreamStat\n\n /**\n * User defined stream metadata\n */\n metadata: Record\n}\n\n/**\n * A Connection is a high-level representation of a connection\n * to a remote peer that may have been secured by encryption and\n * multiplexed, depending on the configuration of the nodes\n * between which the connection is made.\n */\nexport interface Connection {\n id: string\n stat: ConnectionStat\n remoteAddr: Multiaddr\n remotePeer: PeerId\n tags: string[]\n streams: Stream[]\n\n newStream: (multicodecs: string | string[], options?: AbortOptions) => Promise\n addStream: (stream: Stream) => void\n removeStream: (id: string) => void\n close: () => Promise\n}\n\nexport const symbol = Symbol.for('@libp2p/connection')\n\nexport function isConnection (other: any): other is Connection {\n return other != null && Boolean(other[symbol])\n}\n\nexport interface ConnectionGater {\n /**\n * denyDialMultiaddr tests whether we're permitted to Dial the\n * specified peer.\n *\n * This is called by the dialer.connectToPeer implementation before\n * dialling a peer.\n *\n * Return true to prevent dialing the passed peer.\n */\n denyDialPeer: (peerId: PeerId) => Promise\n\n /**\n * denyDialMultiaddr tests whether we're permitted to dial the specified\n * multiaddr for the given peer.\n *\n * This is called by the dialer.connectToPeer implementation after it has\n * resolved the peer's addrs, and prior to dialling each.\n *\n * Return true to prevent dialing the passed peer on the passed multiaddr.\n */\n denyDialMultiaddr: (peerId: PeerId, multiaddr: Multiaddr) => Promise\n\n /**\n * denyInboundConnection tests whether an incipient inbound connection is allowed.\n *\n * This is called by the upgrader, or by the transport directly (e.g. QUIC,\n * Bluetooth), straight after it has accepted a connection from its socket.\n *\n * Return true to deny the incoming passed connection.\n */\n denyInboundConnection: (maConn: MultiaddrConnection) => Promise\n\n /**\n * denyOutboundConnection tests whether an incipient outbound connection is allowed.\n *\n * This is called by the upgrader, or by the transport directly (e.g. QUIC,\n * Bluetooth), straight after it has created a connection with its socket.\n *\n * Return true to deny the incoming passed connection.\n */\n denyOutboundConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise\n\n /**\n * denyInboundEncryptedConnection tests whether a given connection, now encrypted,\n * is allowed.\n *\n * This is called by the upgrader, after it has performed the security\n * handshake, and before it negotiates the muxer, or by the directly by the\n * transport, at the exact same checkpoint.\n *\n * Return true to deny the passed secured connection.\n */\n denyInboundEncryptedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise\n\n /**\n * denyOutboundEncryptedConnection tests whether a given connection, now encrypted,\n * is allowed.\n *\n * This is called by the upgrader, after it has performed the security\n * handshake, and before it negotiates the muxer, or by the directly by the\n * transport, at the exact same checkpoint.\n *\n * Return true to deny the passed secured connection.\n */\n denyOutboundEncryptedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise\n\n /**\n * denyInboundUpgradedConnection tests whether a fully capable connection is allowed.\n *\n * This is called after encryption has been negotiated and the connection has been\n * multiplexed, if a multiplexer is configured.\n *\n * Return true to deny the passed upgraded connection.\n */\n denyInboundUpgradedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise\n\n /**\n * denyOutboundUpgradedConnection tests whether a fully capable connection is allowed.\n *\n * This is called after encryption has been negotiated and the connection has been\n * multiplexed, if a multiplexer is configured.\n *\n * Return true to deny the passed upgraded connection.\n */\n denyOutboundUpgradedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise\n\n /**\n * Used by the address book to filter passed addresses.\n *\n * Return true to allow storing the passed multiaddr for the passed peer.\n */\n filterMultiaddrForPeer: (peer: PeerId, multiaddr: Multiaddr) => Promise\n}\n\nexport interface ConnectionProtector {\n\n /**\n * Takes a given Connection and creates a private encryption stream\n * between its two peers from the PSK the Protector instance was\n * created with.\n */\n protect: (connection: MultiaddrConnection) => Promise\n}\n\nexport interface MultiaddrConnectionTimeline {\n open: number\n upgraded?: number\n close?: number\n}\n\n/**\n * A MultiaddrConnection is returned by transports after dialing\n * a peer. It is a low-level primitive and is the raw connection\n * without encryption or stream multiplexing.\n */\nexport interface MultiaddrConnection extends Duplex {\n close: (err?: Error) => Promise\n remoteAddr: Multiaddr\n timeline: MultiaddrConnectionTimeline\n}\n","import type { Multiaddr } from '@multiformats/multiaddr'\nimport errCode from 'err-code'\nimport { OPEN, CLOSING, CLOSED } from '@libp2p/interface-connection/status'\nimport { symbol } from '@libp2p/interface-connection'\nimport type { Connection, ConnectionStat, Stream } from '@libp2p/interface-connection'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport { logger } from '@libp2p/logger'\nimport type { AbortOptions } from '@libp2p/interfaces'\n\nconst log = logger('libp2p:connection')\n\ninterface ConnectionInit {\n remoteAddr: Multiaddr\n remotePeer: PeerId\n newStream: (protocols: string[], options?: AbortOptions) => Promise\n close: () => Promise\n getStreams: () => Stream[]\n stat: ConnectionStat\n}\n\n/**\n * An implementation of the js-libp2p connection.\n * Any libp2p transport should use an upgrader to return this connection.\n */\nexport class ConnectionImpl implements Connection {\n /**\n * Connection identifier.\n */\n public readonly id: string\n\n /**\n * Observed multiaddr of the remote peer\n */\n public readonly remoteAddr: Multiaddr\n\n /**\n * Remote peer id\n */\n public readonly remotePeer: PeerId\n\n /**\n * Connection metadata\n */\n public readonly stat: ConnectionStat\n\n /**\n * User provided tags\n *\n */\n public tags: string[]\n\n /**\n * Reference to the new stream function of the multiplexer\n */\n private readonly _newStream: (protocols: string[], options?: AbortOptions) => Promise\n\n /**\n * Reference to the close function of the raw connection\n */\n private readonly _close: () => Promise\n\n /**\n * Reference to the getStreams function of the muxer\n */\n private readonly _getStreams: () => Stream[]\n\n private _closing: boolean\n\n /**\n * An implementation of the js-libp2p connection.\n * Any libp2p transport should use an upgrader to return this connection.\n */\n constructor (init: ConnectionInit) {\n const { remoteAddr, remotePeer, newStream, close, getStreams, stat } = init\n\n this.id = `${(parseInt(String(Math.random() * 1e9))).toString(36)}${Date.now()}`\n this.remoteAddr = remoteAddr\n this.remotePeer = remotePeer\n this.stat = {\n ...stat,\n status: OPEN\n }\n this._newStream = newStream\n this._close = close\n this._getStreams = getStreams\n this.tags = []\n this._closing = false\n }\n\n get [Symbol.toStringTag] () {\n return 'Connection'\n }\n\n get [symbol] () {\n return true\n }\n\n /**\n * Get all the streams of the muxer\n */\n get streams () {\n return this._getStreams()\n }\n\n /**\n * Create a new stream from this connection\n */\n async newStream (protocols: string | string[], options?: AbortOptions): Promise {\n if (this.stat.status === CLOSING) {\n throw errCode(new Error('the connection is being closed'), 'ERR_CONNECTION_BEING_CLOSED')\n }\n\n if (this.stat.status === CLOSED) {\n throw errCode(new Error('the connection is closed'), 'ERR_CONNECTION_CLOSED')\n }\n\n if (!Array.isArray(protocols)) {\n protocols = [protocols]\n }\n\n const stream = await this._newStream(protocols, options)\n\n stream.stat.direction = 'outbound'\n\n return stream\n }\n\n /**\n * Add a stream when it is opened to the registry\n */\n addStream (stream: Stream) {\n stream.stat.direction = 'inbound'\n }\n\n /**\n * Remove stream registry after it is closed\n */\n removeStream (id: string) {\n\n }\n\n /**\n * Close the connection\n */\n async close () {\n if (this.stat.status === CLOSED || this._closing) {\n return\n }\n\n this.stat.status = CLOSING\n\n // close all streams - this can throw if we're not multiplexed\n try {\n this.streams.forEach(s => s.close())\n } catch (err) {\n log.error(err)\n }\n\n // Close raw connection\n this._closing = true\n await this._close()\n this._closing = false\n\n this.stat.timeline.close = Date.now()\n this.stat.status = CLOSED\n }\n}\n\nexport function createConnection (init: ConnectionInit): Connection {\n return new ConnectionImpl(init)\n}\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport { codes } from './errors.js'\nimport { isTopology, StreamHandlerOptions, StreamHandlerRecord } from '@libp2p/interface-registrar'\nimport merge from 'merge-options'\nimport type { Registrar, StreamHandler, Topology } from '@libp2p/interface-registrar'\nimport type { PeerProtocolsChangeData } from '@libp2p/interface-peer-store'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { Components } from '@libp2p/components'\n\nconst log = logger('libp2p:registrar')\n\nexport const DEFAULT_MAX_INBOUND_STREAMS = 32\nexport const DEFAULT_MAX_OUTBOUND_STREAMS = 64\n\n/**\n * Responsible for notifying registered protocols of events in the network.\n */\nexport class DefaultRegistrar implements Registrar {\n private readonly topologies: Map>\n private readonly handlers: Map\n private readonly components: Components\n\n constructor (components: Components) {\n this.topologies = new Map()\n this.handlers = new Map()\n this.components = components\n\n this._onDisconnect = this._onDisconnect.bind(this)\n this._onProtocolChange = this._onProtocolChange.bind(this)\n\n this.components.getConnectionManager().addEventListener('peer:disconnect', this._onDisconnect)\n\n // happens after identify\n this.components.getPeerStore().addEventListener('change:protocols', this._onProtocolChange)\n }\n\n getProtocols () {\n return Array.from(new Set([\n ...this.topologies.keys(),\n ...this.handlers.keys()\n ])).sort()\n }\n\n getHandler (protocol: string) {\n const handler = this.handlers.get(protocol)\n\n if (handler == null) {\n throw errCode(new Error(`No handler registered for protocol ${protocol}`), codes.ERR_NO_HANDLER_FOR_PROTOCOL)\n }\n\n return handler\n }\n\n getTopologies (protocol: string) {\n const topologies = this.topologies.get(protocol)\n\n if (topologies == null) {\n return []\n }\n\n return [\n ...topologies.values()\n ]\n }\n\n /**\n * Registers the `handler` for each protocol\n */\n async handle (protocol: string, handler: StreamHandler, opts?: StreamHandlerOptions): Promise {\n if (this.handlers.has(protocol)) {\n throw errCode(new Error(`Handler already registered for protocol ${protocol}`), codes.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED)\n }\n\n const options = merge.bind({ ignoreUndefined: true })({\n maxInboundStreams: DEFAULT_MAX_INBOUND_STREAMS,\n maxOutboundStreams: DEFAULT_MAX_OUTBOUND_STREAMS\n }, opts)\n\n this.handlers.set(protocol, {\n handler,\n options\n })\n\n // Add new protocols to self protocols in the Protobook\n await this.components.getPeerStore().protoBook.add(this.components.getPeerId(), [protocol])\n }\n\n /**\n * Removes the handler for each protocol. The protocol\n * will no longer be supported on streams.\n */\n async unhandle (protocols: string | string[]) {\n const protocolList = Array.isArray(protocols) ? protocols : [protocols]\n\n protocolList.forEach(protocol => {\n this.handlers.delete(protocol)\n })\n\n // Remove protocols from self protocols in the Protobook\n await this.components.getPeerStore().protoBook.remove(this.components.getPeerId(), protocolList)\n }\n\n /**\n * Register handlers for a set of multicodecs given\n */\n async register (protocol: string, topology: Topology): Promise {\n if (!isTopology(topology)) {\n log.error('topology must be an instance of interfaces/topology')\n throw errCode(new Error('topology must be an instance of interfaces/topology'), codes.ERR_INVALID_PARAMETERS)\n }\n\n // Create topology\n const id = `${(Math.random() * 1e9).toString(36)}${Date.now()}`\n\n let topologies = this.topologies.get(protocol)\n\n if (topologies == null) {\n topologies = new Map()\n this.topologies.set(protocol, topologies)\n }\n\n topologies.set(id, topology)\n\n // Set registrar\n await topology.setRegistrar(this)\n\n return id\n }\n\n /**\n * Unregister topology\n */\n unregister (id: string) {\n for (const [protocol, topologies] of this.topologies.entries()) {\n if (topologies.has(id)) {\n topologies.delete(id)\n\n if (topologies.size === 0) {\n this.topologies.delete(protocol)\n }\n }\n }\n }\n\n /**\n * Remove a disconnected peer from the record\n */\n _onDisconnect (evt: CustomEvent) {\n const connection = evt.detail\n\n void this.components.getPeerStore().protoBook.get(connection.remotePeer)\n .then(peerProtocols => {\n for (const protocol of peerProtocols) {\n const topologies = this.topologies.get(protocol)\n\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue\n }\n\n for (const topology of topologies.values()) {\n topology.onDisconnect(connection.remotePeer)\n }\n }\n })\n .catch(err => {\n log.error(err)\n })\n }\n\n /**\n * Check if a new peer support the multicodecs for this topology\n */\n _onProtocolChange (evt: CustomEvent) {\n const { peerId, protocols, oldProtocols } = evt.detail\n\n const removed = oldProtocols.filter(protocol => !protocols.includes(protocol))\n const added = protocols.filter(protocol => !oldProtocols.includes(protocol))\n\n for (const protocol of removed) {\n const topologies = this.topologies.get(protocol)\n\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue\n }\n\n for (const topology of topologies.values()) {\n topology.onDisconnect(peerId)\n }\n }\n\n for (const protocol of added) {\n const topologies = this.topologies.get(protocol)\n\n if (topologies == null) {\n // no topologies are interested in this protocol\n continue\n }\n\n for (const topology of topologies.values()) {\n const connection = this.components.getConnectionManager().getConnections(peerId)[0]\n\n if (connection == null) {\n continue\n }\n\n topology.onConnect(peerId, connection)\n }\n }\n }\n}\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport * as mss from '@libp2p/multistream-select'\nimport { pipe } from 'it-pipe'\n// @ts-expect-error mutable-proxy does not export types\nimport mutableProxy from 'mutable-proxy'\nimport { codes } from './errors.js'\nimport { createConnection } from '@libp2p/connection'\nimport { CustomEvent, EventEmitter } from '@libp2p/interfaces/events'\nimport { peerIdFromString } from '@libp2p/peer-id'\nimport type { MultiaddrConnection, Connection, Stream } from '@libp2p/interface-connection'\nimport type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface-connection-encrypter'\nimport type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface-stream-muxer'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Upgrader, UpgraderEvents } from '@libp2p/interface-transport'\nimport type { Duplex } from 'it-stream-types'\nimport { Components, isInitializable } from '@libp2p/components'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport type { Registrar } from '@libp2p/interface-registrar'\nimport { DEFAULT_MAX_INBOUND_STREAMS, DEFAULT_MAX_OUTBOUND_STREAMS } from './registrar.js'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport { abortableDuplex } from 'abortable-iterator'\nimport { setMaxListeners } from 'events'\n\nconst log = logger('libp2p:upgrader')\n\ninterface CreateConectionOptions {\n cryptoProtocol: string\n direction: 'inbound' | 'outbound'\n maConn: MultiaddrConnection\n upgradedConn: Duplex\n remotePeer: PeerId\n muxerFactory?: StreamMuxerFactory\n}\n\ninterface OnStreamOptions {\n connection: Connection\n stream: Stream\n protocol: string\n}\n\nexport interface CryptoResult extends SecuredConnection {\n protocol: string\n}\n\nexport interface UpgraderInit {\n connectionEncryption: ConnectionEncrypter[]\n muxers: StreamMuxerFactory[]\n\n /**\n * An amount of ms by which an inbound connection upgrade\n * must complete\n */\n inboundUpgradeTimeout: number\n}\n\nfunction findIncomingStreamLimit (protocol: string, registrar: Registrar) {\n try {\n const { options } = registrar.getHandler(protocol)\n\n return options.maxInboundStreams\n } catch (err: any) {\n if (err.code !== codes.ERR_NO_HANDLER_FOR_PROTOCOL) {\n throw err\n }\n }\n\n return DEFAULT_MAX_INBOUND_STREAMS\n}\n\nfunction findOutgoingStreamLimit (protocol: string, registrar: Registrar) {\n try {\n const { options } = registrar.getHandler(protocol)\n\n return options.maxOutboundStreams\n } catch (err: any) {\n if (err.code !== codes.ERR_NO_HANDLER_FOR_PROTOCOL) {\n throw err\n }\n }\n\n return DEFAULT_MAX_OUTBOUND_STREAMS\n}\n\nfunction countStreams (protocol: string, direction: 'inbound' | 'outbound', connection: Connection) {\n let streamCount = 0\n\n connection.streams.forEach(stream => {\n if (stream.stat.direction === direction && stream.stat.protocol === protocol) {\n streamCount++\n }\n })\n\n return streamCount\n}\n\nexport class DefaultUpgrader extends EventEmitter implements Upgrader {\n private readonly components: Components\n private readonly connectionEncryption: Map\n private readonly muxers: Map\n private readonly inboundUpgradeTimeout: number\n\n constructor (components: Components, init: UpgraderInit) {\n super()\n\n this.components = components\n this.connectionEncryption = new Map()\n\n init.connectionEncryption.forEach(encrypter => {\n this.connectionEncryption.set(encrypter.protocol, encrypter)\n })\n\n this.muxers = new Map()\n\n init.muxers.forEach(muxer => {\n this.muxers.set(muxer.protocol, muxer)\n })\n\n this.inboundUpgradeTimeout = init.inboundUpgradeTimeout\n }\n\n /**\n * Upgrades an inbound connection\n */\n async upgradeInbound (maConn: MultiaddrConnection): Promise {\n let encryptedConn\n let remotePeer\n let upgradedConn: Duplex\n let muxerFactory: StreamMuxerFactory | undefined\n let cryptoProtocol\n let setPeer\n let proxyPeer\n const metrics = this.components.getMetrics()\n\n const timeoutController = new TimeoutController(this.inboundUpgradeTimeout)\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n\n try {\n const abortableStream = abortableDuplex(maConn, timeoutController.signal)\n maConn.source = abortableStream.source\n maConn.sink = abortableStream.sink\n\n if (await this.components.getConnectionGater().denyInboundConnection(maConn)) {\n throw errCode(new Error('The multiaddr connection is blocked by gater.acceptConnection'), codes.ERR_CONNECTION_INTERCEPTED)\n }\n\n if (metrics != null) {\n ({ setTarget: setPeer, proxy: proxyPeer } = mutableProxy())\n const idString = `${(Math.random() * 1e9).toString(36)}${Date.now()}`\n setPeer({ toString: () => idString })\n metrics.trackStream({ stream: maConn, remotePeer: proxyPeer })\n }\n\n log('starting the inbound connection upgrade')\n\n // Protect\n let protectedConn = maConn\n const protector = this.components.getConnectionProtector()\n\n if (protector != null) {\n log('protecting the inbound connection')\n protectedConn = await protector.protect(maConn)\n }\n\n try {\n // Encrypt the connection\n ({\n conn: encryptedConn,\n remotePeer,\n protocol: cryptoProtocol\n } = await this._encryptInbound(protectedConn))\n\n if (await this.components.getConnectionGater().denyInboundEncryptedConnection(remotePeer, {\n ...protectedConn,\n ...encryptedConn\n })) {\n throw errCode(new Error('The multiaddr connection is blocked by gater.acceptEncryptedConnection'), codes.ERR_CONNECTION_INTERCEPTED)\n }\n\n // Multiplex the connection\n if (this.muxers.size > 0) {\n const multiplexed = await this._multiplexInbound({\n ...protectedConn,\n ...encryptedConn\n }, this.muxers)\n muxerFactory = multiplexed.muxerFactory\n upgradedConn = multiplexed.stream\n } else {\n upgradedConn = encryptedConn\n }\n } catch (err: any) {\n log.error('Failed to upgrade inbound connection', err)\n await maConn.close(err)\n throw err\n }\n\n if (await this.components.getConnectionGater().denyInboundUpgradedConnection(remotePeer, {\n ...protectedConn,\n ...encryptedConn\n })) {\n throw errCode(new Error('The multiaddr connection is blocked by gater.acceptEncryptedConnection'), codes.ERR_CONNECTION_INTERCEPTED)\n }\n\n if (metrics != null) {\n metrics.updatePlaceholder(proxyPeer, remotePeer)\n setPeer(remotePeer)\n }\n\n log('Successfully upgraded inbound connection')\n\n return this._createConnection({\n cryptoProtocol,\n direction: 'inbound',\n maConn,\n upgradedConn,\n muxerFactory,\n remotePeer\n })\n } finally {\n timeoutController.clear()\n }\n }\n\n /**\n * Upgrades an outbound connection\n */\n async upgradeOutbound (maConn: MultiaddrConnection): Promise {\n const idStr = maConn.remoteAddr.getPeerId()\n if (idStr == null) {\n throw errCode(new Error('outbound connection must have a peer id'), codes.ERR_INVALID_MULTIADDR)\n }\n\n const remotePeerId = peerIdFromString(idStr)\n\n if (await this.components.getConnectionGater().denyOutboundConnection(remotePeerId, maConn)) {\n throw errCode(new Error('The multiaddr connection is blocked by connectionGater.denyOutboundConnection'), codes.ERR_CONNECTION_INTERCEPTED)\n }\n\n let encryptedConn\n let remotePeer\n let upgradedConn\n let cryptoProtocol\n let muxerFactory\n let setPeer\n let proxyPeer\n const metrics = this.components.getMetrics()\n\n if (metrics != null) {\n ({ setTarget: setPeer, proxy: proxyPeer } = mutableProxy())\n const idString = `${(Math.random() * 1e9).toString(36)}${Date.now()}`\n setPeer({ toB58String: () => idString })\n metrics.trackStream({ stream: maConn, remotePeer: proxyPeer })\n }\n\n log('Starting the outbound connection upgrade')\n\n // Protect\n let protectedConn = maConn\n const protector = this.components.getConnectionProtector()\n\n if (protector != null) {\n protectedConn = await protector.protect(maConn)\n }\n\n try {\n // Encrypt the connection\n ({\n conn: encryptedConn,\n remotePeer,\n protocol: cryptoProtocol\n } = await this._encryptOutbound(protectedConn, remotePeerId))\n\n if (await this.components.getConnectionGater().denyOutboundEncryptedConnection(remotePeer, {\n ...protectedConn,\n ...encryptedConn\n })) {\n throw errCode(new Error('The multiaddr connection is blocked by gater.acceptEncryptedConnection'), codes.ERR_CONNECTION_INTERCEPTED)\n }\n\n // Multiplex the connection\n if (this.muxers.size > 0) {\n const multiplexed = await this._multiplexOutbound({\n ...protectedConn,\n ...encryptedConn\n }, this.muxers)\n muxerFactory = multiplexed.muxerFactory\n upgradedConn = multiplexed.stream\n } else {\n upgradedConn = encryptedConn\n }\n } catch (err: any) {\n log.error('Failed to upgrade outbound connection', err)\n await maConn.close(err)\n throw err\n }\n\n if (await this.components.getConnectionGater().denyOutboundUpgradedConnection(remotePeer, {\n ...protectedConn,\n ...encryptedConn\n })) {\n throw errCode(new Error('The multiaddr connection is blocked by gater.acceptEncryptedConnection'), codes.ERR_CONNECTION_INTERCEPTED)\n }\n\n if (metrics != null) {\n metrics.updatePlaceholder(proxyPeer, remotePeer)\n setPeer(remotePeer)\n }\n\n log('Successfully upgraded outbound connection')\n\n return this._createConnection({\n cryptoProtocol,\n direction: 'outbound',\n maConn,\n upgradedConn,\n muxerFactory,\n remotePeer\n })\n }\n\n /**\n * A convenience method for generating a new `Connection`\n */\n _createConnection (opts: CreateConectionOptions): Connection {\n const {\n cryptoProtocol,\n direction,\n maConn,\n upgradedConn,\n remotePeer,\n muxerFactory\n } = opts\n\n let muxer: StreamMuxer | undefined\n let newStream: ((multicodecs: string[], options?: AbortOptions) => Promise) | undefined\n let connection: Connection // eslint-disable-line prefer-const\n\n if (muxerFactory != null) {\n // Create the muxer\n muxer = muxerFactory.createStreamMuxer({\n direction,\n // Run anytime a remote stream is created\n onIncomingStream: muxedStream => {\n if (connection == null) {\n return\n }\n\n void Promise.resolve()\n .then(async () => {\n const protocols = this.components.getRegistrar().getProtocols()\n const { stream, protocol } = await mss.handle(muxedStream, protocols)\n log('%s: incoming stream opened on %s', direction, protocol)\n\n const metrics = this.components.getMetrics()\n\n if (metrics != null) {\n metrics.trackStream({ stream, remotePeer, protocol })\n }\n\n if (connection == null) {\n return\n }\n\n const incomingLimit = findIncomingStreamLimit(protocol, this.components.getRegistrar())\n const streamCount = countStreams(protocol, 'inbound', connection)\n\n if (streamCount === incomingLimit) {\n muxedStream.abort(errCode(new Error(`Too many inbound protocol streams for protocol \"${protocol}\" - limit ${incomingLimit}`), codes.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS))\n\n return\n }\n\n muxedStream.stat.protocol = protocol\n\n // If a protocol stream has been successfully negotiated and is to be passed to the application,\n // the peerstore should ensure that the peer is registered with that protocol\n this.components.getPeerStore().protoBook.add(remotePeer, [protocol]).catch(err => log.error(err))\n\n connection.addStream(muxedStream)\n this._onStream({ connection, stream: { ...muxedStream, ...stream }, protocol })\n })\n .catch(err => {\n log.error(err)\n\n if (muxedStream.stat.timeline.close == null) {\n muxedStream.close()\n }\n })\n },\n // Run anytime a stream closes\n onStreamEnd: muxedStream => {\n connection?.removeStream(muxedStream.id)\n }\n })\n\n if (isInitializable(muxer)) {\n muxer.init(this.components)\n }\n\n newStream = async (protocols: string[], options: AbortOptions = {}): Promise => {\n if (muxer == null) {\n throw errCode(new Error('Stream is not multiplexed'), codes.ERR_MUXER_UNAVAILABLE)\n }\n\n log('%s: starting new stream on %s', direction, protocols)\n const muxedStream = muxer.newStream()\n const metrics = this.components.getMetrics()\n let controller: TimeoutController | undefined\n\n try {\n if (options.signal == null) {\n log('No abort signal was passed while trying to negotiate protocols %s falling back to default timeout', protocols)\n\n controller = new TimeoutController(30000)\n options.signal = controller.signal\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, controller.signal)\n } catch {}\n }\n\n const { stream, protocol } = await mss.select(muxedStream, protocols, options)\n\n if (metrics != null) {\n metrics.trackStream({ stream, remotePeer, protocol })\n }\n\n const outgoingLimit = findOutgoingStreamLimit(protocol, this.components.getRegistrar())\n const streamCount = countStreams(protocol, 'outbound', connection)\n\n if (streamCount === outgoingLimit) {\n const err = errCode(new Error(`Too many outbound protocol streams for protocol \"${protocol}\" - limit ${outgoingLimit}`), codes.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS)\n muxedStream.abort(err)\n\n throw err\n }\n\n muxedStream.stat.protocol = protocol\n\n // If a protocol stream has been successfully negotiated and is to be passed to the application,\n // the peerstore should ensure that the peer is registered with that protocol\n this.components.getPeerStore().protoBook.add(remotePeer, [protocol]).catch(err => log.error(err))\n\n return {\n ...muxedStream,\n ...stream,\n stat: {\n ...muxedStream.stat,\n protocol\n }\n }\n } catch (err: any) {\n log.error('could not create new stream', err)\n\n if (muxedStream.stat.timeline.close == null) {\n muxedStream.close()\n }\n\n if (err.code != null) {\n throw err\n }\n\n throw errCode(err, codes.ERR_UNSUPPORTED_PROTOCOL)\n } finally {\n if (controller != null) {\n controller.clear()\n }\n }\n }\n\n // Pipe all data through the muxer\n pipe(upgradedConn, muxer, upgradedConn).catch(log.error)\n }\n\n const _timeline = maConn.timeline\n maConn.timeline = new Proxy(_timeline, {\n set: (...args) => {\n if (connection != null && args[1] === 'close' && args[2] != null && _timeline.close == null) {\n // Wait for close to finish before notifying of the closure\n (async () => {\n try {\n if (connection.stat.status === 'OPEN') {\n await connection.close()\n }\n } catch (err: any) {\n log.error(err)\n } finally {\n this.dispatchEvent(new CustomEvent('connectionEnd', {\n detail: connection\n }))\n }\n })().catch(err => {\n log.error(err)\n })\n }\n\n return Reflect.set(...args)\n }\n })\n maConn.timeline.upgraded = Date.now()\n\n const errConnectionNotMultiplexed = () => {\n throw errCode(new Error('connection is not multiplexed'), codes.ERR_CONNECTION_NOT_MULTIPLEXED)\n }\n\n // Create the connection\n connection = createConnection({\n remoteAddr: maConn.remoteAddr,\n remotePeer: remotePeer,\n stat: {\n status: 'OPEN',\n direction,\n timeline: maConn.timeline,\n multiplexer: muxer?.protocol,\n encryption: cryptoProtocol\n },\n newStream: newStream ?? errConnectionNotMultiplexed,\n getStreams: () => muxer != null ? muxer.streams : errConnectionNotMultiplexed(),\n close: async () => {\n await maConn.close()\n // Ensure remaining streams are closed\n if (muxer != null) {\n muxer.close()\n }\n }\n })\n\n this.dispatchEvent(new CustomEvent('connection', {\n detail: connection\n }))\n\n return connection\n }\n\n /**\n * Routes incoming streams to the correct handler\n */\n _onStream (opts: OnStreamOptions): void {\n const { connection, stream, protocol } = opts\n const { handler } = this.components.getRegistrar().getHandler(protocol)\n\n handler({ connection, stream })\n }\n\n /**\n * Attempts to encrypt the incoming `connection` with the provided `cryptos`\n */\n async _encryptInbound (connection: Duplex): Promise {\n const protocols = Array.from(this.connectionEncryption.keys())\n log('handling inbound crypto protocol selection', protocols)\n\n try {\n const { stream, protocol } = await mss.handle(connection, protocols, {\n writeBytes: true\n })\n const encrypter = this.connectionEncryption.get(protocol)\n\n if (encrypter == null) {\n throw new Error(`no crypto module found for ${protocol}`)\n }\n\n log('encrypting inbound connection...')\n\n return {\n ...await encrypter.secureInbound(this.components.getPeerId(), stream),\n protocol\n }\n } catch (err: any) {\n throw errCode(err, codes.ERR_ENCRYPTION_FAILED)\n }\n }\n\n /**\n * Attempts to encrypt the given `connection` with the provided connection encrypters.\n * The first `ConnectionEncrypter` module to succeed will be used\n */\n async _encryptOutbound (connection: MultiaddrConnection, remotePeerId: PeerId): Promise {\n const protocols = Array.from(this.connectionEncryption.keys())\n log('selecting outbound crypto protocol', protocols)\n\n try {\n const { stream, protocol } = await mss.select(connection, protocols, {\n writeBytes: true\n })\n const encrypter = this.connectionEncryption.get(protocol)\n\n if (encrypter == null) {\n throw new Error(`no crypto module found for ${protocol}`)\n }\n\n log('encrypting outbound connection to %p', remotePeerId)\n\n return {\n ...await encrypter.secureOutbound(this.components.getPeerId(), stream, remotePeerId),\n protocol\n }\n } catch (err: any) {\n throw errCode(err, codes.ERR_ENCRYPTION_FAILED)\n }\n }\n\n /**\n * Selects one of the given muxers via multistream-select. That\n * muxer will be used for all future streams on the connection.\n */\n async _multiplexOutbound (connection: MultiaddrConnection, muxers: Map): Promise<{ stream: Duplex, muxerFactory?: StreamMuxerFactory}> {\n const protocols = Array.from(muxers.keys())\n log('outbound selecting muxer %s', protocols)\n try {\n const { stream, protocol } = await mss.select(connection, protocols, {\n writeBytes: true\n })\n log('%s selected as muxer protocol', protocol)\n const muxerFactory = muxers.get(protocol)\n return { stream, muxerFactory }\n } catch (err: any) {\n log.error('error multiplexing outbound stream', err)\n throw errCode(err, codes.ERR_MUXER_UNAVAILABLE)\n }\n }\n\n /**\n * Registers support for one of the given muxers via multistream-select. The\n * selected muxer will be used for all future streams on the connection.\n */\n async _multiplexInbound (connection: MultiaddrConnection, muxers: Map): Promise<{ stream: Duplex, muxerFactory?: StreamMuxerFactory}> {\n const protocols = Array.from(muxers.keys())\n log('inbound handling muxers %s', protocols)\n try {\n const { stream, protocol } = await mss.handle(connection, protocols, {\n writeBytes: true\n })\n const muxerFactory = muxers.get(protocol)\n return { stream, muxerFactory }\n } catch (err: any) {\n log.error('error multiplexing inbound stream', err)\n throw errCode(err, codes.ERR_MUXER_UNAVAILABLE)\n }\n }\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface Identify {\n protocolVersion?: string\n agentVersion?: string\n publicKey?: Uint8Array\n listenAddrs: Uint8Array[]\n observedAddr?: Uint8Array\n protocols: string[]\n signedPeerRecord?: Uint8Array\n}\n\nexport namespace Identify {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.protocolVersion != null) {\n writer.uint32(42)\n writer.string(obj.protocolVersion)\n }\n\n if (obj.agentVersion != null) {\n writer.uint32(50)\n writer.string(obj.agentVersion)\n }\n\n if (obj.publicKey != null) {\n writer.uint32(10)\n writer.bytes(obj.publicKey)\n }\n\n if (obj.listenAddrs != null) {\n for (const value of obj.listenAddrs) {\n writer.uint32(18)\n writer.bytes(value)\n }\n } else {\n throw new Error('Protocol error: required field \"listenAddrs\" was not found in object')\n }\n\n if (obj.observedAddr != null) {\n writer.uint32(34)\n writer.bytes(obj.observedAddr)\n }\n\n if (obj.protocols != null) {\n for (const value of obj.protocols) {\n writer.uint32(26)\n writer.string(value)\n }\n } else {\n throw new Error('Protocol error: required field \"protocols\" was not found in object')\n }\n\n if (obj.signedPeerRecord != null) {\n writer.uint32(66)\n writer.bytes(obj.signedPeerRecord)\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {}\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 5:\n obj.protocolVersion = reader.string()\n break\n case 6:\n obj.agentVersion = reader.string()\n break\n case 1:\n obj.publicKey = reader.bytes()\n break\n case 2:\n obj.listenAddrs = obj.listenAddrs ?? []\n obj.listenAddrs.push(reader.bytes())\n break\n case 4:\n obj.observedAddr = reader.bytes()\n break\n case 3:\n obj.protocols = obj.protocols ?? []\n obj.protocols.push(reader.string())\n break\n case 8:\n obj.signedPeerRecord = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n obj.listenAddrs = obj.listenAddrs ?? []\n obj.protocols = obj.protocols ?? []\n\n if (obj.listenAddrs == null) {\n throw new Error('Protocol error: value for required field \"listenAddrs\" was not found in protobuf')\n }\n\n if (obj.protocols == null) {\n throw new Error('Protocol error: value for required field \"protocols\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Identify): Uint8Array => {\n return encodeMessage(obj, Identify.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Identify => {\n return decodeMessage(buf, Identify.codec())\n }\n}\n","export const version = '0.38.0'\nexport const name = 'libp2p'\n","\nimport { version } from '../version.js'\n\nexport const PROTOCOL_VERSION = 'ipfs/0.1.0' // deprecated\nexport const AGENT_VERSION = `js-libp2p/${version}`\nexport const MULTICODEC_IDENTIFY = '/ipfs/id/1.0.0' // deprecated\nexport const MULTICODEC_IDENTIFY_PUSH = '/ipfs/id/push/1.0.0' // deprecated\n\nexport const IDENTIFY_PROTOCOL_VERSION = '0.1.0'\nexport const MULTICODEC_IDENTIFY_PROTOCOL_NAME = 'id'\nexport const MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME = 'id/push'\nexport const MULTICODEC_IDENTIFY_PROTOCOL_VERSION = '1.0.0'\nexport const MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION = '1.0.0'\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport * as lp from 'it-length-prefixed'\nimport { pipe } from 'it-pipe'\nimport drain from 'it-drain'\nimport first from 'it-first'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { Multiaddr, protocols } from '@multiformats/multiaddr'\nimport { Identify } from './pb/message.js'\nimport { RecordEnvelope, PeerRecord } from '@libp2p/peer-record'\nimport {\n MULTICODEC_IDENTIFY,\n MULTICODEC_IDENTIFY_PUSH,\n IDENTIFY_PROTOCOL_VERSION,\n MULTICODEC_IDENTIFY_PROTOCOL_NAME,\n MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME,\n MULTICODEC_IDENTIFY_PROTOCOL_VERSION,\n MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION\n} from './consts.js'\nimport { codes } from '../errors.js'\nimport type { IncomingStreamData } from '@libp2p/interface-registrar'\nimport type { Connection, Stream } from '@libp2p/interface-connection'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport { peerIdFromKeys } from '@libp2p/peer-id'\nimport type { Components } from '@libp2p/components'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport { abortableDuplex } from 'abortable-iterator'\nimport { setMaxListeners } from 'events'\n\nconst log = logger('libp2p:identify')\n\n// https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L52\nconst MAX_IDENTIFY_MESSAGE_SIZE = 1024 * 8\n\nexport interface HostProperties {\n agentVersion: string\n}\n\nexport interface IdentifyServiceInit {\n /**\n * The prefix to use for the protocol (default: 'ipfs')\n */\n protocolPrefix: string\n\n /**\n * What details we should send as part of an identify message\n */\n host: HostProperties\n\n /**\n * How long we should wait for a remote peer to send their identify response\n */\n timeout: number\n\n /**\n * Identify responses larger than this in bytes will be rejected (default: 8192)\n */\n maxIdentifyMessageSize?: number\n\n maxInboundStreams: number\n maxOutboundStreams: number\n\n maxPushIncomingStreams: number\n maxPushOutgoingStreams: number\n}\n\nexport class IdentifyService implements Startable {\n private readonly components: Components\n private readonly identifyProtocolStr: string\n private readonly identifyPushProtocolStr: string\n private readonly host: {\n protocolVersion: string\n agentVersion: string\n }\n\n private readonly init: IdentifyServiceInit\n private started: boolean\n\n constructor (components: Components, init: IdentifyServiceInit) {\n this.components = components\n this.started = false\n this.init = init\n\n this.identifyProtocolStr = `/${init.protocolPrefix}/${MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`\n this.identifyPushProtocolStr = `/${init.protocolPrefix}/${MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION}`\n\n // Store self host metadata\n this.host = {\n protocolVersion: `${init.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,\n ...init.host\n }\n\n // When a new connection happens, trigger identify\n this.components.getConnectionManager().addEventListener('peer:connect', (evt) => {\n const connection = evt.detail\n this.identify(connection).catch(log.error)\n })\n\n // When self multiaddrs change, trigger identify-push\n this.components.getPeerStore().addEventListener('change:multiaddrs', (evt) => {\n const { peerId } = evt.detail\n\n if (this.components.getPeerId().equals(peerId)) {\n void this.pushToPeerStore().catch(err => log.error(err))\n }\n })\n\n // When self protocols change, trigger identify-push\n this.components.getPeerStore().addEventListener('change:protocols', (evt) => {\n const { peerId } = evt.detail\n\n if (this.components.getPeerId().equals(peerId)) {\n void this.pushToPeerStore().catch(err => log.error(err))\n }\n })\n }\n\n isStarted () {\n return this.started\n }\n\n async start () {\n if (this.started) {\n return\n }\n\n await this.components.getPeerStore().metadataBook.setValue(this.components.getPeerId(), 'AgentVersion', uint8ArrayFromString(this.host.agentVersion))\n await this.components.getPeerStore().metadataBook.setValue(this.components.getPeerId(), 'ProtocolVersion', uint8ArrayFromString(this.host.protocolVersion))\n\n await this.components.getRegistrar().handle(this.identifyProtocolStr, (data) => {\n void this._handleIdentify(data).catch(err => {\n log.error(err)\n })\n }, {\n maxInboundStreams: this.init.maxInboundStreams,\n maxOutboundStreams: this.init.maxOutboundStreams\n })\n await this.components.getRegistrar().handle(this.identifyPushProtocolStr, (data) => {\n void this._handlePush(data).catch(err => {\n log.error(err)\n })\n }, {\n maxInboundStreams: this.init.maxPushIncomingStreams,\n maxOutboundStreams: this.init.maxPushOutgoingStreams\n })\n\n this.started = true\n }\n\n async stop () {\n await this.components.getRegistrar().unhandle(this.identifyProtocolStr)\n await this.components.getRegistrar().unhandle(this.identifyPushProtocolStr)\n\n this.started = false\n }\n\n /**\n * Send an Identify Push update to the list of connections\n */\n async push (connections: Connection[]): Promise {\n const signedPeerRecord = await this.components.getPeerStore().addressBook.getRawEnvelope(this.components.getPeerId())\n const listenAddrs = this.components.getAddressManager().getAddresses().map((ma) => ma.bytes)\n const protocols = await this.components.getPeerStore().protoBook.get(this.components.getPeerId())\n\n const pushes = connections.map(async connection => {\n let stream: Stream | undefined\n const timeoutController = new TimeoutController(this.init.timeout)\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n\n try {\n stream = await connection.newStream([this.identifyPushProtocolStr], {\n signal: timeoutController.signal\n })\n\n // make stream abortable\n const source = abortableDuplex(stream, timeoutController.signal)\n\n await pipe(\n [Identify.encode({\n listenAddrs,\n signedPeerRecord,\n protocols\n })],\n lp.encode(),\n source,\n drain\n )\n } catch (err: any) {\n // Just log errors\n log.error('could not push identify update to peer', err)\n } finally {\n if (stream != null) {\n stream.close()\n }\n\n timeoutController.clear()\n }\n })\n\n await Promise.all(pushes)\n }\n\n /**\n * Calls `push` on all peer connections\n */\n async pushToPeerStore () {\n // Do not try to push if we are not running\n if (!this.isStarted()) {\n return\n }\n\n const connections: Connection[] = []\n\n for (const conn of this.components.getConnectionManager().getConnections()) {\n const peerId = conn.remotePeer\n const peer = await this.components.getPeerStore().get(peerId)\n\n if (!peer.protocols.includes(this.identifyPushProtocolStr)) {\n continue\n }\n\n connections.push(conn)\n }\n\n await this.push(connections)\n }\n\n async _identify (connection: Connection, options: AbortOptions = {}): Promise {\n let timeoutController\n let signal = options.signal\n let stream: Stream | undefined\n\n // create a timeout if no abort signal passed\n if (signal == null) {\n timeoutController = new TimeoutController(this.init.timeout)\n signal = timeoutController.signal\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n }\n\n try {\n stream = await connection.newStream([this.identifyProtocolStr], {\n signal\n })\n\n // make stream abortable\n const source = abortableDuplex(stream, signal)\n\n const data = await pipe(\n [],\n source,\n lp.decode({\n maxDataLength: this.init.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE\n }),\n async (source) => await first(source)\n )\n\n if (data == null) {\n throw errCode(new Error('No data could be retrieved'), codes.ERR_CONNECTION_ENDED)\n }\n\n try {\n return Identify.decode(data)\n } catch (err: any) {\n throw errCode(err, codes.ERR_INVALID_MESSAGE)\n }\n } finally {\n if (timeoutController != null) {\n timeoutController.clear()\n }\n\n if (stream != null) {\n stream.close()\n }\n }\n }\n\n /**\n * Requests the `Identify` message from peer associated with the given `connection`.\n * If the identified peer does not match the `PeerId` associated with the connection,\n * an error will be thrown.\n */\n async identify (connection: Connection, options: AbortOptions = {}): Promise {\n const message = await this._identify(connection, options)\n\n const {\n publicKey,\n listenAddrs,\n protocols,\n observedAddr,\n signedPeerRecord,\n agentVersion,\n protocolVersion\n } = message\n\n if (publicKey == null) {\n throw errCode(new Error('public key was missing from identify message'), codes.ERR_MISSING_PUBLIC_KEY)\n }\n\n const id = await peerIdFromKeys(publicKey)\n\n if (!connection.remotePeer.equals(id)) {\n throw errCode(new Error('identified peer does not match the expected peer'), codes.ERR_INVALID_PEER)\n }\n\n if (this.components.getPeerId().equals(id)) {\n throw errCode(new Error('identified peer is our own peer id?'), codes.ERR_INVALID_PEER)\n }\n\n // Get the observedAddr if there is one\n const cleanObservedAddr = IdentifyService.getCleanMultiaddr(observedAddr)\n\n if (signedPeerRecord != null) {\n log('received signed peer record from %p', id)\n\n try {\n const envelope = await RecordEnvelope.openAndCertify(signedPeerRecord, PeerRecord.DOMAIN)\n\n if (!envelope.peerId.equals(id)) {\n throw errCode(new Error('identified peer does not match the expected peer'), codes.ERR_INVALID_PEER)\n }\n\n if (await this.components.getPeerStore().addressBook.consumePeerRecord(envelope)) {\n await this.components.getPeerStore().protoBook.set(id, protocols)\n\n if (agentVersion != null) {\n await this.components.getPeerStore().metadataBook.setValue(id, 'AgentVersion', uint8ArrayFromString(agentVersion))\n }\n\n if (protocolVersion != null) {\n await this.components.getPeerStore().metadataBook.setValue(id, 'ProtocolVersion', uint8ArrayFromString(protocolVersion))\n }\n\n log('identify completed for peer %p and protocols %o', id, protocols)\n\n return\n }\n } catch (err: any) {\n log('received invalid envelope, discard it and fallback to listenAddrs is available', err)\n }\n } else {\n log('no signed peer record received from %p', id)\n }\n\n log('falling back to legacy addresses from %p', id)\n\n // LEGACY: Update peers data in PeerStore\n try {\n await this.components.getPeerStore().addressBook.set(id, listenAddrs.map((addr) => new Multiaddr(addr)))\n } catch (err: any) {\n log.error('received invalid addrs', err)\n }\n\n await this.components.getPeerStore().protoBook.set(id, protocols)\n\n if (agentVersion != null) {\n await this.components.getPeerStore().metadataBook.setValue(id, 'AgentVersion', uint8ArrayFromString(agentVersion))\n }\n\n if (protocolVersion != null) {\n await this.components.getPeerStore().metadataBook.setValue(id, 'ProtocolVersion', uint8ArrayFromString(protocolVersion))\n }\n\n log('identify completed for peer %p and protocols %o', id, protocols)\n\n // TODO: Add and score our observed addr\n log('received observed address of %s', cleanObservedAddr?.toString())\n // this.components.getAddressManager().addObservedAddr(observedAddr)\n }\n\n /**\n * Sends the `Identify` response with the Signed Peer Record\n * to the requesting peer over the given `connection`\n */\n async _handleIdentify (data: IncomingStreamData) {\n const { connection, stream } = data\n const timeoutController = new TimeoutController(this.init.timeout)\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n\n try {\n const publicKey = this.components.getPeerId().publicKey ?? new Uint8Array(0)\n const peerData = await this.components.getPeerStore().get(this.components.getPeerId())\n const multiaddrs = this.components.getAddressManager().getAddresses().map(ma => ma.decapsulateCode(protocols('p2p').code))\n let signedPeerRecord = peerData.peerRecordEnvelope\n\n if (multiaddrs.length > 0 && signedPeerRecord == null) {\n const peerRecord = new PeerRecord({\n peerId: this.components.getPeerId(),\n multiaddrs\n })\n\n const envelope = await RecordEnvelope.seal(peerRecord, this.components.getPeerId())\n await this.components.getPeerStore().addressBook.consumePeerRecord(envelope)\n signedPeerRecord = envelope.marshal().subarray()\n }\n\n const message = Identify.encode({\n protocolVersion: this.host.protocolVersion,\n agentVersion: this.host.agentVersion,\n publicKey,\n listenAddrs: multiaddrs.map(addr => addr.bytes),\n signedPeerRecord,\n observedAddr: connection.remoteAddr.bytes,\n protocols: peerData.protocols\n })\n\n // make stream abortable\n const source = abortableDuplex(stream, timeoutController.signal)\n\n await pipe(\n [message],\n lp.encode(),\n source,\n drain\n )\n } catch (err: any) {\n log.error('could not respond to identify request', err)\n } finally {\n stream.close()\n timeoutController.clear()\n }\n }\n\n /**\n * Reads the Identify Push message from the given `connection`\n */\n async _handlePush (data: IncomingStreamData) {\n const { connection, stream } = data\n const timeoutController = new TimeoutController(this.init.timeout)\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n\n let message: Identify | undefined\n try {\n // make stream abortable\n const source = abortableDuplex(stream, timeoutController.signal)\n\n const data = await pipe(\n [],\n source,\n lp.decode({\n maxDataLength: this.init.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE\n }),\n async (source) => await first(source)\n )\n\n if (data != null) {\n message = Identify.decode(data)\n }\n } catch (err: any) {\n return log.error('received invalid message', err)\n } finally {\n stream.close()\n timeoutController.clear()\n }\n\n if (message == null) {\n return log.error('received invalid message')\n }\n\n const id = connection.remotePeer\n\n if (this.components.getPeerId().equals(id)) {\n log('received push from ourselves?')\n return\n }\n\n log('received push from %p', id)\n\n if (message.signedPeerRecord != null) {\n log('received signedPeerRecord in push')\n\n try {\n const envelope = await RecordEnvelope.openAndCertify(message.signedPeerRecord, PeerRecord.DOMAIN)\n\n if (await this.components.getPeerStore().addressBook.consumePeerRecord(envelope)) {\n log('consumed signedPeerRecord sent in push')\n\n await this.components.getPeerStore().protoBook.set(id, message.protocols)\n return\n } else {\n log('failed to consume signedPeerRecord sent in push')\n }\n } catch (err: any) {\n log('received invalid envelope, discard it and fallback to listenAddrs is available', err)\n }\n } else {\n log('did not receive signedPeerRecord in push')\n }\n\n // LEGACY: Update peers data in PeerStore\n try {\n await this.components.getPeerStore().addressBook.set(id,\n message.listenAddrs.map((addr) => new Multiaddr(addr)))\n } catch (err: any) {\n log.error('received invalid addrs', err)\n }\n\n // Update the protocols\n try {\n await this.components.getPeerStore().protoBook.set(id, message.protocols)\n } catch (err: any) {\n log.error('received invalid protocols', err)\n }\n\n log('handled push from %p', id)\n }\n\n /**\n * Takes the `addr` and converts it to a Multiaddr if possible\n */\n static getCleanMultiaddr (addr: Uint8Array | string | null | undefined) {\n if (addr != null && addr.length > 0) {\n try {\n return new Multiaddr(addr)\n } catch {\n\n }\n }\n }\n}\n\n/**\n * The protocols the IdentifyService supports\n */\nexport const multicodecs = {\n IDENTIFY: MULTICODEC_IDENTIFY,\n IDENTIFY_PUSH: MULTICODEC_IDENTIFY_PUSH\n}\n\nexport const Message = { Identify }\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message, enumeration } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface FetchRequest {\n identifier: string\n}\n\nexport namespace FetchRequest {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.identifier != null) {\n writer.uint32(10)\n writer.string(obj.identifier)\n } else {\n throw new Error('Protocol error: required field \"identifier\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {}\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.identifier = reader.string()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.identifier == null) {\n throw new Error('Protocol error: value for required field \"identifier\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: FetchRequest): Uint8Array => {\n return encodeMessage(obj, FetchRequest.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): FetchRequest => {\n return decodeMessage(buf, FetchRequest.codec())\n }\n}\n\nexport interface FetchResponse {\n status: FetchResponse.StatusCode\n data: Uint8Array\n}\n\nexport namespace FetchResponse {\n export enum StatusCode {\n OK = 'OK',\n NOT_FOUND = 'NOT_FOUND',\n ERROR = 'ERROR'\n }\n\n enum __StatusCodeValues {\n OK = 0,\n NOT_FOUND = 1,\n ERROR = 2\n }\n\n export namespace StatusCode {\n export const codec = () => {\n return enumeration(__StatusCodeValues)\n }\n }\n\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.status != null) {\n writer.uint32(8)\n FetchResponse.StatusCode.codec().encode(obj.status, writer)\n } else {\n throw new Error('Protocol error: required field \"status\" was not found in object')\n }\n\n if (obj.data != null) {\n writer.uint32(18)\n writer.bytes(obj.data)\n } else {\n throw new Error('Protocol error: required field \"data\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {}\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.status = FetchResponse.StatusCode.codec().decode(reader)\n break\n case 2:\n obj.data = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.status == null) {\n throw new Error('Protocol error: value for required field \"status\" was not found in protobuf')\n }\n\n if (obj.data == null) {\n throw new Error('Protocol error: value for required field \"data\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: FetchResponse): Uint8Array => {\n return encodeMessage(obj, FetchResponse.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): FetchResponse => {\n return decodeMessage(buf, FetchResponse.codec())\n }\n}\n","\n// https://github.com/libp2p/specs/tree/master/fetch#wire-protocol\nexport const PROTOCOL_VERSION = '0.0.1'\nexport const PROTOCOL_NAME = 'fetch'\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport { codes } from '../errors.js'\nimport * as lp from 'it-length-prefixed'\nimport { FetchRequest, FetchResponse } from './pb/proto.js'\nimport { PROTOCOL_NAME, PROTOCOL_VERSION } from './constants.js'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { Stream } from '@libp2p/interface-connection'\nimport type { IncomingStreamData } from '@libp2p/interface-registrar'\nimport type { Components } from '@libp2p/components'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport { abortableDuplex } from 'abortable-iterator'\nimport { pipe } from 'it-pipe'\nimport first from 'it-first'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport { setMaxListeners } from 'events'\n\nconst log = logger('libp2p:fetch')\n\nexport interface FetchServiceInit {\n protocolPrefix: string\n maxInboundStreams: number\n maxOutboundStreams: number\n\n /**\n * How long we should wait for a remote peer to send any data\n */\n timeout: number\n}\n\nexport interface HandleMessageOptions {\n stream: Stream\n protocol: string\n}\n\nexport interface LookupFunction {\n (key: string): Promise\n}\n\n/**\n * A simple libp2p protocol for requesting a value corresponding to a key from a peer.\n * Developers can register one or more lookup function for retrieving the value corresponding to\n * a given key. Each lookup function must act on a distinct part of the overall key space, defined\n * by a fixed prefix that all keys that should be routed to that lookup function will start with.\n */\nexport class FetchService implements Startable {\n public readonly protocol: string\n private readonly components: Components\n private readonly lookupFunctions: Map\n private started: boolean\n private readonly init: FetchServiceInit\n\n constructor (components: Components, init: FetchServiceInit) {\n this.started = false\n this.components = components\n this.protocol = `/${init.protocolPrefix ?? 'libp2p'}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`\n this.lookupFunctions = new Map() // Maps key prefix to value lookup function\n this.handleMessage = this.handleMessage.bind(this)\n this.init = init\n }\n\n async start () {\n await this.components.getRegistrar().handle(this.protocol, (data) => {\n void this.handleMessage(data)\n .catch(err => {\n log.error(err)\n })\n .finally(() => {\n data.stream.close()\n })\n }, {\n maxInboundStreams: this.init.maxInboundStreams,\n maxOutboundStreams: this.init.maxOutboundStreams\n })\n this.started = true\n }\n\n async stop () {\n await this.components.getRegistrar().unhandle(this.protocol)\n this.started = false\n }\n\n isStarted () {\n return this.started\n }\n\n /**\n * Sends a request to fetch the value associated with the given key from the given peer\n */\n async fetch (peer: PeerId, key: string, options: AbortOptions = {}): Promise {\n log('dialing %s to %p', this.protocol, peer)\n\n const connection = await this.components.getConnectionManager().openConnection(peer, options)\n let timeoutController\n let signal = options.signal\n let stream: Stream | undefined\n\n // create a timeout if no abort signal passed\n if (signal == null) {\n timeoutController = new TimeoutController(this.init.timeout)\n signal = timeoutController.signal\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n }\n\n try {\n stream = await connection.newStream([this.protocol], {\n signal\n })\n\n // make stream abortable\n const source = abortableDuplex(stream, signal)\n\n const result = await pipe(\n [FetchRequest.encode({ identifier: key })],\n lp.encode(),\n source,\n lp.decode(),\n async function (source) {\n const buf = await first(source)\n\n if (buf == null) {\n throw errCode(new Error('No data received'), codes.ERR_INVALID_MESSAGE)\n }\n\n const response = FetchResponse.decode(buf)\n\n switch (response.status) {\n case (FetchResponse.StatusCode.OK): {\n return response.data\n }\n case (FetchResponse.StatusCode.NOT_FOUND): {\n return null\n }\n case (FetchResponse.StatusCode.ERROR): {\n const errmsg = (new TextDecoder()).decode(response.data)\n throw errCode(new Error('Error in fetch protocol response: ' + errmsg), codes.ERR_INVALID_PARAMETERS)\n }\n default: {\n throw errCode(new Error('Unknown response status'), codes.ERR_INVALID_MESSAGE)\n }\n }\n }\n )\n\n return result ?? null\n } finally {\n if (timeoutController != null) {\n timeoutController.clear()\n }\n\n if (stream != null) {\n stream.close()\n }\n }\n }\n\n /**\n * Invoked when a fetch request is received. Reads the request message off the given stream and\n * responds based on looking up the key in the request via the lookup callback that corresponds\n * to the key's prefix.\n */\n async handleMessage (data: IncomingStreamData) {\n const { stream } = data\n const self = this\n\n await pipe(\n stream,\n lp.decode(),\n async function * (source) {\n const buf = await first(source)\n\n if (buf == null) {\n throw errCode(new Error('No data received'), codes.ERR_INVALID_MESSAGE)\n }\n\n // for await (const buf of source) {\n const request = FetchRequest.decode(buf)\n\n let response: FetchResponse\n const lookup = self._getLookupFunction(request.identifier)\n if (lookup != null) {\n const data = await lookup(request.identifier)\n if (data != null) {\n response = { status: FetchResponse.StatusCode.OK, data }\n } else {\n response = { status: FetchResponse.StatusCode.NOT_FOUND, data: new Uint8Array(0) }\n }\n } else {\n const errmsg = (new TextEncoder()).encode('No lookup function registered for key: ' + request.identifier)\n response = { status: FetchResponse.StatusCode.ERROR, data: errmsg }\n }\n\n yield FetchResponse.encode(response)\n },\n lp.encode(),\n stream\n )\n }\n\n /**\n * Given a key, finds the appropriate function for looking up its corresponding value, based on\n * the key's prefix.\n */\n _getLookupFunction (key: string) {\n for (const prefix of this.lookupFunctions.keys()) {\n if (key.startsWith(prefix)) {\n return this.lookupFunctions.get(prefix)\n }\n }\n }\n\n /**\n * Registers a new lookup callback that can map keys to values, for a given set of keys that\n * share the same prefix\n */\n registerLookupFunction (prefix: string, lookup: LookupFunction) {\n if (this.lookupFunctions.has(prefix)) {\n throw errCode(new Error(\"Fetch protocol handler for key prefix '\" + prefix + \"' already registered\"), codes.ERR_KEY_ALREADY_EXISTS)\n }\n\n this.lookupFunctions.set(prefix, lookup)\n }\n\n /**\n * Registers a new lookup callback that can map keys to values, for a given set of keys that\n * share the same prefix.\n */\n unregisterLookupFunction (prefix: string, lookup?: LookupFunction) {\n if (lookup != null) {\n const existingLookup = this.lookupFunctions.get(prefix)\n\n if (existingLookup !== lookup) {\n return\n }\n }\n\n this.lookupFunctions.delete(prefix)\n }\n}\n","\nexport const PROTOCOL = '/ipfs/ping/1.0.0'\nexport const PING_LENGTH = 32\nexport const PROTOCOL_VERSION = '1.0.0'\nexport const PROTOCOL_NAME = 'ping'\n","import { logger } from '@libp2p/logger'\nimport errCode from 'err-code'\nimport { codes } from '../errors.js'\nimport { randomBytes } from '@libp2p/crypto'\nimport { pipe } from 'it-pipe'\nimport first from 'it-first'\nimport { equals as uint8ArrayEquals } from 'uint8arrays/equals'\nimport { PROTOCOL_NAME, PING_LENGTH, PROTOCOL_VERSION } from './constants.js'\nimport type { IncomingStreamData } from '@libp2p/interface-registrar'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { Components } from '@libp2p/components'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport { abortableDuplex } from 'abortable-iterator'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport type { Stream } from '@libp2p/interface-connection'\nimport { setMaxListeners } from 'events'\n\nconst log = logger('libp2p:ping')\n\nexport interface PingServiceInit {\n protocolPrefix: string\n maxInboundStreams: number\n maxOutboundStreams: number\n\n /**\n * How long we should wait for a ping response\n */\n timeout: number\n}\n\nexport class PingService implements Startable {\n public readonly protocol: string\n private readonly components: Components\n private started: boolean\n private readonly init: PingServiceInit\n\n constructor (components: Components, init: PingServiceInit) {\n this.components = components\n this.started = false\n this.protocol = `/${init.protocolPrefix}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`\n this.init = init\n }\n\n async start () {\n await this.components.getRegistrar().handle(this.protocol, this.handleMessage, {\n maxInboundStreams: this.init.maxInboundStreams,\n maxOutboundStreams: this.init.maxOutboundStreams\n })\n this.started = true\n }\n\n async stop () {\n await this.components.getRegistrar().unhandle(this.protocol)\n this.started = false\n }\n\n isStarted () {\n return this.started\n }\n\n /**\n * A handler to register with Libp2p to process ping messages\n */\n handleMessage (data: IncomingStreamData) {\n const { stream } = data\n\n void pipe(stream, stream)\n .catch(err => {\n log.error(err)\n })\n }\n\n /**\n * Ping a given peer and wait for its response, getting the operation latency.\n *\n * @param {PeerId|Multiaddr} peer\n * @returns {Promise}\n */\n async ping (peer: PeerId, options: AbortOptions = {}): Promise {\n log('dialing %s to %p', this.protocol, peer)\n\n const start = Date.now()\n const data = randomBytes(PING_LENGTH)\n const connection = await this.components.getConnectionManager().openConnection(peer, options)\n let timeoutController\n let signal = options.signal\n let stream: Stream | undefined\n\n // create a timeout if no abort signal passed\n if (signal == null) {\n timeoutController = new TimeoutController(this.init.timeout)\n signal = timeoutController.signal\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, timeoutController.signal)\n } catch {}\n }\n\n try {\n stream = await connection.newStream([this.protocol], {\n signal\n })\n\n // make stream abortable\n const source = abortableDuplex(stream, signal)\n\n const result = await pipe(\n [data],\n source,\n async (source) => await first(source)\n )\n const end = Date.now()\n\n if (result == null || !uint8ArrayEquals(data, result.subarray())) {\n throw errCode(new Error('Received wrong ping ack'), codes.ERR_WRONG_PING_ACK)\n }\n\n return end - start\n } finally {\n if (timeoutController != null) {\n timeoutController.clear()\n }\n\n if (stream != null) {\n stream.close()\n }\n }\n }\n}\n","import { isLoopbackAddr } from 'is-loopback-addr'\nimport type { Multiaddr } from '@multiformats/multiaddr'\n\n/**\n * Check if a given multiaddr is a loopback address.\n */\nexport function isLoopback (ma: Multiaddr) {\n const { address } = ma.nodeAddress()\n\n return isLoopbackAddr(address)\n}\n","/**\n * Check if a given ip address is a loopback address\n */\nexport function isLoopbackAddr (ip: string) {\n return /^127\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/i.test(ip) ||\n /^::1$/.test(ip)\n}\n","import { upnpNat, NatAPI } from '@achingbrain/nat-port-mapper'\nimport { logger } from '@libp2p/logger'\nimport { Multiaddr } from '@multiformats/multiaddr'\nimport { isBrowser } from 'wherearewe'\nimport isPrivateIp from 'private-ip'\nimport * as pkg from './version.js'\nimport errCode from 'err-code'\nimport { codes } from './errors.js'\nimport { isLoopback } from '@libp2p/utils/multiaddr/is-loopback'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { Components } from '@libp2p/components'\n\nconst log = logger('libp2p:nat')\nconst DEFAULT_TTL = 7200\n\nfunction highPort (min = 1024, max = 65535) {\n return Math.floor(Math.random() * (max - min + 1) + min)\n}\n\nexport interface PMPOptions {\n /**\n * Whether to enable PMP as well as UPnP\n */\n enabled?: boolean\n}\n\nexport interface NatManagerInit {\n /**\n * Whether to enable the NAT manager\n */\n enabled: boolean\n\n /**\n * Pass a value to use instead of auto-detection\n */\n externalAddress?: string\n\n /**\n * Pass a value to use instead of auto-detection\n */\n localAddress?: string\n\n /**\n * A string value to use for the port mapping description on the gateway\n */\n description?: string\n\n /**\n * How long UPnP port mappings should last for in seconds (minimum 1200)\n */\n ttl?: number\n\n /**\n * Whether to automatically refresh UPnP port mappings when their TTL is reached\n */\n keepAlive: boolean\n\n /**\n * Pass a value to use instead of auto-detection\n */\n gateway?: string\n}\n\nexport class NatManager implements Startable {\n private readonly components: Components\n private readonly enabled: boolean\n private readonly externalAddress?: string\n private readonly localAddress?: string\n private readonly description: string\n private readonly ttl: number\n private readonly keepAlive: boolean\n private readonly gateway?: string\n private started: boolean\n private client?: NatAPI\n\n constructor (components: Components, init: NatManagerInit) {\n this.components = components\n\n this.started = false\n this.enabled = init.enabled\n this.externalAddress = init.externalAddress\n this.localAddress = init.localAddress\n this.description = init.description ?? `${pkg.name}@${pkg.version} ${this.components.getPeerId().toString()}`\n this.ttl = init.ttl ?? DEFAULT_TTL\n this.keepAlive = init.keepAlive ?? true\n this.gateway = init.gateway\n\n if (this.ttl < DEFAULT_TTL) {\n throw errCode(new Error(`NatManager ttl should be at least ${DEFAULT_TTL} seconds`), codes.ERR_INVALID_PARAMETERS)\n }\n }\n\n isStarted () {\n return this.started\n }\n\n start () {}\n\n /**\n * Attempt to use uPnP to configure port mapping using the current gateway.\n *\n * Run after start to ensure the transport manager has all addresses configured.\n */\n afterStart () {\n if (isBrowser || !this.enabled || this.started) {\n return\n }\n\n this.started = true\n\n // done async to not slow down startup\n void this._start().catch((err) => {\n // hole punching errors are non-fatal\n log.error(err)\n })\n }\n\n async _start () {\n const addrs = this.components.getTransportManager().getAddrs()\n\n for (const addr of addrs) {\n // try to open uPnP ports for each thin waist address\n const { family, host, port, transport } = addr.toOptions()\n\n if (!addr.isThinWaistAddress() || transport !== 'tcp') {\n // only bare tcp addresses\n // eslint-disable-next-line no-continue\n continue\n }\n\n if (isLoopback(addr)) {\n // eslint-disable-next-line no-continue\n continue\n }\n\n if (family !== 4) {\n // ignore ipv6\n // eslint-disable-next-line no-continue\n continue\n }\n\n const client = await this._getClient()\n const publicIp = this.externalAddress ?? await client.externalIp()\n\n if (isPrivateIp(publicIp)) {\n throw new Error(`${publicIp} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`)\n }\n\n const publicPort = highPort()\n\n log(`opening uPnP connection from ${publicIp}:${publicPort} to ${host}:${port}`)\n\n await client.map({\n publicPort,\n localPort: port,\n localAddress: this.localAddress,\n protocol: transport.toUpperCase() === 'TCP' ? 'TCP' : 'UDP'\n })\n\n this.components.getAddressManager().addObservedAddr(Multiaddr.fromNodeAddress({\n family: 4,\n address: publicIp,\n port: publicPort\n }, transport))\n }\n }\n\n async _getClient () {\n if (this.client != null) {\n return this.client\n }\n\n this.client = await upnpNat({\n description: this.description,\n ttl: this.ttl,\n keepAlive: this.keepAlive,\n gateway: this.gateway\n })\n\n return this.client\n }\n\n /**\n * Stops the NAT manager\n */\n async stop () {\n if (isBrowser || this.client == null) {\n return\n }\n\n try {\n await this.client.close()\n this.client = undefined\n } catch (err: any) {\n log.error(err)\n }\n }\n}\n","\nexport async function upnpNat () {\n throw new Error('Not supported in browsers')\n}\n\nexport async function pmpNat () {\n throw new Error('Not supported in browsers')\n}\n","import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record'\nimport type { Components } from '@libp2p/components'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport { logger } from '@libp2p/logger'\nimport { protocols } from '@multiformats/multiaddr'\n\nconst log = logger('libp2p:peer-record-updater')\n\nexport class PeerRecordUpdater implements Startable {\n private readonly components: Components\n private started: boolean\n\n constructor (components: Components) {\n this.components = components\n this.started = false\n this.update = this.update.bind(this)\n }\n\n isStarted () {\n return this.started\n }\n\n async start () {\n this.started = true\n this.components.getTransportManager().addEventListener('listener:listening', this.update)\n this.components.getTransportManager().addEventListener('listener:close', this.update)\n this.components.getAddressManager().addEventListener('change:addresses', this.update)\n }\n\n async stop () {\n this.started = false\n this.components.getTransportManager().removeEventListener('listener:listening', this.update)\n this.components.getTransportManager().removeEventListener('listener:close', this.update)\n this.components.getAddressManager().removeEventListener('change:addresses', this.update)\n }\n\n /**\n * Create (or update if existing) self peer record and store it in the AddressBook.\n */\n update () {\n Promise.resolve()\n .then(async () => {\n const peerRecord = new PeerRecord({\n peerId: this.components.getPeerId(),\n multiaddrs: this.components.getAddressManager().getAddresses().map(ma => ma.decapsulateCode(protocols('p2p').code))\n })\n\n const envelope = await RecordEnvelope.seal(peerRecord, this.components.getPeerId())\n await this.components.getPeerStore().addressBook.consumePeerRecord(envelope)\n })\n .catch(err => {\n log.error('Could not update self peer record: %o', err)\n })\n }\n}\n","import errCode from 'err-code'\nimport { messages, codes } from '../errors.js'\nimport type { PeerRouting } from '@libp2p/interface-peer-routing'\nimport type { DHT } from '@libp2p/interface-dht'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { AbortOptions } from '@libp2p/interfaces'\n\n/**\n * Wrapper class to convert events into returned values\n */\nexport class DHTPeerRouting implements PeerRouting {\n private readonly dht: DHT\n\n constructor (dht: DHT) {\n this.dht = dht\n }\n\n async findPeer (peerId: PeerId, options: AbortOptions = {}) {\n for await (const event of this.dht.findPeer(peerId, options)) {\n if (event.name === 'FINAL_PEER') {\n return event.peer\n }\n }\n\n throw errCode(new Error(messages.NOT_FOUND), codes.ERR_NOT_FOUND)\n }\n\n async * getClosestPeers (key: Uint8Array, options: AbortOptions = {}) {\n for await (const event of this.dht.getClosestPeers(key, options)) {\n if (event.name === 'PEER_RESPONSE') {\n yield * event.closer\n }\n }\n }\n}\n","\nexport const codes = {\n ERR_INVALID_PARAMETERS: 'ERR_INVALID_PARAMETERS',\n ERR_NOT_FOUND: 'ERR_NOT_FOUND'\n}\n","import { logger } from '@libp2p/logger'\nimport errcode from 'err-code'\nimport { Multiaddr } from '@multiformats/multiaddr'\nimport { codes } from './errors.js'\nimport { PeerRecord, RecordEnvelope } from '@libp2p/peer-record'\nimport { pipe } from 'it-pipe'\nimport all from 'it-all'\nimport filter from 'it-filter'\nimport map from 'it-map'\nimport each from 'it-foreach'\nimport { peerIdFromPeerId } from '@libp2p/peer-id'\nimport { CustomEvent } from '@libp2p/interfaces/events'\nimport type { AddressFilter, Peer, PeerMultiaddrsChangeData, PeerStore } from '@libp2p/interface-peer-store'\nimport type { Store } from './store.js'\nimport type { Envelope } from '@libp2p/interface-record'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { PeerInfo } from '@libp2p/interface-peer-info'\n\nconst log = logger('libp2p:peer-store:address-book')\nconst EVENT_NAME = 'change:multiaddrs'\n\nasync function allowAll () {\n return true\n}\n\nexport class PeerStoreAddressBook {\n private readonly dispatchEvent: PeerStore['dispatchEvent']\n private readonly store: Store\n private readonly addressFilter: AddressFilter\n\n constructor (dispatchEvent: PeerStore['dispatchEvent'], store: Store, addressFilter?: AddressFilter) {\n this.dispatchEvent = dispatchEvent\n this.store = store\n this.addressFilter = addressFilter ?? allowAll\n }\n\n /**\n * ConsumePeerRecord adds addresses from a signed peer record contained in a record envelope.\n * This will return a boolean that indicates if the record was successfully processed and added\n * into the AddressBook.\n */\n async consumePeerRecord (envelope: Envelope) {\n log.trace('consumePeerRecord await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('consumePeerRecord got write lock')\n\n let peerId\n let peer: Peer | undefined\n let updatedPeer\n\n try {\n let peerRecord\n try {\n peerRecord = PeerRecord.createFromProtobuf(envelope.payload)\n } catch (err: any) {\n log.error('invalid peer record received')\n return false\n }\n\n peerId = peerRecord.peerId\n const multiaddrs = peerRecord.multiaddrs\n\n // Verify peerId\n if (!peerId.equals(envelope.peerId)) {\n log('signing key does not match PeerId in the PeerRecord')\n return false\n }\n\n // ensure the record has multiaddrs\n if (multiaddrs == null || multiaddrs.length === 0) {\n return false\n }\n\n if (await this.store.has(peerId)) {\n peer = await this.store.load(peerId)\n\n if (peer.peerRecordEnvelope != null) {\n const storedEnvelope = await RecordEnvelope.createFromProtobuf(peer.peerRecordEnvelope)\n const storedRecord = PeerRecord.createFromProtobuf(storedEnvelope.payload)\n\n // ensure seq is greater than, or equal to, the last received\n if (storedRecord.seqNumber >= peerRecord.seqNumber) {\n log('sequence number was lower or equal to existing sequence number - stored: %d received: %d', storedRecord.seqNumber, peerRecord.seqNumber)\n return false\n }\n }\n }\n\n const addresses = await filterMultiaddrs(peerId, multiaddrs, this.addressFilter, true)\n\n // Replace unsigned addresses by the new ones from the record\n // TODO: Once we have ttls for the addresses, we should merge these in\n updatedPeer = await this.store.patchOrCreate(peerId, {\n addresses,\n peerRecordEnvelope: envelope.marshal().subarray()\n })\n\n log('stored provided peer record for %p', peerRecord.peerId)\n } finally {\n log.trace('consumePeerRecord release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n multiaddrs: updatedPeer.addresses.map(({ multiaddr }) => multiaddr),\n oldMultiaddrs: peer == null ? [] : peer.addresses.map(({ multiaddr }) => multiaddr)\n }\n }))\n\n return true\n }\n\n async getRawEnvelope (peerId: PeerId) {\n log.trace('getRawEnvelope await read lock')\n const release = await this.store.lock.readLock()\n log.trace('getRawEnvelope got read lock')\n\n try {\n const peer = await this.store.load(peerId)\n\n return peer.peerRecordEnvelope\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log.trace('getRawEnvelope release read lock')\n release()\n }\n }\n\n /**\n * Get an Envelope containing a PeerRecord for the given peer.\n * Returns undefined if no record exists.\n */\n async getPeerRecord (peerId: PeerId) {\n const raw = await this.getRawEnvelope(peerId)\n\n if (raw == null) {\n return undefined\n }\n\n return await RecordEnvelope.createFromProtobuf(raw)\n }\n\n async get (peerId: PeerId) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('get wait for read lock')\n const release = await this.store.lock.readLock()\n log.trace('get got read lock')\n\n try {\n const peer = await this.store.load(peerId)\n\n return peer.addresses\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log.trace('get release read lock')\n release()\n }\n\n return []\n }\n\n async set (peerId: PeerId, multiaddrs: Multiaddr[]) {\n peerId = peerIdFromPeerId(peerId)\n\n if (!Array.isArray(multiaddrs)) {\n log.error('multiaddrs must be an array of Multiaddrs')\n throw errcode(new Error('multiaddrs must be an array of Multiaddrs'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('set await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('set got write lock')\n\n let hasPeer = false\n let peer: Peer | undefined\n let updatedPeer\n\n try {\n const addresses = await filterMultiaddrs(peerId, multiaddrs, this.addressFilter)\n\n // No valid addresses found\n if (addresses.length === 0) {\n return\n }\n\n try {\n peer = await this.store.load(peerId)\n hasPeer = true\n\n if (new Set([\n ...addresses.map(({ multiaddr }) => multiaddr.toString()),\n ...peer.addresses.map(({ multiaddr }) => multiaddr.toString())\n ]).size === peer.addresses.length && addresses.length === peer.addresses.length) {\n // not changing anything, no need to update\n return\n }\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n updatedPeer = await this.store.patchOrCreate(peerId, { addresses })\n\n log('set multiaddrs for %p', peerId)\n } finally {\n log.trace('set multiaddrs for %p', peerId)\n log('set release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n multiaddrs: updatedPeer.addresses.map(addr => addr.multiaddr),\n oldMultiaddrs: peer == null ? [] : peer.addresses.map(({ multiaddr }) => multiaddr)\n }\n }))\n\n // Notify the existence of a new peer\n if (!hasPeer) {\n this.dispatchEvent(new CustomEvent('peer', {\n detail: {\n id: peerId,\n multiaddrs: updatedPeer.addresses.map(addr => addr.multiaddr),\n protocols: updatedPeer.protocols\n }\n }))\n }\n }\n\n async add (peerId: PeerId, multiaddrs: Multiaddr[]) {\n peerId = peerIdFromPeerId(peerId)\n\n if (!Array.isArray(multiaddrs)) {\n log.error('multiaddrs must be an array of Multiaddrs')\n throw errcode(new Error('multiaddrs must be an array of Multiaddrs'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('add await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('add got write lock')\n\n let hasPeer\n let peer: Peer | undefined\n let updatedPeer\n\n try {\n const addresses = await filterMultiaddrs(peerId, multiaddrs, this.addressFilter)\n\n // No valid addresses found\n if (addresses.length === 0) {\n return\n }\n\n try {\n peer = await this.store.load(peerId)\n hasPeer = true\n\n if (new Set([\n ...addresses.map(({ multiaddr }) => multiaddr.toString()),\n ...peer.addresses.map(({ multiaddr }) => multiaddr.toString())\n ]).size === peer.addresses.length) {\n return\n }\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n updatedPeer = await this.store.mergeOrCreate(peerId, { addresses })\n\n log('added multiaddrs for %p', peerId)\n } finally {\n log.trace('set release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n multiaddrs: updatedPeer.addresses.map(addr => addr.multiaddr),\n oldMultiaddrs: peer == null ? [] : peer.addresses.map(({ multiaddr }) => multiaddr)\n }\n }))\n\n // Notify the existence of a new peer\n if (hasPeer === true) {\n this.dispatchEvent(new CustomEvent('peer', {\n detail: {\n id: peerId,\n multiaddrs: updatedPeer.addresses.map(addr => addr.multiaddr),\n protocols: updatedPeer.protocols\n }\n }))\n }\n }\n\n async delete (peerId: PeerId) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('delete await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('delete got write lock')\n\n let peer: Peer | undefined\n\n try {\n try {\n peer = await this.store.load(peerId)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n await this.store.patchOrCreate(peerId, {\n addresses: []\n })\n } finally {\n log.trace('delete release write lock')\n release()\n }\n\n if (peer != null) {\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n multiaddrs: [],\n oldMultiaddrs: peer == null ? [] : peer.addresses.map(({ multiaddr }) => multiaddr)\n }\n }))\n }\n }\n}\n\nasync function filterMultiaddrs (peerId: PeerId, multiaddrs: Multiaddr[], addressFilter: AddressFilter, isCertified: boolean = false) {\n return await pipe(\n multiaddrs,\n (source) => each(source, (multiaddr) => {\n if (!Multiaddr.isMultiaddr(multiaddr)) {\n log.error('multiaddr must be an instance of Multiaddr')\n throw errcode(new Error('multiaddr must be an instance of Multiaddr'), codes.ERR_INVALID_PARAMETERS)\n }\n }),\n (source) => filter(source, async (multiaddr) => await addressFilter(peerId, multiaddr)),\n (source) => map(source, (multiaddr) => {\n return {\n multiaddr: new Multiaddr(multiaddr.toString()),\n isCertified\n }\n }),\n async (source) => await all(source)\n )\n}\n","import { logger } from '@libp2p/logger'\nimport errcode from 'err-code'\nimport { codes } from './errors.js'\nimport { peerIdFromPeerId } from '@libp2p/peer-id'\nimport { equals as uint8arrayEquals } from 'uint8arrays/equals'\nimport { CustomEvent } from '@libp2p/interfaces/events'\nimport type { Store } from './store.js'\nimport type { PeerStore, KeyBook, PeerPublicKeyChangeData, Peer } from '@libp2p/interface-peer-store'\nimport type { PeerId } from '@libp2p/interface-peer-id'\n\nconst log = logger('libp2p:peer-store:key-book')\n\nconst EVENT_NAME = 'change:pubkey'\n\nexport class PeerStoreKeyBook implements KeyBook {\n private readonly dispatchEvent: PeerStore['dispatchEvent']\n private readonly store: Store\n\n /**\n * The KeyBook is responsible for keeping the known public keys of a peer\n */\n constructor (dispatchEvent: PeerStore['dispatchEvent'], store: Store) {\n this.dispatchEvent = dispatchEvent\n this.store = store\n }\n\n /**\n * Set the Peer public key\n */\n async set (peerId: PeerId, publicKey: Uint8Array) {\n peerId = peerIdFromPeerId(peerId)\n\n if (!(publicKey instanceof Uint8Array)) {\n log.error('publicKey must be an instance of Uint8Array to store data')\n throw errcode(new Error('publicKey must be an instance of PublicKey'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('set await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('set got write lock')\n\n let updatedKey = false\n let peer: Peer | undefined\n\n try {\n try {\n peer = await this.store.load(peerId)\n\n if ((peer.pubKey != null) && uint8arrayEquals(peer.pubKey, publicKey)) {\n return\n }\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n await this.store.patchOrCreate(peerId, {\n pubKey: publicKey\n })\n updatedKey = true\n } finally {\n log.trace('set release write lock')\n release()\n }\n\n if (updatedKey) {\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n publicKey: publicKey,\n oldPublicKey: peer == null ? undefined : peer.pubKey\n }\n }))\n }\n }\n\n /**\n * Get Public key of the given PeerId, if stored\n */\n async get (peerId: PeerId) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('get await write lock')\n const release = await this.store.lock.readLock()\n log.trace('get got write lock')\n\n try {\n const peer = await this.store.load(peerId)\n\n return peer.pubKey\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log('get release write lock')\n release()\n }\n }\n\n async delete (peerId: PeerId) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('delete await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('delete got write lock')\n\n let peer: Peer | undefined\n\n try {\n try {\n peer = await this.store.load(peerId)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n await this.store.patchOrCreate(peerId, {\n pubKey: undefined\n })\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log.trace('delete release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n publicKey: undefined,\n oldPublicKey: peer == null ? undefined : peer.pubKey\n }\n }))\n }\n}\n","import { logger } from '@libp2p/logger'\nimport errcode from 'err-code'\nimport { codes } from './errors.js'\nimport { peerIdFromPeerId } from '@libp2p/peer-id'\nimport { equals as uint8ArrayEquals } from 'uint8arrays/equals'\nimport { CustomEvent } from '@libp2p/interfaces/events'\nimport type { Store } from './store.js'\nimport type { PeerStore, MetadataBook, PeerMetadataChangeData, Peer } from '@libp2p/interface-peer-store'\nimport type { PeerId } from '@libp2p/interface-peer-id'\n\nconst log = logger('libp2p:peer-store:metadata-book')\n\nconst EVENT_NAME = 'change:metadata'\n\nexport class PeerStoreMetadataBook implements MetadataBook {\n private readonly dispatchEvent: PeerStore['dispatchEvent']\n private readonly store: Store\n\n /**\n * The MetadataBook is responsible for keeping metadata\n * about known peers\n */\n constructor (dispatchEvent: PeerStore['dispatchEvent'], store: Store) {\n this.dispatchEvent = dispatchEvent\n this.store = store\n }\n\n /**\n * Get the known data of a provided peer\n */\n async get (peerId: PeerId) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('get await read lock')\n const release = await this.store.lock.readLock()\n log.trace('get got read lock')\n\n try {\n const peer = await this.store.load(peerId)\n\n return peer.metadata\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log.trace('get release read lock')\n release()\n }\n\n return new Map()\n }\n\n /**\n * Get specific metadata value, if it exists\n */\n async getValue (peerId: PeerId, key: string) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('getValue await read lock')\n const release = await this.store.lock.readLock()\n log.trace('getValue got read lock')\n\n try {\n const peer = await this.store.load(peerId)\n\n return peer.metadata.get(key)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log.trace('getValue release write lock')\n release()\n }\n }\n\n async set (peerId: PeerId, metadata: Map) {\n peerId = peerIdFromPeerId(peerId)\n\n if (!(metadata instanceof Map)) {\n log.error('valid metadata must be provided to store data')\n throw errcode(new Error('valid metadata must be provided'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('set await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('set got write lock')\n\n let peer: Peer | undefined\n\n try {\n try {\n peer = await this.store.load(peerId)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n await this.store.mergeOrCreate(peerId, {\n metadata\n })\n } finally {\n log.trace('set release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n metadata,\n oldMetadata: peer == null ? new Map() : peer.metadata\n }\n }))\n }\n\n /**\n * Set metadata key and value of a provided peer\n */\n async setValue (peerId: PeerId, key: string, value: Uint8Array) {\n peerId = peerIdFromPeerId(peerId)\n\n if (typeof key !== 'string' || !(value instanceof Uint8Array)) {\n log.error('valid key and value must be provided to store data')\n throw errcode(new Error('valid key and value must be provided'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('setValue await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('setValue got write lock')\n\n let peer: Peer | undefined\n let updatedPeer\n\n try {\n try {\n peer = await this.store.load(peerId)\n const existingValue = peer.metadata.get(key)\n\n if (existingValue != null && uint8ArrayEquals(value, existingValue)) {\n return\n }\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n updatedPeer = await this.store.mergeOrCreate(peerId, {\n metadata: new Map([[key, value]])\n })\n } finally {\n log.trace('setValue release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n metadata: updatedPeer.metadata,\n oldMetadata: peer == null ? new Map() : peer.metadata\n }\n }))\n }\n\n async delete (peerId: PeerId) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('delete await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('delete got write lock')\n\n let peer: Peer | undefined\n\n try {\n try {\n peer = await this.store.load(peerId)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n if (peer != null) {\n await this.store.patch(peerId, {\n metadata: new Map()\n })\n }\n } finally {\n log.trace('delete release write lock')\n release()\n }\n\n if (peer != null) {\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n metadata: new Map(),\n oldMetadata: peer.metadata\n }\n }))\n }\n }\n\n async deleteValue (peerId: PeerId, key: string) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('deleteValue await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('deleteValue got write lock')\n\n let metadata\n let peer: Peer | undefined\n\n try {\n peer = await this.store.load(peerId)\n metadata = peer.metadata\n\n metadata.delete(key)\n\n await this.store.patch(peerId, {\n metadata\n })\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log.trace('deleteValue release write lock')\n release()\n }\n\n if (metadata != null) {\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n metadata,\n oldMetadata: peer == null ? new Map() : peer.metadata\n }\n }))\n }\n }\n}\n","import { logger } from '@libp2p/logger'\nimport errcode from 'err-code'\nimport { codes } from './errors.js'\nimport { peerIdFromPeerId } from '@libp2p/peer-id'\nimport { CustomEvent } from '@libp2p/interfaces/events'\nimport type { Store } from './store.js'\nimport type { Peer, PeerProtocolsChangeData, PeerStore, ProtoBook } from '@libp2p/interface-peer-store'\nimport type { PeerId } from '@libp2p/interface-peer-id'\n\nconst log = logger('libp2p:peer-store:proto-book')\n\nconst EVENT_NAME = 'change:protocols'\n\nexport class PeerStoreProtoBook implements ProtoBook {\n private readonly dispatchEvent: PeerStore['dispatchEvent']\n private readonly store: Store\n\n /**\n * The ProtoBook is responsible for keeping the known supported\n * protocols of a peer\n */\n constructor (dispatchEvent: PeerStore['dispatchEvent'], store: Store) {\n this.dispatchEvent = dispatchEvent\n this.store = store\n }\n\n async get (peerId: PeerId) {\n log.trace('get wait for read lock')\n const release = await this.store.lock.readLock()\n log.trace('get got read lock')\n\n try {\n const peer = await this.store.load(peerId)\n\n return peer.protocols\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n } finally {\n log.trace('get release read lock')\n release()\n }\n\n return []\n }\n\n async set (peerId: PeerId, protocols: string[]) {\n peerId = peerIdFromPeerId(peerId)\n\n if (!Array.isArray(protocols)) {\n log.error('protocols must be provided to store data')\n throw errcode(new Error('protocols must be provided'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('set await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('set got write lock')\n\n let peer\n let updatedPeer\n\n try {\n try {\n peer = await this.store.load(peerId)\n\n if (new Set([\n ...protocols\n ]).size === peer.protocols.length) {\n return\n }\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n updatedPeer = await this.store.patchOrCreate(peerId, {\n protocols\n })\n\n log('stored provided protocols for %p', peerId)\n } finally {\n log.trace('set release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n protocols: updatedPeer.protocols,\n oldProtocols: peer == null ? [] : peer.protocols\n }\n }))\n }\n\n async add (peerId: PeerId, protocols: string[]) {\n peerId = peerIdFromPeerId(peerId)\n\n if (!Array.isArray(protocols)) {\n log.error('protocols must be provided to store data')\n throw errcode(new Error('protocols must be provided'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('add await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('add got write lock')\n\n let peer: Peer | undefined\n let updatedPeer\n\n try {\n try {\n peer = await this.store.load(peerId)\n\n if (new Set([\n ...peer.protocols,\n ...protocols\n ]).size === peer.protocols.length) {\n return\n }\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n updatedPeer = await this.store.mergeOrCreate(peerId, {\n protocols\n })\n\n log('added provided protocols for %p', peerId)\n } finally {\n log.trace('add release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n protocols: updatedPeer.protocols,\n oldProtocols: peer == null ? [] : peer.protocols\n }\n }))\n }\n\n async remove (peerId: PeerId, protocols: string[]) {\n peerId = peerIdFromPeerId(peerId)\n\n if (!Array.isArray(protocols)) {\n log.error('protocols must be provided to store data')\n throw errcode(new Error('protocols must be provided'), codes.ERR_INVALID_PARAMETERS)\n }\n\n log.trace('remove await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('remove got write lock')\n\n let peer: Peer | undefined\n let updatedPeer: Peer\n\n try {\n try {\n peer = await this.store.load(peerId)\n const protocolSet = new Set(peer.protocols)\n\n for (const protocol of protocols) {\n protocolSet.delete(protocol)\n }\n\n if (peer.protocols.length === protocolSet.size) {\n return\n }\n\n protocols = Array.from(protocolSet)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n updatedPeer = await this.store.patchOrCreate(peerId, {\n protocols\n })\n } finally {\n log.trace('remove release write lock')\n release()\n }\n\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n protocols: updatedPeer.protocols,\n oldProtocols: peer == null ? [] : peer.protocols\n }\n }))\n }\n\n async delete (peerId: PeerId) {\n peerId = peerIdFromPeerId(peerId)\n\n log.trace('delete await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('delete got write lock')\n let peer: Peer | undefined\n\n try {\n try {\n peer = await this.store.load(peerId)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n }\n\n await this.store.patchOrCreate(peerId, {\n protocols: []\n })\n } finally {\n log.trace('delete release write lock')\n release()\n }\n\n if (peer != null) {\n this.dispatchEvent(new CustomEvent(EVENT_NAME, {\n detail: {\n peerId,\n protocols: [],\n oldProtocols: peer.protocols\n }\n }))\n }\n }\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface Peer {\n addresses: Address[]\n protocols: string[]\n metadata: Metadata[]\n pubKey?: Uint8Array\n peerRecordEnvelope?: Uint8Array\n}\n\nexport namespace Peer {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.addresses != null) {\n for (const value of obj.addresses) {\n writer.uint32(10)\n Address.codec().encode(value, writer)\n }\n } else {\n throw new Error('Protocol error: required field \"addresses\" was not found in object')\n }\n\n if (obj.protocols != null) {\n for (const value of obj.protocols) {\n writer.uint32(18)\n writer.string(value)\n }\n } else {\n throw new Error('Protocol error: required field \"protocols\" was not found in object')\n }\n\n if (obj.metadata != null) {\n for (const value of obj.metadata) {\n writer.uint32(26)\n Metadata.codec().encode(value, writer)\n }\n } else {\n throw new Error('Protocol error: required field \"metadata\" was not found in object')\n }\n\n if (obj.pubKey != null) {\n writer.uint32(34)\n writer.bytes(obj.pubKey)\n }\n\n if (obj.peerRecordEnvelope != null) {\n writer.uint32(42)\n writer.bytes(obj.peerRecordEnvelope)\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n addresses: [],\n protocols: [],\n metadata: []\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.addresses.push(Address.codec().decode(reader, reader.uint32()))\n break\n case 2:\n obj.protocols.push(reader.string())\n break\n case 3:\n obj.metadata.push(Metadata.codec().decode(reader, reader.uint32()))\n break\n case 4:\n obj.pubKey = reader.bytes()\n break\n case 5:\n obj.peerRecordEnvelope = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Peer): Uint8Array => {\n return encodeMessage(obj, Peer.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Peer => {\n return decodeMessage(buf, Peer.codec())\n }\n}\n\nexport interface Address {\n multiaddr: Uint8Array\n isCertified?: boolean\n}\n\nexport namespace Address {\n let _codec: Codec
\n\n export const codec = (): Codec
=> {\n if (_codec == null) {\n _codec = message
((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.multiaddr != null) {\n writer.uint32(10)\n writer.bytes(obj.multiaddr)\n } else {\n throw new Error('Protocol error: required field \"multiaddr\" was not found in object')\n }\n\n if (obj.isCertified != null) {\n writer.uint32(16)\n writer.bool(obj.isCertified)\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n multiaddr: new Uint8Array(0)\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.multiaddr = reader.bytes()\n break\n case 2:\n obj.isCertified = reader.bool()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.multiaddr == null) {\n throw new Error('Protocol error: value for required field \"multiaddr\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Address): Uint8Array => {\n return encodeMessage(obj, Address.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Address => {\n return decodeMessage(buf, Address.codec())\n }\n}\n\nexport interface Metadata {\n key: string\n value: Uint8Array\n}\n\nexport namespace Metadata {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.key != null) {\n writer.uint32(10)\n writer.string(obj.key)\n } else {\n throw new Error('Protocol error: required field \"key\" was not found in object')\n }\n\n if (obj.value != null) {\n writer.uint32(18)\n writer.bytes(obj.value)\n } else {\n throw new Error('Protocol error: required field \"value\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n key: '',\n value: new Uint8Array(0)\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.key = reader.string()\n break\n case 2:\n obj.value = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.key == null) {\n throw new Error('Protocol error: value for required field \"key\" was not found in protobuf')\n }\n\n if (obj.value == null) {\n throw new Error('Protocol error: value for required field \"value\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Metadata): Uint8Array => {\n return encodeMessage(obj, Metadata.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Metadata => {\n return decodeMessage(buf, Metadata.codec())\n }\n}\n","export class TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined ?\n\tnew AbortError(errorMessage) :\n\tnew DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined ?\n\t\tgetDOMException('This operation was aborted.') :\n\t\tsignal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nexport default function pTimeout(promise, milliseconds, fallback, options) {\n\tlet timer;\n\n\tconst cancelablePromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tresolve(promise);\n\t\t\treturn;\n\t\t}\n\n\t\toptions = {\n\t\t\tcustomTimers: {setTimeout, clearTimeout},\n\t\t\t...options\n\t\t};\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\ttimer = options.customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (typeof fallback === 'function') {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\tconst timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\treject(timeoutError);\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t} finally {\n\t\t\t\toptions.customTimers.clearTimeout.call(undefined, timer);\n\t\t\t}\n\t\t})();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tclearTimeout(timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _PriorityQueue_queue;\nimport lowerBound from './lower-bound.js';\nexport default class PriorityQueue {\n constructor() {\n _PriorityQueue_queue.set(this, []);\n }\n enqueue(run, options) {\n options = {\n priority: 0,\n ...options,\n };\n const element = {\n priority: options.priority,\n run,\n };\n if (this.size && __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\")[this.size - 1].priority >= options.priority) {\n __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").push(element);\n return;\n }\n const index = lowerBound(__classPrivateFieldGet(this, _PriorityQueue_queue, \"f\"), element, (a, b) => b.priority - a.priority);\n __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").splice(index, 0, element);\n }\n dequeue() {\n const item = __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").shift();\n return item === null || item === void 0 ? void 0 : item.run;\n }\n filter(options) {\n return __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return __classPrivateFieldGet(this, _PriorityQueue_queue, \"f\").length;\n }\n}\n_PriorityQueue_queue = new WeakMap();\n","// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nexport default function lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _PQueue_instances, _PQueue_carryoverConcurrencyCount, _PQueue_isIntervalIgnored, _PQueue_intervalCount, _PQueue_intervalCap, _PQueue_interval, _PQueue_intervalEnd, _PQueue_intervalId, _PQueue_timeoutId, _PQueue_queue, _PQueue_queueClass, _PQueue_pendingCount, _PQueue_concurrency, _PQueue_isPaused, _PQueue_throwOnTimeout, _PQueue_doesIntervalAllowAnother_get, _PQueue_doesConcurrentAllowAnother_get, _PQueue_next, _PQueue_emitEvents, _PQueue_onResumeInterval, _PQueue_isIntervalPaused_get, _PQueue_tryToStartAnother, _PQueue_initializeIntervalIfNeeded, _PQueue_onInterval, _PQueue_processQueue, _PQueue_onEvent;\nimport EventEmitter from 'eventemitter3';\nimport pTimeout, { TimeoutError } from 'p-timeout';\nimport PriorityQueue from './priority-queue.js';\nconst timeoutError = new TimeoutError();\n/**\nThe error thrown by `queue.add()` when a job is aborted before it is run. See `signal`.\n*/\nexport class AbortError extends Error {\n}\n/**\nPromise queue with concurrency control.\n*/\nexport default class PQueue extends EventEmitter {\n constructor(options) {\n var _a, _b, _c, _d;\n super();\n _PQueue_instances.add(this);\n _PQueue_carryoverConcurrencyCount.set(this, void 0);\n _PQueue_isIntervalIgnored.set(this, void 0);\n _PQueue_intervalCount.set(this, 0);\n _PQueue_intervalCap.set(this, void 0);\n _PQueue_interval.set(this, void 0);\n _PQueue_intervalEnd.set(this, 0);\n _PQueue_intervalId.set(this, void 0);\n _PQueue_timeoutId.set(this, void 0);\n _PQueue_queue.set(this, void 0);\n _PQueue_queueClass.set(this, void 0);\n _PQueue_pendingCount.set(this, 0);\n // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194\n _PQueue_concurrency.set(this, void 0);\n _PQueue_isPaused.set(this, void 0);\n _PQueue_throwOnTimeout.set(this, void 0);\n /**\n Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.\n \n Applies to each future operation.\n */\n Object.defineProperty(this, \"timeout\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = {\n carryoverConcurrencyCount: false,\n intervalCap: Number.POSITIVE_INFINITY,\n interval: 0,\n concurrency: Number.POSITIVE_INFINITY,\n autoStart: true,\n queueClass: PriorityQueue,\n ...options,\n };\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${(_b = (_a = options.intervalCap) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${(_d = (_c = options.interval) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ''}\\` (${typeof options.interval})`);\n }\n __classPrivateFieldSet(this, _PQueue_carryoverConcurrencyCount, options.carryoverConcurrencyCount, \"f\");\n __classPrivateFieldSet(this, _PQueue_isIntervalIgnored, options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0, \"f\");\n __classPrivateFieldSet(this, _PQueue_intervalCap, options.intervalCap, \"f\");\n __classPrivateFieldSet(this, _PQueue_interval, options.interval, \"f\");\n __classPrivateFieldSet(this, _PQueue_queue, new options.queueClass(), \"f\");\n __classPrivateFieldSet(this, _PQueue_queueClass, options.queueClass, \"f\");\n this.concurrency = options.concurrency;\n this.timeout = options.timeout;\n __classPrivateFieldSet(this, _PQueue_throwOnTimeout, options.throwOnTimeout === true, \"f\");\n __classPrivateFieldSet(this, _PQueue_isPaused, options.autoStart === false, \"f\");\n }\n get concurrency() {\n return __classPrivateFieldGet(this, _PQueue_concurrency, \"f\");\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n __classPrivateFieldSet(this, _PQueue_concurrency, newConcurrency, \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_processQueue).call(this);\n }\n /**\n Adds a sync or async task to the queue. Always returns a promise.\n */\n async add(fn, options = {}) {\n return new Promise((resolve, reject) => {\n const run = async () => {\n var _a;\n var _b, _c;\n __classPrivateFieldSet(this, _PQueue_pendingCount, (_b = __classPrivateFieldGet(this, _PQueue_pendingCount, \"f\"), _b++, _b), \"f\");\n __classPrivateFieldSet(this, _PQueue_intervalCount, (_c = __classPrivateFieldGet(this, _PQueue_intervalCount, \"f\"), _c++, _c), \"f\");\n try {\n if ((_a = options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n // TODO: Use ABORT_ERR code when targeting Node.js 16 (https://nodejs.org/docs/latest-v16.x/api/errors.html#abort_err)\n reject(new AbortError('The task was aborted.'));\n return;\n }\n const operation = (this.timeout === undefined && options.timeout === undefined) ? fn({ signal: options.signal }) : pTimeout(Promise.resolve(fn({ signal: options.signal })), (options.timeout === undefined ? this.timeout : options.timeout), () => {\n if (options.throwOnTimeout === undefined ? __classPrivateFieldGet(this, _PQueue_throwOnTimeout, \"f\") : options.throwOnTimeout) {\n reject(timeoutError);\n }\n return undefined;\n });\n const result = await operation;\n resolve(result);\n this.emit('completed', result);\n }\n catch (error) {\n reject(error);\n this.emit('error', error);\n }\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_next).call(this);\n };\n __classPrivateFieldGet(this, _PQueue_queue, \"f\").enqueue(run, options);\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_tryToStartAnother).call(this);\n this.emit('add');\n });\n }\n /**\n Same as `.add()`, but accepts an array of sync or async functions.\n\n @returns A promise that resolves when all functions are resolved.\n */\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!__classPrivateFieldGet(this, _PQueue_isPaused, \"f\")) {\n return this;\n }\n __classPrivateFieldSet(this, _PQueue_isPaused, false, \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_processQueue).call(this);\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n __classPrivateFieldSet(this, _PQueue_isPaused, true, \"f\");\n }\n /**\n Clear the queue.\n */\n clear() {\n __classPrivateFieldSet(this, _PQueue_queue, new (__classPrivateFieldGet(this, _PQueue_queueClass, \"f\"))(), \"f\");\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (__classPrivateFieldGet(this, _PQueue_queue, \"f\").size === 0) {\n return;\n }\n await __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onEvent).call(this, 'empty');\n }\n /**\n @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.\n\n If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.\n\n Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.\n */\n async onSizeLessThan(limit) {\n // Instantly resolve if the queue is empty.\n if (__classPrivateFieldGet(this, _PQueue_queue, \"f\").size < limit) {\n return;\n }\n await __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onEvent).call(this, 'next', () => __classPrivateFieldGet(this, _PQueue_queue, \"f\").size < limit);\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (__classPrivateFieldGet(this, _PQueue_pendingCount, \"f\") === 0 && __classPrivateFieldGet(this, _PQueue_queue, \"f\").size === 0) {\n return;\n }\n await __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onEvent).call(this, 'idle');\n }\n /**\n Size of the queue, the number of queued items waiting to run.\n */\n get size() {\n return __classPrivateFieldGet(this, _PQueue_queue, \"f\").size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-array-callback-reference\n return __classPrivateFieldGet(this, _PQueue_queue, \"f\").filter(options).length;\n }\n /**\n Number of running items (no longer in the queue).\n */\n get pending() {\n return __classPrivateFieldGet(this, _PQueue_pendingCount, \"f\");\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return __classPrivateFieldGet(this, _PQueue_isPaused, \"f\");\n }\n}\n_PQueue_carryoverConcurrencyCount = new WeakMap(), _PQueue_isIntervalIgnored = new WeakMap(), _PQueue_intervalCount = new WeakMap(), _PQueue_intervalCap = new WeakMap(), _PQueue_interval = new WeakMap(), _PQueue_intervalEnd = new WeakMap(), _PQueue_intervalId = new WeakMap(), _PQueue_timeoutId = new WeakMap(), _PQueue_queue = new WeakMap(), _PQueue_queueClass = new WeakMap(), _PQueue_pendingCount = new WeakMap(), _PQueue_concurrency = new WeakMap(), _PQueue_isPaused = new WeakMap(), _PQueue_throwOnTimeout = new WeakMap(), _PQueue_instances = new WeakSet(), _PQueue_doesIntervalAllowAnother_get = function _PQueue_doesIntervalAllowAnother_get() {\n return __classPrivateFieldGet(this, _PQueue_isIntervalIgnored, \"f\") || __classPrivateFieldGet(this, _PQueue_intervalCount, \"f\") < __classPrivateFieldGet(this, _PQueue_intervalCap, \"f\");\n}, _PQueue_doesConcurrentAllowAnother_get = function _PQueue_doesConcurrentAllowAnother_get() {\n return __classPrivateFieldGet(this, _PQueue_pendingCount, \"f\") < __classPrivateFieldGet(this, _PQueue_concurrency, \"f\");\n}, _PQueue_next = function _PQueue_next() {\n var _a;\n __classPrivateFieldSet(this, _PQueue_pendingCount, (_a = __classPrivateFieldGet(this, _PQueue_pendingCount, \"f\"), _a--, _a), \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_tryToStartAnother).call(this);\n this.emit('next');\n}, _PQueue_emitEvents = function _PQueue_emitEvents() {\n this.emit('empty');\n if (__classPrivateFieldGet(this, _PQueue_pendingCount, \"f\") === 0) {\n this.emit('idle');\n }\n}, _PQueue_onResumeInterval = function _PQueue_onResumeInterval() {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onInterval).call(this);\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_initializeIntervalIfNeeded).call(this);\n __classPrivateFieldSet(this, _PQueue_timeoutId, undefined, \"f\");\n}, _PQueue_isIntervalPaused_get = function _PQueue_isIntervalPaused_get() {\n const now = Date.now();\n if (__classPrivateFieldGet(this, _PQueue_intervalId, \"f\") === undefined) {\n const delay = __classPrivateFieldGet(this, _PQueue_intervalEnd, \"f\") - now;\n if (delay < 0) {\n // Act as the interval was done\n // We don't need to resume it here because it will be resumed on line 160\n __classPrivateFieldSet(this, _PQueue_intervalCount, (__classPrivateFieldGet(this, _PQueue_carryoverConcurrencyCount, \"f\")) ? __classPrivateFieldGet(this, _PQueue_pendingCount, \"f\") : 0, \"f\");\n }\n else {\n // Act as the interval is pending\n if (__classPrivateFieldGet(this, _PQueue_timeoutId, \"f\") === undefined) {\n __classPrivateFieldSet(this, _PQueue_timeoutId, setTimeout(() => {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onResumeInterval).call(this);\n }, delay), \"f\");\n }\n return true;\n }\n }\n return false;\n}, _PQueue_tryToStartAnother = function _PQueue_tryToStartAnother() {\n if (__classPrivateFieldGet(this, _PQueue_queue, \"f\").size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n if (__classPrivateFieldGet(this, _PQueue_intervalId, \"f\")) {\n clearInterval(__classPrivateFieldGet(this, _PQueue_intervalId, \"f\"));\n }\n __classPrivateFieldSet(this, _PQueue_intervalId, undefined, \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_emitEvents).call(this);\n return false;\n }\n if (!__classPrivateFieldGet(this, _PQueue_isPaused, \"f\")) {\n const canInitializeInterval = !__classPrivateFieldGet(this, _PQueue_instances, \"a\", _PQueue_isIntervalPaused_get);\n if (__classPrivateFieldGet(this, _PQueue_instances, \"a\", _PQueue_doesIntervalAllowAnother_get) && __classPrivateFieldGet(this, _PQueue_instances, \"a\", _PQueue_doesConcurrentAllowAnother_get)) {\n const job = __classPrivateFieldGet(this, _PQueue_queue, \"f\").dequeue();\n if (!job) {\n return false;\n }\n this.emit('active');\n job();\n if (canInitializeInterval) {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_initializeIntervalIfNeeded).call(this);\n }\n return true;\n }\n }\n return false;\n}, _PQueue_initializeIntervalIfNeeded = function _PQueue_initializeIntervalIfNeeded() {\n if (__classPrivateFieldGet(this, _PQueue_isIntervalIgnored, \"f\") || __classPrivateFieldGet(this, _PQueue_intervalId, \"f\") !== undefined) {\n return;\n }\n __classPrivateFieldSet(this, _PQueue_intervalId, setInterval(() => {\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_onInterval).call(this);\n }, __classPrivateFieldGet(this, _PQueue_interval, \"f\")), \"f\");\n __classPrivateFieldSet(this, _PQueue_intervalEnd, Date.now() + __classPrivateFieldGet(this, _PQueue_interval, \"f\"), \"f\");\n}, _PQueue_onInterval = function _PQueue_onInterval() {\n if (__classPrivateFieldGet(this, _PQueue_intervalCount, \"f\") === 0 && __classPrivateFieldGet(this, _PQueue_pendingCount, \"f\") === 0 && __classPrivateFieldGet(this, _PQueue_intervalId, \"f\")) {\n clearInterval(__classPrivateFieldGet(this, _PQueue_intervalId, \"f\"));\n __classPrivateFieldSet(this, _PQueue_intervalId, undefined, \"f\");\n }\n __classPrivateFieldSet(this, _PQueue_intervalCount, __classPrivateFieldGet(this, _PQueue_carryoverConcurrencyCount, \"f\") ? __classPrivateFieldGet(this, _PQueue_pendingCount, \"f\") : 0, \"f\");\n __classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_processQueue).call(this);\n}, _PQueue_processQueue = function _PQueue_processQueue() {\n // eslint-disable-next-line no-empty\n while (__classPrivateFieldGet(this, _PQueue_instances, \"m\", _PQueue_tryToStartAnother).call(this)) { }\n}, _PQueue_onEvent = async function _PQueue_onEvent(event, filter) {\n return new Promise(resolve => {\n const listener = () => {\n if (filter && !filter()) {\n return;\n }\n this.off(event, listener);\n resolve();\n };\n this.on(event, listener);\n });\n};\n","export class TimeoutError extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = 'TimeoutError';\n\t}\n}\n\n/**\nAn error to be thrown when the request is aborted by AbortController.\nDOMException is thrown instead of this Error when DOMException is available.\n*/\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\n/**\nTODO: Remove AbortError and just throw DOMException when targeting Node 18.\n*/\nconst getDOMException = errorMessage => globalThis.DOMException === undefined\n\t? new AbortError(errorMessage)\n\t: new DOMException(errorMessage);\n\n/**\nTODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.\n*/\nconst getAbortedReason = signal => {\n\tconst reason = signal.reason === undefined\n\t\t? getDOMException('This operation was aborted.')\n\t\t: signal.reason;\n\n\treturn reason instanceof Error ? reason : getDOMException(reason);\n};\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t} = options;\n\n\tlet timer;\n\n\tconst cancelablePromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\tresolve(promise);\n\t\t\treturn;\n\t\t}\n\n\t\tif (options.signal) {\n\t\t\tconst {signal} = options;\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t});\n\t\t}\n\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst errorMessage = typeof message === 'string' ? message : `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\tconst timeoutError = message instanceof Error ? message : new TimeoutError(errorMessage);\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\treject(timeoutError);\n\t\t}, milliseconds);\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tresolve(await promise);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t} finally {\n\t\t\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\t\t}\n\t\t})();\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n","\nexport const WORKER_REQUEST_READ_LOCK = 'lock:worker:request-read'\nexport const WORKER_RELEASE_READ_LOCK = 'lock:worker:release-read'\nexport const MASTER_GRANT_READ_LOCK = 'lock:master:grant-read'\n\nexport const WORKER_REQUEST_WRITE_LOCK = 'lock:worker:request-write'\nexport const WORKER_RELEASE_WRITE_LOCK = 'lock:worker:release-write'\nexport const MASTER_GRANT_WRITE_LOCK = 'lock:master:grant-write'\n","export interface WebworkerEventListener {\n (worker: Worker, event: MessageEvent): void\n}\n\nconst events: Record = {}\n\nconst observable = (worker: Worker & { port?: any }) => {\n worker.addEventListener('message', (event) => {\n observable.dispatchEvent('message', worker, event)\n })\n\n if (worker.port != null) {\n worker.port.addEventListener('message', (event: any) => {\n observable.dispatchEvent('message', worker, event)\n })\n }\n}\n\nobservable.addEventListener = (type: string, fn: WebworkerEventListener) => {\n if (events[type] == null) {\n events[type] = []\n }\n\n events[type].push(fn)\n}\n\nobservable.removeEventListener = (type: string, fn: WebworkerEventListener) => {\n if (events[type] == null) {\n return\n }\n\n events[type] = events[type]\n .filter(listener => listener === fn)\n}\n\nobservable.dispatchEvent = function (type: string, worker: Worker, event: MessageEvent) {\n if (events[type] == null) {\n return\n }\n\n events[type].forEach(fn => fn(worker, event))\n}\n\nexport default observable\n","import { nanoid } from 'nanoid'\nimport {\n WORKER_REQUEST_READ_LOCK,\n WORKER_RELEASE_READ_LOCK,\n MASTER_GRANT_READ_LOCK,\n WORKER_REQUEST_WRITE_LOCK,\n WORKER_RELEASE_WRITE_LOCK,\n MASTER_GRANT_WRITE_LOCK\n} from './constants.js'\nimport observer from 'observable-webworkers'\nimport type { MorticeImplementation, MorticeOptions, Release } from './index.js'\n\nconst handleWorkerLockRequest = (emitter: EventTarget, masterEvent: string, requestType: string, releaseType: string, grantType: string) => {\n return (worker: Worker, event: MessageEvent) => {\n if (event.data.type !== requestType) {\n return\n }\n\n const requestEvent = {\n type: event.data.type,\n name: event.data.name,\n identifier: event.data.identifier\n }\n\n emitter.dispatchEvent(new MessageEvent(masterEvent, {\n data: {\n name: requestEvent.name,\n handler: async (): Promise => {\n // grant lock to worker\n worker.postMessage({\n type: grantType,\n name: requestEvent.name,\n identifier: requestEvent.identifier\n })\n\n // wait for worker to finish\n return await new Promise((resolve) => {\n const releaseEventListener = (event: MessageEvent) => {\n if (event == null || event.data == null) {\n return\n }\n\n const releaseEvent = {\n type: event.data.type,\n name: event.data.name,\n identifier: event.data.identifier\n }\n\n if (releaseEvent.type === releaseType && releaseEvent.identifier === requestEvent.identifier) {\n worker.removeEventListener('message', releaseEventListener)\n resolve()\n }\n }\n\n worker.addEventListener('message', releaseEventListener)\n })\n }\n }\n }))\n }\n}\n\nconst makeWorkerLockRequest = (name: string, requestType: string, grantType: string, releaseType: string) => {\n return async () => {\n const id = nanoid()\n\n globalThis.postMessage({\n type: requestType,\n identifier: id,\n name\n })\n\n return await new Promise((resolve) => {\n const listener = (event: MessageEvent) => {\n if (event == null || event.data == null) {\n return\n }\n\n const responseEvent = {\n type: event.data.type,\n identifier: event.data.identifier\n }\n\n if (responseEvent.type === grantType && responseEvent.identifier === id) {\n globalThis.removeEventListener('message', listener)\n\n // grant lock\n resolve(() => {\n // release lock\n globalThis.postMessage({\n type: releaseType,\n identifier: id,\n name\n })\n })\n }\n }\n\n globalThis.addEventListener('message', listener)\n })\n }\n}\n\nconst defaultOptions = {\n singleProcess: false\n}\n\nexport default (options: Required): MorticeImplementation | EventTarget => {\n options = Object.assign({}, defaultOptions, options)\n const isPrimary = Boolean(globalThis.document) || options.singleProcess\n\n if (isPrimary) {\n const emitter = new EventTarget()\n\n observer.addEventListener('message', handleWorkerLockRequest(emitter, 'requestReadLock', WORKER_REQUEST_READ_LOCK, WORKER_RELEASE_READ_LOCK, MASTER_GRANT_READ_LOCK))\n observer.addEventListener('message', handleWorkerLockRequest(emitter, 'requestWriteLock', WORKER_REQUEST_WRITE_LOCK, WORKER_RELEASE_WRITE_LOCK, MASTER_GRANT_WRITE_LOCK))\n\n return emitter\n }\n\n return {\n isWorker: true,\n readLock: (name) => makeWorkerLockRequest(name, WORKER_REQUEST_READ_LOCK, MASTER_GRANT_READ_LOCK, WORKER_RELEASE_READ_LOCK),\n writeLock: (name) => makeWorkerLockRequest(name, WORKER_REQUEST_WRITE_LOCK, MASTER_GRANT_WRITE_LOCK, WORKER_RELEASE_WRITE_LOCK)\n }\n}\n","export { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nexport let nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\n","import PQueue from 'p-queue'\nimport pTimeout from 'p-timeout'\nimport impl from './node.js'\n\nexport interface MorticeOptions {\n name?: string\n timeout?: number\n concurrency?: number\n singleProcess?: boolean\n}\n\nexport interface Mortice {\n readLock: () => Promise\n writeLock: () => Promise\n}\n\nexport interface Release {\n (): void\n}\n\nexport interface MorticeImplementation {\n isWorker: boolean\n readLock: (name: string, options: MorticeOptions) => Mortice['readLock']\n writeLock: (name: string, options: MorticeOptions) => Mortice['writeLock']\n}\n\nconst mutexes: Record = {}\nlet implementation: any\n\nasync function createReleaseable (queue: PQueue, options: Required): Promise {\n let res: (release: Release) => void\n\n const p = new Promise((resolve) => {\n res = resolve\n })\n\n void queue.add(async () => await pTimeout((async () => {\n return await new Promise((resolve) => {\n res(() => {\n resolve()\n })\n })\n })(), {\n milliseconds: options.timeout\n }))\n\n return await p\n}\n\nconst createMutex = (name: string, options: Required): Mortice => {\n if (implementation.isWorker === true) {\n return {\n readLock: implementation.readLock(name, options),\n writeLock: implementation.writeLock(name, options)\n }\n }\n\n const masterQueue = new PQueue({ concurrency: 1 })\n let readQueue: PQueue | null\n\n return {\n async readLock () {\n // If there's already a read queue, just add the task to it\n if (readQueue != null) {\n return await createReleaseable(readQueue, options)\n }\n\n // Create a new read queue\n readQueue = new PQueue({\n concurrency: options.concurrency,\n autoStart: false\n })\n const localReadQueue = readQueue\n\n // Add the task to the read queue\n const readPromise = createReleaseable(readQueue, options)\n\n void masterQueue.add(async () => {\n // Start the task only once the master queue has completed processing\n // any previous tasks\n localReadQueue.start()\n\n // Once all the tasks in the read queue have completed, remove it so\n // that the next read lock will occur after any write locks that were\n // started in the interim\n return await localReadQueue.onIdle()\n .then(() => {\n if (readQueue === localReadQueue) {\n readQueue = null\n }\n })\n })\n\n return await readPromise\n },\n async writeLock () {\n // Remove the read queue reference, so that any later read locks will be\n // added to a new queue that starts after this write lock has been\n // released\n readQueue = null\n\n return await createReleaseable(masterQueue, options)\n }\n }\n}\n\nconst defaultOptions = {\n name: 'lock',\n concurrency: Infinity,\n timeout: 84600000,\n singleProcess: false\n}\n\ninterface EventData {\n name: string\n handler: () => Promise\n}\n\nexport default function createMortice (options?: MorticeOptions) {\n const opts: Required = Object.assign({}, defaultOptions, options)\n\n if (implementation == null) {\n implementation = impl(opts)\n\n if (implementation.isWorker !== true) {\n // we are master, set up worker requests\n implementation.addEventListener('requestReadLock', (event: MessageEvent) => {\n if (mutexes[event.data.name] == null) {\n return\n }\n\n void mutexes[event.data.name].readLock()\n .then(async release => await event.data.handler().finally(() => release()))\n })\n\n implementation.addEventListener('requestWriteLock', async (event: MessageEvent) => {\n if (mutexes[event.data.name] == null) {\n return\n }\n\n void mutexes[event.data.name].writeLock()\n .then(async release => await event.data.handler().finally(() => release()))\n })\n }\n }\n\n if (mutexes[opts.name] == null) {\n mutexes[opts.name] = createMutex(opts.name, opts)\n }\n\n return mutexes[opts.name]\n}\n","import { logger } from '@libp2p/logger'\nimport { peerIdFromBytes } from '@libp2p/peer-id'\nimport errcode from 'err-code'\nimport { codes } from './errors.js'\nimport { Key } from 'interface-datastore/key'\nimport { base32 } from 'multiformats/bases/base32'\nimport { Multiaddr } from '@multiformats/multiaddr'\nimport { Metadata, Peer as PeerPB } from './pb/peer.js'\nimport mortice from 'mortice'\nimport { equals as uint8arrayEquals } from 'uint8arrays/equals'\nimport type { Peer } from '@libp2p/interface-peer-store'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport { Components } from '@libp2p/components'\n\nconst log = logger('libp2p:peer-store:store')\n\nconst NAMESPACE_COMMON = '/peers/'\n\nexport interface Store {\n has: (peerId: PeerId) => Promise\n save: (peer: Peer) => Promise\n load: (peerId: PeerId) => Promise\n delete: (peerId: PeerId) => Promise\n merge: (peerId: PeerId, data: Partial) => Promise\n mergeOrCreate: (peerId: PeerId, data: Partial) => Promise\n patch: (peerId: PeerId, data: Partial) => Promise\n patchOrCreate: (peerId: PeerId, data: Partial) => Promise\n all: () => AsyncIterable\n\n lock: {\n readLock: () => Promise<() => void>\n writeLock: () => Promise<() => void>\n }\n}\n\nexport class PersistentStore {\n private components: Components = new Components()\n public lock: any\n\n constructor () {\n this.lock = mortice({\n name: 'peer-store',\n singleProcess: true\n })\n }\n\n init (components: Components) {\n this.components = components\n }\n\n _peerIdToDatastoreKey (peerId: PeerId) {\n if (peerId.type == null) {\n log.error('peerId must be an instance of peer-id to store data')\n throw errcode(new Error('peerId must be an instance of peer-id'), codes.ERR_INVALID_PARAMETERS)\n }\n\n const b32key = peerId.toCID().toString()\n return new Key(`${NAMESPACE_COMMON}${b32key}`)\n }\n\n async has (peerId: PeerId) {\n return await this.components.getDatastore().has(this._peerIdToDatastoreKey(peerId))\n }\n\n async delete (peerId: PeerId) {\n await this.components.getDatastore().delete(this._peerIdToDatastoreKey(peerId))\n }\n\n async load (peerId: PeerId): Promise {\n const buf = await this.components.getDatastore().get(this._peerIdToDatastoreKey(peerId))\n const peer = PeerPB.decode(buf)\n const metadata = new Map()\n\n for (const meta of peer.metadata) {\n metadata.set(meta.key, meta.value)\n }\n\n return {\n ...peer,\n id: peerId,\n addresses: peer.addresses.map(({ multiaddr, isCertified }) => {\n return {\n multiaddr: new Multiaddr(multiaddr),\n isCertified: isCertified ?? false\n }\n }),\n metadata,\n pubKey: peer.pubKey ?? undefined,\n peerRecordEnvelope: peer.peerRecordEnvelope ?? undefined\n }\n }\n\n async save (peer: Peer) {\n if (peer.pubKey != null && peer.id.publicKey != null && !uint8arrayEquals(peer.pubKey, peer.id.publicKey)) {\n log.error('peer publicKey bytes do not match peer id publicKey bytes')\n throw errcode(new Error('publicKey bytes do not match peer id publicKey bytes'), codes.ERR_INVALID_PARAMETERS)\n }\n\n // dedupe addresses\n const addressSet = new Set()\n const addresses = peer.addresses\n .filter(address => {\n if (addressSet.has(address.multiaddr.toString())) {\n return false\n }\n\n addressSet.add(address.multiaddr.toString())\n return true\n })\n .sort((a, b) => {\n return a.multiaddr.toString().localeCompare(b.multiaddr.toString())\n })\n .map(({ multiaddr, isCertified }) => ({\n multiaddr: multiaddr.bytes,\n isCertified\n }))\n\n const metadata: Metadata[] = []\n\n ;[...peer.metadata.keys()].sort().forEach(key => {\n const value = peer.metadata.get(key)\n\n if (value != null) {\n metadata.push({ key, value })\n }\n })\n\n const buf = PeerPB.encode({\n addresses,\n protocols: peer.protocols.sort(),\n pubKey: peer.pubKey,\n metadata,\n peerRecordEnvelope: peer.peerRecordEnvelope\n })\n\n await this.components.getDatastore().put(this._peerIdToDatastoreKey(peer.id), buf.subarray())\n\n return await this.load(peer.id)\n }\n\n async patch (peerId: PeerId, data: Partial) {\n const peer = await this.load(peerId)\n\n return await this._patch(peerId, data, peer)\n }\n\n async patchOrCreate (peerId: PeerId, data: Partial) {\n let peer: Peer\n\n try {\n peer = await this.load(peerId)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n\n peer = { id: peerId, addresses: [], protocols: [], metadata: new Map() }\n }\n\n return await this._patch(peerId, data, peer)\n }\n\n async _patch (peerId: PeerId, data: Partial, peer: Peer) {\n return await this.save({\n ...peer,\n ...data,\n id: peerId\n })\n }\n\n async merge (peerId: PeerId, data: Partial) {\n const peer = await this.load(peerId)\n\n return await this._merge(peerId, data, peer)\n }\n\n async mergeOrCreate (peerId: PeerId, data: Partial) {\n /** @type {Peer} */\n let peer\n\n try {\n peer = await this.load(peerId)\n } catch (err: any) {\n if (err.code !== codes.ERR_NOT_FOUND) {\n throw err\n }\n\n peer = { id: peerId, addresses: [], protocols: [], metadata: new Map() }\n }\n\n return await this._merge(peerId, data, peer)\n }\n\n async _merge (peerId: PeerId, data: Partial, peer: Peer) {\n // if the peer has certified addresses, use those in\n // favour of the supplied versions\n const addresses = new Map()\n\n peer.addresses.forEach((addr) => {\n addresses.set(addr.multiaddr.toString(), addr.isCertified)\n })\n\n ;(data.addresses ?? []).forEach(addr => {\n const addrString = addr.multiaddr.toString()\n const isAlreadyCertified = Boolean(addresses.get(addrString))\n\n const isCertified = isAlreadyCertified || addr.isCertified\n\n addresses.set(addrString, isCertified)\n })\n\n return await this.save({\n id: peerId,\n addresses: Array.from(addresses.entries()).map(([addrStr, isCertified]) => {\n return {\n multiaddr: new Multiaddr(addrStr),\n isCertified\n }\n }),\n protocols: Array.from(new Set([\n ...(peer.protocols ?? []),\n ...(data.protocols ?? [])\n ])),\n metadata: new Map([\n ...(peer.metadata?.entries() ?? []),\n ...(data.metadata?.entries() ?? [])\n ]),\n pubKey: data.pubKey ?? (peer != null ? peer.pubKey : undefined),\n peerRecordEnvelope: data.peerRecordEnvelope ?? (peer != null ? peer.peerRecordEnvelope : undefined)\n })\n }\n\n async * all () {\n for await (const key of this.components.getDatastore().queryKeys({\n prefix: NAMESPACE_COMMON\n })) {\n // /peers/${peer-id-as-libp2p-key-cid-string-in-base-32}\n const base32Str = key.toString().split('/')[2]\n const buf = base32.decode(base32Str)\n\n yield this.load(peerIdFromBytes(buf))\n }\n }\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface Tags {\n tags: Tag[]\n}\n\nexport namespace Tags {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.tags != null) {\n for (const value of obj.tags) {\n writer.uint32(10)\n Tag.codec().encode(value, writer)\n }\n } else {\n throw new Error('Protocol error: required field \"tags\" was not found in object')\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n tags: []\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.tags.push(Tag.codec().decode(reader, reader.uint32()))\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Tags): Uint8Array => {\n return encodeMessage(obj, Tags.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Tags => {\n return decodeMessage(buf, Tags.codec())\n }\n}\n\nexport interface Tag {\n name: string\n value?: number\n expiry?: bigint\n}\n\nexport namespace Tag {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.name != null) {\n writer.uint32(10)\n writer.string(obj.name)\n } else {\n throw new Error('Protocol error: required field \"name\" was not found in object')\n }\n\n if (obj.value != null) {\n writer.uint32(16)\n writer.uint32(obj.value)\n }\n\n if (obj.expiry != null) {\n writer.uint32(24)\n writer.uint64(obj.expiry)\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n name: ''\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.name = reader.string()\n break\n case 2:\n obj.value = reader.uint32()\n break\n case 3:\n obj.expiry = reader.uint64()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.name == null) {\n throw new Error('Protocol error: value for required field \"name\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: Tag): Uint8Array => {\n return encodeMessage(obj, Tag.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): Tag => {\n return decodeMessage(buf, Tag.codec())\n }\n}\n","import { logger } from '@libp2p/logger'\nimport { EventEmitter } from '@libp2p/interfaces/events'\nimport { PeerStoreAddressBook } from './address-book.js'\nimport { PeerStoreKeyBook } from './key-book.js'\nimport { PeerStoreMetadataBook } from './metadata-book.js'\nimport { PeerStoreProtoBook } from './proto-book.js'\nimport { PersistentStore, Store } from './store.js'\nimport type { PeerStore, AddressBook, KeyBook, MetadataBook, ProtoBook, PeerStoreEvents, PeerStoreInit, Peer, TagOptions } from '@libp2p/interface-peer-store'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport { Components, Initializable } from '@libp2p/components'\nimport errCode from 'err-code'\nimport { Tag, Tags } from './pb/tags.js'\n\nconst log = logger('libp2p:peer-store')\n\n/**\n * An implementation of PeerStore that stores data in a Datastore\n */\nexport class PersistentPeerStore extends EventEmitter implements PeerStore, Initializable {\n public addressBook: AddressBook\n public keyBook: KeyBook\n public metadataBook: MetadataBook\n public protoBook: ProtoBook\n\n private components: Components = new Components()\n private readonly store: Store\n\n constructor (init: PeerStoreInit = {}) {\n super()\n\n this.store = new PersistentStore()\n this.addressBook = new PeerStoreAddressBook(this.dispatchEvent.bind(this), this.store, init.addressFilter)\n this.keyBook = new PeerStoreKeyBook(this.dispatchEvent.bind(this), this.store)\n this.metadataBook = new PeerStoreMetadataBook(this.dispatchEvent.bind(this), this.store)\n this.protoBook = new PeerStoreProtoBook(this.dispatchEvent.bind(this), this.store)\n }\n\n init (components: Components) {\n this.components = components\n ;(this.store as PersistentStore).init(components)\n }\n\n async forEach (fn: (peer: Peer) => void) {\n log.trace('getPeers await read lock')\n const release = await this.store.lock.readLock()\n log.trace('getPeers got read lock')\n\n try {\n for await (const peer of this.store.all()) {\n if (peer.id.equals(this.components.getPeerId())) {\n // Skip self peer if present\n continue\n }\n\n fn(peer)\n }\n } finally {\n log.trace('getPeers release read lock')\n release()\n }\n }\n\n async all (): Promise {\n const output: Peer[] = []\n\n await this.forEach(peer => {\n output.push(peer)\n })\n\n return output\n }\n\n /**\n * Delete the information of the given peer in every book\n */\n async delete (peerId: PeerId) {\n log.trace('delete await write lock')\n const release = await this.store.lock.writeLock()\n log.trace('delete got write lock')\n\n try {\n await this.store.delete(peerId)\n } finally {\n log.trace('delete release write lock')\n release()\n }\n }\n\n /**\n * Get the stored information of a given peer\n */\n async get (peerId: PeerId) {\n log.trace('get await read lock')\n const release = await this.store.lock.readLock()\n log.trace('get got read lock')\n\n try {\n return await this.store.load(peerId)\n } finally {\n log.trace('get release read lock')\n release()\n }\n }\n\n /**\n * Returns true if we have a record of the peer\n */\n async has (peerId: PeerId) {\n log.trace('has await read lock')\n const release = await this.store.lock.readLock()\n log.trace('has got read lock')\n\n try {\n return await this.store.has(peerId)\n } finally {\n log.trace('has release read lock')\n release()\n }\n }\n\n async tagPeer (peerId: PeerId, tag: string, options: TagOptions = {}) {\n const providedValue = options.value ?? 0\n const value = Math.round(providedValue)\n const ttl = options.ttl ?? undefined\n\n if (value !== providedValue || value < 0 || value > 100) {\n throw errCode(new Error('Tag value must be between 0-100'), 'ERR_TAG_VALUE_OUT_OF_BOUNDS')\n }\n\n const buf = await this.metadataBook.getValue(peerId, 'tags')\n let tags: Tag[] = []\n\n if (buf != null) {\n tags = Tags.decode(buf).tags\n }\n\n for (const t of tags) {\n if (t.name === tag) {\n throw errCode(new Error('Peer already tagged'), 'ERR_DUPLICATE_TAG')\n }\n }\n\n tags.push({\n name: tag,\n value,\n expiry: ttl == null ? undefined : BigInt(Date.now() + ttl)\n })\n\n await this.metadataBook.setValue(peerId, 'tags', Tags.encode({ tags }).subarray())\n }\n\n async unTagPeer (peerId: PeerId, tag: string) {\n const buf = await this.metadataBook.getValue(peerId, 'tags')\n let tags: Tag[] = []\n\n if (buf != null) {\n tags = Tags.decode(buf).tags\n }\n\n tags = tags.filter(t => t.name !== tag)\n\n await this.metadataBook.setValue(peerId, 'tags', Tags.encode({ tags }).subarray())\n }\n\n async getTags (peerId: PeerId) {\n const buf = await this.metadataBook.getValue(peerId, 'tags')\n let tags: Tag[] = []\n\n if (buf != null) {\n tags = Tags.decode(buf).tags\n }\n\n const now = BigInt(Date.now())\n const unexpiredTags = tags.filter(tag => tag.expiry == null || tag.expiry > now)\n\n if (unexpiredTags.length !== tags.length) {\n // remove any expired tags\n await this.metadataBook.setValue(peerId, 'tags', Tags.encode({ tags: unexpiredTags }).subarray())\n }\n\n return unexpiredTags.map(t => ({\n name: t.name,\n value: t.value ?? 0\n }))\n }\n}\n","import drain from 'it-drain'\nimport errCode from 'err-code'\nimport type { DHT } from '@libp2p/interface-dht'\nimport type { ContentRouting } from '@libp2p/interface-content-routing'\nimport type { CID } from 'multiformats/cid'\nimport type { AbortOptions } from '@libp2p/interfaces'\n\n/**\n * Wrapper class to convert events into returned values\n */\nexport class DHTContentRouting implements ContentRouting {\n private readonly dht: DHT\n\n constructor (dht: DHT) {\n this.dht = dht\n }\n\n async provide (cid: CID) {\n await drain(this.dht.provide(cid))\n }\n\n async * findProviders (cid: CID, options: AbortOptions = {}) {\n for await (const event of this.dht.findProviders(cid, options)) {\n if (event.name === 'PROVIDER') {\n yield * event.providers\n }\n }\n }\n\n async put (key: Uint8Array, value: Uint8Array, options?: AbortOptions): Promise {\n await drain(this.dht.put(key, value, options))\n }\n\n async get (key: Uint8Array, options?: AbortOptions): Promise {\n for await (const event of this.dht.get(key, options)) {\n if (event.name === 'VALUE') {\n return event.value\n }\n }\n\n throw errCode(new Error('Not found'), 'ERR_NOT_FOUND')\n }\n}\n","import type { PeerInfo } from '@libp2p/interface-peer-info'\nimport { logger } from '@libp2p/logger'\nimport type { Components } from '@libp2p/components'\nimport { TimeoutController } from 'timeout-abort-controller'\nimport { setMaxListeners } from 'events'\n\nconst log = logger('libp2p:dialer:auto-dialer')\n\nexport interface AutoDialerInit {\n enabled: boolean\n minConnections: number\n dialTimeout: number\n}\n\nexport class AutoDialer {\n private readonly components: Components\n private readonly enabled: boolean\n private readonly minConnections: number\n private readonly dialTimeout: number\n\n constructor (components: Components, init: AutoDialerInit) {\n this.components = components\n this.enabled = init.enabled\n this.minConnections = init.minConnections\n this.dialTimeout = init.dialTimeout\n }\n\n public handle (evt: CustomEvent) {\n const { detail: peer } = evt\n\n if (!this.enabled) {\n return\n }\n\n const connections = this.components.getConnectionManager().getConnections(peer.id)\n\n // If auto dialing is on and we have no connection to the peer, check if we should dial\n if (connections.length === 0) {\n const minConnections = this.minConnections ?? 0\n\n const allConnections = this.components.getConnectionManager().getConnections()\n\n if (minConnections > allConnections.length) {\n log('auto-dialing discovered peer %p with timeout %d', peer.id, this.dialTimeout)\n\n const controller = new TimeoutController(this.dialTimeout)\n\n try {\n // fails on node < 15.4\n setMaxListeners?.(Infinity, controller.signal)\n } catch {}\n\n void this.components.getConnectionManager().openConnection(peer.id, {\n signal: controller.signal\n })\n .catch(err => {\n log.error('could not connect to discovered peer %p with %o', peer.id, err)\n })\n .finally(() => {\n controller.clear()\n })\n }\n }\n }\n}\n","const globalFetch = globalThis.fetch;\nconst globalHeaders = globalThis.Headers;\nconst globalRequest = globalThis.Request;\nconst globalResponse = globalThis.Response;\nexport {\n globalFetch as fetch\n};\nexport {\n globalHeaders as Headers\n};\nexport {\n globalRequest as Request\n};\nexport {\n globalResponse as Response\n};","import { fetch as nativeFetch, Headers } from 'native-fetch'\n\n/**\n * Build fetch resource for request\n */\nexport function buildResource (serverResolver: string, hostname: string, recordType: string) {\n return `${serverResolver}?name=${hostname}&type=${recordType}`\n}\n\nexport interface DNSJSON {\n Question: Question[]\n Answer: Answer[]\n}\n\ninterface Question {\n name: string\n type: number\n}\n\ninterface Answer {\n name: string\n type: number\n data: string\n TTL: number\n}\n\n/**\n * Use fetch to find the record\n */\nexport async function request (resource: string, signal: AbortSignal) {\n const req = await nativeFetch(resource, {\n headers: new Headers({\n accept: 'application/dns-json'\n }),\n signal\n })\n const res = await req.json()\n\n return res as DNSJSON\n}\n\n/**\n * Creates cache key composed by recordType and hostname\n *\n * @param {string} hostname\n * @param {string} recordType\n */\nexport function getCacheKey (hostname: string, recordType: string) {\n return `${recordType}_${hostname}`\n}\n","import debug from 'debug'\nimport Receptacle from 'receptacle'\nimport * as utils from './utils.js'\nimport type { DNSJSON } from './utils'\n\nconst log = Object.assign(debug('dns-over-http-resolver'), {\n error: debug('dns-over-http-resolver:error')\n})\n\nexport interface Request { (resource: string, signal: AbortSignal): Promise }\n\ninterface ResolverOptions {\n maxCache?: number\n request?: Request\n}\n\n/**\n * DNS over HTTP resolver.\n * Uses a list of servers to resolve DNS records with HTTP requests.\n */\nclass Resolver {\n private readonly _cache: Receptacle\n private readonly _TXTcache: Receptacle\n private _servers: string[]\n private readonly _request: Request\n private _abortControllers: AbortController[]\n\n /**\n * @class\n * @param {object} [options]\n * @param {number} [options.maxCache = 100] - maximum number of cached dns records\n * @param {Request} [options.request] - function to return DNSJSON\n */\n constructor (options: ResolverOptions = {}) {\n this._cache = new Receptacle({ max: options?.maxCache ?? 100 })\n this._TXTcache = new Receptacle({ max: options?.maxCache ?? 100 })\n this._servers = [\n 'https://cloudflare-dns.com/dns-query',\n 'https://dns.google/resolve'\n ]\n this._request = options.request ?? utils.request\n this._abortControllers = []\n }\n\n /**\n * Cancel all outstanding DNS queries made by this resolver. Any outstanding\n * requests will be aborted and promises rejected.\n */\n cancel () {\n this._abortControllers.forEach(controller => controller.abort())\n }\n\n /**\n * Get an array of the IP addresses currently configured for DNS resolution.\n * These addresses are formatted according to RFC 5952. It can include a custom port.\n */\n getServers () {\n return this._servers\n }\n\n /**\n * Get a shuffled array of the IP addresses currently configured for DNS resolution.\n * These addresses are formatted according to RFC 5952. It can include a custom port.\n */\n _getShuffledServers () {\n const newServers = [...this._servers]\n\n for (let i = newServers.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i)\n const temp = newServers[i]\n newServers[i] = newServers[j]\n newServers[j] = temp\n }\n\n return newServers\n }\n\n /**\n * Sets the IP address and port of servers to be used when performing DNS resolution.\n *\n * @param {string[]} servers - array of RFC 5952 formatted addresses.\n */\n setServers (servers: string[]) {\n this._servers = servers\n }\n\n /**\n * Uses the DNS protocol to resolve the given host name into the appropriate DNS record\n *\n * @param {string} hostname - host name to resolve\n * @param {string} [rrType = 'A'] - resource record type\n */\n async resolve (hostname: string, rrType = 'A') {\n switch (rrType) {\n case 'A':\n return await this.resolve4(hostname)\n case 'AAAA':\n return await this.resolve6(hostname)\n case 'TXT':\n return await this.resolveTxt(hostname)\n default:\n throw new Error(`${rrType} is not supported`)\n }\n }\n\n /**\n * Uses the DNS protocol to resolve the given host name into IPv4 addresses\n *\n * @param {string} hostname - host name to resolve\n */\n async resolve4 (hostname: string) {\n const recordType = 'A'\n const cached = this._cache.get(utils.getCacheKey(hostname, recordType))\n if (cached != null) {\n return cached\n }\n let aborted = false\n\n for (const server of this._getShuffledServers()) {\n const controller = new AbortController()\n this._abortControllers.push(controller)\n\n try {\n const response = await this._request(utils.buildResource(\n server,\n hostname,\n recordType\n ), controller.signal)\n\n const data = response.Answer.map(a => a.data)\n const ttl = Math.min(...response.Answer.map(a => a.TTL))\n\n this._cache.set(utils.getCacheKey(hostname, recordType), data, { ttl })\n\n return data\n } catch (err) {\n if (controller.signal.aborted) {\n aborted = true\n }\n\n log.error(`${server} could not resolve ${hostname} record ${recordType}`)\n } finally {\n this._abortControllers = this._abortControllers.filter(c => c !== controller)\n }\n }\n\n if (aborted) {\n throw Object.assign(new Error('queryA ECANCELLED'), {\n code: 'ECANCELLED'\n })\n }\n\n throw new Error(`Could not resolve ${hostname} record ${recordType}`)\n }\n\n /**\n * Uses the DNS protocol to resolve the given host name into IPv6 addresses\n *\n * @param {string} hostname - host name to resolve\n */\n async resolve6 (hostname: string) {\n const recordType = 'AAAA'\n const cached = this._cache.get(utils.getCacheKey(hostname, recordType))\n if (cached != null) {\n return cached\n }\n let aborted = false\n\n for (const server of this._getShuffledServers()) {\n const controller = new AbortController()\n this._abortControllers.push(controller)\n\n try {\n const response = await this._request(utils.buildResource(\n server,\n hostname,\n recordType\n ), controller.signal)\n\n const data = response.Answer.map(a => a.data)\n const ttl = Math.min(...response.Answer.map(a => a.TTL))\n\n this._cache.set(utils.getCacheKey(hostname, recordType), data, { ttl })\n\n return data\n } catch (err) {\n if (controller.signal.aborted) {\n aborted = true\n }\n\n log.error(`${server} could not resolve ${hostname} record ${recordType}`)\n } finally {\n this._abortControllers = this._abortControllers.filter(c => c !== controller)\n }\n }\n\n if (aborted) {\n throw Object.assign(new Error('queryAaaa ECANCELLED'), {\n code: 'ECANCELLED'\n })\n }\n\n throw new Error(`Could not resolve ${hostname} record ${recordType}`)\n }\n\n /**\n * Uses the DNS protocol to resolve the given host name into a Text record\n *\n * @param {string} hostname - host name to resolve\n */\n async resolveTxt (hostname: string) {\n const recordType = 'TXT'\n const cached = this._TXTcache.get(utils.getCacheKey(hostname, recordType))\n if (cached != null) {\n return cached\n }\n let aborted = false\n\n for (const server of this._getShuffledServers()) {\n const controller = new AbortController()\n this._abortControllers.push(controller)\n\n try {\n const response = await this._request(utils.buildResource(\n server,\n hostname,\n recordType\n ), controller.signal)\n\n const data = response.Answer.map(a => [a.data.replace(/['\"]+/g, '')])\n const ttl = Math.min(...response.Answer.map(a => a.TTL))\n\n this._TXTcache.set(utils.getCacheKey(hostname, recordType), data, { ttl })\n\n return data\n } catch (err) {\n if (controller.signal.aborted) {\n aborted = true\n }\n\n log.error(`${server} could not resolve ${hostname} record ${recordType}`)\n } finally {\n this._abortControllers = this._abortControllers.filter(c => c !== controller)\n }\n }\n\n if (aborted) {\n throw Object.assign(new Error('queryTxt ECANCELLED'), {\n code: 'ECANCELLED'\n })\n }\n\n throw new Error(`Could not resolve ${hostname} record ${recordType}`)\n }\n\n clearCache () {\n this._cache.clear()\n this._TXTcache.clear()\n }\n}\n\nexport default Resolver\n","import dns from 'dns-over-http-resolver'\n\nexport default dns\n","import { getProtocol } from '../protocols-table.js'\nimport Resolver from './dns.js'\nimport type { AbortOptions, Multiaddr } from '../index.js'\n\nconst { code: dnsaddrCode } = getProtocol('dnsaddr')\n\n/**\n * Resolver for dnsaddr addresses.\n */\nexport async function dnsaddrResolver (addr: Multiaddr, options: AbortOptions = {}) {\n const resolver = new Resolver()\n\n if (options.signal != null) {\n options.signal.addEventListener('abort', () => {\n resolver.cancel()\n })\n }\n\n const peerId = addr.getPeerId()\n const [, hostname] = addr.stringTuples().find(([proto]) => proto === dnsaddrCode) ?? []\n\n if (hostname == null) {\n throw new Error('No hostname found in multiaddr')\n }\n\n const records = await resolver.resolveTxt(`_dnsaddr.${hostname}`)\n\n let addresses = records.flat().map((a) => a.split('=')[1])\n\n if (peerId != null) {\n addresses = addresses.filter((entry) => entry.includes(peerId))\n }\n\n return addresses\n}\n","import mergeOptions from 'merge-options'\nimport { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'\nimport * as Constants from './constants.js'\nimport { AGENT_VERSION } from './identify/consts.js'\nimport * as RelayConstants from './circuit/constants.js'\nimport { publicAddressesFirst } from '@libp2p/utils/address-sort'\nimport { FaultTolerance } from './transport-manager.js'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { Libp2pInit } from './index.js'\nimport { codes, messages } from './errors.js'\nimport errCode from 'err-code'\nimport type { RecursivePartial } from '@libp2p/interfaces'\nimport { isNode, isBrowser, isWebWorker, isElectronMain, isElectronRenderer, isReactNative } from 'wherearewe'\n\nconst DefaultConfig: Partial = {\n addresses: {\n listen: [],\n announce: [],\n noAnnounce: [],\n announceFilter: (multiaddrs: Multiaddr[]) => multiaddrs\n },\n connectionManager: {\n maxConnections: 300,\n minConnections: 50,\n autoDial: true,\n autoDialInterval: 10000,\n maxParallelDials: Constants.MAX_PARALLEL_DIALS,\n maxDialsPerPeer: Constants.MAX_PER_PEER_DIALS,\n dialTimeout: Constants.DIAL_TIMEOUT,\n inboundUpgradeTimeout: Constants.INBOUND_UPGRADE_TIMEOUT,\n resolvers: {\n dnsaddr: dnsaddrResolver\n },\n addressSorter: publicAddressesFirst\n },\n connectionGater: {},\n transportManager: {\n faultTolerance: FaultTolerance.FATAL_ALL\n },\n metrics: {\n enabled: false,\n computeThrottleMaxQueueSize: 1000,\n computeThrottleTimeout: 2000,\n movingAverageIntervals: [\n 60 * 1000, // 1 minute\n 5 * 60 * 1000, // 5 minutes\n 15 * 60 * 1000 // 15 minutes\n ],\n maxOldPeersRetention: 50\n },\n peerRouting: {\n refreshManager: {\n enabled: true,\n interval: 6e5,\n bootDelay: 10e3\n }\n },\n nat: {\n enabled: true,\n ttl: 7200,\n keepAlive: true\n },\n relay: {\n enabled: true,\n advertise: {\n bootDelay: RelayConstants.ADVERTISE_BOOT_DELAY,\n enabled: false,\n ttl: RelayConstants.ADVERTISE_TTL\n },\n hop: {\n enabled: false,\n active: false,\n timeout: 30000\n },\n autoRelay: {\n enabled: false,\n maxListeners: 2\n }\n },\n identify: {\n protocolPrefix: 'ipfs',\n host: {\n agentVersion: AGENT_VERSION\n },\n // https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L48\n timeout: 60000,\n maxInboundStreams: 1,\n maxOutboundStreams: 1,\n maxPushIncomingStreams: 1,\n maxPushOutgoingStreams: 1\n },\n ping: {\n protocolPrefix: 'ipfs',\n maxInboundStreams: 1,\n maxOutboundStreams: 1,\n timeout: 10000\n },\n fetch: {\n protocolPrefix: 'libp2p',\n maxInboundStreams: 1,\n maxOutboundStreams: 1,\n timeout: 10000\n }\n}\n\nexport function validateConfig (opts: RecursivePartial): Libp2pInit {\n const resultingOptions: Libp2pInit = mergeOptions(DefaultConfig, opts)\n\n if (resultingOptions.transports == null || resultingOptions.transports.length < 1) {\n throw errCode(new Error(messages.ERR_TRANSPORTS_REQUIRED), codes.ERR_TRANSPORTS_REQUIRED)\n }\n\n if (resultingOptions.connectionEncryption == null || resultingOptions.connectionEncryption.length === 0) {\n throw errCode(new Error(messages.CONN_ENCRYPTION_REQUIRED), codes.CONN_ENCRYPTION_REQUIRED)\n }\n\n if (resultingOptions.connectionProtector === null && globalThis.process?.env?.LIBP2P_FORCE_PNET != null) { // eslint-disable-line no-undef\n throw errCode(new Error(messages.ERR_PROTECTOR_REQUIRED), codes.ERR_PROTECTOR_REQUIRED)\n }\n\n // Append user agent version to default AGENT_VERSION depending on the environment\n if (resultingOptions.identify.host.agentVersion === AGENT_VERSION) {\n if (isNode || isElectronMain) {\n resultingOptions.identify.host.agentVersion += ` UserAgent=${globalThis.process.version}`\n } else if (isBrowser || isWebWorker || isElectronRenderer || isReactNative) {\n resultingOptions.identify.host.agentVersion += ` UserAgent=${globalThis.navigator.userAgent}`\n }\n }\n\n return resultingOptions\n}\n","/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport { encodeMessage, decodeMessage, message } from 'protons-runtime'\nimport type { Uint8ArrayList } from 'uint8arraylist'\nimport type { Codec } from 'protons-runtime'\n\nexport interface PeerIdProto {\n id: Uint8Array\n pubKey?: Uint8Array\n privKey?: Uint8Array\n}\n\nexport namespace PeerIdProto {\n let _codec: Codec\n\n export const codec = (): Codec => {\n if (_codec == null) {\n _codec = message((obj, writer, opts = {}) => {\n if (opts.lengthDelimited !== false) {\n writer.fork()\n }\n\n if (obj.id != null) {\n writer.uint32(10)\n writer.bytes(obj.id)\n } else {\n throw new Error('Protocol error: required field \"id\" was not found in object')\n }\n\n if (obj.pubKey != null) {\n writer.uint32(18)\n writer.bytes(obj.pubKey)\n }\n\n if (obj.privKey != null) {\n writer.uint32(26)\n writer.bytes(obj.privKey)\n }\n\n if (opts.lengthDelimited !== false) {\n writer.ldelim()\n }\n }, (reader, length) => {\n const obj: any = {\n id: new Uint8Array(0)\n }\n\n const end = length == null ? reader.len : reader.pos + length\n\n while (reader.pos < end) {\n const tag = reader.uint32()\n\n switch (tag >>> 3) {\n case 1:\n obj.id = reader.bytes()\n break\n case 2:\n obj.pubKey = reader.bytes()\n break\n case 3:\n obj.privKey = reader.bytes()\n break\n default:\n reader.skipType(tag & 7)\n break\n }\n }\n\n if (obj.id == null) {\n throw new Error('Protocol error: value for required field \"id\" was not found in protobuf')\n }\n\n return obj\n })\n }\n\n return _codec\n }\n\n export const encode = (obj: PeerIdProto): Uint8Array => {\n return encodeMessage(obj, PeerIdProto.codec())\n }\n\n export const decode = (buf: Uint8Array | Uint8ArrayList): PeerIdProto => {\n return decodeMessage(buf, PeerIdProto.codec())\n }\n}\n","import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey, marshalPublicKey, unmarshalPublicKey } from '@libp2p/crypto/keys'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { peerIdFromKeys, peerIdFromBytes } from '@libp2p/peer-id'\nimport { PeerIdProto } from './proto.js'\nimport type { PublicKey, PrivateKey } from '@libp2p/interface-keys'\nimport type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId, PeerId } from '@libp2p/interface-peer-id'\n\nexport const createEd25519PeerId = async (): Promise => {\n const key = await generateKeyPair('Ed25519')\n const id = await createFromPrivKey(key)\n\n if (id.type === 'Ed25519') {\n return id\n }\n\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`)\n}\n\nexport const createSecp256k1PeerId = async (): Promise => {\n const key = await generateKeyPair('secp256k1')\n const id = await createFromPrivKey(key)\n\n if (id.type === 'secp256k1') {\n return id\n }\n\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`)\n}\n\nexport const createRSAPeerId = async (opts?: { bits: number }): Promise => {\n const key = await generateKeyPair('RSA', opts?.bits ?? 2048)\n const id = await createFromPrivKey(key)\n\n if (id.type === 'RSA') {\n return id\n }\n\n throw new Error(`Generated unexpected PeerId type \"${id.type}\"`)\n}\n\nexport async function createFromPubKey (publicKey: PublicKey): Promise {\n return await peerIdFromKeys(marshalPublicKey(publicKey))\n}\n\nexport async function createFromPrivKey (privateKey: PrivateKey): Promise {\n return await peerIdFromKeys(marshalPublicKey(privateKey.public), marshalPrivateKey(privateKey))\n}\n\nexport function exportToProtobuf (peerId: RSAPeerId | Ed25519PeerId | Secp256k1PeerId, excludePrivateKey?: boolean): Uint8Array {\n return PeerIdProto.encode({\n id: peerId.multihash.bytes,\n pubKey: peerId.publicKey,\n privKey: excludePrivateKey === true || peerId.privateKey == null ? undefined : peerId.privateKey\n })\n}\n\nexport async function createFromProtobuf (buf: Uint8Array) {\n const {\n id,\n privKey,\n pubKey\n } = PeerIdProto.decode(buf)\n\n return await createFromParts(\n id,\n privKey,\n pubKey\n )\n}\n\nexport async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }) {\n return await createFromParts(\n uint8ArrayFromString(obj.id, 'base58btc'),\n obj.privKey != null ? uint8ArrayFromString(obj.privKey, 'base64pad') : undefined,\n obj.pubKey != null ? uint8ArrayFromString(obj.pubKey, 'base64pad') : undefined\n )\n}\n\nasync function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array) {\n if (privKey != null) {\n const key = await unmarshalPrivateKey(privKey)\n\n return await createFromPrivKey(key)\n } else if (pubKey != null) {\n const key = await unmarshalPublicKey(pubKey)\n\n return await createFromPubKey(key)\n }\n\n return peerIdFromBytes(multihash)\n}\n","import type { PeerInfo } from '@libp2p/interface-peer-info'\nimport type { EventEmitter } from '@libp2p/interfaces/events'\n\nexport const symbol = Symbol.for('@libp2p/peer-discovery')\n\nexport interface PeerDiscoveryEvents {\n 'peer': CustomEvent\n}\n\nexport interface PeerDiscovery extends EventEmitter {\n /**\n * Used to identify the peer discovery mechanism\n */\n [Symbol.toStringTag]: string\n\n /**\n * Used by the isPeerDiscovery function\n */\n [symbol]: true\n}\n\nexport function isPeerDiscovery (other: any): other is PeerDiscovery {\n return other != null && Boolean(other[symbol])\n}\n","import type { DualDHT, QueryEvent, SingleDHT } from '@libp2p/interface-dht'\nimport type { PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery'\nimport errCode from 'err-code'\nimport { messages, codes } from '../errors.js'\nimport { EventEmitter } from '@libp2p/interfaces/events'\nimport { symbol } from '@libp2p/interface-peer-discovery'\n\nexport class DummyDHT extends EventEmitter implements DualDHT {\n get [symbol] (): true {\n return true\n }\n\n get [Symbol.toStringTag] () {\n return '@libp2p/dummy-dht'\n }\n\n get wan (): SingleDHT {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n get lan (): SingleDHT {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n get (): AsyncIterable {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n findProviders (): AsyncIterable {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n findPeer (): AsyncIterable {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n getClosestPeers (): AsyncIterable {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n provide (): AsyncIterable {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n put (): AsyncIterable {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n async getMode (): Promise<'client' | 'server'> {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n async setMode (): Promise {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n\n async refreshRoutingTable (): Promise {\n throw errCode(new Error(messages.DHT_DISABLED), codes.DHT_DISABLED)\n }\n}\n","import { EventEmitter } from '@libp2p/interfaces/events'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign } from '@libp2p/interface-pubsub'\nimport errCode from 'err-code'\nimport { messages, codes } from '../errors.js'\n\nexport class DummyPubSub extends EventEmitter implements PubSub {\n isStarted (): boolean {\n return false\n }\n\n start (): void | Promise {\n\n }\n\n stop (): void | Promise {\n\n }\n\n get globalSignaturePolicy (): typeof StrictSign | typeof StrictNoSign {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n\n get multicodecs (): string[] {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n\n getPeers (): PeerId[] {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n\n getTopics (): string[] {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n\n subscribe (): void {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n\n unsubscribe (): void {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n\n getSubscribers (): PeerId[] {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n\n async publish (): Promise {\n throw errCode(new Error(messages.PUBSUB_DISABLED), codes.ERR_PUBSUB_DISABLED)\n }\n}\n","import { logger } from '@libp2p/logger'\nimport type { AbortOptions } from '@libp2p/interfaces'\nimport { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'\nimport { Startable, isStartable } from '@libp2p/interfaces/startable'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport { MemoryDatastore } from 'datastore-core/memory'\nimport { DefaultPeerRouting } from './peer-routing.js'\nimport { CompoundContentRouting } from './content-routing/index.js'\nimport { getPeer } from './get-peer.js'\nimport { codes } from './errors.js'\nimport { DefaultAddressManager } from './address-manager/index.js'\nimport { DefaultConnectionManager } from './connection-manager/index.js'\nimport { AutoDialler } from './connection-manager/auto-dialler.js'\nimport { Circuit } from './circuit/transport.js'\nimport { Relay } from './circuit/index.js'\nimport { KeyChain } from './keychain/index.js'\nimport { DefaultMetrics } from './metrics/index.js'\nimport { DefaultTransportManager } from './transport-manager.js'\nimport { DefaultUpgrader } from './upgrader.js'\nimport { DefaultRegistrar } from './registrar.js'\nimport { IdentifyService } from './identify/index.js'\nimport { FetchService } from './fetch/index.js'\nimport { PingService } from './ping/index.js'\nimport { NatManager } from './nat-manager.js'\nimport { PeerRecordUpdater } from './peer-record-updater.js'\nimport { DHTPeerRouting } from './dht/dht-peer-routing.js'\nimport { PersistentPeerStore } from '@libp2p/peer-store'\nimport { DHTContentRouting } from './dht/dht-content-routing.js'\nimport { AutoDialer } from './connection-manager/dialer/auto-dialer.js'\nimport { Initializable, Components, isInitializable } from '@libp2p/components'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { Connection } from '@libp2p/interface-connection'\nimport type { PeerRouting } from '@libp2p/interface-peer-routing'\nimport type { ContentRouting } from '@libp2p/interface-content-routing'\nimport type { PubSub } from '@libp2p/interface-pubsub'\nimport type { Registrar, StreamHandler, StreamHandlerOptions } from '@libp2p/interface-registrar'\nimport type { ConnectionManager } from '@libp2p/interface-connection-manager'\nimport type { PeerInfo } from '@libp2p/interface-peer-info'\nimport type { Libp2p, Libp2pEvents, Libp2pInit, Libp2pOptions } from './index.js'\nimport { validateConfig } from './config.js'\nimport { createEd25519PeerId } from '@libp2p/peer-id-factory'\nimport type { PeerStore } from '@libp2p/interface-peer-store'\nimport type { DualDHT } from '@libp2p/interface-dht'\nimport { concat as uint8ArrayConcat } from 'uint8arrays/concat'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport errCode from 'err-code'\nimport { unmarshalPublicKey } from '@libp2p/crypto/keys'\nimport type { Metrics } from '@libp2p/interface-metrics'\nimport { DummyDHT } from './dht/dummy-dht.js'\nimport { DummyPubSub } from './pubsub/dummy-pubsub.js'\nimport { PeerSet } from '@libp2p/peer-collections'\n\nconst log = logger('libp2p')\n\nexport class Libp2pNode extends EventEmitter implements Libp2p {\n public peerId: PeerId\n public dht: DualDHT\n public pubsub: PubSub\n public identifyService?: IdentifyService\n public fetchService: FetchService\n public pingService: PingService\n public components: Components\n public peerStore: PeerStore\n public contentRouting: ContentRouting\n public peerRouting: PeerRouting\n public keychain: KeyChain\n public connectionManager: ConnectionManager\n public registrar: Registrar\n public metrics?: Metrics\n\n private started: boolean\n private readonly services: Startable[]\n private readonly initializables: Initializable[]\n\n constructor (init: Libp2pInit) {\n super()\n\n this.initializables = []\n this.started = false\n this.peerId = init.peerId\n this.components = new Components({\n peerId: init.peerId,\n datastore: init.datastore ?? new MemoryDatastore(),\n connectionGater: {\n denyDialPeer: async () => await Promise.resolve(false),\n denyDialMultiaddr: async () => await Promise.resolve(false),\n denyInboundConnection: async () => await Promise.resolve(false),\n denyOutboundConnection: async () => await Promise.resolve(false),\n denyInboundEncryptedConnection: async () => await Promise.resolve(false),\n denyOutboundEncryptedConnection: async () => await Promise.resolve(false),\n denyInboundUpgradedConnection: async () => await Promise.resolve(false),\n denyOutboundUpgradedConnection: async () => await Promise.resolve(false),\n filterMultiaddrForPeer: async () => await Promise.resolve(true),\n ...init.connectionGater\n }\n })\n this.components.setPeerStore(new PersistentPeerStore({\n addressFilter: this.components.getConnectionGater().filterMultiaddrForPeer,\n ...init.peerStore\n }))\n\n this.services = [\n this.components\n ]\n\n // Create Metrics\n if (init.metrics.enabled) {\n this.metrics = this.components.setMetrics(new DefaultMetrics(init.metrics))\n }\n\n this.peerStore = this.components.getPeerStore()\n\n this.peerStore.addEventListener('peer', evt => {\n const { detail: peerData } = evt\n\n this.dispatchEvent(new CustomEvent('peer:discovery', { detail: peerData }))\n })\n\n // Set up connection protector if configured\n if (init.connectionProtector != null) {\n this.components.setConnectionProtector(init.connectionProtector)\n }\n\n // Set up the Upgrader\n this.components.setUpgrader(new DefaultUpgrader(this.components, {\n connectionEncryption: (init.connectionEncryption ?? []).map(component => this.configureComponent(component)),\n muxers: (init.streamMuxers ?? []).map(component => this.configureComponent(component)),\n inboundUpgradeTimeout: init.connectionManager.inboundUpgradeTimeout\n }))\n\n // Create the Connection Manager\n this.connectionManager = this.components.setConnectionManager(new DefaultConnectionManager(init.connectionManager))\n\n // Create the Registrar\n this.registrar = this.components.setRegistrar(new DefaultRegistrar(this.components))\n\n // Setup the transport manager\n this.components.setTransportManager(new DefaultTransportManager(this.components, init.transportManager))\n\n // Addresses {listen, announce, noAnnounce}\n this.components.setAddressManager(new DefaultAddressManager(this.components, init.addresses))\n\n // update our peer record when addresses change\n this.configureComponent(new PeerRecordUpdater(this.components))\n\n this.configureComponent(new AutoDialler(this.components, {\n enabled: init.connectionManager.autoDial,\n minConnections: init.connectionManager.minConnections,\n autoDialInterval: init.connectionManager.autoDialInterval\n }))\n\n // Create keychain\n const keychainOpts = KeyChain.generateOptions()\n this.keychain = this.configureComponent(new KeyChain(this.components, {\n ...keychainOpts,\n ...init.keychain\n }))\n\n // Create the Nat Manager\n this.services.push(new NatManager(this.components, init.nat))\n\n init.transports.forEach((transport) => {\n this.components.getTransportManager().add(this.configureComponent(transport))\n })\n\n // Attach stream multiplexers\n if (init.streamMuxers != null && init.streamMuxers.length > 0) {\n // Add the identify service since we can multiplex\n this.identifyService = new IdentifyService(this.components, {\n ...init.identify\n })\n this.configureComponent(this.identifyService)\n }\n\n // dht provided components (peerRouting, contentRouting, dht)\n if (init.dht != null) {\n this.dht = this.components.setDHT(init.dht)\n } else {\n this.dht = new DummyDHT()\n }\n\n // Create pubsub if provided\n if (init.pubsub != null) {\n this.pubsub = this.components.setPubSub(init.pubsub)\n } else {\n this.pubsub = new DummyPubSub()\n }\n\n // Attach remaining APIs\n // peer and content routing will automatically get modules from _modules and _dht\n\n const peerRouters: PeerRouting[] = (init.peerRouters ?? []).map(component => this.configureComponent(component))\n\n if (init.dht != null) {\n // add dht to routers\n peerRouters.push(this.configureComponent(new DHTPeerRouting(this.dht)))\n\n // use dht for peer discovery\n this.dht.addEventListener('peer', (evt) => {\n this.onDiscoveryPeer(evt)\n })\n }\n\n this.peerRouting = this.components.setPeerRouting(this.configureComponent(new DefaultPeerRouting(this.components, {\n ...init.peerRouting,\n routers: peerRouters\n })))\n\n const contentRouters: ContentRouting[] = (init.contentRouters ?? []).map(component => this.configureComponent(component))\n\n if (init.dht != null) {\n // add dht to routers\n contentRouters.push(this.configureComponent(new DHTContentRouting(this.dht)))\n }\n\n this.contentRouting = this.components.setContentRouting(this.configureComponent(new CompoundContentRouting(this.components, {\n routers: contentRouters\n })))\n\n if (init.relay.enabled) {\n this.components.getTransportManager().add(this.configureComponent(new Circuit(init.relay)))\n\n this.configureComponent(new Relay(this.components, {\n addressSorter: init.connectionManager.addressSorter,\n ...init.relay\n }))\n }\n\n this.fetchService = this.configureComponent(new FetchService(this.components, {\n ...init.fetch\n }))\n\n this.pingService = this.configureComponent(new PingService(this.components, {\n ...init.ping\n }))\n\n const autoDialer = this.configureComponent(new AutoDialer(this.components, {\n enabled: init.connectionManager.autoDial !== false,\n minConnections: init.connectionManager.minConnections,\n dialTimeout: init.connectionManager.dialTimeout ?? 30000\n }))\n\n this.addEventListener('peer:discovery', evt => {\n if (!this.isStarted()) {\n return\n }\n\n autoDialer.handle(evt)\n })\n\n // Discovery modules\n for (const service of init.peerDiscovery ?? []) {\n this.configureComponent(service)\n\n service.addEventListener('peer', (evt) => {\n this.onDiscoveryPeer(evt)\n })\n }\n }\n\n private configureComponent (component: T): T {\n if (isStartable(component)) {\n this.services.push(component)\n }\n\n if (isInitializable(component)) {\n this.initializables.push(component)\n }\n\n return component\n }\n\n /**\n * Starts the libp2p node and all its subsystems\n */\n async start () {\n if (this.started) {\n return\n }\n\n this.started = true\n\n log('libp2p is starting')\n\n try {\n // Set available components on all modules interested in components\n this.initializables.forEach(obj => {\n obj.init(this.components)\n })\n\n await Promise.all(\n this.services.map(async service => {\n if (service.beforeStart != null) {\n await service.beforeStart()\n }\n })\n )\n\n // start any startables\n await Promise.all(\n this.services.map(service => service.start())\n )\n\n await Promise.all(\n this.services.map(async service => {\n if (service.afterStart != null) {\n await service.afterStart()\n }\n })\n )\n\n log('libp2p has started')\n } catch (err: any) {\n log.error('An error occurred starting libp2p', err)\n await this.stop()\n throw err\n }\n }\n\n /**\n * Stop the libp2p node by closing its listeners and open connections\n */\n async stop () {\n if (!this.started) {\n return\n }\n\n log('libp2p is stopping')\n\n this.started = false\n\n await Promise.all(\n this.services.map(async service => {\n if (service.beforeStop != null) {\n await service.beforeStop()\n }\n })\n )\n\n await Promise.all(\n this.services.map(servce => servce.stop())\n )\n\n await Promise.all(\n this.services.map(async service => {\n if (service.afterStop != null) {\n await service.afterStop()\n }\n })\n )\n\n log('libp2p has stopped')\n }\n\n /**\n * Load keychain keys from the datastore.\n * Imports the private key as 'self', if needed.\n */\n async loadKeychain () {\n if (this.keychain == null) {\n return\n }\n\n try {\n await this.keychain.findKeyByName('self')\n } catch (err: any) {\n await this.keychain.importPeer('self', this.peerId)\n }\n }\n\n isStarted () {\n return this.started\n }\n\n getConnections (peerId?: PeerId): Connection[] {\n return this.components.getConnectionManager().getConnections(peerId)\n }\n\n getPeers (): PeerId[] {\n const peerSet = new PeerSet()\n\n for (const conn of this.components.getConnectionManager().getConnections()) {\n peerSet.add(conn.remotePeer)\n }\n\n return Array.from(peerSet)\n }\n\n async dial (peer: PeerId | Multiaddr, options: AbortOptions = {}): Promise {\n const { id, multiaddrs } = getPeer(peer)\n\n await this.components.getPeerStore().addressBook.add(id, multiaddrs)\n\n return await this.components.getConnectionManager().openConnection(id, options)\n }\n\n async dialProtocol (peer: PeerId | Multiaddr, protocols: string | string[], options: AbortOptions = {}) {\n if (protocols == null) {\n throw errCode(new Error('no protocols were provided to open a stream'), codes.ERR_INVALID_PROTOCOLS_FOR_STREAM)\n }\n\n protocols = Array.isArray(protocols) ? protocols : [protocols]\n\n if (protocols.length === 0) {\n throw errCode(new Error('no protocols were provided to open a stream'), codes.ERR_INVALID_PROTOCOLS_FOR_STREAM)\n }\n\n const connection = await this.dial(peer, options)\n\n return await connection.newStream(protocols, options)\n }\n\n getMultiaddrs (): Multiaddr[] {\n return this.components.getAddressManager().getAddresses()\n }\n\n async hangUp (peer: PeerId | Multiaddr | string): Promise {\n const { id } = getPeer(peer)\n\n await this.components.getConnectionManager().closeConnections(id)\n }\n\n /**\n * Get the public key for the given peer id\n */\n async getPublicKey (peer: PeerId, options: AbortOptions = {}): Promise {\n log('getPublicKey %p', peer)\n\n if (peer.publicKey != null) {\n return peer.publicKey\n }\n\n const peerInfo = await this.peerStore.get(peer)\n\n if (peerInfo.pubKey != null) {\n return peerInfo.pubKey\n }\n\n if (this.dht == null) {\n throw errCode(new Error('Public key was not in the peer store and the DHT is not enabled'), codes.ERR_NO_ROUTERS_AVAILABLE)\n }\n\n const peerKey = uint8ArrayConcat([\n uint8ArrayFromString('/pk/'),\n peer.multihash.digest\n ])\n\n // search the dht\n for await (const event of this.dht.get(peerKey, options)) {\n if (event.name === 'VALUE') {\n const key = unmarshalPublicKey(event.value)\n\n await this.peerStore.keyBook.set(peer, event.value)\n\n return key.bytes\n }\n }\n\n throw errCode(new Error(`Node not responding with its public key: ${peer.toString()}`), codes.ERR_INVALID_RECORD)\n }\n\n async fetch (peer: PeerId | Multiaddr | string, key: string, options: AbortOptions = {}): Promise {\n const { id, multiaddrs } = getPeer(peer)\n\n if (multiaddrs != null) {\n await this.components.getPeerStore().addressBook.add(id, multiaddrs)\n }\n\n return await this.fetchService.fetch(id, key, options)\n }\n\n async ping (peer: PeerId | Multiaddr | string, options: AbortOptions = {}): Promise {\n const { id, multiaddrs } = getPeer(peer)\n\n if (multiaddrs.length > 0) {\n await this.components.getPeerStore().addressBook.add(id, multiaddrs)\n }\n\n return await this.pingService.ping(id, options)\n }\n\n async handle (protocols: string | string[], handler: StreamHandler, options?: StreamHandlerOptions): Promise {\n if (!Array.isArray(protocols)) {\n protocols = [protocols]\n }\n\n await Promise.all(\n protocols.map(async protocol => {\n await this.components.getRegistrar().handle(protocol, handler, options)\n })\n )\n }\n\n async unhandle (protocols: string[] | string): Promise {\n if (!Array.isArray(protocols)) {\n protocols = [protocols]\n }\n\n await Promise.all(\n protocols.map(async protocol => {\n await this.components.getRegistrar().unhandle(protocol)\n })\n )\n }\n\n /**\n * Called whenever peer discovery services emit `peer` events.\n * Known peers may be emitted.\n */\n onDiscoveryPeer (evt: CustomEvent) {\n const { detail: peer } = evt\n\n if (peer.id.toString() === this.peerId.toString()) {\n log.error(new Error(codes.ERR_DISCOVERED_SELF))\n return\n }\n\n if (peer.multiaddrs.length > 0) {\n void this.components.getPeerStore().addressBook.add(peer.id, peer.multiaddrs).catch(err => log.error(err))\n }\n\n if (peer.protocols.length > 0) {\n void this.components.getPeerStore().protoBook.set(peer.id, peer.protocols).catch(err => log.error(err))\n }\n\n this.dispatchEvent(new CustomEvent('peer:discovery', { detail: peer }))\n }\n}\n\n/**\n * Returns a new Libp2pNode instance - this exposes more of the internals than the\n * libp2p interface and is useful for testing and debugging.\n */\nexport async function createLibp2pNode (options: Libp2pOptions): Promise {\n if (options.peerId == null) {\n options.peerId = await createEd25519PeerId()\n }\n\n return new Libp2pNode(validateConfig(options))\n}\n","/**\n * Return pseudo random subset of the input.\n */\nexport function getPseudoRandomSubset(\n values: T[],\n wantedNumber: number\n): T[] {\n if (values.length <= wantedNumber || values.length <= 1) {\n return values;\n }\n\n return shuffle(values).slice(0, wantedNumber);\n}\n\nfunction shuffle(arr: T[]): T[] {\n if (arr.length <= 1) {\n return arr;\n }\n const randInt = (): number => {\n return Math.floor(Math.random() * Math.floor(arr.length));\n };\n\n for (let i = 0; i < arr.length; i++) {\n const j = randInt();\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n return arr;\n}\n","import type {\n PeerDiscovery,\n PeerDiscoveryEvents,\n} from \"@libp2p/interface-peer-discovery\";\nimport { symbol } from \"@libp2p/interface-peer-discovery\";\nimport type { PeerInfo } from \"@libp2p/interface-peer-info\";\nimport { CustomEvent, EventEmitter } from \"@libp2p/interfaces/events\";\nimport { Multiaddr } from \"@multiformats/multiaddr\";\nimport debug from \"debug\";\n\nimport { multiaddrsToPeerInfo } from \"./multiaddr_to_peer_info\";\nimport { getPseudoRandomSubset } from \"./random_subset\";\n\nconst log = debug(\"waku:peer-discovery-static-list\");\n\nexport interface Options {\n /**\n * The maximum of peers to connect to as part of the bootstrap process.\n *\n * @default The length of the passed `peers` array.\n */\n maxPeers?: number;\n /**\n * The interval between emitting addresses in milliseconds.\n *\n * @default {@link PeerDiscoveryEvents.DefaultInterval}\n */\n interval?: number;\n}\n\n/**\n * Parse options and expose function to return bootstrap peer addresses.\n *\n * @throws if an invalid combination of options is passed, see [[BootstrapOptions]] for details.\n */\nexport class PeerDiscoveryStaticPeers\n extends EventEmitter\n implements PeerDiscovery\n{\n static DefaultInterval = 200;\n private readonly peers: PeerInfo[];\n private timer?: ReturnType;\n private readonly interval: number;\n\n /**\n * @param peers Multiaddrs of peers to connect to.\n * @param opts\n */\n constructor(peers: string[] | Multiaddr[], opts?: Options) {\n super();\n\n this.interval = opts?.interval ?? PeerDiscoveryStaticPeers.DefaultInterval;\n const maxPeers = opts?.maxPeers ?? peers?.length;\n\n const peerMas = peers.map((peer: string | Multiaddr) => {\n if (typeof peer === \"string\") {\n return new Multiaddr(peer);\n } else {\n return peer;\n }\n });\n this.peers = multiaddrsToPeerInfo(getPseudoRandomSubset(peerMas, maxPeers));\n log(\n \"Use provided list of peers (reduced to maxPeers)\",\n this.peers.map((ma) => ma.toString())\n );\n }\n\n /**\n * Start emitting static peers.\n */\n start(): void {\n this._startTimer();\n }\n\n private _startTimer(): void {\n if (this.peers) {\n log(\"Starting to emit static peers.\");\n if (this.timer != null) {\n return;\n }\n\n this.timer = setInterval(() => this._returnPeers(), this.interval);\n\n this._returnPeers();\n }\n }\n\n _returnPeers(): void {\n if (this.timer == null) {\n return;\n }\n\n this.peers.forEach((peerData) => {\n this.dispatchEvent(\n new CustomEvent(\"peer\", { detail: peerData })\n );\n });\n }\n\n /**\n * Stop emitting peers.\n */\n stop(): void {\n if (this.timer != null) {\n clearInterval(this.timer);\n }\n\n this.timer = undefined;\n }\n\n get [symbol](): true {\n return true;\n }\n\n get [Symbol.toStringTag](): string {\n return \"@waku/peer-discovery-static-list\";\n }\n}\n","import { PeerInfo } from \"@libp2p/interface-peer-info\";\nimport { peerIdFromString } from \"@libp2p/peer-id\";\nimport { Multiaddr } from \"@multiformats/multiaddr\";\n\nexport function multiaddrsToPeerInfo(mas: Multiaddr[]): PeerInfo[] {\n return mas\n .map((ma) => {\n const peerIdStr = ma.getPeerId();\n const protocols: string[] = [];\n return {\n id: peerIdStr ? peerIdFromString(peerIdStr) : null,\n multiaddrs: [ma.decapsulateCode(421)],\n protocols,\n };\n })\n .filter((peerInfo): peerInfo is PeerInfo => peerInfo.id !== null);\n}\n","import { Multiaddr } from \"@multiformats/multiaddr\";\n\nimport { getPseudoRandomSubset } from \"./random_subset\";\n\nexport const DefaultWantedNumber = 1;\n\nexport enum Fleet {\n Prod = \"prod\",\n Test = \"test\",\n}\n\n/**\n * Return list of pre-defined (hardcoded) bootstrap nodes.\n *\n * Default behavior is to return nodes of the nwaku Status Prod fleet.\n *\n * @param fleet The fleet to be returned. Defaults to production fleet.\n * @param wantedNumber The number of connections desired. Defaults to [[DefaultWantedNumber]].\n *\n * @returns An array of multiaddresses.\n */\nexport function getPredefinedBootstrapNodes(\n fleet: Fleet = Fleet.Prod,\n wantedNumber: number = DefaultWantedNumber\n): Multiaddr[] {\n if (wantedNumber <= 0) {\n return [];\n }\n\n let nodes;\n switch (fleet) {\n case Fleet.Prod:\n nodes = fleets.fleets[\"wakuv2.prod\"][\"waku-websocket\"];\n break;\n case Fleet.Test:\n nodes = fleets.fleets[\"wakuv2.test\"][\"waku-websocket\"];\n break;\n default:\n nodes = fleets.fleets[\"wakuv2.prod\"][\"waku-websocket\"];\n }\n\n nodes = Object.values(nodes) as string[];\n\n nodes = nodes.map((node: string) => new Multiaddr(node));\n return getPseudoRandomSubset(nodes, wantedNumber);\n}\n\nexport const fleets = {\n fleets: {\n \"wakuv2.prod\": {\n \"waku-websocket\": {\n \"node-01.ac-cn-hongkong-c.wakuv2.prod\":\n \"/dns4/node-01.ac-cn-hongkong-c.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD\",\n \"node-01.do-ams3.wakuv2.prod\":\n \"/dns4/node-01.do-ams3.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmL5okWopX7NqZWBUKVqW8iUxCEmd5GMHLVPwCgzYzQv3e\",\n \"node-01.gc-us-central1-a.wakuv2.prod\":\n \"/dns4/node-01.gc-us-central1-a.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmVkKntsECaYfefR1V2yCR79CegLATuTPE6B9TxgxBiiiA\",\n },\n },\n \"wakuv2.test\": {\n \"waku-websocket\": {\n \"node-01.ac-cn-hongkong-c.wakuv2.test\":\n \"/dns4/node-01.ac-cn-hongkong-c.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAkvWiyFsgRhuJEb9JfjYxEkoHLgnUQmr1N5mKWnYjxYRVm\",\n \"node-01.do-ams3.wakuv2.test\":\n \"/dns4/node-01.do-ams3.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ\",\n \"node-01.gc-us-central1-a.wakuv2.test\":\n \"/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS\",\n },\n },\n },\n};\n","import { Noise } from \"@chainsafe/libp2p-noise\";\nimport type { PeerDiscovery } from \"@libp2p/interface-peer-discovery\";\nimport { Mplex } from \"@libp2p/mplex\";\nimport { WebSockets } from \"@libp2p/websockets\";\nimport { all as filterAll } from \"@libp2p/websockets/filters\";\nimport { createLibp2p, Libp2pOptions } from \"libp2p\";\nimport type { Libp2p } from \"libp2p\";\n\nimport { PeerDiscoveryStaticPeers } from \"./peer_discovery_static_list\";\nimport { getPredefinedBootstrapNodes } from \"./predefined_bootstrap_nodes\";\nimport { Waku, WakuOptions } from \"./waku\";\nimport { WakuFilter } from \"./waku_filter\";\nimport { WakuLightPush } from \"./waku_light_push\";\nimport { WakuRelay } from \"./waku_relay\";\nimport { WakuStore } from \"./waku_store\";\n\nexport interface CreateOptions {\n /**\n * The PubSub Topic to use.\n *\n * One and only one pubsub topic is used by Waku. This is used by:\n * - WakuRelay to receive, route and send messages,\n * - WakuLightPush to send messages,\n * - WakuStore to retrieve messages.\n *\n * The usage of the default pubsub topic is recommended.\n * See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for details.\n *\n * @default {@link index.DefaultPubSubTopic}\n */\n pubSubTopic?: string;\n /**\n * You can pass options to the `Libp2p` instance used by {@link index.waku.Waku} using the {@link CreateOptions.libp2p} property.\n * This property is the same type than the one passed to [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)\n * apart that we made the `modules` property optional and partial,\n * allowing its omission and letting Waku set good defaults.\n * Notes that some values are overridden by {@link index.waku.Waku} to ensure it implements the Waku protocol.\n */\n libp2p?: Partial;\n /**\n * Byte array used as key for the noise protocol used for connection encryption\n * by [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)\n * This is only used for test purposes to not run out of entropy during CI runs.\n */\n staticNoiseKey?: Uint8Array;\n /**\n * Use recommended bootstrap method to discovery and connect to new nodes.\n */\n defaultBootstrap?: boolean;\n}\n\nexport async function createWaku(\n options?: CreateOptions & WakuOptions\n): Promise {\n const libp2pOptions = options?.libp2p ?? {};\n const peerDiscovery = libp2pOptions.peerDiscovery ?? [];\n if (options?.defaultBootstrap) {\n peerDiscovery.push(defaultPeerDiscovery());\n Object.assign(libp2pOptions, { peerDiscovery });\n }\n\n const libp2p = await defaultLibp2p(new WakuRelay(options), libp2pOptions);\n\n const wakuStore = new WakuStore(libp2p, options);\n const wakuLightPush = new WakuLightPush(libp2p, options);\n const wakuFilter = new WakuFilter(libp2p, options);\n\n return new Waku(options ?? {}, libp2p, wakuStore, wakuLightPush, wakuFilter);\n}\n\nexport function defaultPeerDiscovery(): PeerDiscovery {\n return new PeerDiscoveryStaticPeers(getPredefinedBootstrapNodes());\n}\n\nexport async function defaultLibp2p(\n wakuRelay: WakuRelay,\n options?: Partial\n): Promise {\n const libp2pOpts = Object.assign(\n {\n transports: [new WebSockets({ filter: filterAll })],\n streamMuxers: [new Mplex()],\n connectionEncryption: [new Noise()],\n },\n { pubsub: wakuRelay },\n options ?? {}\n );\n\n return createLibp2p(libp2pOpts);\n}\n","import { createLibp2pNode } from './libp2p.js'\nimport type { AbortOptions, RecursivePartial } from '@libp2p/interfaces'\nimport type { EventEmitter } from '@libp2p/interfaces/events'\nimport type { Startable } from '@libp2p/interfaces/startable'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { FaultTolerance } from './transport-manager.js'\nimport type { IdentifyServiceInit } from './identify/index.js'\nimport type { DualDHT } from '@libp2p/interface-dht'\nimport type { Datastore } from 'interface-datastore'\nimport type { PeerStore, PeerStoreInit } from '@libp2p/interface-peer-store'\nimport type { PeerId } from '@libp2p/interface-peer-id'\nimport type { AutoRelayConfig, RelayAdvertiseConfig } from './circuit/index.js'\nimport type { PeerDiscovery } from '@libp2p/interface-peer-discovery'\nimport type { Connection, ConnectionGater, ConnectionProtector, Stream } from '@libp2p/interface-connection'\nimport type { Transport } from '@libp2p/interface-transport'\nimport type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer'\nimport type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter'\nimport type { PeerRouting } from '@libp2p/interface-peer-routing'\nimport type { ContentRouting } from '@libp2p/interface-content-routing'\nimport type { PubSub } from '@libp2p/interface-pubsub'\nimport type { Registrar, StreamHandler, StreamHandlerOptions } from '@libp2p/interface-registrar'\nimport type { ConnectionManager } from '@libp2p/interface-connection-manager'\nimport type { Metrics, MetricsInit } from '@libp2p/interface-metrics'\nimport type { PeerInfo } from '@libp2p/interface-peer-info'\nimport type { KeyChain } from './keychain/index.js'\nimport type { ConnectionManagerInit } from './connection-manager/index.js'\nimport type { PingServiceInit } from './ping/index.js'\nimport type { FetchServiceInit } from './fetch/index.js'\n\nexport interface PersistentPeerStoreOptions {\n threshold?: number\n}\n\nexport interface DEKConfig {\n keyLength: number\n iterationCount: number\n salt: string\n hash: string\n}\n\nexport interface KeychainConfig {\n pass?: string\n dek?: DEKConfig\n}\n\nexport interface MetricsConfig {\n enabled?: boolean\n}\n\nexport interface HopConfig {\n enabled?: boolean\n active?: boolean\n timeout: number\n}\n\nexport interface RelayConfig {\n enabled: boolean\n advertise: RelayAdvertiseConfig\n hop: HopConfig\n autoRelay: AutoRelayConfig\n}\n\nexport interface NatManagerConfig {\n enabled: boolean\n externalAddress?: string\n localAddress?: string\n description?: string\n ttl?: number\n keepAlive: boolean\n gateway?: string\n}\n\nexport interface AddressesConfig {\n listen: string[]\n announce: string[]\n noAnnounce: string[]\n announceFilter: (multiaddrs: Multiaddr[]) => Multiaddr[]\n}\n\nexport interface TransportManagerConfig {\n faultTolerance?: FaultTolerance\n}\n\nexport interface PeerStoreConfig {\n persistence?: boolean\n threshold?: number\n}\n\nexport interface PeerRoutingConfig {\n refreshManager: RefreshManagerConfig\n}\n\nexport interface RefreshManagerConfig {\n enabled?: boolean\n interval: number\n bootDelay: number\n}\n\nexport interface Libp2pInit {\n peerId: PeerId\n addresses: AddressesConfig\n connectionManager: ConnectionManagerInit\n connectionGater: Partial\n transportManager: TransportManagerConfig\n datastore: Datastore\n metrics: MetricsInit\n peerStore: PeerStoreInit\n peerRouting: PeerRoutingConfig\n keychain: KeychainConfig\n nat: NatManagerConfig\n relay: RelayConfig\n identify: IdentifyServiceInit\n ping: PingServiceInit\n fetch: FetchServiceInit\n\n transports: Transport[]\n streamMuxers?: StreamMuxerFactory[]\n connectionEncryption?: ConnectionEncrypter[]\n peerDiscovery?: PeerDiscovery[]\n peerRouters?: PeerRouting[]\n contentRouters?: ContentRouting[]\n dht?: DualDHT\n pubsub?: PubSub\n connectionProtector?: ConnectionProtector\n}\n\nexport interface Libp2pEvents {\n 'peer:discovery': CustomEvent\n}\n\nexport interface Libp2p extends Startable, EventEmitter {\n peerId: PeerId\n peerStore: PeerStore\n peerRouting: PeerRouting\n contentRouting: ContentRouting\n keychain: KeyChain\n connectionManager: ConnectionManager\n registrar: Registrar\n metrics?: Metrics\n pubsub: PubSub\n dht: DualDHT\n\n /**\n * Load keychain keys from the datastore.\n * Imports the private key as 'self', if needed.\n */\n loadKeychain: () => Promise\n\n /**\n * Get a deduplicated list of peer advertising multiaddrs by concatenating\n * the listen addresses used by transports with any configured\n * announce addresses as well as observed addresses reported by peers.\n *\n * If Announce addrs are specified, configured listen addresses will be\n * ignored though observed addresses will still be included.\n */\n getMultiaddrs: () => Multiaddr[]\n\n /**\n * Return a list of all connections this node has open, optionally filtering\n * by a PeerId\n */\n getConnections: (peerId?: PeerId) => Connection[]\n\n /**\n * Return a list of all peers we currently have a connection open to\n */\n getPeers: () => PeerId[]\n\n /**\n * Dials to the provided peer. If successful, the known metadata of the\n * peer will be added to the nodes `peerStore`\n */\n dial: (peer: PeerId | Multiaddr, options?: AbortOptions) => Promise\n\n /**\n * Dials to the provided peer and tries to handshake with the given protocols in order.\n * If successful, the known metadata of the peer will be added to the nodes `peerStore`,\n * and the `MuxedStream` will be returned together with the successful negotiated protocol.\n */\n dialProtocol: (peer: PeerId | Multiaddr, protocols: string | string[], options?: AbortOptions) => Promise\n\n /**\n * Disconnects all connections to the given `peer`\n */\n hangUp: (peer: PeerId | Multiaddr | string) => Promise\n\n /**\n * Registers the `handler` for each protocol\n */\n handle: (protocol: string | string[], handler: StreamHandler, options?: StreamHandlerOptions) => Promise\n\n /**\n * Removes the handler for each protocol. The protocol\n * will no longer be supported on streams.\n */\n unhandle: (protocols: string[] | string) => Promise\n\n /**\n * Pings the given peer in order to obtain the operation latency\n */\n ping: (peer: Multiaddr | PeerId, options?: AbortOptions) => Promise\n\n /**\n * Sends a request to fetch the value associated with the given key from the given peer.\n */\n fetch: (peer: PeerId | Multiaddr | string, key: string, options?: AbortOptions) => Promise\n\n /**\n * Returns the public key for the passed PeerId. If the PeerId is of the 'RSA' type\n * this may mean searching the DHT if the key is not present in the KeyStore.\n */\n getPublicKey: (peer: PeerId, options?: AbortOptions) => Promise\n}\n\nexport type Libp2pOptions = RecursivePartial\n\n/**\n * Returns a new instance of the Libp2p interface, generating a new PeerId\n * if one is not passed as part of the options.\n */\nexport async function createLibp2p (options: Libp2pOptions): Promise {\n return await createLibp2pNode(options)\n}\n","import pTimeout from 'p-timeout';\n\nconst normalizeEmitter = emitter => {\n\tconst addListener = emitter.on || emitter.addListener || emitter.addEventListener;\n\tconst removeListener = emitter.off || emitter.removeListener || emitter.removeEventListener;\n\n\tif (!addListener || !removeListener) {\n\t\tthrow new TypeError('Emitter is not compatible');\n\t}\n\n\treturn {\n\t\taddListener: addListener.bind(emitter),\n\t\tremoveListener: removeListener.bind(emitter),\n\t};\n};\n\nexport function pEventMultiple(emitter, event, options) {\n\tlet cancel;\n\tconst returnValue = new Promise((resolve, reject) => {\n\t\toptions = {\n\t\t\trejectionEvents: ['error'],\n\t\t\tmultiArgs: false,\n\t\t\tresolveImmediately: false,\n\t\t\t...options,\n\t\t};\n\n\t\tif (!(options.count >= 0 && (options.count === Number.POSITIVE_INFINITY || Number.isInteger(options.count)))) {\n\t\t\tthrow new TypeError('The `count` option should be at least 0 or more');\n\t\t}\n\n\t\t// Allow multiple events\n\t\tconst events = [event].flat();\n\n\t\tconst items = [];\n\t\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\t\tconst onItem = (...arguments_) => {\n\t\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\t\tif (options.filter && !options.filter(value)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titems.push(value);\n\n\t\t\tif (options.count === items.length) {\n\t\t\t\tcancel();\n\t\t\t\tresolve(items);\n\t\t\t}\n\t\t};\n\n\t\tconst rejectHandler = error => {\n\t\t\tcancel();\n\t\t\treject(error);\n\t\t};\n\n\t\tcancel = () => {\n\t\t\tfor (const event of events) {\n\t\t\t\tremoveListener(event, onItem);\n\t\t\t}\n\n\t\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t\t}\n\t\t};\n\n\t\tfor (const event of events) {\n\t\t\taddListener(event, onItem);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\taddListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tif (options.resolveImmediately) {\n\t\t\tresolve(items);\n\t\t}\n\t});\n\n\treturnValue.cancel = cancel;\n\n\tif (typeof options.timeout === 'number') {\n\t\tconst timeout = pTimeout(returnValue, options.timeout);\n\t\ttimeout.cancel = cancel;\n\t\treturn timeout;\n\t}\n\n\treturn returnValue;\n}\n\nexport function pEvent(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\toptions = {\n\t\t...options,\n\t\tcount: 1,\n\t\tresolveImmediately: false,\n\t};\n\n\tconst arrayPromise = pEventMultiple(emitter, event, options);\n\tconst promise = arrayPromise.then(array => array[0]); // eslint-disable-line promise/prefer-await-to-then\n\tpromise.cancel = arrayPromise.cancel;\n\n\treturn promise;\n}\n\nexport function pEventIterator(emitter, event, options) {\n\tif (typeof options === 'function') {\n\t\toptions = {filter: options};\n\t}\n\n\t// Allow multiple events\n\tconst events = [event].flat();\n\n\toptions = {\n\t\trejectionEvents: ['error'],\n\t\tresolutionEvents: [],\n\t\tlimit: Number.POSITIVE_INFINITY,\n\t\tmultiArgs: false,\n\t\t...options,\n\t};\n\n\tconst {limit} = options;\n\tconst isValidLimit = limit >= 0 && (limit === Number.POSITIVE_INFINITY || Number.isInteger(limit));\n\tif (!isValidLimit) {\n\t\tthrow new TypeError('The `limit` option should be a non-negative integer or Infinity');\n\t}\n\n\tif (limit === 0) {\n\t\t// Return an empty async iterator to avoid any further cost\n\t\treturn {\n\t\t\t[Symbol.asyncIterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tasync next() {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\n\tconst {addListener, removeListener} = normalizeEmitter(emitter);\n\n\tlet isDone = false;\n\tlet error;\n\tlet hasPendingError = false;\n\tconst nextQueue = [];\n\tconst valueQueue = [];\n\tlet eventCount = 0;\n\tlet isLimitReached = false;\n\n\tconst valueHandler = (...arguments_) => {\n\t\teventCount++;\n\t\tisLimitReached = eventCount === limit;\n\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\n\t\t\tresolve({done: false, value});\n\n\t\t\tif (isLimitReached) {\n\t\t\t\tcancel();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvalueQueue.push(value);\n\n\t\tif (isLimitReached) {\n\t\t\tcancel();\n\t\t}\n\t};\n\n\tconst cancel = () => {\n\t\tisDone = true;\n\n\t\tfor (const event of events) {\n\t\t\tremoveListener(event, valueHandler);\n\t\t}\n\n\t\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\t\tremoveListener(rejectionEvent, rejectHandler);\n\t\t}\n\n\t\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\t\tremoveListener(resolutionEvent, resolveHandler);\n\t\t}\n\n\t\twhile (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value: undefined});\n\t\t}\n\t};\n\n\tconst rejectHandler = (...arguments_) => {\n\t\terror = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {reject} = nextQueue.shift();\n\t\t\treject(error);\n\t\t} else {\n\t\t\thasPendingError = true;\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tconst resolveHandler = (...arguments_) => {\n\t\tconst value = options.multiArgs ? arguments_ : arguments_[0];\n\n\t\t// eslint-disable-next-line unicorn/no-array-callback-reference\n\t\tif (options.filter && !options.filter(value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (nextQueue.length > 0) {\n\t\t\tconst {resolve} = nextQueue.shift();\n\t\t\tresolve({done: true, value});\n\t\t} else {\n\t\t\tvalueQueue.push(value);\n\t\t}\n\n\t\tcancel();\n\t};\n\n\tfor (const event of events) {\n\t\taddListener(event, valueHandler);\n\t}\n\n\tfor (const rejectionEvent of options.rejectionEvents) {\n\t\taddListener(rejectionEvent, rejectHandler);\n\t}\n\n\tfor (const resolutionEvent of options.resolutionEvents) {\n\t\taddListener(resolutionEvent, resolveHandler);\n\t}\n\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\treturn this;\n\t\t},\n\t\tasync next() {\n\t\t\tif (valueQueue.length > 0) {\n\t\t\t\tconst value = valueQueue.shift();\n\t\t\t\treturn {\n\t\t\t\t\tdone: isDone && valueQueue.length === 0 && !isLimitReached,\n\t\t\t\t\tvalue,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (hasPendingError) {\n\t\t\t\thasPendingError = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (isDone) {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t\tvalue: undefined,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tnextQueue.push({resolve, reject});\n\t\t\t});\n\t\t},\n\t\tasync return(value) {\n\t\t\tcancel();\n\t\t\treturn {\n\t\t\t\tdone: isDone,\n\t\t\t\tvalue,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport {TimeoutError} from 'p-timeout';\n","import type { GossipSub } from \"@chainsafe/libp2p-gossipsub\";\nimport { Peer, PeerProtocolsChangeData } from \"@libp2p/interface-peer-store\";\nimport debug from \"debug\";\nimport type { Libp2p } from \"libp2p\";\nimport { pEvent } from \"p-event\";\n\nimport { StoreCodecs } from \"./constants\";\nimport { Protocols, Waku } from \"./waku\";\nimport { FilterCodec } from \"./waku_filter\";\nimport { LightPushCodec } from \"./waku_light_push\";\n\nconst log = debug(\"waku:wait-for-remote-peer\");\n\ninterface WakuProtocol {\n libp2p: Libp2p;\n peers: () => Promise;\n}\n\ninterface WakuGossipSubProtocol extends GossipSub {\n getMeshPeers: () => string[];\n}\n\n/**\n * Wait for a remote peer to be ready given the passed protocols.\n * Must be used after attempting to connect to nodes, using {@link index.waku.Waku.dial} or\n * a bootstrap method with {@link index.waku.Waku.constructor}.\n *\n * If the passed protocols is a GossipSub protocol, then it resolves only once\n * a peer is in a mesh, to help ensure that other peers will send and receive\n * message to us.\n *\n * @param waku The Waku Node\n * @param protocols The protocols that need to be enabled by remote peers.\n * @param timeoutMs A timeout value in milliseconds..\n *\n * @returns A promise that **resolves** if all desired protocols are fulfilled by\n * remote nodes, **rejects** if the timeoutMs is reached.\n *\n * @default Remote peer must have Waku Relay enabled and no time out is applied.\n */\nexport async function waitForRemotePeer(\n waku: Waku,\n protocols?: Protocols[],\n timeoutMs?: number\n): Promise {\n protocols = protocols ?? [Protocols.Relay];\n\n if (!waku.isStarted()) return Promise.reject(\"Waku node is not started\");\n\n const promises = [];\n\n if (protocols.includes(Protocols.Relay)) {\n promises.push(waitForGossipSubPeerInMesh(waku.relay));\n }\n\n if (protocols.includes(Protocols.Store)) {\n promises.push(waitForConnectedPeer(waku.store, Object.values(StoreCodecs)));\n }\n\n if (protocols.includes(Protocols.LightPush)) {\n promises.push(waitForConnectedPeer(waku.lightPush, [LightPushCodec]));\n }\n\n if (protocols.includes(Protocols.Filter)) {\n promises.push(waitForConnectedPeer(waku.filter, [FilterCodec]));\n }\n\n if (timeoutMs) {\n await rejectOnTimeout(\n Promise.all(promises),\n timeoutMs,\n \"Timed out waiting for a remote peer.\"\n );\n } else {\n await Promise.all(promises);\n }\n}\n\n/**\n * Wait for a peer with the given protocol to be connected.\n */\nasync function waitForConnectedPeer(\n waku: WakuProtocol,\n codecs: string[]\n): Promise {\n const peers = await waku.peers();\n\n if (peers.length) {\n log(`${codecs} peer found: `, peers[0].id.toString());\n return;\n }\n\n await new Promise((resolve) => {\n const cb = (evt: CustomEvent): void => {\n for (const codec of codecs) {\n if (evt.detail.protocols.includes(codec)) {\n log(\"Resolving for\", codec, evt.detail.protocols);\n waku.libp2p.peerStore.removeEventListener(\"change:protocols\", cb);\n resolve();\n break;\n }\n }\n };\n waku.libp2p.peerStore.addEventListener(\"change:protocols\", cb);\n });\n}\n\n/**\n * Wait for a peer with the given protocol to be connected and in the gossipsub\n * mesh.\n */\nasync function waitForGossipSubPeerInMesh(\n waku: WakuGossipSubProtocol\n): Promise {\n let peers = waku.getMeshPeers();\n\n while (peers.length == 0) {\n await pEvent(waku, \"gossipsub:heartbeat\");\n peers = waku.getMeshPeers();\n }\n}\n\nconst awaitTimeout = (ms: number, rejectReason: string): Promise =>\n new Promise((_resolve, reject) => setTimeout(() => reject(rejectReason), ms));\n\nasync function rejectOnTimeout(\n promise: Promise,\n timeoutMs: number,\n rejectReason: string\n): Promise {\n await Promise.race([promise, awaitTimeout(timeoutMs, rejectReason)]);\n}\n","import { Dispatch, SetStateAction } from \"react\";\nimport { Protocols, utils, Waku, WakuMessage } from \"js-waku\";\nimport { PrivateMessage, PublicKeyMessage } from \"./messaging/wire\";\nimport { validatePublicKeyMessage } from \"./crypto\";\nimport { Message } from \"./messaging/Messages\";\nimport { equals } from \"uint8arrays/equals\";\nimport { createWaku } from \"js-waku/lib/create_waku\";\nimport { PeerDiscoveryStaticPeers } from \"js-waku/lib/peer_discovery_static_list\";\nimport {\n getPredefinedBootstrapNodes,\n Fleet,\n} from \"js-waku/lib/predefined_bootstrap_nodes\";\nimport { waitForRemotePeer } from \"js-waku/lib/wait_for_remote_peer\";\n\nexport const PublicKeyContentTopic = \"/eth-pm/1/public-key/proto\";\nexport const PrivateMessageContentTopic = \"/eth-pm/1/private-message/proto\";\n\nexport async function initWaku(): Promise {\n const waku = await createWaku({\n libp2p: {\n peerDiscovery: [\n new PeerDiscoveryStaticPeers(getPredefinedBootstrapNodes(Fleet.Test)),\n ],\n },\n });\n await waku.start();\n await waitForRemotePeer(waku, [Protocols.Filter, Protocols.LightPush]);\n\n return waku;\n}\n\nexport function handlePublicKeyMessage(\n myAddress: string | undefined,\n setter: Dispatch>>,\n msg: WakuMessage\n) {\n console.log(\"Public Key Message received:\", msg);\n if (!msg.payload) return;\n const publicKeyMsg = PublicKeyMessage.decode(msg.payload);\n if (!publicKeyMsg) return;\n if (myAddress && equals(publicKeyMsg.ethAddress, utils.hexToBytes(myAddress)))\n return;\n\n const res = validatePublicKeyMessage(publicKeyMsg);\n console.log(\"Is Public Key Message valid?\", res);\n\n if (res) {\n setter((prevPks: Map) => {\n prevPks.set(\n utils.bytesToHex(publicKeyMsg.ethAddress),\n publicKeyMsg.encryptionPublicKey\n );\n return new Map(prevPks);\n });\n }\n}\n\nexport async function handlePrivateMessage(\n setter: Dispatch>,\n address: string,\n wakuMsg: WakuMessage\n) {\n console.log(\"Private Message received:\", wakuMsg);\n if (!wakuMsg.payload) return;\n const privateMessage = PrivateMessage.decode(wakuMsg.payload);\n if (!privateMessage) {\n console.log(\"Failed to decode Private Message\");\n return;\n }\n if (!equals(privateMessage.toAddress, utils.hexToBytes(address))) return;\n\n const timestamp = wakuMsg.timestamp ? wakuMsg.timestamp : new Date();\n\n console.log(\"Message decrypted:\", privateMessage.message);\n setter((prevMsgs: Message[]) => {\n const copy = prevMsgs.slice();\n copy.push({\n text: privateMessage.message,\n timestamp: timestamp,\n });\n return copy;\n });\n}\n","import \"@ethersproject/shims\";\n\nimport { PublicKeyMessage } from \"./messaging/wire\";\nimport { generatePrivateKey, getPublicKey, utils } from \"js-waku\";\nimport { PublicKeyContentTopic } from \"./waku\";\nimport { keccak256, _TypedDataEncoder, recoverAddress } from \"ethers/lib/utils\";\nimport { equals } from \"uint8arrays/equals\";\nimport type { TypedDataSigner } from \"@ethersproject/abstract-signer\";\n\nexport const PublicKeyMessageEncryptionKey = utils.hexToBytes(\n keccak256(utils.utf8ToBytes(PublicKeyContentTopic))\n);\n\nexport interface KeyPair {\n privateKey: Uint8Array;\n publicKey: Uint8Array;\n}\n\n/**\n * Generate new encryption key pair.\n */\nexport async function generateEncryptionKeyPair(): Promise {\n const privateKey = generatePrivateKey();\n const publicKey = getPublicKey(privateKey);\n return { privateKey, publicKey };\n}\n\n/**\n * Sign the encryption public key with Web3. This can then be published to let other\n * users know to use this encryption public key to encrypt messages for the\n * Ethereum Address holder.\n */\nexport async function createPublicKeyMessage(\n address: string,\n encryptionPublicKey: Uint8Array,\n signer: TypedDataSigner\n): Promise {\n const signature = await signEncryptionKey(\n encryptionPublicKey,\n address,\n signer\n );\n\n console.log(\"Asking wallet to sign Public Key Message\");\n console.log(\"Public Key Message signed\");\n\n return new PublicKeyMessage({\n encryptionPublicKey: encryptionPublicKey,\n ethAddress: utils.hexToBytes(address),\n signature: utils.hexToBytes(signature),\n });\n}\n\nfunction buildMsgParams(encryptionPublicKey: Uint8Array, fromAddress: string) {\n return {\n domain: {\n name: \"Ethereum Private Message over Waku\",\n version: \"1\",\n },\n value: {\n message:\n \"By signing this message you certify that messages addressed to `ownerAddress` must be encrypted with `encryptionPublicKey`\",\n encryptionPublicKey: utils.bytesToHex(encryptionPublicKey),\n ownerAddress: fromAddress,\n },\n // Refers to the keys of the *types* object below.\n primaryType: \"PublishEncryptionPublicKey\",\n types: {\n PublishEncryptionPublicKey: [\n { name: \"message\", type: \"string\" },\n { name: \"encryptionPublicKey\", type: \"string\" },\n { name: \"ownerAddress\", type: \"string\" },\n ],\n },\n };\n}\n\nexport async function signEncryptionKey(\n encryptionPublicKey: Uint8Array,\n fromAddress: string,\n signer: TypedDataSigner\n): Promise {\n const { domain, types, value } = buildMsgParams(\n encryptionPublicKey,\n fromAddress\n );\n\n const result = await signer._signTypedData(domain, types, value);\n\n console.log(\"TYPED SIGNED:\" + JSON.stringify(result));\n\n return utils.hexToBytes(result);\n}\n\n/**\n * Validate that the Encryption Public Key was signed by the holder of the given Ethereum address.\n */\nexport function validatePublicKeyMessage(msg: PublicKeyMessage): boolean {\n const { domain, types, value } = buildMsgParams(\n msg.encryptionPublicKey,\n \"0x\" + utils.bytesToHex(msg.ethAddress)\n );\n\n try {\n const hash = _TypedDataEncoder.hash(domain, types, value);\n\n const recovered = recoverAddress(hash, msg.signature);\n console.log(\"Recovered\", recovered);\n console.log(\"ethAddress\", \"0x\" + utils.bytesToHex(msg.ethAddress));\n\n return equals(utils.hexToBytes(recovered), msg.ethAddress);\n } catch (e) {\n console.error(\"Could not recover public key from signature\", e);\n return false;\n }\n}\n","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { chainPropTypes } from '@material-ui/utils';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n var elevations = {};\n theme.shadows.forEach(function (shadow, index) {\n elevations[\"elevation\".concat(index)] = {\n boxShadow: shadow\n };\n });\n return _extends({\n /* Styles applied to the root element. */\n root: {\n backgroundColor: theme.palette.background.paper,\n color: theme.palette.text.primary,\n transition: theme.transitions.create('box-shadow')\n },\n\n /* Styles applied to the root element if `square={false}`. */\n rounded: {\n borderRadius: theme.shape.borderRadius\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"`. */\n outlined: {\n border: \"1px solid \".concat(theme.palette.divider)\n }\n }, elevations);\n};\nvar Paper = /*#__PURE__*/React.forwardRef(function Paper(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'div' : _props$component,\n _props$square = props.square,\n square = _props$square === void 0 ? false : _props$square,\n _props$elevation = props.elevation,\n elevation = _props$elevation === void 0 ? 1 : _props$elevation,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'elevation' : _props$variant,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"component\", \"square\", \"elevation\", \"variant\"]);\n\n return /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, className, variant === 'outlined' ? classes.outlined : classes[\"elevation\".concat(elevation)], !square && classes.rounded),\n ref: ref\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? Paper.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * Shadow depth, corresponds to `dp` in the spec.\n * It accepts values between 0 and 24 inclusive.\n */\n elevation: chainPropTypes(PropTypes.number, function (props) {\n var classes = props.classes,\n elevation = props.elevation; // in case `withStyles` fails to inject we don't need this warning\n\n if (classes === undefined) {\n return null;\n }\n\n if (elevation != null && classes[\"elevation\".concat(elevation)] === undefined) {\n return new Error(\"Material-UI: This elevation `\".concat(elevation, \"` is not implemented.\"));\n }\n\n return null;\n }),\n\n /**\n * If `true`, rounded corners are disabled.\n */\n square: PropTypes.bool,\n\n /**\n * The variant to use.\n */\n variant: PropTypes.oneOf(['elevation', 'outlined'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiPaper'\n})(Paper);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport capitalize from '../utils/capitalize';\nimport Paper from '../Paper';\nexport var styles = function styles(theme) {\n var backgroundColorDefault = theme.palette.type === 'light' ? theme.palette.grey[100] : theme.palette.grey[900];\n return {\n /* Styles applied to the root element. */\n root: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n boxSizing: 'border-box',\n // Prevent padding issue with the Modal and fixed positioned AppBar.\n zIndex: theme.zIndex.appBar,\n flexShrink: 0\n },\n\n /* Styles applied to the root element if `position=\"fixed\"`. */\n positionFixed: {\n position: 'fixed',\n top: 0,\n left: 'auto',\n right: 0,\n '@media print': {\n // Prevent the app bar to be visible on each printed page.\n position: 'absolute'\n }\n },\n\n /* Styles applied to the root element if `position=\"absolute\"`. */\n positionAbsolute: {\n position: 'absolute',\n top: 0,\n left: 'auto',\n right: 0\n },\n\n /* Styles applied to the root element if `position=\"sticky\"`. */\n positionSticky: {\n // ⚠️ sticky is not supported by IE 11.\n position: 'sticky',\n top: 0,\n left: 'auto',\n right: 0\n },\n\n /* Styles applied to the root element if `position=\"static\"`. */\n positionStatic: {\n position: 'static'\n },\n\n /* Styles applied to the root element if `position=\"relative\"`. */\n positionRelative: {\n position: 'relative'\n },\n\n /* Styles applied to the root element if `color=\"default\"`. */\n colorDefault: {\n backgroundColor: backgroundColorDefault,\n color: theme.palette.getContrastText(backgroundColorDefault)\n },\n\n /* Styles applied to the root element if `color=\"primary\"`. */\n colorPrimary: {\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.primary.contrastText\n },\n\n /* Styles applied to the root element if `color=\"secondary\"`. */\n colorSecondary: {\n backgroundColor: theme.palette.secondary.main,\n color: theme.palette.secondary.contrastText\n },\n\n /* Styles applied to the root element if `color=\"inherit\"`. */\n colorInherit: {\n color: 'inherit'\n },\n\n /* Styles applied to the root element if `color=\"transparent\"`. */\n colorTransparent: {\n backgroundColor: 'transparent',\n color: 'inherit'\n }\n };\n};\nvar AppBar = /*#__PURE__*/React.forwardRef(function AppBar(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$color = props.color,\n color = _props$color === void 0 ? 'primary' : _props$color,\n _props$position = props.position,\n position = _props$position === void 0 ? 'fixed' : _props$position,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"color\", \"position\"]);\n\n return /*#__PURE__*/React.createElement(Paper, _extends({\n square: true,\n component: \"header\",\n elevation: 4,\n className: clsx(classes.root, classes[\"position\".concat(capitalize(position))], classes[\"color\".concat(capitalize(color))], className, position === 'fixed' && 'mui-fixed'),\n ref: ref\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? AppBar.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']),\n\n /**\n * The positioning type. The behavior of the different options is described\n * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning).\n * Note: `sticky` is not universally supported and will fall back to `static` when unavailable.\n */\n position: PropTypes.oneOf(['absolute', 'fixed', 'relative', 'static', 'sticky'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiAppBar'\n})(AppBar);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n position: 'relative',\n display: 'flex',\n alignItems: 'center'\n },\n\n /* Styles applied to the root element if `disableGutters={false}`. */\n gutters: _defineProperty({\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2)\n }, theme.breakpoints.up('sm'), {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3)\n }),\n\n /* Styles applied to the root element if `variant=\"regular\"`. */\n regular: theme.mixins.toolbar,\n\n /* Styles applied to the root element if `variant=\"dense\"`. */\n dense: {\n minHeight: 48\n }\n };\n};\nvar Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'div' : _props$component,\n _props$disableGutters = props.disableGutters,\n disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'regular' : _props$variant,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"component\", \"disableGutters\", \"variant\"]);\n\n return /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, classes[variant], className, !disableGutters && classes.gutters),\n ref: ref\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? Toolbar.propTypes = {\n /**\n * Toolbar children, usually a mixture of `IconButton`, `Button` and `Typography`.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * If `true`, disables gutter padding.\n */\n disableGutters: PropTypes.bool,\n\n /**\n * The variant to use.\n */\n variant: PropTypes.oneOf(['regular', 'dense'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiToolbar'\n})(Toolbar);","import React from 'react';\nexport default React.createContext(null);","import { Children, cloneElement, isValidElement } from 'react';\n/**\n * Given `this.props.children`, return an object mapping key to child.\n *\n * @param {*} children `this.props.children`\n * @return {object} Mapping of key to child\n */\n\nexport function getChildMapping(children, mapFn) {\n var mapper = function mapper(child) {\n return mapFn && isValidElement(child) ? mapFn(child) : child;\n };\n\n var result = Object.create(null);\n if (children) Children.map(children, function (c) {\n return c;\n }).forEach(function (child) {\n // run the map function here instead so that the key is the computed one\n result[child.key] = mapper(child);\n });\n return result;\n}\n/**\n * When you're adding or removing children some may be added or removed in the\n * same render pass. We want to show *both* since we want to simultaneously\n * animate elements in and out. This function takes a previous set of keys\n * and a new set of keys and merges them with its best guess of the correct\n * ordering. In the future we may expose some of the utilities in\n * ReactMultiChild to make this easy, but for now React itself does not\n * directly have this concept of the union of prevChildren and nextChildren\n * so we implement it here.\n *\n * @param {object} prev prev children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @param {object} next next children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @return {object} a key set that contains all keys in `prev` and all keys\n * in `next` in a reasonable order.\n */\n\nexport function mergeChildMappings(prev, next) {\n prev = prev || {};\n next = next || {};\n\n function getValueForKey(key) {\n return key in next ? next[key] : prev[key];\n } // For each key of `next`, the list of keys to insert before that key in\n // the combined list\n\n\n var nextKeysPending = Object.create(null);\n var pendingKeys = [];\n\n for (var prevKey in prev) {\n if (prevKey in next) {\n if (pendingKeys.length) {\n nextKeysPending[prevKey] = pendingKeys;\n pendingKeys = [];\n }\n } else {\n pendingKeys.push(prevKey);\n }\n }\n\n var i;\n var childMapping = {};\n\n for (var nextKey in next) {\n if (nextKeysPending[nextKey]) {\n for (i = 0; i < nextKeysPending[nextKey].length; i++) {\n var pendingNextKey = nextKeysPending[nextKey][i];\n childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);\n }\n }\n\n childMapping[nextKey] = getValueForKey(nextKey);\n } // Finally, add the keys which didn't appear before any key in `next`\n\n\n for (i = 0; i < pendingKeys.length; i++) {\n childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);\n }\n\n return childMapping;\n}\n\nfunction getProp(child, prop, props) {\n return props[prop] != null ? props[prop] : child.props[prop];\n}\n\nexport function getInitialChildMapping(props, onExited) {\n return getChildMapping(props.children, function (child) {\n return cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n appear: getProp(child, 'appear', props),\n enter: getProp(child, 'enter', props),\n exit: getProp(child, 'exit', props)\n });\n });\n}\nexport function getNextChildMapping(nextProps, prevChildMapping, onExited) {\n var nextChildMapping = getChildMapping(nextProps.children);\n var children = mergeChildMappings(prevChildMapping, nextChildMapping);\n Object.keys(children).forEach(function (key) {\n var child = children[key];\n if (!isValidElement(child)) return;\n var hasPrev = (key in prevChildMapping);\n var hasNext = (key in nextChildMapping);\n var prevChild = prevChildMapping[key];\n var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)\n\n if (hasNext && (!hasPrev || isLeaving)) {\n // console.log('entering', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n } else if (!hasNext && hasPrev && !isLeaving) {\n // item is old (exiting)\n // console.log('leaving', key)\n children[key] = cloneElement(child, {\n in: false\n });\n } else if (hasNext && hasPrev && isValidElement(prevChild)) {\n // item hasn't changed transition states\n // copy over the last transition props;\n // console.log('unchanged', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: prevChild.props.in,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n }\n });\n return children;\n}","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport TransitionGroupContext from './TransitionGroupContext';\nimport { getChildMapping, getInitialChildMapping, getNextChildMapping } from './utils/ChildMapping';\n\nvar values = Object.values || function (obj) {\n return Object.keys(obj).map(function (k) {\n return obj[k];\n });\n};\n\nvar defaultProps = {\n component: 'div',\n childFactory: function childFactory(child) {\n return child;\n }\n};\n/**\n * The `` component manages a set of transition components\n * (`` and ``) in a list. Like with the transition\n * components, `` is a state machine for managing the mounting\n * and unmounting of components over time.\n *\n * Consider the example below. As items are removed or added to the TodoList the\n * `in` prop is toggled automatically by the ``.\n *\n * Note that `` does not define any animation behavior!\n * Exactly _how_ a list item animates is up to the individual transition\n * component. This means you can mix and match animations across different list\n * items.\n */\n\nvar TransitionGroup = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(TransitionGroup, _React$Component);\n\n function TransitionGroup(props, context) {\n var _this;\n\n _this = _React$Component.call(this, props, context) || this;\n\n var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear\n\n\n _this.state = {\n contextValue: {\n isMounting: true\n },\n handleExited: handleExited,\n firstRender: true\n };\n return _this;\n }\n\n var _proto = TransitionGroup.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this.mounted = true;\n this.setState({\n contextValue: {\n isMounting: false\n }\n });\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.mounted = false;\n };\n\n TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {\n var prevChildMapping = _ref.children,\n handleExited = _ref.handleExited,\n firstRender = _ref.firstRender;\n return {\n children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),\n firstRender: false\n };\n } // node is `undefined` when user provided `nodeRef` prop\n ;\n\n _proto.handleExited = function handleExited(child, node) {\n var currentChildMapping = getChildMapping(this.props.children);\n if (child.key in currentChildMapping) return;\n\n if (child.props.onExited) {\n child.props.onExited(node);\n }\n\n if (this.mounted) {\n this.setState(function (state) {\n var children = _extends({}, state.children);\n\n delete children[child.key];\n return {\n children: children\n };\n });\n }\n };\n\n _proto.render = function render() {\n var _this$props = this.props,\n Component = _this$props.component,\n childFactory = _this$props.childFactory,\n props = _objectWithoutPropertiesLoose(_this$props, [\"component\", \"childFactory\"]);\n\n var contextValue = this.state.contextValue;\n var children = values(this.state.children).map(childFactory);\n delete props.appear;\n delete props.enter;\n delete props.exit;\n\n if (Component === null) {\n return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {\n value: contextValue\n }, children);\n }\n\n return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {\n value: contextValue\n }, /*#__PURE__*/React.createElement(Component, props, children));\n };\n\n return TransitionGroup;\n}(React.Component);\n\nTransitionGroup.propTypes = process.env.NODE_ENV !== \"production\" ? {\n /**\n * `` renders a `
` by default. You can change this\n * behavior by providing a `component` prop.\n * If you use React v16+ and would like to avoid a wrapping `
` element\n * you can pass in `component={null}`. This is useful if the wrapping div\n * borks your css styles.\n */\n component: PropTypes.any,\n\n /**\n * A set of `` components, that are toggled `in` and out as they\n * leave. the `` will inject specific transition props, so\n * remember to spread them through if you are wrapping the `` as\n * with our `` example.\n *\n * While this component is meant for multiple `Transition` or `CSSTransition`\n * children, sometimes you may want to have a single transition child with\n * content that you want to be transitioned out and in when you change it\n * (e.g. routes, images etc.) In that case you can change the `key` prop of\n * the transition child as you change its content, this will cause\n * `TransitionGroup` to transition the child out and back in.\n */\n children: PropTypes.node,\n\n /**\n * A convenience prop that enables or disables appear animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n appear: PropTypes.bool,\n\n /**\n * A convenience prop that enables or disables enter animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n enter: PropTypes.bool,\n\n /**\n * A convenience prop that enables or disables exit animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n exit: PropTypes.bool,\n\n /**\n * You may need to apply reactive updates to a child as it is exiting.\n * This is generally done by using `cloneElement` however in the case of an exiting\n * child the element has already been removed and not accessible to the consumer.\n *\n * If you do need to update a child as it leaves you can provide a `childFactory`\n * to wrap every child, even the ones that are leaving.\n *\n * @type Function(child: ReactElement) -> ReactElement\n */\n childFactory: PropTypes.func\n} : {};\nTransitionGroup.defaultProps = defaultProps;\nexport default TransitionGroup;","import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport useEventCallback from '../utils/useEventCallback';\nvar useEnhancedEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n/**\n * @ignore - internal component.\n */\n\nfunction Ripple(props) {\n var classes = props.classes,\n _props$pulsate = props.pulsate,\n pulsate = _props$pulsate === void 0 ? false : _props$pulsate,\n rippleX = props.rippleX,\n rippleY = props.rippleY,\n rippleSize = props.rippleSize,\n inProp = props.in,\n _props$onExited = props.onExited,\n onExited = _props$onExited === void 0 ? function () {} : _props$onExited,\n timeout = props.timeout;\n\n var _React$useState = React.useState(false),\n leaving = _React$useState[0],\n setLeaving = _React$useState[1];\n\n var rippleClassName = clsx(classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);\n var rippleStyles = {\n width: rippleSize,\n height: rippleSize,\n top: -(rippleSize / 2) + rippleY,\n left: -(rippleSize / 2) + rippleX\n };\n var childClassName = clsx(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);\n var handleExited = useEventCallback(onExited); // Ripple is used for user feedback (e.g. click or press) so we want to apply styles with the highest priority\n\n useEnhancedEffect(function () {\n if (!inProp) {\n // react-transition-group#onExit\n setLeaving(true); // react-transition-group#onExited\n\n var timeoutId = setTimeout(handleExited, timeout);\n return function () {\n clearTimeout(timeoutId);\n };\n }\n\n return undefined;\n }, [handleExited, inProp, timeout]);\n return /*#__PURE__*/React.createElement(\"span\", {\n className: rippleClassName,\n style: rippleStyles\n }, /*#__PURE__*/React.createElement(\"span\", {\n className: childClassName\n }));\n}\n\nprocess.env.NODE_ENV !== \"production\" ? Ripple.propTypes = {\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore - injected from TransitionGroup\n */\n in: PropTypes.bool,\n\n /**\n * @ignore - injected from TransitionGroup\n */\n onExited: PropTypes.func,\n\n /**\n * If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.\n */\n pulsate: PropTypes.bool,\n\n /**\n * Diameter of the ripple.\n */\n rippleSize: PropTypes.number,\n\n /**\n * Horizontal position of the ripple center.\n */\n rippleX: PropTypes.number,\n\n /**\n * Vertical position of the ripple center.\n */\n rippleY: PropTypes.number,\n\n /**\n * exit delay\n */\n timeout: PropTypes.number.isRequired\n} : void 0;\nexport default Ripple;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { TransitionGroup } from 'react-transition-group';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport Ripple from './Ripple';\nvar DURATION = 550;\nexport var DELAY_RIPPLE = 80;\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n overflow: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 0,\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n borderRadius: 'inherit'\n },\n\n /* Styles applied to the internal `Ripple` components `ripple` class. */\n ripple: {\n opacity: 0,\n position: 'absolute'\n },\n\n /* Styles applied to the internal `Ripple` components `rippleVisible` class. */\n rippleVisible: {\n opacity: 0.3,\n transform: 'scale(1)',\n animation: \"$enter \".concat(DURATION, \"ms \").concat(theme.transitions.easing.easeInOut)\n },\n\n /* Styles applied to the internal `Ripple` components `ripplePulsate` class. */\n ripplePulsate: {\n animationDuration: \"\".concat(theme.transitions.duration.shorter, \"ms\")\n },\n\n /* Styles applied to the internal `Ripple` components `child` class. */\n child: {\n opacity: 1,\n display: 'block',\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n backgroundColor: 'currentColor'\n },\n\n /* Styles applied to the internal `Ripple` components `childLeaving` class. */\n childLeaving: {\n opacity: 0,\n animation: \"$exit \".concat(DURATION, \"ms \").concat(theme.transitions.easing.easeInOut)\n },\n\n /* Styles applied to the internal `Ripple` components `childPulsate` class. */\n childPulsate: {\n position: 'absolute',\n left: 0,\n top: 0,\n animation: \"$pulsate 2500ms \".concat(theme.transitions.easing.easeInOut, \" 200ms infinite\")\n },\n '@keyframes enter': {\n '0%': {\n transform: 'scale(0)',\n opacity: 0.1\n },\n '100%': {\n transform: 'scale(1)',\n opacity: 0.3\n }\n },\n '@keyframes exit': {\n '0%': {\n opacity: 1\n },\n '100%': {\n opacity: 0\n }\n },\n '@keyframes pulsate': {\n '0%': {\n transform: 'scale(1)'\n },\n '50%': {\n transform: 'scale(0.92)'\n },\n '100%': {\n transform: 'scale(1)'\n }\n }\n };\n};\n/**\n * @ignore - internal component.\n *\n * TODO v5: Make private\n */\n\nvar TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(props, ref) {\n var _props$center = props.center,\n centerProp = _props$center === void 0 ? false : _props$center,\n classes = props.classes,\n className = props.className,\n other = _objectWithoutProperties(props, [\"center\", \"classes\", \"className\"]);\n\n var _React$useState = React.useState([]),\n ripples = _React$useState[0],\n setRipples = _React$useState[1];\n\n var nextKey = React.useRef(0);\n var rippleCallback = React.useRef(null);\n React.useEffect(function () {\n if (rippleCallback.current) {\n rippleCallback.current();\n rippleCallback.current = null;\n }\n }, [ripples]); // Used to filter out mouse emulated events on mobile.\n\n var ignoringMouseDown = React.useRef(false); // We use a timer in order to only show the ripples for touch \"click\" like events.\n // We don't want to display the ripple for touch scroll events.\n\n var startTimer = React.useRef(null); // This is the hook called once the previous timeout is ready.\n\n var startTimerCommit = React.useRef(null);\n var container = React.useRef(null);\n React.useEffect(function () {\n return function () {\n clearTimeout(startTimer.current);\n };\n }, []);\n var startCommit = React.useCallback(function (params) {\n var pulsate = params.pulsate,\n rippleX = params.rippleX,\n rippleY = params.rippleY,\n rippleSize = params.rippleSize,\n cb = params.cb;\n setRipples(function (oldRipples) {\n return [].concat(_toConsumableArray(oldRipples), [/*#__PURE__*/React.createElement(Ripple, {\n key: nextKey.current,\n classes: classes,\n timeout: DURATION,\n pulsate: pulsate,\n rippleX: rippleX,\n rippleY: rippleY,\n rippleSize: rippleSize\n })]);\n });\n nextKey.current += 1;\n rippleCallback.current = cb;\n }, [classes]);\n var start = React.useCallback(function () {\n var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var cb = arguments.length > 2 ? arguments[2] : undefined;\n var _options$pulsate = options.pulsate,\n pulsate = _options$pulsate === void 0 ? false : _options$pulsate,\n _options$center = options.center,\n center = _options$center === void 0 ? centerProp || options.pulsate : _options$center,\n _options$fakeElement = options.fakeElement,\n fakeElement = _options$fakeElement === void 0 ? false : _options$fakeElement;\n\n if (event.type === 'mousedown' && ignoringMouseDown.current) {\n ignoringMouseDown.current = false;\n return;\n }\n\n if (event.type === 'touchstart') {\n ignoringMouseDown.current = true;\n }\n\n var element = fakeElement ? null : container.current;\n var rect = element ? element.getBoundingClientRect() : {\n width: 0,\n height: 0,\n left: 0,\n top: 0\n }; // Get the size of the ripple\n\n var rippleX;\n var rippleY;\n var rippleSize;\n\n if (center || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {\n rippleX = Math.round(rect.width / 2);\n rippleY = Math.round(rect.height / 2);\n } else {\n var _ref = event.touches ? event.touches[0] : event,\n clientX = _ref.clientX,\n clientY = _ref.clientY;\n\n rippleX = Math.round(clientX - rect.left);\n rippleY = Math.round(clientY - rect.top);\n }\n\n if (center) {\n rippleSize = Math.sqrt((2 * Math.pow(rect.width, 2) + Math.pow(rect.height, 2)) / 3); // For some reason the animation is broken on Mobile Chrome if the size if even.\n\n if (rippleSize % 2 === 0) {\n rippleSize += 1;\n }\n } else {\n var sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;\n var sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;\n rippleSize = Math.sqrt(Math.pow(sizeX, 2) + Math.pow(sizeY, 2));\n } // Touche devices\n\n\n if (event.touches) {\n // check that this isn't another touchstart due to multitouch\n // otherwise we will only clear a single timer when unmounting while two\n // are running\n if (startTimerCommit.current === null) {\n // Prepare the ripple effect.\n startTimerCommit.current = function () {\n startCommit({\n pulsate: pulsate,\n rippleX: rippleX,\n rippleY: rippleY,\n rippleSize: rippleSize,\n cb: cb\n });\n }; // Delay the execution of the ripple effect.\n\n\n startTimer.current = setTimeout(function () {\n if (startTimerCommit.current) {\n startTimerCommit.current();\n startTimerCommit.current = null;\n }\n }, DELAY_RIPPLE); // We have to make a tradeoff with this value.\n }\n } else {\n startCommit({\n pulsate: pulsate,\n rippleX: rippleX,\n rippleY: rippleY,\n rippleSize: rippleSize,\n cb: cb\n });\n }\n }, [centerProp, startCommit]);\n var pulsate = React.useCallback(function () {\n start({}, {\n pulsate: true\n });\n }, [start]);\n var stop = React.useCallback(function (event, cb) {\n clearTimeout(startTimer.current); // The touch interaction occurs too quickly.\n // We still want to show ripple effect.\n\n if (event.type === 'touchend' && startTimerCommit.current) {\n event.persist();\n startTimerCommit.current();\n startTimerCommit.current = null;\n startTimer.current = setTimeout(function () {\n stop(event, cb);\n });\n return;\n }\n\n startTimerCommit.current = null;\n setRipples(function (oldRipples) {\n if (oldRipples.length > 0) {\n return oldRipples.slice(1);\n }\n\n return oldRipples;\n });\n rippleCallback.current = cb;\n }, []);\n React.useImperativeHandle(ref, function () {\n return {\n pulsate: pulsate,\n start: start,\n stop: stop\n };\n }, [pulsate, start, stop]);\n return /*#__PURE__*/React.createElement(\"span\", _extends({\n className: clsx(classes.root, className),\n ref: container\n }, other), /*#__PURE__*/React.createElement(TransitionGroup, {\n component: null,\n exit: true\n }, ripples));\n});\nprocess.env.NODE_ENV !== \"production\" ? TouchRipple.propTypes = {\n /**\n * If `true`, the ripple starts at the center of the component\n * rather than at the point of interaction.\n */\n center: PropTypes.bool,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string\n} : void 0;\nexport default withStyles(styles, {\n flip: false,\n name: 'MuiTouchRipple'\n})( /*#__PURE__*/React.memo(TouchRipple));","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport * as ReactDOM from 'react-dom';\nimport clsx from 'clsx';\nimport { elementTypeAcceptingRef, refType } from '@material-ui/utils';\nimport useForkRef from '../utils/useForkRef';\nimport useEventCallback from '../utils/useEventCallback';\nimport deprecatedPropType from '../utils/deprecatedPropType';\nimport withStyles from '../styles/withStyles';\nimport useIsFocusVisible from '../utils/useIsFocusVisible';\nimport TouchRipple from './TouchRipple';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n WebkitTapHighlightColor: 'transparent',\n backgroundColor: 'transparent',\n // Reset default value\n // We disable the focus ring for mouse, touch and keyboard users.\n outline: 0,\n border: 0,\n margin: 0,\n // Remove the margin in Safari\n borderRadius: 0,\n padding: 0,\n // Remove the padding in Firefox\n cursor: 'pointer',\n userSelect: 'none',\n verticalAlign: 'middle',\n '-moz-appearance': 'none',\n // Reset\n '-webkit-appearance': 'none',\n // Reset\n textDecoration: 'none',\n // So we take precedent over the style of a native element.\n color: 'inherit',\n '&::-moz-focus-inner': {\n borderStyle: 'none' // Remove Firefox dotted outline.\n\n },\n '&$disabled': {\n pointerEvents: 'none',\n // Disable link interactions\n cursor: 'default'\n },\n '@media print': {\n colorAdjust: 'exact'\n }\n },\n\n /* Pseudo-class applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Pseudo-class applied to the root element if keyboard focused. */\n focusVisible: {}\n};\n/**\n * `ButtonBase` contains as few styles as possible.\n * It aims to be a simple building block for creating a button.\n * It contains a load of style reset and some focus/ripple logic.\n */\n\nvar ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {\n var action = props.action,\n buttonRefProp = props.buttonRef,\n _props$centerRipple = props.centerRipple,\n centerRipple = _props$centerRipple === void 0 ? false : _props$centerRipple,\n children = props.children,\n classes = props.classes,\n className = props.className,\n _props$component = props.component,\n component = _props$component === void 0 ? 'button' : _props$component,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n _props$disableRipple = props.disableRipple,\n disableRipple = _props$disableRipple === void 0 ? false : _props$disableRipple,\n _props$disableTouchRi = props.disableTouchRipple,\n disableTouchRipple = _props$disableTouchRi === void 0 ? false : _props$disableTouchRi,\n _props$focusRipple = props.focusRipple,\n focusRipple = _props$focusRipple === void 0 ? false : _props$focusRipple,\n focusVisibleClassName = props.focusVisibleClassName,\n onBlur = props.onBlur,\n onClick = props.onClick,\n onFocus = props.onFocus,\n onFocusVisible = props.onFocusVisible,\n onKeyDown = props.onKeyDown,\n onKeyUp = props.onKeyUp,\n onMouseDown = props.onMouseDown,\n onMouseLeave = props.onMouseLeave,\n onMouseUp = props.onMouseUp,\n onTouchEnd = props.onTouchEnd,\n onTouchMove = props.onTouchMove,\n onTouchStart = props.onTouchStart,\n onDragLeave = props.onDragLeave,\n _props$tabIndex = props.tabIndex,\n tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,\n TouchRippleProps = props.TouchRippleProps,\n _props$type = props.type,\n type = _props$type === void 0 ? 'button' : _props$type,\n other = _objectWithoutProperties(props, [\"action\", \"buttonRef\", \"centerRipple\", \"children\", \"classes\", \"className\", \"component\", \"disabled\", \"disableRipple\", \"disableTouchRipple\", \"focusRipple\", \"focusVisibleClassName\", \"onBlur\", \"onClick\", \"onFocus\", \"onFocusVisible\", \"onKeyDown\", \"onKeyUp\", \"onMouseDown\", \"onMouseLeave\", \"onMouseUp\", \"onTouchEnd\", \"onTouchMove\", \"onTouchStart\", \"onDragLeave\", \"tabIndex\", \"TouchRippleProps\", \"type\"]);\n\n var buttonRef = React.useRef(null);\n\n function getButtonNode() {\n // #StrictMode ready\n return ReactDOM.findDOMNode(buttonRef.current);\n }\n\n var rippleRef = React.useRef(null);\n\n var _React$useState = React.useState(false),\n focusVisible = _React$useState[0],\n setFocusVisible = _React$useState[1];\n\n if (disabled && focusVisible) {\n setFocusVisible(false);\n }\n\n var _useIsFocusVisible = useIsFocusVisible(),\n isFocusVisible = _useIsFocusVisible.isFocusVisible,\n onBlurVisible = _useIsFocusVisible.onBlurVisible,\n focusVisibleRef = _useIsFocusVisible.ref;\n\n React.useImperativeHandle(action, function () {\n return {\n focusVisible: function focusVisible() {\n setFocusVisible(true);\n buttonRef.current.focus();\n }\n };\n }, []);\n React.useEffect(function () {\n if (focusVisible && focusRipple && !disableRipple) {\n rippleRef.current.pulsate();\n }\n }, [disableRipple, focusRipple, focusVisible]);\n\n function useRippleHandler(rippleAction, eventCallback) {\n var skipRippleAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : disableTouchRipple;\n return useEventCallback(function (event) {\n if (eventCallback) {\n eventCallback(event);\n }\n\n var ignore = skipRippleAction;\n\n if (!ignore && rippleRef.current) {\n rippleRef.current[rippleAction](event);\n }\n\n return true;\n });\n }\n\n var handleMouseDown = useRippleHandler('start', onMouseDown);\n var handleDragLeave = useRippleHandler('stop', onDragLeave);\n var handleMouseUp = useRippleHandler('stop', onMouseUp);\n var handleMouseLeave = useRippleHandler('stop', function (event) {\n if (focusVisible) {\n event.preventDefault();\n }\n\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n });\n var handleTouchStart = useRippleHandler('start', onTouchStart);\n var handleTouchEnd = useRippleHandler('stop', onTouchEnd);\n var handleTouchMove = useRippleHandler('stop', onTouchMove);\n var handleBlur = useRippleHandler('stop', function (event) {\n if (focusVisible) {\n onBlurVisible(event);\n setFocusVisible(false);\n }\n\n if (onBlur) {\n onBlur(event);\n }\n }, false);\n var handleFocus = useEventCallback(function (event) {\n // Fix for https://github.com/facebook/react/issues/7769\n if (!buttonRef.current) {\n buttonRef.current = event.currentTarget;\n }\n\n if (isFocusVisible(event)) {\n setFocusVisible(true);\n\n if (onFocusVisible) {\n onFocusVisible(event);\n }\n }\n\n if (onFocus) {\n onFocus(event);\n }\n });\n\n var isNonNativeButton = function isNonNativeButton() {\n var button = getButtonNode();\n return component && component !== 'button' && !(button.tagName === 'A' && button.href);\n };\n /**\n * IE 11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat\n */\n\n\n var keydownRef = React.useRef(false);\n var handleKeyDown = useEventCallback(function (event) {\n // Check if key is already down to avoid repeats being counted as multiple activations\n if (focusRipple && !keydownRef.current && focusVisible && rippleRef.current && event.key === ' ') {\n keydownRef.current = true;\n event.persist();\n rippleRef.current.stop(event, function () {\n rippleRef.current.start(event);\n });\n }\n\n if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {\n event.preventDefault();\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n } // Keyboard accessibility for non interactive elements\n\n\n if (event.target === event.currentTarget && isNonNativeButton() && event.key === 'Enter' && !disabled) {\n event.preventDefault();\n\n if (onClick) {\n onClick(event);\n }\n }\n });\n var handleKeyUp = useEventCallback(function (event) {\n // calling preventDefault in keyUp on a \n );\n}\n","import { Button } from \"@material-ui/core\";\nimport React from \"react\";\nimport { KeyPair } from \"../crypto\";\nimport { saveKeyPairToStorage } from \"./key_pair_storage\";\n\nexport interface Props {\n EncryptionKeyPair: KeyPair | undefined;\n password: string | undefined;\n}\n\nexport function SaveKeyPair({ password, EncryptionKeyPair }: Props) {\n const saveKeyPair = () => {\n if (!EncryptionKeyPair) return;\n if (!password) return;\n saveKeyPairToStorage(EncryptionKeyPair, password).then(() => {\n console.log(\"Encryption KeyPair saved to storage\");\n });\n };\n\n return (\n \n Save Encryption Key Pair to storage\n \n );\n}\n","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { makeStyles as makeStylesWithoutDefault } from '@material-ui/styles';\nimport defaultTheme from './defaultTheme';\n\nfunction makeStyles(stylesOrCreator) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return makeStylesWithoutDefault(stylesOrCreator, _extends({\n defaultTheme: defaultTheme\n }, options));\n}\n\nexport default makeStyles;","export default function formControlState(_ref) {\n var props = _ref.props,\n states = _ref.states,\n muiFormControl = _ref.muiFormControl;\n return states.reduce(function (acc, state) {\n acc[state] = props[state];\n\n if (muiFormControl) {\n if (typeof props[state] === 'undefined') {\n acc[state] = muiFormControl[state];\n }\n }\n\n return acc;\n }, {});\n}","import * as React from 'react';\n/**\n * @ignore - internal component.\n */\n\nvar FormControlContext = React.createContext();\n\nif (process.env.NODE_ENV !== 'production') {\n FormControlContext.displayName = 'FormControlContext';\n}\n\nexport function useFormControl() {\n return React.useContext(FormControlContext);\n}\nexport default FormControlContext;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from '../utils/debounce';\nimport useForkRef from '../utils/useForkRef';\nimport deprecatedPropType from '../utils/deprecatedPropType';\n\nfunction getStyleValue(computedStyle, property) {\n return parseInt(computedStyle[property], 10) || 0;\n}\n\nvar useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\nvar styles = {\n /* Styles applied to the shadow textarea element. */\n shadow: {\n // Visibility needed to hide the extra text area on iPads\n visibility: 'hidden',\n // Remove from the content flow\n position: 'absolute',\n // Ignore the scrollbar width\n overflow: 'hidden',\n height: 0,\n top: 0,\n left: 0,\n // Create a new layer, increase the isolation of the computed values\n transform: 'translateZ(0)'\n }\n};\nvar TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize(props, ref) {\n var onChange = props.onChange,\n rows = props.rows,\n rowsMax = props.rowsMax,\n rowsMinProp = props.rowsMin,\n maxRowsProp = props.maxRows,\n _props$minRows = props.minRows,\n minRowsProp = _props$minRows === void 0 ? 1 : _props$minRows,\n style = props.style,\n value = props.value,\n other = _objectWithoutProperties(props, [\"onChange\", \"rows\", \"rowsMax\", \"rowsMin\", \"maxRows\", \"minRows\", \"style\", \"value\"]);\n\n var maxRows = maxRowsProp || rowsMax;\n var minRows = rows || rowsMinProp || minRowsProp;\n\n var _React$useRef = React.useRef(value != null),\n isControlled = _React$useRef.current;\n\n var inputRef = React.useRef(null);\n var handleRef = useForkRef(ref, inputRef);\n var shadowRef = React.useRef(null);\n var renders = React.useRef(0);\n\n var _React$useState = React.useState({}),\n state = _React$useState[0],\n setState = _React$useState[1];\n\n var syncHeight = React.useCallback(function () {\n var input = inputRef.current;\n var computedStyle = window.getComputedStyle(input);\n var inputShallow = shadowRef.current;\n inputShallow.style.width = computedStyle.width;\n inputShallow.value = input.value || props.placeholder || 'x';\n\n if (inputShallow.value.slice(-1) === '\\n') {\n // Certain fonts which overflow the line height will cause the textarea\n // to report a different scrollHeight depending on whether the last line\n // is empty. Make it non-empty to avoid this issue.\n inputShallow.value += ' ';\n }\n\n var boxSizing = computedStyle['box-sizing'];\n var padding = getStyleValue(computedStyle, 'padding-bottom') + getStyleValue(computedStyle, 'padding-top');\n var border = getStyleValue(computedStyle, 'border-bottom-width') + getStyleValue(computedStyle, 'border-top-width'); // The height of the inner content\n\n var innerHeight = inputShallow.scrollHeight - padding; // Measure height of a textarea with a single row\n\n inputShallow.value = 'x';\n var singleRowHeight = inputShallow.scrollHeight - padding; // The height of the outer content\n\n var outerHeight = innerHeight;\n\n if (minRows) {\n outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);\n }\n\n if (maxRows) {\n outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);\n }\n\n outerHeight = Math.max(outerHeight, singleRowHeight); // Take the box sizing into account for applying this value as a style.\n\n var outerHeightStyle = outerHeight + (boxSizing === 'border-box' ? padding + border : 0);\n var overflow = Math.abs(outerHeight - innerHeight) <= 1;\n setState(function (prevState) {\n // Need a large enough difference to update the height.\n // This prevents infinite rendering loop.\n if (renders.current < 20 && (outerHeightStyle > 0 && Math.abs((prevState.outerHeightStyle || 0) - outerHeightStyle) > 1 || prevState.overflow !== overflow)) {\n renders.current += 1;\n return {\n overflow: overflow,\n outerHeightStyle: outerHeightStyle\n };\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (renders.current === 20) {\n console.error(['Material-UI: Too many re-renders. The layout is unstable.', 'TextareaAutosize limits the number of renders to prevent an infinite loop.'].join('\\n'));\n }\n }\n\n return prevState;\n });\n }, [maxRows, minRows, props.placeholder]);\n React.useEffect(function () {\n var handleResize = debounce(function () {\n renders.current = 0;\n syncHeight();\n });\n window.addEventListener('resize', handleResize);\n return function () {\n handleResize.clear();\n window.removeEventListener('resize', handleResize);\n };\n }, [syncHeight]);\n useEnhancedEffect(function () {\n syncHeight();\n });\n React.useEffect(function () {\n renders.current = 0;\n }, [value]);\n\n var handleChange = function handleChange(event) {\n renders.current = 0;\n\n if (!isControlled) {\n syncHeight();\n }\n\n if (onChange) {\n onChange(event);\n }\n };\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"textarea\", _extends({\n value: value,\n onChange: handleChange,\n ref: handleRef // Apply the rows prop to get a \"correct\" first SSR paint\n ,\n rows: minRows,\n style: _extends({\n height: state.outerHeightStyle,\n // Need a large enough difference to allow scrolling.\n // This prevents infinite rendering loop.\n overflow: state.overflow ? 'hidden' : null\n }, style)\n }, other)), /*#__PURE__*/React.createElement(\"textarea\", {\n \"aria-hidden\": true,\n className: props.className,\n readOnly: true,\n ref: shadowRef,\n tabIndex: -1,\n style: _extends({}, styles.shadow, style)\n }));\n});\nprocess.env.NODE_ENV !== \"production\" ? TextareaAutosize.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * Maximum number of rows to display.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Minimum number of rows to display.\n */\n minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * @ignore\n */\n onChange: PropTypes.func,\n\n /**\n * @ignore\n */\n placeholder: PropTypes.string,\n\n /**\n * Minimum number of rows to display.\n * @deprecated Use `minRows` instead.\n */\n rows: deprecatedPropType(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), 'Use `minRows` instead.'),\n\n /**\n * Maximum number of rows to display.\n * @deprecated Use `maxRows` instead.\n */\n rowsMax: deprecatedPropType(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), 'Use `maxRows` instead.'),\n\n /**\n * Minimum number of rows to display.\n * @deprecated Use `minRows` instead.\n */\n rowsMin: deprecatedPropType(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), 'Use `minRows` instead.'),\n\n /**\n * @ignore\n */\n style: PropTypes.object,\n\n /**\n * @ignore\n */\n value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.number, PropTypes.string])\n} : void 0;\nexport default TextareaAutosize;","// Supports determination of isControlled().\n// Controlled input accepts its current value as a prop.\n//\n// @see https://facebook.github.io/react/docs/forms.html#controlled-components\n// @param value\n// @returns {boolean} true if string (including '') or number (including zero)\nexport function hasValue(value) {\n return value != null && !(Array.isArray(value) && value.length === 0);\n} // Determine if field is empty or filled.\n// Response determines if label is presented above field or as placeholder.\n//\n// @param obj\n// @param SSR\n// @returns {boolean} False when not present or empty string.\n// True when any number or string with length.\n\nexport function isFilled(obj) {\n var SSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n return obj && (hasValue(obj.value) && obj.value !== '' || SSR && hasValue(obj.defaultValue) && obj.defaultValue !== '');\n} // Determine if an Input is adorned on start.\n// It's corresponding to the left with LTR.\n//\n// @param obj\n// @returns {boolean} False when no adornments.\n// True when adorned at the start.\n\nexport function isAdornedStart(obj) {\n return obj.startAdornment;\n}","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { formatMuiErrorMessage as _formatMuiErrorMessage } from \"@material-ui/utils\";\n\n/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { refType } from '@material-ui/utils';\nimport formControlState from '../FormControl/formControlState';\nimport FormControlContext, { useFormControl } from '../FormControl/FormControlContext';\nimport withStyles from '../styles/withStyles';\nimport capitalize from '../utils/capitalize';\nimport useForkRef from '../utils/useForkRef';\nimport TextareaAutosize from '../TextareaAutosize';\nimport { isFilled } from './utils';\nexport var styles = function styles(theme) {\n var light = theme.palette.type === 'light';\n var placeholder = {\n color: 'currentColor',\n opacity: light ? 0.42 : 0.5,\n transition: theme.transitions.create('opacity', {\n duration: theme.transitions.duration.shorter\n })\n };\n var placeholderHidden = {\n opacity: '0 !important'\n };\n var placeholderVisible = {\n opacity: light ? 0.42 : 0.5\n };\n return {\n '@global': {\n '@keyframes mui-auto-fill': {},\n '@keyframes mui-auto-fill-cancel': {}\n },\n\n /* Styles applied to the root element. */\n root: _extends({}, theme.typography.body1, {\n color: theme.palette.text.primary,\n lineHeight: '1.1876em',\n // Reset (19px), match the native input line-height\n boxSizing: 'border-box',\n // Prevent padding issue with fullWidth.\n position: 'relative',\n cursor: 'text',\n display: 'inline-flex',\n alignItems: 'center',\n '&$disabled': {\n color: theme.palette.text.disabled,\n cursor: 'default'\n }\n }),\n\n /* Styles applied to the root element if the component is a descendant of `FormControl`. */\n formControl: {},\n\n /* Styles applied to the root element if the component is focused. */\n focused: {},\n\n /* Styles applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if `startAdornment` is provided. */\n adornedStart: {},\n\n /* Styles applied to the root element if `endAdornment` is provided. */\n adornedEnd: {},\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n marginDense: {},\n\n /* Styles applied to the root element if `multiline={true}`. */\n multiline: {\n padding: \"\".concat(8 - 2, \"px 0 \").concat(8 - 1, \"px\"),\n '&$marginDense': {\n paddingTop: 4 - 1\n }\n },\n\n /* Styles applied to the root element if the color is secondary. */\n colorSecondary: {},\n\n /* Styles applied to the root element if `fullWidth={true}`. */\n fullWidth: {\n width: '100%'\n },\n\n /* Styles applied to the `input` element. */\n input: {\n font: 'inherit',\n letterSpacing: 'inherit',\n color: 'currentColor',\n padding: \"\".concat(8 - 2, \"px 0 \").concat(8 - 1, \"px\"),\n border: 0,\n boxSizing: 'content-box',\n background: 'none',\n height: '1.1876em',\n // Reset (19px), match the native input line-height\n margin: 0,\n // Reset for Safari\n WebkitTapHighlightColor: 'transparent',\n display: 'block',\n // Make the flex item shrink with Firefox\n minWidth: 0,\n width: '100%',\n // Fix IE 11 width issue\n animationName: 'mui-auto-fill-cancel',\n animationDuration: '10ms',\n '&::-webkit-input-placeholder': placeholder,\n '&::-moz-placeholder': placeholder,\n // Firefox 19+\n '&:-ms-input-placeholder': placeholder,\n // IE 11\n '&::-ms-input-placeholder': placeholder,\n // Edge\n '&:focus': {\n outline: 0\n },\n // Reset Firefox invalid required input style\n '&:invalid': {\n boxShadow: 'none'\n },\n '&::-webkit-search-decoration': {\n // Remove the padding when type=search.\n '-webkit-appearance': 'none'\n },\n // Show and hide the placeholder logic\n 'label[data-shrink=false] + $formControl &': {\n '&::-webkit-input-placeholder': placeholderHidden,\n '&::-moz-placeholder': placeholderHidden,\n // Firefox 19+\n '&:-ms-input-placeholder': placeholderHidden,\n // IE 11\n '&::-ms-input-placeholder': placeholderHidden,\n // Edge\n '&:focus::-webkit-input-placeholder': placeholderVisible,\n '&:focus::-moz-placeholder': placeholderVisible,\n // Firefox 19+\n '&:focus:-ms-input-placeholder': placeholderVisible,\n // IE 11\n '&:focus::-ms-input-placeholder': placeholderVisible // Edge\n\n },\n '&$disabled': {\n opacity: 1 // Reset iOS opacity\n\n },\n '&:-webkit-autofill': {\n animationDuration: '5000s',\n animationName: 'mui-auto-fill'\n }\n },\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n inputMarginDense: {\n paddingTop: 4 - 1\n },\n\n /* Styles applied to the `input` element if `multiline={true}`. */\n inputMultiline: {\n height: 'auto',\n resize: 'none',\n padding: 0\n },\n\n /* Styles applied to the `input` element if `type=\"search\"`. */\n inputTypeSearch: {\n // Improve type search style.\n '-moz-appearance': 'textfield',\n '-webkit-appearance': 'textfield'\n },\n\n /* Styles applied to the `input` element if `startAdornment` is provided. */\n inputAdornedStart: {},\n\n /* Styles applied to the `input` element if `endAdornment` is provided. */\n inputAdornedEnd: {},\n\n /* Styles applied to the `input` element if `hiddenLabel={true}`. */\n inputHiddenLabel: {}\n };\n};\nvar useEnhancedEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n/**\n * `InputBase` contains as few styles as possible.\n * It aims to be a simple building block for creating an input.\n * It contains a load of style reset and some state logic.\n */\n\nvar InputBase = /*#__PURE__*/React.forwardRef(function InputBase(props, ref) {\n var ariaDescribedby = props['aria-describedby'],\n autoComplete = props.autoComplete,\n autoFocus = props.autoFocus,\n classes = props.classes,\n className = props.className,\n color = props.color,\n defaultValue = props.defaultValue,\n disabled = props.disabled,\n endAdornment = props.endAdornment,\n error = props.error,\n _props$fullWidth = props.fullWidth,\n fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,\n id = props.id,\n _props$inputComponent = props.inputComponent,\n inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,\n _props$inputProps = props.inputProps,\n inputPropsProp = _props$inputProps === void 0 ? {} : _props$inputProps,\n inputRefProp = props.inputRef,\n margin = props.margin,\n _props$multiline = props.multiline,\n multiline = _props$multiline === void 0 ? false : _props$multiline,\n name = props.name,\n onBlur = props.onBlur,\n onChange = props.onChange,\n onClick = props.onClick,\n onFocus = props.onFocus,\n onKeyDown = props.onKeyDown,\n onKeyUp = props.onKeyUp,\n placeholder = props.placeholder,\n readOnly = props.readOnly,\n renderSuffix = props.renderSuffix,\n rows = props.rows,\n rowsMax = props.rowsMax,\n rowsMin = props.rowsMin,\n maxRows = props.maxRows,\n minRows = props.minRows,\n startAdornment = props.startAdornment,\n _props$type = props.type,\n type = _props$type === void 0 ? 'text' : _props$type,\n valueProp = props.value,\n other = _objectWithoutProperties(props, [\"aria-describedby\", \"autoComplete\", \"autoFocus\", \"classes\", \"className\", \"color\", \"defaultValue\", \"disabled\", \"endAdornment\", \"error\", \"fullWidth\", \"id\", \"inputComponent\", \"inputProps\", \"inputRef\", \"margin\", \"multiline\", \"name\", \"onBlur\", \"onChange\", \"onClick\", \"onFocus\", \"onKeyDown\", \"onKeyUp\", \"placeholder\", \"readOnly\", \"renderSuffix\", \"rows\", \"rowsMax\", \"rowsMin\", \"maxRows\", \"minRows\", \"startAdornment\", \"type\", \"value\"]);\n\n var value = inputPropsProp.value != null ? inputPropsProp.value : valueProp;\n\n var _React$useRef = React.useRef(value != null),\n isControlled = _React$useRef.current;\n\n var inputRef = React.useRef();\n var handleInputRefWarning = React.useCallback(function (instance) {\n if (process.env.NODE_ENV !== 'production') {\n if (instance && instance.nodeName !== 'INPUT' && !instance.focus) {\n console.error(['Material-UI: You have provided a `inputComponent` to the input component', 'that does not correctly handle the `inputRef` prop.', 'Make sure the `inputRef` prop is called with a HTMLInputElement.'].join('\\n'));\n }\n }\n }, []);\n var handleInputPropsRefProp = useForkRef(inputPropsProp.ref, handleInputRefWarning);\n var handleInputRefProp = useForkRef(inputRefProp, handleInputPropsRefProp);\n var handleInputRef = useForkRef(inputRef, handleInputRefProp);\n\n var _React$useState = React.useState(false),\n focused = _React$useState[0],\n setFocused = _React$useState[1];\n\n var muiFormControl = useFormControl();\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(function () {\n if (muiFormControl) {\n return muiFormControl.registerEffect();\n }\n\n return undefined;\n }, [muiFormControl]);\n }\n\n var fcs = formControlState({\n props: props,\n muiFormControl: muiFormControl,\n states: ['color', 'disabled', 'error', 'hiddenLabel', 'margin', 'required', 'filled']\n });\n fcs.focused = muiFormControl ? muiFormControl.focused : focused; // The blur won't fire when the disabled state is set on a focused input.\n // We need to book keep the focused state manually.\n\n React.useEffect(function () {\n if (!muiFormControl && disabled && focused) {\n setFocused(false);\n\n if (onBlur) {\n onBlur();\n }\n }\n }, [muiFormControl, disabled, focused, onBlur]);\n var onFilled = muiFormControl && muiFormControl.onFilled;\n var onEmpty = muiFormControl && muiFormControl.onEmpty;\n var checkDirty = React.useCallback(function (obj) {\n if (isFilled(obj)) {\n if (onFilled) {\n onFilled();\n }\n } else if (onEmpty) {\n onEmpty();\n }\n }, [onFilled, onEmpty]);\n useEnhancedEffect(function () {\n if (isControlled) {\n checkDirty({\n value: value\n });\n }\n }, [value, checkDirty, isControlled]);\n\n var handleFocus = function handleFocus(event) {\n // Fix a bug with IE 11 where the focus/blur events are triggered\n // while the input is disabled.\n if (fcs.disabled) {\n event.stopPropagation();\n return;\n }\n\n if (onFocus) {\n onFocus(event);\n }\n\n if (inputPropsProp.onFocus) {\n inputPropsProp.onFocus(event);\n }\n\n if (muiFormControl && muiFormControl.onFocus) {\n muiFormControl.onFocus(event);\n } else {\n setFocused(true);\n }\n };\n\n var handleBlur = function handleBlur(event) {\n if (onBlur) {\n onBlur(event);\n }\n\n if (inputPropsProp.onBlur) {\n inputPropsProp.onBlur(event);\n }\n\n if (muiFormControl && muiFormControl.onBlur) {\n muiFormControl.onBlur(event);\n } else {\n setFocused(false);\n }\n };\n\n var handleChange = function handleChange(event) {\n if (!isControlled) {\n var element = event.target || inputRef.current;\n\n if (element == null) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? \"Material-UI: Expected valid input target. Did you use a custom `inputComponent` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info.\" : _formatMuiErrorMessage(1));\n }\n\n checkDirty({\n value: element.value\n });\n }\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (inputPropsProp.onChange) {\n inputPropsProp.onChange.apply(inputPropsProp, [event].concat(args));\n } // Perform in the willUpdate\n\n\n if (onChange) {\n onChange.apply(void 0, [event].concat(args));\n }\n }; // Check the input state on mount, in case it was filled by the user\n // or auto filled by the browser before the hydration (for SSR).\n\n\n React.useEffect(function () {\n checkDirty(inputRef.current);\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n var handleClick = function handleClick(event) {\n if (inputRef.current && event.currentTarget === event.target) {\n inputRef.current.focus();\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n var InputComponent = inputComponent;\n\n var inputProps = _extends({}, inputPropsProp, {\n ref: handleInputRef\n });\n\n if (typeof InputComponent !== 'string') {\n inputProps = _extends({\n // Rename ref to inputRef as we don't know the\n // provided `inputComponent` structure.\n inputRef: handleInputRef,\n type: type\n }, inputProps, {\n ref: null\n });\n } else if (multiline) {\n if (rows && !maxRows && !minRows && !rowsMax && !rowsMin) {\n InputComponent = 'textarea';\n } else {\n inputProps = _extends({\n minRows: rows || minRows,\n rowsMax: rowsMax,\n maxRows: maxRows\n }, inputProps);\n InputComponent = TextareaAutosize;\n }\n } else {\n inputProps = _extends({\n type: type\n }, inputProps);\n }\n\n var handleAutoFill = function handleAutoFill(event) {\n // Provide a fake value as Chrome might not let you access it for security reasons.\n checkDirty(event.animationName === 'mui-auto-fill-cancel' ? inputRef.current : {\n value: 'x'\n });\n };\n\n React.useEffect(function () {\n if (muiFormControl) {\n muiFormControl.setAdornedStart(Boolean(startAdornment));\n }\n }, [muiFormControl, startAdornment]);\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n className: clsx(classes.root, classes[\"color\".concat(capitalize(fcs.color || 'primary'))], className, fcs.disabled && classes.disabled, fcs.error && classes.error, fullWidth && classes.fullWidth, fcs.focused && classes.focused, muiFormControl && classes.formControl, multiline && classes.multiline, startAdornment && classes.adornedStart, endAdornment && classes.adornedEnd, fcs.margin === 'dense' && classes.marginDense),\n onClick: handleClick,\n ref: ref\n }, other), startAdornment, /*#__PURE__*/React.createElement(FormControlContext.Provider, {\n value: null\n }, /*#__PURE__*/React.createElement(InputComponent, _extends({\n \"aria-invalid\": fcs.error,\n \"aria-describedby\": ariaDescribedby,\n autoComplete: autoComplete,\n autoFocus: autoFocus,\n defaultValue: defaultValue,\n disabled: fcs.disabled,\n id: id,\n onAnimationStart: handleAutoFill,\n name: name,\n placeholder: placeholder,\n readOnly: readOnly,\n required: fcs.required,\n rows: rows,\n value: value,\n onKeyDown: onKeyDown,\n onKeyUp: onKeyUp\n }, inputProps, {\n className: clsx(classes.input, inputPropsProp.className, fcs.disabled && classes.disabled, multiline && classes.inputMultiline, fcs.hiddenLabel && classes.inputHiddenLabel, startAdornment && classes.inputAdornedStart, endAdornment && classes.inputAdornedEnd, type === 'search' && classes.inputTypeSearch, fcs.margin === 'dense' && classes.inputMarginDense),\n onBlur: handleBlur,\n onChange: handleChange,\n onFocus: handleFocus\n }))), endAdornment, renderSuffix ? renderSuffix(_extends({}, fcs, {\n startAdornment: startAdornment\n })) : null);\n});\nprocess.env.NODE_ENV !== \"production\" ? InputBase.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * @ignore\n */\n 'aria-describedby': PropTypes.string,\n\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoComplete: PropTypes.string,\n\n /**\n * If `true`, the `input` element will be focused during the first mount.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The default `input` element value. Use when the component is not controlled.\n */\n defaultValue: PropTypes.any,\n\n /**\n * If `true`, the `input` element will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * End `InputAdornment` for this component.\n */\n endAdornment: PropTypes.node,\n\n /**\n * If `true`, the input will indicate an error. This is normally obtained via context from\n * FormControl.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the input will take up the full width of its container.\n */\n fullWidth: PropTypes.bool,\n\n /**\n * The id of the `input` element.\n */\n id: PropTypes.string,\n\n /**\n * The component used for the `input` element.\n * Either a string to use a HTML element or a component.\n */\n inputComponent: PropTypes.elementType,\n\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps: PropTypes.object,\n\n /**\n * Pass a ref to the `input` element.\n */\n inputRef: refType,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense', 'none']),\n\n /**\n * Maximum number of rows to display when multiline option is set to true.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Minimum number of rows to display when multiline option is set to true.\n */\n minRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * If `true`, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n\n /**\n * Name attribute of the `input` element.\n */\n name: PropTypes.string,\n\n /**\n * Callback fired when the input is blurred.\n *\n * Notice that the first argument (event) might be undefined.\n */\n onBlur: PropTypes.func,\n\n /**\n * Callback fired when the value is changed.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: PropTypes.func,\n\n /**\n * @ignore\n */\n onClick: PropTypes.func,\n\n /**\n * @ignore\n */\n onFocus: PropTypes.func,\n\n /**\n * @ignore\n */\n onKeyDown: PropTypes.func,\n\n /**\n * @ignore\n */\n onKeyUp: PropTypes.func,\n\n /**\n * The short hint displayed in the input before the user enters a value.\n */\n placeholder: PropTypes.string,\n\n /**\n * It prevents the user from changing the value of the field\n * (not from interacting with the field).\n */\n readOnly: PropTypes.bool,\n\n /**\n * @ignore\n */\n renderSuffix: PropTypes.func,\n\n /**\n * If `true`, the `input` element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * Number of rows to display when multiline option is set to true.\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Maximum number of rows to display.\n * @deprecated Use `maxRows` instead.\n */\n rowsMax: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Minimum number of rows to display.\n * @deprecated Use `minRows` instead.\n */\n rowsMin: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment: PropTypes.node,\n\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type: PropTypes.string,\n\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value: PropTypes.any\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiInputBase'\n})(InputBase);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { refType } from '@material-ui/utils';\nimport InputBase from '../InputBase';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n var light = theme.palette.type === 'light';\n var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';\n return {\n /* Styles applied to the root element. */\n root: {\n position: 'relative'\n },\n\n /* Styles applied to the root element if the component is a descendant of `FormControl`. */\n formControl: {\n 'label + &': {\n marginTop: 16\n }\n },\n\n /* Styles applied to the root element if the component is focused. */\n focused: {},\n\n /* Styles applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if color secondary. */\n colorSecondary: {\n '&$underline:after': {\n borderBottomColor: theme.palette.secondary.main\n }\n },\n\n /* Styles applied to the root element if `disableUnderline={false}`. */\n underline: {\n '&:after': {\n borderBottom: \"2px solid \".concat(theme.palette.primary.main),\n left: 0,\n bottom: 0,\n // Doing the other way around crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\"',\n position: 'absolute',\n right: 0,\n transform: 'scaleX(0)',\n transition: theme.transitions.create('transform', {\n duration: theme.transitions.duration.shorter,\n easing: theme.transitions.easing.easeOut\n }),\n pointerEvents: 'none' // Transparent to the hover style.\n\n },\n '&$focused:after': {\n transform: 'scaleX(1)'\n },\n '&$error:after': {\n borderBottomColor: theme.palette.error.main,\n transform: 'scaleX(1)' // error is always underlined in red\n\n },\n '&:before': {\n borderBottom: \"1px solid \".concat(bottomLineColor),\n left: 0,\n bottom: 0,\n // Doing the other way around crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\\\\00a0\"',\n position: 'absolute',\n right: 0,\n transition: theme.transitions.create('border-bottom-color', {\n duration: theme.transitions.duration.shorter\n }),\n pointerEvents: 'none' // Transparent to the hover style.\n\n },\n '&:hover:not($disabled):before': {\n borderBottom: \"2px solid \".concat(theme.palette.text.primary),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n borderBottom: \"1px solid \".concat(bottomLineColor)\n }\n },\n '&$disabled:before': {\n borderBottomStyle: 'dotted'\n }\n },\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n marginDense: {},\n\n /* Styles applied to the root element if `multiline={true}`. */\n multiline: {},\n\n /* Styles applied to the root element if `fullWidth={true}`. */\n fullWidth: {},\n\n /* Styles applied to the `input` element. */\n input: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n inputMarginDense: {},\n\n /* Styles applied to the `input` element if `multiline={true}`. */\n inputMultiline: {},\n\n /* Styles applied to the `input` element if `type=\"search\"`. */\n inputTypeSearch: {}\n };\n};\nvar Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {\n var disableUnderline = props.disableUnderline,\n classes = props.classes,\n _props$fullWidth = props.fullWidth,\n fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,\n _props$inputComponent = props.inputComponent,\n inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,\n _props$multiline = props.multiline,\n multiline = _props$multiline === void 0 ? false : _props$multiline,\n _props$type = props.type,\n type = _props$type === void 0 ? 'text' : _props$type,\n other = _objectWithoutProperties(props, [\"disableUnderline\", \"classes\", \"fullWidth\", \"inputComponent\", \"multiline\", \"type\"]);\n\n return /*#__PURE__*/React.createElement(InputBase, _extends({\n classes: _extends({}, classes, {\n root: clsx(classes.root, !disableUnderline && classes.underline),\n underline: null\n }),\n fullWidth: fullWidth,\n inputComponent: inputComponent,\n multiline: multiline,\n ref: ref,\n type: type\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? Input.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoComplete: PropTypes.string,\n\n /**\n * If `true`, the `input` element will be focused during the first mount.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The default `input` element value. Use when the component is not controlled.\n */\n defaultValue: PropTypes.any,\n\n /**\n * If `true`, the `input` element will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, the input will not have an underline.\n */\n disableUnderline: PropTypes.bool,\n\n /**\n * End `InputAdornment` for this component.\n */\n endAdornment: PropTypes.node,\n\n /**\n * If `true`, the input will indicate an error. This is normally obtained via context from\n * FormControl.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the input will take up the full width of its container.\n */\n fullWidth: PropTypes.bool,\n\n /**\n * The id of the `input` element.\n */\n id: PropTypes.string,\n\n /**\n * The component used for the `input` element.\n * Either a string to use a HTML element or a component.\n */\n inputComponent: PropTypes.elementType,\n\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps: PropTypes.object,\n\n /**\n * Pass a ref to the `input` element.\n */\n inputRef: refType,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense', 'none']),\n\n /**\n * Maximum number of rows to display when multiline option is set to true.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * If `true`, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n\n /**\n * Name attribute of the `input` element.\n */\n name: PropTypes.string,\n\n /**\n * Callback fired when the value is changed.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: PropTypes.func,\n\n /**\n * The short hint displayed in the input before the user enters a value.\n */\n placeholder: PropTypes.string,\n\n /**\n * It prevents the user from changing the value of the field\n * (not from interacting with the field).\n */\n readOnly: PropTypes.bool,\n\n /**\n * If `true`, the `input` element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * Number of rows to display when multiline option is set to true.\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment: PropTypes.node,\n\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type: PropTypes.string,\n\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value: PropTypes.any\n} : void 0;\nInput.muiName = 'Input';\nexport default withStyles(styles, {\n name: 'MuiInput'\n})(Input);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { refType } from '@material-ui/utils';\nimport InputBase from '../InputBase';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n var light = theme.palette.type === 'light';\n var bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';\n var backgroundColor = light ? 'rgba(0, 0, 0, 0.09)' : 'rgba(255, 255, 255, 0.09)';\n return {\n /* Styles applied to the root element. */\n root: {\n position: 'relative',\n backgroundColor: backgroundColor,\n borderTopLeftRadius: theme.shape.borderRadius,\n borderTopRightRadius: theme.shape.borderRadius,\n transition: theme.transitions.create('background-color', {\n duration: theme.transitions.duration.shorter,\n easing: theme.transitions.easing.easeOut\n }),\n '&:hover': {\n backgroundColor: light ? 'rgba(0, 0, 0, 0.13)' : 'rgba(255, 255, 255, 0.13)',\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: backgroundColor\n }\n },\n '&$focused': {\n backgroundColor: light ? 'rgba(0, 0, 0, 0.09)' : 'rgba(255, 255, 255, 0.09)'\n },\n '&$disabled': {\n backgroundColor: light ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)'\n }\n },\n\n /* Styles applied to the root element if color secondary. */\n colorSecondary: {\n '&$underline:after': {\n borderBottomColor: theme.palette.secondary.main\n }\n },\n\n /* Styles applied to the root element if `disableUnderline={false}`. */\n underline: {\n '&:after': {\n borderBottom: \"2px solid \".concat(theme.palette.primary.main),\n left: 0,\n bottom: 0,\n // Doing the other way around crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\"',\n position: 'absolute',\n right: 0,\n transform: 'scaleX(0)',\n transition: theme.transitions.create('transform', {\n duration: theme.transitions.duration.shorter,\n easing: theme.transitions.easing.easeOut\n }),\n pointerEvents: 'none' // Transparent to the hover style.\n\n },\n '&$focused:after': {\n transform: 'scaleX(1)'\n },\n '&$error:after': {\n borderBottomColor: theme.palette.error.main,\n transform: 'scaleX(1)' // error is always underlined in red\n\n },\n '&:before': {\n borderBottom: \"1px solid \".concat(bottomLineColor),\n left: 0,\n bottom: 0,\n // Doing the other way around crash on IE 11 \"''\" https://github.com/cssinjs/jss/issues/242\n content: '\"\\\\00a0\"',\n position: 'absolute',\n right: 0,\n transition: theme.transitions.create('border-bottom-color', {\n duration: theme.transitions.duration.shorter\n }),\n pointerEvents: 'none' // Transparent to the hover style.\n\n },\n '&:hover:before': {\n borderBottom: \"1px solid \".concat(theme.palette.text.primary)\n },\n '&$disabled:before': {\n borderBottomStyle: 'dotted'\n }\n },\n\n /* Pseudo-class applied to the root element if the component is focused. */\n focused: {},\n\n /* Pseudo-class applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if `startAdornment` is provided. */\n adornedStart: {\n paddingLeft: 12\n },\n\n /* Styles applied to the root element if `endAdornment` is provided. */\n adornedEnd: {\n paddingRight: 12\n },\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n marginDense: {},\n\n /* Styles applied to the root element if `multiline={true}`. */\n multiline: {\n padding: '27px 12px 10px',\n '&$marginDense': {\n paddingTop: 23,\n paddingBottom: 6\n }\n },\n\n /* Styles applied to the `input` element. */\n input: {\n padding: '27px 12px 10px',\n '&:-webkit-autofill': {\n WebkitBoxShadow: theme.palette.type === 'light' ? null : '0 0 0 100px #266798 inset',\n WebkitTextFillColor: theme.palette.type === 'light' ? null : '#fff',\n caretColor: theme.palette.type === 'light' ? null : '#fff',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit'\n }\n },\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n inputMarginDense: {\n paddingTop: 23,\n paddingBottom: 6\n },\n\n /* Styles applied to the `input` if in ``. */\n inputHiddenLabel: {\n paddingTop: 18,\n paddingBottom: 19,\n '&$inputMarginDense': {\n paddingTop: 10,\n paddingBottom: 11\n }\n },\n\n /* Styles applied to the `input` element if `multiline={true}`. */\n inputMultiline: {\n padding: 0\n },\n\n /* Styles applied to the `input` element if `startAdornment` is provided. */\n inputAdornedStart: {\n paddingLeft: 0\n },\n\n /* Styles applied to the `input` element if `endAdornment` is provided. */\n inputAdornedEnd: {\n paddingRight: 0\n }\n };\n};\nvar FilledInput = /*#__PURE__*/React.forwardRef(function FilledInput(props, ref) {\n var disableUnderline = props.disableUnderline,\n classes = props.classes,\n _props$fullWidth = props.fullWidth,\n fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,\n _props$inputComponent = props.inputComponent,\n inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,\n _props$multiline = props.multiline,\n multiline = _props$multiline === void 0 ? false : _props$multiline,\n _props$type = props.type,\n type = _props$type === void 0 ? 'text' : _props$type,\n other = _objectWithoutProperties(props, [\"disableUnderline\", \"classes\", \"fullWidth\", \"inputComponent\", \"multiline\", \"type\"]);\n\n return /*#__PURE__*/React.createElement(InputBase, _extends({\n classes: _extends({}, classes, {\n root: clsx(classes.root, !disableUnderline && classes.underline),\n underline: null\n }),\n fullWidth: fullWidth,\n inputComponent: inputComponent,\n multiline: multiline,\n ref: ref,\n type: type\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? FilledInput.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoComplete: PropTypes.string,\n\n /**\n * If `true`, the `input` element will be focused during the first mount.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The default `input` element value. Use when the component is not controlled.\n */\n defaultValue: PropTypes.any,\n\n /**\n * If `true`, the `input` element will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, the input will not have an underline.\n */\n disableUnderline: PropTypes.bool,\n\n /**\n * End `InputAdornment` for this component.\n */\n endAdornment: PropTypes.node,\n\n /**\n * If `true`, the input will indicate an error. This is normally obtained via context from\n * FormControl.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the input will take up the full width of its container.\n */\n fullWidth: PropTypes.bool,\n\n /**\n * The id of the `input` element.\n */\n id: PropTypes.string,\n\n /**\n * The component used for the `input` element.\n * Either a string to use a HTML element or a component.\n */\n inputComponent: PropTypes.elementType,\n\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps: PropTypes.object,\n\n /**\n * Pass a ref to the `input` element.\n */\n inputRef: refType,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense', 'none']),\n\n /**\n * Maximum number of rows to display when multiline option is set to true.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * If `true`, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n\n /**\n * Name attribute of the `input` element.\n */\n name: PropTypes.string,\n\n /**\n * Callback fired when the value is changed.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: PropTypes.func,\n\n /**\n * The short hint displayed in the input before the user enters a value.\n */\n placeholder: PropTypes.string,\n\n /**\n * It prevents the user from changing the value of the field\n * (not from interacting with the field).\n */\n readOnly: PropTypes.bool,\n\n /**\n * If `true`, the `input` element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * Number of rows to display when multiline option is set to true.\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment: PropTypes.node,\n\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type: PropTypes.string,\n\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value: PropTypes.any\n} : void 0;\nFilledInput.muiName = 'Input';\nexport default withStyles(styles, {\n name: 'MuiFilledInput'\n})(FilledInput);","import { useTheme as useThemeWithoutDefault } from '@material-ui/styles';\nimport React from 'react';\nimport defaultTheme from './defaultTheme';\nexport default function useTheme() {\n var theme = useThemeWithoutDefault() || defaultTheme;\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useDebugValue(theme);\n }\n\n return theme;\n}","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport useTheme from '../styles/useTheme';\nimport capitalize from '../utils/capitalize';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n top: -5,\n left: 0,\n margin: 0,\n padding: '0 8px',\n pointerEvents: 'none',\n borderRadius: 'inherit',\n borderStyle: 'solid',\n borderWidth: 1,\n overflow: 'hidden'\n },\n\n /* Styles applied to the legend element when `labelWidth` is provided. */\n legend: {\n textAlign: 'left',\n padding: 0,\n lineHeight: '11px',\n // sync with `height` in `legend` styles\n transition: theme.transitions.create('width', {\n duration: 150,\n easing: theme.transitions.easing.easeOut\n })\n },\n\n /* Styles applied to the legend element. */\n legendLabelled: {\n display: 'block',\n width: 'auto',\n textAlign: 'left',\n padding: 0,\n height: 11,\n // sync with `lineHeight` in `legend` styles\n fontSize: '0.75em',\n visibility: 'hidden',\n maxWidth: 0.01,\n transition: theme.transitions.create('max-width', {\n duration: 50,\n easing: theme.transitions.easing.easeOut\n }),\n '& > span': {\n paddingLeft: 5,\n paddingRight: 5,\n display: 'inline-block'\n }\n },\n\n /* Styles applied to the legend element is notched. */\n legendNotched: {\n maxWidth: 1000,\n transition: theme.transitions.create('max-width', {\n duration: 100,\n easing: theme.transitions.easing.easeOut,\n delay: 50\n })\n }\n };\n};\n/**\n * @ignore - internal component.\n */\n\nvar NotchedOutline = /*#__PURE__*/React.forwardRef(function NotchedOutline(props, ref) {\n var children = props.children,\n classes = props.classes,\n className = props.className,\n label = props.label,\n labelWidthProp = props.labelWidth,\n notched = props.notched,\n style = props.style,\n other = _objectWithoutProperties(props, [\"children\", \"classes\", \"className\", \"label\", \"labelWidth\", \"notched\", \"style\"]);\n\n var theme = useTheme();\n var align = theme.direction === 'rtl' ? 'right' : 'left';\n\n if (label !== undefined) {\n return /*#__PURE__*/React.createElement(\"fieldset\", _extends({\n \"aria-hidden\": true,\n className: clsx(classes.root, className),\n ref: ref,\n style: style\n }, other), /*#__PURE__*/React.createElement(\"legend\", {\n className: clsx(classes.legendLabelled, notched && classes.legendNotched)\n }, label ? /*#__PURE__*/React.createElement(\"span\", null, label) : /*#__PURE__*/React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: '​'\n }\n })));\n }\n\n var labelWidth = labelWidthProp > 0 ? labelWidthProp * 0.75 + 8 : 0.01;\n return /*#__PURE__*/React.createElement(\"fieldset\", _extends({\n \"aria-hidden\": true,\n style: _extends(_defineProperty({}, \"padding\".concat(capitalize(align)), 8), style),\n className: clsx(classes.root, className),\n ref: ref\n }, other), /*#__PURE__*/React.createElement(\"legend\", {\n className: classes.legend,\n style: {\n // IE 11: fieldset with legend does not render\n // a border radius. This maintains consistency\n // by always having a legend rendered\n width: notched ? labelWidth : 0.01\n }\n }, /*#__PURE__*/React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: '​'\n }\n })));\n});\nprocess.env.NODE_ENV !== \"production\" ? NotchedOutline.propTypes = {\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The label.\n */\n label: PropTypes.node,\n\n /**\n * The width of the label.\n */\n labelWidth: PropTypes.number.isRequired,\n\n /**\n * If `true`, the outline is notched to accommodate the label.\n */\n notched: PropTypes.bool.isRequired,\n\n /**\n * @ignore\n */\n style: PropTypes.object\n} : void 0;\nexport default withStyles(styles, {\n name: 'PrivateNotchedOutline'\n})(NotchedOutline);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { refType } from '@material-ui/utils';\nimport InputBase from '../InputBase';\nimport NotchedOutline from './NotchedOutline';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n var borderColor = theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';\n return {\n /* Styles applied to the root element. */\n root: {\n position: 'relative',\n borderRadius: theme.shape.borderRadius,\n '&:hover $notchedOutline': {\n borderColor: theme.palette.text.primary\n },\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n '&:hover $notchedOutline': {\n borderColor: borderColor\n }\n },\n '&$focused $notchedOutline': {\n borderColor: theme.palette.primary.main,\n borderWidth: 2\n },\n '&$error $notchedOutline': {\n borderColor: theme.palette.error.main\n },\n '&$disabled $notchedOutline': {\n borderColor: theme.palette.action.disabled\n }\n },\n\n /* Styles applied to the root element if the color is secondary. */\n colorSecondary: {\n '&$focused $notchedOutline': {\n borderColor: theme.palette.secondary.main\n }\n },\n\n /* Styles applied to the root element if the component is focused. */\n focused: {},\n\n /* Styles applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if `startAdornment` is provided. */\n adornedStart: {\n paddingLeft: 14\n },\n\n /* Styles applied to the root element if `endAdornment` is provided. */\n adornedEnd: {\n paddingRight: 14\n },\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n marginDense: {},\n\n /* Styles applied to the root element if `multiline={true}`. */\n multiline: {\n padding: '18.5px 14px',\n '&$marginDense': {\n paddingTop: 10.5,\n paddingBottom: 10.5\n }\n },\n\n /* Styles applied to the `NotchedOutline` element. */\n notchedOutline: {\n borderColor: borderColor\n },\n\n /* Styles applied to the `input` element. */\n input: {\n padding: '18.5px 14px',\n '&:-webkit-autofill': {\n WebkitBoxShadow: theme.palette.type === 'light' ? null : '0 0 0 100px #266798 inset',\n WebkitTextFillColor: theme.palette.type === 'light' ? null : '#fff',\n caretColor: theme.palette.type === 'light' ? null : '#fff',\n borderRadius: 'inherit'\n }\n },\n\n /* Styles applied to the `input` element if `margin=\"dense\"`. */\n inputMarginDense: {\n paddingTop: 10.5,\n paddingBottom: 10.5\n },\n\n /* Styles applied to the `input` element if `multiline={true}`. */\n inputMultiline: {\n padding: 0\n },\n\n /* Styles applied to the `input` element if `startAdornment` is provided. */\n inputAdornedStart: {\n paddingLeft: 0\n },\n\n /* Styles applied to the `input` element if `endAdornment` is provided. */\n inputAdornedEnd: {\n paddingRight: 0\n }\n };\n};\nvar OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(props, ref) {\n var classes = props.classes,\n _props$fullWidth = props.fullWidth,\n fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,\n _props$inputComponent = props.inputComponent,\n inputComponent = _props$inputComponent === void 0 ? 'input' : _props$inputComponent,\n label = props.label,\n _props$labelWidth = props.labelWidth,\n labelWidth = _props$labelWidth === void 0 ? 0 : _props$labelWidth,\n _props$multiline = props.multiline,\n multiline = _props$multiline === void 0 ? false : _props$multiline,\n notched = props.notched,\n _props$type = props.type,\n type = _props$type === void 0 ? 'text' : _props$type,\n other = _objectWithoutProperties(props, [\"classes\", \"fullWidth\", \"inputComponent\", \"label\", \"labelWidth\", \"multiline\", \"notched\", \"type\"]);\n\n return /*#__PURE__*/React.createElement(InputBase, _extends({\n renderSuffix: function renderSuffix(state) {\n return /*#__PURE__*/React.createElement(NotchedOutline, {\n className: classes.notchedOutline,\n label: label,\n labelWidth: labelWidth,\n notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)\n });\n },\n classes: _extends({}, classes, {\n root: clsx(classes.root, classes.underline),\n notchedOutline: null\n }),\n fullWidth: fullWidth,\n inputComponent: inputComponent,\n multiline: multiline,\n ref: ref,\n type: type\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? OutlinedInput.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * This prop helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).\n */\n autoComplete: PropTypes.string,\n\n /**\n * If `true`, the `input` element will be focused during the first mount.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The default `input` element value. Use when the component is not controlled.\n */\n defaultValue: PropTypes.any,\n\n /**\n * If `true`, the `input` element will be disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * End `InputAdornment` for this component.\n */\n endAdornment: PropTypes.node,\n\n /**\n * If `true`, the input will indicate an error. This is normally obtained via context from\n * FormControl.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the input will take up the full width of its container.\n */\n fullWidth: PropTypes.bool,\n\n /**\n * The id of the `input` element.\n */\n id: PropTypes.string,\n\n /**\n * The component used for the `input` element.\n * Either a string to use a HTML element or a component.\n */\n inputComponent: PropTypes.elementType,\n\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps: PropTypes.object,\n\n /**\n * Pass a ref to the `input` element.\n */\n inputRef: refType,\n\n /**\n * The label of the input. It is only used for layout. The actual labelling\n * is handled by `InputLabel`. If specified `labelWidth` is ignored.\n */\n label: PropTypes.node,\n\n /**\n * The width of the label. Is ignored if `label` is provided. Prefer `label`\n * if the input label appears with a strike through.\n */\n labelWidth: PropTypes.number,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense', 'none']),\n\n /**\n * Maximum number of rows to display when multiline option is set to true.\n */\n maxRows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * If `true`, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n\n /**\n * Name attribute of the `input` element.\n */\n name: PropTypes.string,\n\n /**\n * If `true`, the outline is notched to accommodate the label.\n */\n notched: PropTypes.bool,\n\n /**\n * Callback fired when the value is changed.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: PropTypes.func,\n\n /**\n * The short hint displayed in the input before the user enters a value.\n */\n placeholder: PropTypes.string,\n\n /**\n * It prevents the user from changing the value of the field\n * (not from interacting with the field).\n */\n readOnly: PropTypes.bool,\n\n /**\n * If `true`, the `input` element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * Number of rows to display when multiline option is set to true.\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n /**\n * Start `InputAdornment` for this component.\n */\n startAdornment: PropTypes.node,\n\n /**\n * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).\n */\n type: PropTypes.string,\n\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value: PropTypes.any\n} : void 0;\nOutlinedInput.muiName = 'Input';\nexport default withStyles(styles, {\n name: 'MuiOutlinedInput'\n})(OutlinedInput);","import * as React from 'react';\nimport FormControlContext from './FormControlContext';\nexport default function useFormControl() {\n return React.useContext(FormControlContext);\n}","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport formControlState from '../FormControl/formControlState';\nimport useFormControl from '../FormControl/useFormControl';\nimport capitalize from '../utils/capitalize';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: _extends({\n color: theme.palette.text.secondary\n }, theme.typography.body1, {\n lineHeight: 1,\n padding: 0,\n '&$focused': {\n color: theme.palette.primary.main\n },\n '&$disabled': {\n color: theme.palette.text.disabled\n },\n '&$error': {\n color: theme.palette.error.main\n }\n }),\n\n /* Styles applied to the root element if the color is secondary. */\n colorSecondary: {\n '&$focused': {\n color: theme.palette.secondary.main\n }\n },\n\n /* Pseudo-class applied to the root element if `focused={true}`. */\n focused: {},\n\n /* Pseudo-class applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Pseudo-class applied to the root element if `filled={true}`. */\n filled: {},\n\n /* Pseudo-class applied to the root element if `required={true}`. */\n required: {},\n\n /* Styles applied to the asterisk element. */\n asterisk: {\n '&$error': {\n color: theme.palette.error.main\n }\n }\n };\n};\nvar FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(props, ref) {\n var children = props.children,\n classes = props.classes,\n className = props.className,\n color = props.color,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'label' : _props$component,\n disabled = props.disabled,\n error = props.error,\n filled = props.filled,\n focused = props.focused,\n required = props.required,\n other = _objectWithoutProperties(props, [\"children\", \"classes\", \"className\", \"color\", \"component\", \"disabled\", \"error\", \"filled\", \"focused\", \"required\"]);\n\n var muiFormControl = useFormControl();\n var fcs = formControlState({\n props: props,\n muiFormControl: muiFormControl,\n states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']\n });\n return /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, classes[\"color\".concat(capitalize(fcs.color || 'primary'))], className, fcs.disabled && classes.disabled, fcs.error && classes.error, fcs.filled && classes.filled, fcs.focused && classes.focused, fcs.required && classes.required),\n ref: ref\n }, other), children, fcs.required && /*#__PURE__*/React.createElement(\"span\", {\n \"aria-hidden\": true,\n className: clsx(classes.asterisk, fcs.error && classes.error)\n }, \"\\u2009\", '*'));\n});\nprocess.env.NODE_ENV !== \"production\" ? FormLabel.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * If `true`, the label should be displayed in a disabled state.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, the label should be displayed in an error state.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the label should use filled classes key.\n */\n filled: PropTypes.bool,\n\n /**\n * If `true`, the input of this label is focused (used by `FormGroup` components).\n */\n focused: PropTypes.bool,\n\n /**\n * If `true`, the label will indicate that the input is required.\n */\n required: PropTypes.bool\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiFormLabel'\n})(FormLabel);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport formControlState from '../FormControl/formControlState';\nimport useFormControl from '../FormControl/useFormControl';\nimport withStyles from '../styles/withStyles';\nimport FormLabel from '../FormLabel';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n display: 'block',\n transformOrigin: 'top left'\n },\n\n /* Pseudo-class applied to the root element if `focused={true}`. */\n focused: {},\n\n /* Pseudo-class applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Pseudo-class applied to the root element if `required={true}`. */\n required: {},\n\n /* Pseudo-class applied to the asterisk element. */\n asterisk: {},\n\n /* Styles applied to the root element if the component is a descendant of `FormControl`. */\n formControl: {\n position: 'absolute',\n left: 0,\n top: 0,\n // slight alteration to spec spacing to match visual spec result\n transform: 'translate(0, 24px) scale(1)'\n },\n\n /* Styles applied to the root element if `margin=\"dense\"`. */\n marginDense: {\n // Compensation for the `Input.inputDense` style.\n transform: 'translate(0, 21px) scale(1)'\n },\n\n /* Styles applied to the `input` element if `shrink={true}`. */\n shrink: {\n transform: 'translate(0, 1.5px) scale(0.75)',\n transformOrigin: 'top left'\n },\n\n /* Styles applied to the `input` element if `disableAnimation={false}`. */\n animated: {\n transition: theme.transitions.create(['color', 'transform'], {\n duration: theme.transitions.duration.shorter,\n easing: theme.transitions.easing.easeOut\n })\n },\n\n /* Styles applied to the root element if `variant=\"filled\"`. */\n filled: {\n // Chrome's autofill feature gives the input field a yellow background.\n // Since the input field is behind the label in the HTML tree,\n // the input field is drawn last and hides the label with an opaque background color.\n // zIndex: 1 will raise the label above opaque background-colors of input.\n zIndex: 1,\n pointerEvents: 'none',\n transform: 'translate(12px, 20px) scale(1)',\n '&$marginDense': {\n transform: 'translate(12px, 17px) scale(1)'\n },\n '&$shrink': {\n transform: 'translate(12px, 10px) scale(0.75)',\n '&$marginDense': {\n transform: 'translate(12px, 7px) scale(0.75)'\n }\n }\n },\n\n /* Styles applied to the root element if `variant=\"outlined\"`. */\n outlined: {\n // see comment above on filled.zIndex\n zIndex: 1,\n pointerEvents: 'none',\n transform: 'translate(14px, 20px) scale(1)',\n '&$marginDense': {\n transform: 'translate(14px, 12px) scale(1)'\n },\n '&$shrink': {\n transform: 'translate(14px, -6px) scale(0.75)'\n }\n }\n };\n};\nvar InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(props, ref) {\n var classes = props.classes,\n className = props.className,\n _props$disableAnimati = props.disableAnimation,\n disableAnimation = _props$disableAnimati === void 0 ? false : _props$disableAnimati,\n margin = props.margin,\n shrinkProp = props.shrink,\n variant = props.variant,\n other = _objectWithoutProperties(props, [\"classes\", \"className\", \"disableAnimation\", \"margin\", \"shrink\", \"variant\"]);\n\n var muiFormControl = useFormControl();\n var shrink = shrinkProp;\n\n if (typeof shrink === 'undefined' && muiFormControl) {\n shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;\n }\n\n var fcs = formControlState({\n props: props,\n muiFormControl: muiFormControl,\n states: ['margin', 'variant']\n });\n return /*#__PURE__*/React.createElement(FormLabel, _extends({\n \"data-shrink\": shrink,\n className: clsx(classes.root, className, muiFormControl && classes.formControl, !disableAnimation && classes.animated, shrink && classes.shrink, fcs.margin === 'dense' && classes.marginDense, {\n 'filled': classes.filled,\n 'outlined': classes.outlined\n }[fcs.variant]),\n classes: {\n focused: classes.focused,\n disabled: classes.disabled,\n error: classes.error,\n required: classes.required,\n asterisk: classes.asterisk\n },\n ref: ref\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? InputLabel.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The contents of the `InputLabel`.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * If `true`, the transition animation is disabled.\n */\n disableAnimation: PropTypes.bool,\n\n /**\n * If `true`, apply disabled class.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, the label will be displayed in an error state.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the input of this label is focused.\n */\n focused: PropTypes.bool,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense']),\n\n /**\n * if `true`, the label will indicate that the input is required.\n */\n required: PropTypes.bool,\n\n /**\n * If `true`, the label is shrunk.\n */\n shrink: PropTypes.bool,\n\n /**\n * The variant to use.\n */\n variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiInputLabel'\n})(InputLabel);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { isFilled, isAdornedStart } from '../InputBase/utils';\nimport withStyles from '../styles/withStyles';\nimport capitalize from '../utils/capitalize';\nimport isMuiElement from '../utils/isMuiElement';\nimport FormControlContext from './FormControlContext';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n display: 'inline-flex',\n flexDirection: 'column',\n position: 'relative',\n // Reset fieldset default style.\n minWidth: 0,\n padding: 0,\n margin: 0,\n border: 0,\n verticalAlign: 'top' // Fix alignment issue on Safari.\n\n },\n\n /* Styles applied to the root element if `margin=\"normal\"`. */\n marginNormal: {\n marginTop: 16,\n marginBottom: 8\n },\n\n /* Styles applied to the root element if `margin=\"dense\"`. */\n marginDense: {\n marginTop: 8,\n marginBottom: 4\n },\n\n /* Styles applied to the root element if `fullWidth={true}`. */\n fullWidth: {\n width: '100%'\n }\n};\n/**\n * Provides context such as filled/focused/error/required for form inputs.\n * Relying on the context provides high flexibility and ensures that the state always stays\n * consistent across the children of the `FormControl`.\n * This context is used by the following components:\n *\n * - FormLabel\n * - FormHelperText\n * - Input\n * - InputLabel\n *\n * You can find one composition example below and more going to [the demos](/components/text-fields/#components).\n *\n * ```jsx\n * \n * Email address\n * \n * We'll never share your email.\n * \n * ```\n *\n * ⚠️Only one input can be used within a FormControl.\n */\n\nvar FormControl = /*#__PURE__*/React.forwardRef(function FormControl(props, ref) {\n var children = props.children,\n classes = props.classes,\n className = props.className,\n _props$color = props.color,\n color = _props$color === void 0 ? 'primary' : _props$color,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'div' : _props$component,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n _props$error = props.error,\n error = _props$error === void 0 ? false : _props$error,\n _props$fullWidth = props.fullWidth,\n fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,\n visuallyFocused = props.focused,\n _props$hiddenLabel = props.hiddenLabel,\n hiddenLabel = _props$hiddenLabel === void 0 ? false : _props$hiddenLabel,\n _props$margin = props.margin,\n margin = _props$margin === void 0 ? 'none' : _props$margin,\n _props$required = props.required,\n required = _props$required === void 0 ? false : _props$required,\n size = props.size,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'standard' : _props$variant,\n other = _objectWithoutProperties(props, [\"children\", \"classes\", \"className\", \"color\", \"component\", \"disabled\", \"error\", \"fullWidth\", \"focused\", \"hiddenLabel\", \"margin\", \"required\", \"size\", \"variant\"]);\n\n var _React$useState = React.useState(function () {\n // We need to iterate through the children and find the Input in order\n // to fully support server-side rendering.\n var initialAdornedStart = false;\n\n if (children) {\n React.Children.forEach(children, function (child) {\n if (!isMuiElement(child, ['Input', 'Select'])) {\n return;\n }\n\n var input = isMuiElement(child, ['Select']) ? child.props.input : child;\n\n if (input && isAdornedStart(input.props)) {\n initialAdornedStart = true;\n }\n });\n }\n\n return initialAdornedStart;\n }),\n adornedStart = _React$useState[0],\n setAdornedStart = _React$useState[1];\n\n var _React$useState2 = React.useState(function () {\n // We need to iterate through the children and find the Input in order\n // to fully support server-side rendering.\n var initialFilled = false;\n\n if (children) {\n React.Children.forEach(children, function (child) {\n if (!isMuiElement(child, ['Input', 'Select'])) {\n return;\n }\n\n if (isFilled(child.props, true)) {\n initialFilled = true;\n }\n });\n }\n\n return initialFilled;\n }),\n filled = _React$useState2[0],\n setFilled = _React$useState2[1];\n\n var _React$useState3 = React.useState(false),\n _focused = _React$useState3[0],\n setFocused = _React$useState3[1];\n\n var focused = visuallyFocused !== undefined ? visuallyFocused : _focused;\n\n if (disabled && focused) {\n setFocused(false);\n }\n\n var registerEffect;\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n var registeredInput = React.useRef(false);\n\n registerEffect = function registerEffect() {\n if (registeredInput.current) {\n console.error(['Material-UI: There are multiple InputBase components inside a FormControl.', 'This is not supported. It might cause infinite rendering loops.', 'Only use one InputBase.'].join('\\n'));\n }\n\n registeredInput.current = true;\n return function () {\n registeredInput.current = false;\n };\n };\n }\n\n var onFilled = React.useCallback(function () {\n setFilled(true);\n }, []);\n var onEmpty = React.useCallback(function () {\n setFilled(false);\n }, []);\n var childContext = {\n adornedStart: adornedStart,\n setAdornedStart: setAdornedStart,\n color: color,\n disabled: disabled,\n error: error,\n filled: filled,\n focused: focused,\n fullWidth: fullWidth,\n hiddenLabel: hiddenLabel,\n margin: (size === 'small' ? 'dense' : undefined) || margin,\n onBlur: function onBlur() {\n setFocused(false);\n },\n onEmpty: onEmpty,\n onFilled: onFilled,\n onFocus: function onFocus() {\n setFocused(true);\n },\n registerEffect: registerEffect,\n required: required,\n variant: variant\n };\n return /*#__PURE__*/React.createElement(FormControlContext.Provider, {\n value: childContext\n }, /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, className, margin !== 'none' && classes[\"margin\".concat(capitalize(margin))], fullWidth && classes.fullWidth),\n ref: ref\n }, other), children));\n});\nprocess.env.NODE_ENV !== \"production\" ? FormControl.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The contents of the form control.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n */\n color: PropTypes.oneOf(['primary', 'secondary']),\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * If `true`, the label, input and helper text should be displayed in a disabled state.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, the label should be displayed in an error state.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the component will be displayed in focused state.\n */\n focused: PropTypes.bool,\n\n /**\n * If `true`, the component will take up the full width of its container.\n */\n fullWidth: PropTypes.bool,\n\n /**\n * If `true`, the label will be hidden.\n * This is used to increase density for a `FilledInput`.\n * Be sure to add `aria-label` to the `input` element.\n */\n hiddenLabel: PropTypes.bool,\n\n /**\n * If `dense` or `normal`, will adjust vertical spacing of this and contained components.\n */\n margin: PropTypes.oneOf(['dense', 'none', 'normal']),\n\n /**\n * If `true`, the label will indicate that the input is required.\n */\n required: PropTypes.bool,\n\n /**\n * The size of the text field.\n */\n size: PropTypes.oneOf(['medium', 'small']),\n\n /**\n * The variant to use.\n */\n variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiFormControl'\n})(FormControl);","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport formControlState from '../FormControl/formControlState';\nimport useFormControl from '../FormControl/useFormControl';\nimport withStyles from '../styles/withStyles';\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: _extends({\n color: theme.palette.text.secondary\n }, theme.typography.caption, {\n textAlign: 'left',\n marginTop: 3,\n margin: 0,\n '&$disabled': {\n color: theme.palette.text.disabled\n },\n '&$error': {\n color: theme.palette.error.main\n }\n }),\n\n /* Pseudo-class applied to the root element if `error={true}`. */\n error: {},\n\n /* Pseudo-class applied to the root element if `disabled={true}`. */\n disabled: {},\n\n /* Styles applied to the root element if `margin=\"dense\"`. */\n marginDense: {\n marginTop: 4\n },\n\n /* Styles applied to the root element if `variant=\"filled\"` or `variant=\"outlined\"`. */\n contained: {\n marginLeft: 14,\n marginRight: 14\n },\n\n /* Pseudo-class applied to the root element if `focused={true}`. */\n focused: {},\n\n /* Pseudo-class applied to the root element if `filled={true}`. */\n filled: {},\n\n /* Pseudo-class applied to the root element if `required={true}`. */\n required: {}\n };\n};\nvar FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(props, ref) {\n var children = props.children,\n classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'p' : _props$component,\n disabled = props.disabled,\n error = props.error,\n filled = props.filled,\n focused = props.focused,\n margin = props.margin,\n required = props.required,\n variant = props.variant,\n other = _objectWithoutProperties(props, [\"children\", \"classes\", \"className\", \"component\", \"disabled\", \"error\", \"filled\", \"focused\", \"margin\", \"required\", \"variant\"]);\n\n var muiFormControl = useFormControl();\n var fcs = formControlState({\n props: props,\n muiFormControl: muiFormControl,\n states: ['variant', 'margin', 'disabled', 'error', 'filled', 'focused', 'required']\n });\n return /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, (fcs.variant === 'filled' || fcs.variant === 'outlined') && classes.contained, className, fcs.disabled && classes.disabled, fcs.error && classes.error, fcs.filled && classes.filled, fcs.focused && classes.focused, fcs.required && classes.required, fcs.margin === 'dense' && classes.marginDense),\n ref: ref\n }, other), children === ' ' ?\n /*#__PURE__*/\n // eslint-disable-next-line react/no-danger\n React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: '​'\n }\n }) : children);\n});\nprocess.env.NODE_ENV !== \"production\" ? FormHelperText.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The content of the component.\n *\n * If `' '` is provided, the component reserves one line height for displaying a future message.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * If `true`, the helper text should be displayed in a disabled state.\n */\n disabled: PropTypes.bool,\n\n /**\n * If `true`, helper text should be displayed in an error state.\n */\n error: PropTypes.bool,\n\n /**\n * If `true`, the helper text should use filled classes key.\n */\n filled: PropTypes.bool,\n\n /**\n * If `true`, the helper text should use focused classes key.\n */\n focused: PropTypes.bool,\n\n /**\n * If `dense`, will adjust vertical spacing. This is normally obtained via context from\n * FormControl.\n */\n margin: PropTypes.oneOf(['dense']),\n\n /**\n * If `true`, the helper text should use required classes key.\n */\n required: PropTypes.bool,\n\n /**\n * The variant to use.\n */\n variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiFormHelperText'\n})(FormHelperText);","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { exactProp, HTMLElementType } from '@material-ui/utils';\nimport deprecatedPropType from '../utils/deprecatedPropType';\nimport setRef from '../utils/setRef';\nimport useForkRef from '../utils/useForkRef';\n\nfunction getContainer(container) {\n container = typeof container === 'function' ? container() : container; // #StrictMode ready\n\n return ReactDOM.findDOMNode(container);\n}\n\nvar useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n/**\n * Portals provide a first-class way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n */\n\nvar Portal = /*#__PURE__*/React.forwardRef(function Portal(props, ref) {\n var children = props.children,\n container = props.container,\n _props$disablePortal = props.disablePortal,\n disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,\n onRendered = props.onRendered;\n\n var _React$useState = React.useState(null),\n mountNode = _React$useState[0],\n setMountNode = _React$useState[1];\n\n var handleRef = useForkRef( /*#__PURE__*/React.isValidElement(children) ? children.ref : null, ref);\n useEnhancedEffect(function () {\n if (!disablePortal) {\n setMountNode(getContainer(container) || document.body);\n }\n }, [container, disablePortal]);\n useEnhancedEffect(function () {\n if (mountNode && !disablePortal) {\n setRef(ref, mountNode);\n return function () {\n setRef(ref, null);\n };\n }\n\n return undefined;\n }, [ref, mountNode, disablePortal]);\n useEnhancedEffect(function () {\n if (onRendered && (mountNode || disablePortal)) {\n onRendered();\n }\n }, [onRendered, mountNode, disablePortal]);\n\n if (disablePortal) {\n if ( /*#__PURE__*/React.isValidElement(children)) {\n return /*#__PURE__*/React.cloneElement(children, {\n ref: handleRef\n });\n }\n\n return children;\n }\n\n return mountNode ? /*#__PURE__*/ReactDOM.createPortal(children, mountNode) : mountNode;\n});\nprocess.env.NODE_ENV !== \"production\" ? Portal.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The children to render into the `container`.\n */\n children: PropTypes.node,\n\n /**\n * A HTML element, component instance, or function that returns either.\n * The `container` will have the portal children appended to it.\n *\n * By default, it uses the body of the top-level document object,\n * so it's simply `document.body` most of the time.\n */\n container: PropTypes\n /* @typescript-to-proptypes-ignore */\n .oneOfType([HTMLElementType, PropTypes.instanceOf(React.Component), PropTypes.func]),\n\n /**\n * Disable the portal behavior.\n * The children stay within it's parent DOM hierarchy.\n */\n disablePortal: PropTypes.bool,\n\n /**\n * Callback fired once the children has been mounted into the `container`.\n *\n * This prop will be removed in v5, the ref can be used instead.\n * @deprecated Use the ref instead.\n */\n onRendered: deprecatedPropType(PropTypes.func, 'Use the ref instead.')\n} : void 0;\n\nif (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n Portal['propTypes' + ''] = exactProp(Portal.propTypes);\n}\n\nexport default Portal;","// A change of the browser zoom change the scrollbar size.\n// Credit https://github.com/twbs/bootstrap/blob/3ffe3a5d82f6f561b82ff78d82b32a7d14aed558/js/src/modal.js#L512-L519\nexport default function getScrollbarSize() {\n var scrollDiv = document.createElement('div');\n scrollDiv.style.width = '99px';\n scrollDiv.style.height = '99px';\n scrollDiv.style.position = 'absolute';\n scrollDiv.style.top = '-9999px';\n scrollDiv.style.overflow = 'scroll';\n document.body.appendChild(scrollDiv);\n var scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarSize;\n}","import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport getScrollbarSize from '../utils/getScrollbarSize';\nimport ownerDocument from '../utils/ownerDocument';\nimport ownerWindow from '../utils/ownerWindow'; // Is a vertical scrollbar displayed?\n\nfunction isOverflowing(container) {\n var doc = ownerDocument(container);\n\n if (doc.body === container) {\n return ownerWindow(doc).innerWidth > doc.documentElement.clientWidth;\n }\n\n return container.scrollHeight > container.clientHeight;\n}\n\nexport function ariaHidden(node, show) {\n if (show) {\n node.setAttribute('aria-hidden', 'true');\n } else {\n node.removeAttribute('aria-hidden');\n }\n}\n\nfunction getPaddingRight(node) {\n return parseInt(window.getComputedStyle(node)['padding-right'], 10) || 0;\n}\n\nfunction ariaHiddenSiblings(container, mountNode, currentNode) {\n var nodesToExclude = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];\n var show = arguments.length > 4 ? arguments[4] : undefined;\n var blacklist = [mountNode, currentNode].concat(_toConsumableArray(nodesToExclude));\n var blacklistTagNames = ['TEMPLATE', 'SCRIPT', 'STYLE'];\n [].forEach.call(container.children, function (node) {\n if (node.nodeType === 1 && blacklist.indexOf(node) === -1 && blacklistTagNames.indexOf(node.tagName) === -1) {\n ariaHidden(node, show);\n }\n });\n}\n\nfunction findIndexOf(containerInfo, callback) {\n var idx = -1;\n containerInfo.some(function (item, index) {\n if (callback(item)) {\n idx = index;\n return true;\n }\n\n return false;\n });\n return idx;\n}\n\nfunction handleContainer(containerInfo, props) {\n var restoreStyle = [];\n var restorePaddings = [];\n var container = containerInfo.container;\n var fixedNodes;\n\n if (!props.disableScrollLock) {\n if (isOverflowing(container)) {\n // Compute the size before applying overflow hidden to avoid any scroll jumps.\n var scrollbarSize = getScrollbarSize();\n restoreStyle.push({\n value: container.style.paddingRight,\n key: 'padding-right',\n el: container\n }); // Use computed style, here to get the real padding to add our scrollbar width.\n\n container.style['padding-right'] = \"\".concat(getPaddingRight(container) + scrollbarSize, \"px\"); // .mui-fixed is a global helper.\n\n fixedNodes = ownerDocument(container).querySelectorAll('.mui-fixed');\n [].forEach.call(fixedNodes, function (node) {\n restorePaddings.push(node.style.paddingRight);\n node.style.paddingRight = \"\".concat(getPaddingRight(node) + scrollbarSize, \"px\");\n });\n } // Improve Gatsby support\n // https://css-tricks.com/snippets/css/force-vertical-scrollbar/\n\n\n var parent = container.parentElement;\n var scrollContainer = parent.nodeName === 'HTML' && window.getComputedStyle(parent)['overflow-y'] === 'scroll' ? parent : container; // Block the scroll even if no scrollbar is visible to account for mobile keyboard\n // screensize shrink.\n\n restoreStyle.push({\n value: scrollContainer.style.overflow,\n key: 'overflow',\n el: scrollContainer\n });\n scrollContainer.style.overflow = 'hidden';\n }\n\n var restore = function restore() {\n if (fixedNodes) {\n [].forEach.call(fixedNodes, function (node, i) {\n if (restorePaddings[i]) {\n node.style.paddingRight = restorePaddings[i];\n } else {\n node.style.removeProperty('padding-right');\n }\n });\n }\n\n restoreStyle.forEach(function (_ref) {\n var value = _ref.value,\n el = _ref.el,\n key = _ref.key;\n\n if (value) {\n el.style.setProperty(key, value);\n } else {\n el.style.removeProperty(key);\n }\n });\n };\n\n return restore;\n}\n\nfunction getHiddenSiblings(container) {\n var hiddenSiblings = [];\n [].forEach.call(container.children, function (node) {\n if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') {\n hiddenSiblings.push(node);\n }\n });\n return hiddenSiblings;\n}\n/**\n * @ignore - do not document.\n *\n * Proper state management for containers and the modals in those containers.\n * Simplified, but inspired by react-overlay's ModalManager class.\n * Used by the Modal to ensure proper styling of containers.\n */\n\n\nvar ModalManager = /*#__PURE__*/function () {\n function ModalManager() {\n _classCallCheck(this, ModalManager);\n\n // this.modals[modalIndex] = modal\n this.modals = []; // this.containers[containerIndex] = {\n // modals: [],\n // container,\n // restore: null,\n // }\n\n this.containers = [];\n }\n\n _createClass(ModalManager, [{\n key: \"add\",\n value: function add(modal, container) {\n var modalIndex = this.modals.indexOf(modal);\n\n if (modalIndex !== -1) {\n return modalIndex;\n }\n\n modalIndex = this.modals.length;\n this.modals.push(modal); // If the modal we are adding is already in the DOM.\n\n if (modal.modalRef) {\n ariaHidden(modal.modalRef, false);\n }\n\n var hiddenSiblingNodes = getHiddenSiblings(container);\n ariaHiddenSiblings(container, modal.mountNode, modal.modalRef, hiddenSiblingNodes, true);\n var containerIndex = findIndexOf(this.containers, function (item) {\n return item.container === container;\n });\n\n if (containerIndex !== -1) {\n this.containers[containerIndex].modals.push(modal);\n return modalIndex;\n }\n\n this.containers.push({\n modals: [modal],\n container: container,\n restore: null,\n hiddenSiblingNodes: hiddenSiblingNodes\n });\n return modalIndex;\n }\n }, {\n key: \"mount\",\n value: function mount(modal, props) {\n var containerIndex = findIndexOf(this.containers, function (item) {\n return item.modals.indexOf(modal) !== -1;\n });\n var containerInfo = this.containers[containerIndex];\n\n if (!containerInfo.restore) {\n containerInfo.restore = handleContainer(containerInfo, props);\n }\n }\n }, {\n key: \"remove\",\n value: function remove(modal) {\n var modalIndex = this.modals.indexOf(modal);\n\n if (modalIndex === -1) {\n return modalIndex;\n }\n\n var containerIndex = findIndexOf(this.containers, function (item) {\n return item.modals.indexOf(modal) !== -1;\n });\n var containerInfo = this.containers[containerIndex];\n containerInfo.modals.splice(containerInfo.modals.indexOf(modal), 1);\n this.modals.splice(modalIndex, 1); // If that was the last modal in a container, clean up the container.\n\n if (containerInfo.modals.length === 0) {\n // The modal might be closed before it had the chance to be mounted in the DOM.\n if (containerInfo.restore) {\n containerInfo.restore();\n }\n\n if (modal.modalRef) {\n // In case the modal wasn't in the DOM yet.\n ariaHidden(modal.modalRef, true);\n }\n\n ariaHiddenSiblings(containerInfo.container, modal.mountNode, modal.modalRef, containerInfo.hiddenSiblingNodes, false);\n this.containers.splice(containerIndex, 1);\n } else {\n // Otherwise make sure the next top modal is visible to a screen reader.\n var nextTop = containerInfo.modals[containerInfo.modals.length - 1]; // as soon as a modal is adding its modalRef is undefined. it can't set\n // aria-hidden because the dom element doesn't exist either\n // when modal was unmounted before modalRef gets null\n\n if (nextTop.modalRef) {\n ariaHidden(nextTop.modalRef, false);\n }\n }\n\n return modalIndex;\n }\n }, {\n key: \"isTopModal\",\n value: function isTopModal(modal) {\n return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;\n }\n }]);\n\n return ModalManager;\n}();\n\nexport { ModalManager as default };","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","/* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex, camelcase */\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport ownerDocument from '../utils/ownerDocument';\nimport useForkRef from '../utils/useForkRef';\nimport { exactProp } from '@material-ui/utils';\n/**\n * Utility component that locks focus inside the component.\n */\n\nfunction Unstable_TrapFocus(props) {\n var children = props.children,\n _props$disableAutoFoc = props.disableAutoFocus,\n disableAutoFocus = _props$disableAutoFoc === void 0 ? false : _props$disableAutoFoc,\n _props$disableEnforce = props.disableEnforceFocus,\n disableEnforceFocus = _props$disableEnforce === void 0 ? false : _props$disableEnforce,\n _props$disableRestore = props.disableRestoreFocus,\n disableRestoreFocus = _props$disableRestore === void 0 ? false : _props$disableRestore,\n getDoc = props.getDoc,\n isEnabled = props.isEnabled,\n open = props.open;\n var ignoreNextEnforceFocus = React.useRef();\n var sentinelStart = React.useRef(null);\n var sentinelEnd = React.useRef(null);\n var nodeToRestore = React.useRef();\n var rootRef = React.useRef(null); // can be removed once we drop support for non ref forwarding class components\n\n var handleOwnRef = React.useCallback(function (instance) {\n // #StrictMode ready\n rootRef.current = ReactDOM.findDOMNode(instance);\n }, []);\n var handleRef = useForkRef(children.ref, handleOwnRef);\n var prevOpenRef = React.useRef();\n React.useEffect(function () {\n prevOpenRef.current = open;\n }, [open]);\n\n if (!prevOpenRef.current && open && typeof window !== 'undefined') {\n // WARNING: Potentially unsafe in concurrent mode.\n // The way the read on `nodeToRestore` is setup could make this actually safe.\n // Say we render `open={false}` -> `open={true}` but never commit.\n // We have now written a state that wasn't committed. But no committed effect\n // will read this wrong value. We only read from `nodeToRestore` in effects\n // that were committed on `open={true}`\n // WARNING: Prevents the instance from being garbage collected. Should only\n // hold a weak ref.\n nodeToRestore.current = getDoc().activeElement;\n }\n\n React.useEffect(function () {\n if (!open) {\n return;\n }\n\n var doc = ownerDocument(rootRef.current); // We might render an empty child.\n\n if (!disableAutoFocus && rootRef.current && !rootRef.current.contains(doc.activeElement)) {\n if (!rootRef.current.hasAttribute('tabIndex')) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(['Material-UI: The modal content node does not accept focus.', 'For the benefit of assistive technologies, ' + 'the tabIndex of the node is being set to \"-1\".'].join('\\n'));\n }\n\n rootRef.current.setAttribute('tabIndex', -1);\n }\n\n rootRef.current.focus();\n }\n\n var contain = function contain() {\n var rootElement = rootRef.current; // Cleanup functions are executed lazily in React 17.\n // Contain can be called between the component being unmounted and its cleanup function being run.\n\n if (rootElement === null) {\n return;\n }\n\n if (!doc.hasFocus() || disableEnforceFocus || !isEnabled() || ignoreNextEnforceFocus.current) {\n ignoreNextEnforceFocus.current = false;\n return;\n }\n\n if (rootRef.current && !rootRef.current.contains(doc.activeElement)) {\n rootRef.current.focus();\n }\n };\n\n var loopFocus = function loopFocus(event) {\n // 9 = Tab\n if (disableEnforceFocus || !isEnabled() || event.keyCode !== 9) {\n return;\n } // Make sure the next tab starts from the right place.\n\n\n if (doc.activeElement === rootRef.current) {\n // We need to ignore the next contain as\n // it will try to move the focus back to the rootRef element.\n ignoreNextEnforceFocus.current = true;\n\n if (event.shiftKey) {\n sentinelEnd.current.focus();\n } else {\n sentinelStart.current.focus();\n }\n }\n };\n\n doc.addEventListener('focus', contain, true);\n doc.addEventListener('keydown', loopFocus, true); // With Edge, Safari and Firefox, no focus related events are fired when the focused area stops being a focused area\n // e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=559561.\n //\n // The whatwg spec defines how the browser should behave but does not explicitly mention any events:\n // https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.\n\n var interval = setInterval(function () {\n contain();\n }, 50);\n return function () {\n clearInterval(interval);\n doc.removeEventListener('focus', contain, true);\n doc.removeEventListener('keydown', loopFocus, true); // restoreLastFocus()\n\n if (!disableRestoreFocus) {\n // In IE 11 it is possible for document.activeElement to be null resulting\n // in nodeToRestore.current being null.\n // Not all elements in IE 11 have a focus method.\n // Once IE 11 support is dropped the focus() call can be unconditional.\n if (nodeToRestore.current && nodeToRestore.current.focus) {\n nodeToRestore.current.focus();\n }\n\n nodeToRestore.current = null;\n }\n };\n }, [disableAutoFocus, disableEnforceFocus, disableRestoreFocus, isEnabled, open]);\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"div\", {\n tabIndex: 0,\n ref: sentinelStart,\n \"data-test\": \"sentinelStart\"\n }), /*#__PURE__*/React.cloneElement(children, {\n ref: handleRef\n }), /*#__PURE__*/React.createElement(\"div\", {\n tabIndex: 0,\n ref: sentinelEnd,\n \"data-test\": \"sentinelEnd\"\n }));\n}\n\nprocess.env.NODE_ENV !== \"production\" ? Unstable_TrapFocus.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * A single child content element.\n */\n children: PropTypes.node,\n\n /**\n * If `true`, the trap focus will not automatically shift focus to itself when it opens, and\n * replace it to the last focused element when it closes.\n * This also works correctly with any trap focus children that have the `disableAutoFocus` prop.\n *\n * Generally this should never be set to `true` as it makes the trap focus less\n * accessible to assistive technologies, like screen readers.\n */\n disableAutoFocus: PropTypes.bool,\n\n /**\n * If `true`, the trap focus will not prevent focus from leaving the trap focus while open.\n *\n * Generally this should never be set to `true` as it makes the trap focus less\n * accessible to assistive technologies, like screen readers.\n */\n disableEnforceFocus: PropTypes.bool,\n\n /**\n * If `true`, the trap focus will not restore focus to previously focused element once\n * trap focus is hidden.\n */\n disableRestoreFocus: PropTypes.bool,\n\n /**\n * Return the document to consider.\n * We use it to implement the restore focus between different browser documents.\n */\n getDoc: PropTypes.func.isRequired,\n\n /**\n * Do we still want to enforce the focus?\n * This prop helps nesting TrapFocus elements.\n */\n isEnabled: PropTypes.func.isRequired,\n\n /**\n * If `true`, focus will be locked.\n */\n open: PropTypes.bool.isRequired\n} : void 0;\n\nif (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n Unstable_TrapFocus['propTypes' + ''] = exactProp(Unstable_TrapFocus.propTypes);\n}\n\nexport default Unstable_TrapFocus;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n zIndex: -1,\n position: 'fixed',\n right: 0,\n bottom: 0,\n top: 0,\n left: 0,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n WebkitTapHighlightColor: 'transparent'\n },\n\n /* Styles applied to the root element if `invisible={true}`. */\n invisible: {\n backgroundColor: 'transparent'\n }\n};\n/**\n * @ignore - internal component.\n */\n\nvar SimpleBackdrop = /*#__PURE__*/React.forwardRef(function SimpleBackdrop(props, ref) {\n var _props$invisible = props.invisible,\n invisible = _props$invisible === void 0 ? false : _props$invisible,\n open = props.open,\n other = _objectWithoutProperties(props, [\"invisible\", \"open\"]);\n\n return open ? /*#__PURE__*/React.createElement(\"div\", _extends({\n \"aria-hidden\": true,\n ref: ref\n }, other, {\n style: _extends({}, styles.root, invisible ? styles.invisible : {}, other.style)\n })) : null;\n});\nprocess.env.NODE_ENV !== \"production\" ? SimpleBackdrop.propTypes = {\n /**\n * If `true`, the backdrop is invisible.\n * It can be used when rendering a popover or a custom select component.\n */\n invisible: PropTypes.bool,\n\n /**\n * If `true`, the backdrop is open.\n */\n open: PropTypes.bool.isRequired\n} : void 0;\nexport default SimpleBackdrop;","import _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { getThemeProps, useTheme } from '@material-ui/styles';\nimport { elementAcceptingRef, HTMLElementType } from '@material-ui/utils';\nimport deprecatedPropType from '../utils/deprecatedPropType';\nimport ownerDocument from '../utils/ownerDocument';\nimport Portal from '../Portal';\nimport createChainedFunction from '../utils/createChainedFunction';\nimport useForkRef from '../utils/useForkRef';\nimport useEventCallback from '../utils/useEventCallback';\nimport zIndex from '../styles/zIndex';\nimport ModalManager, { ariaHidden } from './ModalManager';\nimport TrapFocus from '../Unstable_TrapFocus';\nimport SimpleBackdrop from './SimpleBackdrop';\n\nfunction getContainer(container) {\n container = typeof container === 'function' ? container() : container;\n return ReactDOM.findDOMNode(container);\n}\n\nfunction getHasTransition(props) {\n return props.children ? props.children.props.hasOwnProperty('in') : false;\n} // A modal manager used to track and manage the state of open Modals.\n// Modals don't open on the server so this won't conflict with concurrent requests.\n\n\nvar defaultManager = new ModalManager();\nexport var styles = function styles(theme) {\n return {\n /* Styles applied to the root element. */\n root: {\n position: 'fixed',\n zIndex: theme.zIndex.modal,\n right: 0,\n bottom: 0,\n top: 0,\n left: 0\n },\n\n /* Styles applied to the root element if the `Modal` has exited. */\n hidden: {\n visibility: 'hidden'\n }\n };\n};\n/**\n * Modal is a lower-level construct that is leveraged by the following components:\n *\n * - [Dialog](/api/dialog/)\n * - [Drawer](/api/drawer/)\n * - [Menu](/api/menu/)\n * - [Popover](/api/popover/)\n *\n * If you are creating a modal dialog, you probably want to use the [Dialog](/api/dialog/) component\n * rather than directly using Modal.\n *\n * This component shares many concepts with [react-overlays](https://react-bootstrap.github.io/react-overlays/#modals).\n */\n\nvar Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {\n var theme = useTheme();\n var props = getThemeProps({\n name: 'MuiModal',\n props: _extends({}, inProps),\n theme: theme\n });\n\n var _props$BackdropCompon = props.BackdropComponent,\n BackdropComponent = _props$BackdropCompon === void 0 ? SimpleBackdrop : _props$BackdropCompon,\n BackdropProps = props.BackdropProps,\n children = props.children,\n _props$closeAfterTran = props.closeAfterTransition,\n closeAfterTransition = _props$closeAfterTran === void 0 ? false : _props$closeAfterTran,\n container = props.container,\n _props$disableAutoFoc = props.disableAutoFocus,\n disableAutoFocus = _props$disableAutoFoc === void 0 ? false : _props$disableAutoFoc,\n _props$disableBackdro = props.disableBackdropClick,\n disableBackdropClick = _props$disableBackdro === void 0 ? false : _props$disableBackdro,\n _props$disableEnforce = props.disableEnforceFocus,\n disableEnforceFocus = _props$disableEnforce === void 0 ? false : _props$disableEnforce,\n _props$disableEscapeK = props.disableEscapeKeyDown,\n disableEscapeKeyDown = _props$disableEscapeK === void 0 ? false : _props$disableEscapeK,\n _props$disablePortal = props.disablePortal,\n disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,\n _props$disableRestore = props.disableRestoreFocus,\n disableRestoreFocus = _props$disableRestore === void 0 ? false : _props$disableRestore,\n _props$disableScrollL = props.disableScrollLock,\n disableScrollLock = _props$disableScrollL === void 0 ? false : _props$disableScrollL,\n _props$hideBackdrop = props.hideBackdrop,\n hideBackdrop = _props$hideBackdrop === void 0 ? false : _props$hideBackdrop,\n _props$keepMounted = props.keepMounted,\n keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,\n _props$manager = props.manager,\n manager = _props$manager === void 0 ? defaultManager : _props$manager,\n onBackdropClick = props.onBackdropClick,\n onClose = props.onClose,\n onEscapeKeyDown = props.onEscapeKeyDown,\n onRendered = props.onRendered,\n open = props.open,\n other = _objectWithoutProperties(props, [\"BackdropComponent\", \"BackdropProps\", \"children\", \"closeAfterTransition\", \"container\", \"disableAutoFocus\", \"disableBackdropClick\", \"disableEnforceFocus\", \"disableEscapeKeyDown\", \"disablePortal\", \"disableRestoreFocus\", \"disableScrollLock\", \"hideBackdrop\", \"keepMounted\", \"manager\", \"onBackdropClick\", \"onClose\", \"onEscapeKeyDown\", \"onRendered\", \"open\"]);\n\n var _React$useState = React.useState(true),\n exited = _React$useState[0],\n setExited = _React$useState[1];\n\n var modal = React.useRef({});\n var mountNodeRef = React.useRef(null);\n var modalRef = React.useRef(null);\n var handleRef = useForkRef(modalRef, ref);\n var hasTransition = getHasTransition(props);\n\n var getDoc = function getDoc() {\n return ownerDocument(mountNodeRef.current);\n };\n\n var getModal = function getModal() {\n modal.current.modalRef = modalRef.current;\n modal.current.mountNode = mountNodeRef.current;\n return modal.current;\n };\n\n var handleMounted = function handleMounted() {\n manager.mount(getModal(), {\n disableScrollLock: disableScrollLock\n }); // Fix a bug on Chrome where the scroll isn't initially 0.\n\n modalRef.current.scrollTop = 0;\n };\n\n var handleOpen = useEventCallback(function () {\n var resolvedContainer = getContainer(container) || getDoc().body;\n manager.add(getModal(), resolvedContainer); // The element was already mounted.\n\n if (modalRef.current) {\n handleMounted();\n }\n });\n var isTopModal = React.useCallback(function () {\n return manager.isTopModal(getModal());\n }, [manager]);\n var handlePortalRef = useEventCallback(function (node) {\n mountNodeRef.current = node;\n\n if (!node) {\n return;\n }\n\n if (onRendered) {\n onRendered();\n }\n\n if (open && isTopModal()) {\n handleMounted();\n } else {\n ariaHidden(modalRef.current, true);\n }\n });\n var handleClose = React.useCallback(function () {\n manager.remove(getModal());\n }, [manager]);\n React.useEffect(function () {\n return function () {\n handleClose();\n };\n }, [handleClose]);\n React.useEffect(function () {\n if (open) {\n handleOpen();\n } else if (!hasTransition || !closeAfterTransition) {\n handleClose();\n }\n }, [open, handleClose, hasTransition, closeAfterTransition, handleOpen]);\n\n if (!keepMounted && !open && (!hasTransition || exited)) {\n return null;\n }\n\n var handleEnter = function handleEnter() {\n setExited(false);\n };\n\n var handleExited = function handleExited() {\n setExited(true);\n\n if (closeAfterTransition) {\n handleClose();\n }\n };\n\n var handleBackdropClick = function handleBackdropClick(event) {\n if (event.target !== event.currentTarget) {\n return;\n }\n\n if (onBackdropClick) {\n onBackdropClick(event);\n }\n\n if (!disableBackdropClick && onClose) {\n onClose(event, 'backdropClick');\n }\n };\n\n var handleKeyDown = function handleKeyDown(event) {\n // The handler doesn't take event.defaultPrevented into account:\n //\n // event.preventDefault() is meant to stop default behaviours like\n // clicking a checkbox to check it, hitting a button to submit a form,\n // and hitting left arrow to move the cursor in a text input etc.\n // Only special HTML elements have these default behaviors.\n if (event.key !== 'Escape' || !isTopModal()) {\n return;\n }\n\n if (onEscapeKeyDown) {\n onEscapeKeyDown(event);\n }\n\n if (!disableEscapeKeyDown) {\n // Swallow the event, in case someone is listening for the escape key on the body.\n event.stopPropagation();\n\n if (onClose) {\n onClose(event, 'escapeKeyDown');\n }\n }\n };\n\n var inlineStyle = styles(theme || {\n zIndex: zIndex\n });\n var childProps = {};\n\n if (children.props.tabIndex === undefined) {\n childProps.tabIndex = children.props.tabIndex || '-1';\n } // It's a Transition like component\n\n\n if (hasTransition) {\n childProps.onEnter = createChainedFunction(handleEnter, children.props.onEnter);\n childProps.onExited = createChainedFunction(handleExited, children.props.onExited);\n }\n\n return /*#__PURE__*/React.createElement(Portal, {\n ref: handlePortalRef,\n container: container,\n disablePortal: disablePortal\n }, /*#__PURE__*/React.createElement(\"div\", _extends({\n ref: handleRef,\n onKeyDown: handleKeyDown,\n role: \"presentation\"\n }, other, {\n style: _extends({}, inlineStyle.root, !open && exited ? inlineStyle.hidden : {}, other.style)\n }), hideBackdrop ? null : /*#__PURE__*/React.createElement(BackdropComponent, _extends({\n open: open,\n onClick: handleBackdropClick\n }, BackdropProps)), /*#__PURE__*/React.createElement(TrapFocus, {\n disableEnforceFocus: disableEnforceFocus,\n disableAutoFocus: disableAutoFocus,\n disableRestoreFocus: disableRestoreFocus,\n getDoc: getDoc,\n isEnabled: isTopModal,\n open: open\n }, /*#__PURE__*/React.cloneElement(children, childProps))));\n});\nprocess.env.NODE_ENV !== \"production\" ? Modal.propTypes = {\n /**\n * A backdrop component. This prop enables custom backdrop rendering.\n */\n BackdropComponent: PropTypes.elementType,\n\n /**\n * Props applied to the [`Backdrop`](/api/backdrop/) element.\n */\n BackdropProps: PropTypes.object,\n\n /**\n * A single child content element.\n */\n children: elementAcceptingRef.isRequired,\n\n /**\n * When set to true the Modal waits until a nested Transition is completed before closing.\n */\n closeAfterTransition: PropTypes.bool,\n\n /**\n * A HTML element, component instance, or function that returns either.\n * The `container` will have the portal children appended to it.\n *\n * By default, it uses the body of the top-level document object,\n * so it's simply `document.body` most of the time.\n */\n container: PropTypes\n /* @typescript-to-proptypes-ignore */\n .oneOfType([HTMLElementType, PropTypes.instanceOf(React.Component), PropTypes.func]),\n\n /**\n * If `true`, the modal will not automatically shift focus to itself when it opens, and\n * replace it to the last focused element when it closes.\n * This also works correctly with any modal children that have the `disableAutoFocus` prop.\n *\n * Generally this should never be set to `true` as it makes the modal less\n * accessible to assistive technologies, like screen readers.\n */\n disableAutoFocus: PropTypes.bool,\n\n /**\n * If `true`, clicking the backdrop will not fire `onClose`.\n */\n disableBackdropClick: deprecatedPropType(PropTypes.bool, 'Use the onClose prop with the `reason` argument to filter the `backdropClick` events.'),\n\n /**\n * If `true`, the modal will not prevent focus from leaving the modal while open.\n *\n * Generally this should never be set to `true` as it makes the modal less\n * accessible to assistive technologies, like screen readers.\n */\n disableEnforceFocus: PropTypes.bool,\n\n /**\n * If `true`, hitting escape will not fire `onClose`.\n */\n disableEscapeKeyDown: PropTypes.bool,\n\n /**\n * Disable the portal behavior.\n * The children stay within it's parent DOM hierarchy.\n */\n disablePortal: PropTypes.bool,\n\n /**\n * If `true`, the modal will not restore focus to previously focused element once\n * modal is hidden.\n */\n disableRestoreFocus: PropTypes.bool,\n\n /**\n * Disable the scroll lock behavior.\n */\n disableScrollLock: PropTypes.bool,\n\n /**\n * If `true`, the backdrop is not rendered.\n */\n hideBackdrop: PropTypes.bool,\n\n /**\n * Always keep the children in the DOM.\n * This prop can be useful in SEO situation or\n * when you want to maximize the responsiveness of the Modal.\n */\n keepMounted: PropTypes.bool,\n\n /**\n * @ignore\n */\n manager: PropTypes.object,\n\n /**\n * Callback fired when the backdrop is clicked.\n */\n onBackdropClick: deprecatedPropType(PropTypes.func, 'Use the onClose prop with the `reason` argument to handle the `backdropClick` events.'),\n\n /**\n * Callback fired when the component requests to be closed.\n * The `reason` parameter can optionally be used to control the response to `onClose`.\n *\n * @param {object} event The event source of the callback.\n * @param {string} reason Can be: `\"escapeKeyDown\"`, `\"backdropClick\"`.\n */\n onClose: PropTypes.func,\n\n /**\n * Callback fired when the escape key is pressed,\n * `disableEscapeKeyDown` is false and the modal is in focus.\n */\n onEscapeKeyDown: deprecatedPropType(PropTypes.func, 'Use the onClose prop with the `reason` argument to handle the `escapeKeyDown` events.'),\n\n /**\n * Callback fired once the children has been mounted into the `container`.\n * It signals that the `open={true}` prop took effect.\n *\n * This prop will be removed in v5, the ref can be used instead.\n */\n onRendered: deprecatedPropType(PropTypes.func, 'Use the ref instead.'),\n\n /**\n * If `true`, the modal is open.\n */\n open: PropTypes.bool.isRequired\n} : void 0;\nexport default Modal;","export default {\n disabled: false\n};","export var forceReflow = function forceReflow(node) {\n return node.scrollTop;\n};","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport config from './config';\nimport { timeoutsShape } from './utils/PropTypes';\nimport TransitionGroupContext from './TransitionGroupContext';\nimport { forceReflow } from './utils/reflow';\nexport var UNMOUNTED = 'unmounted';\nexport var EXITED = 'exited';\nexport var ENTERING = 'entering';\nexport var ENTERED = 'entered';\nexport var EXITING = 'exiting';\n/**\n * The Transition component lets you describe a transition from one component\n * state to another _over time_ with a simple declarative API. Most commonly\n * it's used to animate the mounting and unmounting of a component, but can also\n * be used to describe in-place transition states as well.\n *\n * ---\n *\n * **Note**: `Transition` is a platform-agnostic base component. If you're using\n * transitions in CSS, you'll probably want to use\n * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)\n * instead. It inherits all the features of `Transition`, but contains\n * additional features necessary to play nice with CSS transitions (hence the\n * name of the component).\n *\n * ---\n *\n * By default the `Transition` component does not alter the behavior of the\n * component it renders, it only tracks \"enter\" and \"exit\" states for the\n * components. It's up to you to give meaning and effect to those states. For\n * example we can add styles to a component when it enters or exits:\n *\n * ```jsx\n * import { Transition } from 'react-transition-group';\n *\n * const duration = 300;\n *\n * const defaultStyle = {\n * transition: `opacity ${duration}ms ease-in-out`,\n * opacity: 0,\n * }\n *\n * const transitionStyles = {\n * entering: { opacity: 1 },\n * entered: { opacity: 1 },\n * exiting: { opacity: 0 },\n * exited: { opacity: 0 },\n * };\n *\n * const Fade = ({ in: inProp }) => (\n * \n * {state => (\n *
\n * I'm a fade Transition!\n *
\n * )}\n *
\n * );\n * ```\n *\n * There are 4 main states a Transition can be in:\n * - `'entering'`\n * - `'entered'`\n * - `'exiting'`\n * - `'exited'`\n *\n * Transition state is toggled via the `in` prop. When `true` the component\n * begins the \"Enter\" stage. During this stage, the component will shift from\n * its current transition state, to `'entering'` for the duration of the\n * transition and then to the `'entered'` stage once it's complete. Let's take\n * the following example (we'll use the\n * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):\n *\n * ```jsx\n * function App() {\n * const [inProp, setInProp] = useState(false);\n * return (\n *
\n * \n * {state => (\n * // ...\n * )}\n * \n * \n *
\n * );\n * }\n * ```\n *\n * When the button is clicked the component will shift to the `'entering'` state\n * and stay there for 500ms (the value of `timeout`) before it finally switches\n * to `'entered'`.\n *\n * When `in` is `false` the same thing happens except the state moves from\n * `'exiting'` to `'exited'`.\n */\n\nvar Transition = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(Transition, _React$Component);\n\n function Transition(props, context) {\n var _this;\n\n _this = _React$Component.call(this, props, context) || this;\n var parentGroup = context; // In the context of a TransitionGroup all enters are really appears\n\n var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;\n var initialStatus;\n _this.appearStatus = null;\n\n if (props.in) {\n if (appear) {\n initialStatus = EXITED;\n _this.appearStatus = ENTERING;\n } else {\n initialStatus = ENTERED;\n }\n } else {\n if (props.unmountOnExit || props.mountOnEnter) {\n initialStatus = UNMOUNTED;\n } else {\n initialStatus = EXITED;\n }\n }\n\n _this.state = {\n status: initialStatus\n };\n _this.nextCallback = null;\n return _this;\n }\n\n Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {\n var nextIn = _ref.in;\n\n if (nextIn && prevState.status === UNMOUNTED) {\n return {\n status: EXITED\n };\n }\n\n return null;\n } // getSnapshotBeforeUpdate(prevProps) {\n // let nextStatus = null\n // if (prevProps !== this.props) {\n // const { status } = this.state\n // if (this.props.in) {\n // if (status !== ENTERING && status !== ENTERED) {\n // nextStatus = ENTERING\n // }\n // } else {\n // if (status === ENTERING || status === ENTERED) {\n // nextStatus = EXITING\n // }\n // }\n // }\n // return { nextStatus }\n // }\n ;\n\n var _proto = Transition.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this.updateStatus(true, this.appearStatus);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n var nextStatus = null;\n\n if (prevProps !== this.props) {\n var status = this.state.status;\n\n if (this.props.in) {\n if (status !== ENTERING && status !== ENTERED) {\n nextStatus = ENTERING;\n }\n } else {\n if (status === ENTERING || status === ENTERED) {\n nextStatus = EXITING;\n }\n }\n }\n\n this.updateStatus(false, nextStatus);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.cancelNextCallback();\n };\n\n _proto.getTimeouts = function getTimeouts() {\n var timeout = this.props.timeout;\n var exit, enter, appear;\n exit = enter = appear = timeout;\n\n if (timeout != null && typeof timeout !== 'number') {\n exit = timeout.exit;\n enter = timeout.enter; // TODO: remove fallback for next major\n\n appear = timeout.appear !== undefined ? timeout.appear : enter;\n }\n\n return {\n exit: exit,\n enter: enter,\n appear: appear\n };\n };\n\n _proto.updateStatus = function updateStatus(mounting, nextStatus) {\n if (mounting === void 0) {\n mounting = false;\n }\n\n if (nextStatus !== null) {\n // nextStatus will always be ENTERING or EXITING.\n this.cancelNextCallback();\n\n if (nextStatus === ENTERING) {\n if (this.props.unmountOnExit || this.props.mountOnEnter) {\n var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749\n // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.\n // To make the animation happen, we have to separate each rendering and avoid being processed as batched.\n\n if (node) forceReflow(node);\n }\n\n this.performEnter(mounting);\n } else {\n this.performExit();\n }\n } else if (this.props.unmountOnExit && this.state.status === EXITED) {\n this.setState({\n status: UNMOUNTED\n });\n }\n };\n\n _proto.performEnter = function performEnter(mounting) {\n var _this2 = this;\n\n var enter = this.props.enter;\n var appearing = this.context ? this.context.isMounting : mounting;\n\n var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],\n maybeNode = _ref2[0],\n maybeAppearing = _ref2[1];\n\n var timeouts = this.getTimeouts();\n var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED\n // if we are mounting and running this it means appear _must_ be set\n\n if (!mounting && !enter || config.disabled) {\n this.safeSetState({\n status: ENTERED\n }, function () {\n _this2.props.onEntered(maybeNode);\n });\n return;\n }\n\n this.props.onEnter(maybeNode, maybeAppearing);\n this.safeSetState({\n status: ENTERING\n }, function () {\n _this2.props.onEntering(maybeNode, maybeAppearing);\n\n _this2.onTransitionEnd(enterTimeout, function () {\n _this2.safeSetState({\n status: ENTERED\n }, function () {\n _this2.props.onEntered(maybeNode, maybeAppearing);\n });\n });\n });\n };\n\n _proto.performExit = function performExit() {\n var _this3 = this;\n\n var exit = this.props.exit;\n var timeouts = this.getTimeouts();\n var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED\n\n if (!exit || config.disabled) {\n this.safeSetState({\n status: EXITED\n }, function () {\n _this3.props.onExited(maybeNode);\n });\n return;\n }\n\n this.props.onExit(maybeNode);\n this.safeSetState({\n status: EXITING\n }, function () {\n _this3.props.onExiting(maybeNode);\n\n _this3.onTransitionEnd(timeouts.exit, function () {\n _this3.safeSetState({\n status: EXITED\n }, function () {\n _this3.props.onExited(maybeNode);\n });\n });\n });\n };\n\n _proto.cancelNextCallback = function cancelNextCallback() {\n if (this.nextCallback !== null) {\n this.nextCallback.cancel();\n this.nextCallback = null;\n }\n };\n\n _proto.safeSetState = function safeSetState(nextState, callback) {\n // This shouldn't be necessary, but there are weird race conditions with\n // setState callbacks and unmounting in testing, so always make sure that\n // we can cancel any pending setState callbacks after we unmount.\n callback = this.setNextCallback(callback);\n this.setState(nextState, callback);\n };\n\n _proto.setNextCallback = function setNextCallback(callback) {\n var _this4 = this;\n\n var active = true;\n\n this.nextCallback = function (event) {\n if (active) {\n active = false;\n _this4.nextCallback = null;\n callback(event);\n }\n };\n\n this.nextCallback.cancel = function () {\n active = false;\n };\n\n return this.nextCallback;\n };\n\n _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {\n this.setNextCallback(handler);\n var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);\n var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;\n\n if (!node || doesNotHaveTimeoutOrListener) {\n setTimeout(this.nextCallback, 0);\n return;\n }\n\n if (this.props.addEndListener) {\n var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],\n maybeNode = _ref3[0],\n maybeNextCallback = _ref3[1];\n\n this.props.addEndListener(maybeNode, maybeNextCallback);\n }\n\n if (timeout != null) {\n setTimeout(this.nextCallback, timeout);\n }\n };\n\n _proto.render = function render() {\n var status = this.state.status;\n\n if (status === UNMOUNTED) {\n return null;\n }\n\n var _this$props = this.props,\n children = _this$props.children,\n _in = _this$props.in,\n _mountOnEnter = _this$props.mountOnEnter,\n _unmountOnExit = _this$props.unmountOnExit,\n _appear = _this$props.appear,\n _enter = _this$props.enter,\n _exit = _this$props.exit,\n _timeout = _this$props.timeout,\n _addEndListener = _this$props.addEndListener,\n _onEnter = _this$props.onEnter,\n _onEntering = _this$props.onEntering,\n _onEntered = _this$props.onEntered,\n _onExit = _this$props.onExit,\n _onExiting = _this$props.onExiting,\n _onExited = _this$props.onExited,\n _nodeRef = _this$props.nodeRef,\n childProps = _objectWithoutPropertiesLoose(_this$props, [\"children\", \"in\", \"mountOnEnter\", \"unmountOnExit\", \"appear\", \"enter\", \"exit\", \"timeout\", \"addEndListener\", \"onEnter\", \"onEntering\", \"onEntered\", \"onExit\", \"onExiting\", \"onExited\", \"nodeRef\"]);\n\n return (\n /*#__PURE__*/\n // allows for nested Transitions\n React.createElement(TransitionGroupContext.Provider, {\n value: null\n }, typeof children === 'function' ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))\n );\n };\n\n return Transition;\n}(React.Component);\n\nTransition.contextType = TransitionGroupContext;\nTransition.propTypes = process.env.NODE_ENV !== \"production\" ? {\n /**\n * A React reference to DOM element that need to transition:\n * https://stackoverflow.com/a/51127130/4671932\n *\n * - When `nodeRef` prop is used, `node` is not passed to callback functions\n * (e.g. `onEnter`) because user already has direct access to the node.\n * - When changing `key` prop of `Transition` in a `TransitionGroup` a new\n * `nodeRef` need to be provided to `Transition` with changed `key` prop\n * (see\n * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).\n */\n nodeRef: PropTypes.shape({\n current: typeof Element === 'undefined' ? PropTypes.any : function (propValue, key, componentName, location, propFullName, secret) {\n var value = propValue[key];\n return PropTypes.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);\n }\n }),\n\n /**\n * A `function` child can be used instead of a React element. This function is\n * called with the current transition status (`'entering'`, `'entered'`,\n * `'exiting'`, `'exited'`), which can be used to apply context\n * specific props to a component.\n *\n * ```jsx\n * \n * {state => (\n * \n * )}\n * \n * ```\n */\n children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,\n\n /**\n * Show the component; triggers the enter or exit states\n */\n in: PropTypes.bool,\n\n /**\n * By default the child component is mounted immediately along with\n * the parent `Transition` component. If you want to \"lazy mount\" the component on the\n * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay\n * mounted, even on \"exited\", unless you also specify `unmountOnExit`.\n */\n mountOnEnter: PropTypes.bool,\n\n /**\n * By default the child component stays mounted after it reaches the `'exited'` state.\n * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.\n */\n unmountOnExit: PropTypes.bool,\n\n /**\n * By default the child component does not perform the enter transition when\n * it first mounts, regardless of the value of `in`. If you want this\n * behavior, set both `appear` and `in` to `true`.\n *\n * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop\n * > only adds an additional enter transition. However, in the\n * > `` component that first enter transition does result in\n * > additional `.appear-*` classes, that way you can choose to style it\n * > differently.\n */\n appear: PropTypes.bool,\n\n /**\n * Enable or disable enter transitions.\n */\n enter: PropTypes.bool,\n\n /**\n * Enable or disable exit transitions.\n */\n exit: PropTypes.bool,\n\n /**\n * The duration of the transition, in milliseconds.\n * Required unless `addEndListener` is provided.\n *\n * You may specify a single timeout for all transitions:\n *\n * ```jsx\n * timeout={500}\n * ```\n *\n * or individually:\n *\n * ```jsx\n * timeout={{\n * appear: 500,\n * enter: 300,\n * exit: 500,\n * }}\n * ```\n *\n * - `appear` defaults to the value of `enter`\n * - `enter` defaults to `0`\n * - `exit` defaults to `0`\n *\n * @type {number | { enter?: number, exit?: number, appear?: number }}\n */\n timeout: function timeout(props) {\n var pt = timeoutsShape;\n if (!props.addEndListener) pt = pt.isRequired;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return pt.apply(void 0, [props].concat(args));\n },\n\n /**\n * Add a custom transition end trigger. Called with the transitioning\n * DOM node and a `done` callback. Allows for more fine grained transition end\n * logic. Timeouts are still used as a fallback if provided.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * ```jsx\n * addEndListener={(node, done) => {\n * // use the css transitionend event to mark the finish of a transition\n * node.addEventListener('transitionend', done, false);\n * }}\n * ```\n */\n addEndListener: PropTypes.func,\n\n /**\n * Callback fired before the \"entering\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool) -> void\n */\n onEnter: PropTypes.func,\n\n /**\n * Callback fired after the \"entering\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEntering: PropTypes.func,\n\n /**\n * Callback fired after the \"entered\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool) -> void\n */\n onEntered: PropTypes.func,\n\n /**\n * Callback fired before the \"exiting\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExit: PropTypes.func,\n\n /**\n * Callback fired after the \"exiting\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExiting: PropTypes.func,\n\n /**\n * Callback fired after the \"exited\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExited: PropTypes.func\n} : {}; // Name the function so it is clearer in the documentation\n\nfunction noop() {}\n\nTransition.defaultProps = {\n in: false,\n mountOnEnter: false,\n unmountOnExit: false,\n appear: false,\n enter: true,\n exit: true,\n onEnter: noop,\n onEntering: noop,\n onEntered: noop,\n onExit: noop,\n onExiting: noop,\n onExited: noop\n};\nTransition.UNMOUNTED = UNMOUNTED;\nTransition.EXITED = EXITED;\nTransition.ENTERING = ENTERING;\nTransition.ENTERED = ENTERED;\nTransition.EXITING = EXITING;\nexport default Transition;","export var reflow = function reflow(node) {\n return node.scrollTop;\n};\nexport function getTransitionProps(props, options) {\n var timeout = props.timeout,\n _props$style = props.style,\n style = _props$style === void 0 ? {} : _props$style;\n return {\n duration: style.transitionDuration || typeof timeout === 'number' ? timeout : timeout[options.mode] || 0,\n delay: style.transitionDelay\n };\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { Transition } from 'react-transition-group';\nimport useTheme from '../styles/useTheme';\nimport { reflow, getTransitionProps } from '../transitions/utils';\nimport useForkRef from '../utils/useForkRef';\n\nfunction getScale(value) {\n return \"scale(\".concat(value, \", \").concat(Math.pow(value, 2), \")\");\n}\n\nvar styles = {\n entering: {\n opacity: 1,\n transform: getScale(1)\n },\n entered: {\n opacity: 1,\n transform: 'none'\n }\n};\n/**\n * The Grow transition is used by the [Tooltip](/components/tooltips/) and\n * [Popover](/components/popover/) components.\n * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.\n */\n\nvar Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {\n var children = props.children,\n _props$disableStrictM = props.disableStrictModeCompat,\n disableStrictModeCompat = _props$disableStrictM === void 0 ? false : _props$disableStrictM,\n inProp = props.in,\n onEnter = props.onEnter,\n onEntered = props.onEntered,\n onEntering = props.onEntering,\n onExit = props.onExit,\n onExited = props.onExited,\n onExiting = props.onExiting,\n style = props.style,\n _props$timeout = props.timeout,\n timeout = _props$timeout === void 0 ? 'auto' : _props$timeout,\n _props$TransitionComp = props.TransitionComponent,\n TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,\n other = _objectWithoutProperties(props, [\"children\", \"disableStrictModeCompat\", \"in\", \"onEnter\", \"onEntered\", \"onEntering\", \"onExit\", \"onExited\", \"onExiting\", \"style\", \"timeout\", \"TransitionComponent\"]);\n\n var timer = React.useRef();\n var autoTimeout = React.useRef();\n var theme = useTheme();\n var enableStrictModeCompat = theme.unstable_strictMode && !disableStrictModeCompat;\n var nodeRef = React.useRef(null);\n var foreignRef = useForkRef(children.ref, ref);\n var handleRef = useForkRef(enableStrictModeCompat ? nodeRef : undefined, foreignRef);\n\n var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {\n return function (nodeOrAppearing, maybeAppearing) {\n if (callback) {\n var _ref = enableStrictModeCompat ? [nodeRef.current, nodeOrAppearing] : [nodeOrAppearing, maybeAppearing],\n _ref2 = _slicedToArray(_ref, 2),\n node = _ref2[0],\n isAppearing = _ref2[1]; // onEnterXxx and onExitXxx callbacks have a different arguments.length value.\n\n\n if (isAppearing === undefined) {\n callback(node);\n } else {\n callback(node, isAppearing);\n }\n }\n };\n };\n\n var handleEntering = normalizedTransitionCallback(onEntering);\n var handleEnter = normalizedTransitionCallback(function (node, isAppearing) {\n reflow(node); // So the animation always start from the start.\n\n var _getTransitionProps = getTransitionProps({\n style: style,\n timeout: timeout\n }, {\n mode: 'enter'\n }),\n transitionDuration = _getTransitionProps.duration,\n delay = _getTransitionProps.delay;\n\n var duration;\n\n if (timeout === 'auto') {\n duration = theme.transitions.getAutoHeightDuration(node.clientHeight);\n autoTimeout.current = duration;\n } else {\n duration = transitionDuration;\n }\n\n node.style.transition = [theme.transitions.create('opacity', {\n duration: duration,\n delay: delay\n }), theme.transitions.create('transform', {\n duration: duration * 0.666,\n delay: delay\n })].join(',');\n\n if (onEnter) {\n onEnter(node, isAppearing);\n }\n });\n var handleEntered = normalizedTransitionCallback(onEntered);\n var handleExiting = normalizedTransitionCallback(onExiting);\n var handleExit = normalizedTransitionCallback(function (node) {\n var _getTransitionProps2 = getTransitionProps({\n style: style,\n timeout: timeout\n }, {\n mode: 'exit'\n }),\n transitionDuration = _getTransitionProps2.duration,\n delay = _getTransitionProps2.delay;\n\n var duration;\n\n if (timeout === 'auto') {\n duration = theme.transitions.getAutoHeightDuration(node.clientHeight);\n autoTimeout.current = duration;\n } else {\n duration = transitionDuration;\n }\n\n node.style.transition = [theme.transitions.create('opacity', {\n duration: duration,\n delay: delay\n }), theme.transitions.create('transform', {\n duration: duration * 0.666,\n delay: delay || duration * 0.333\n })].join(',');\n node.style.opacity = '0';\n node.style.transform = getScale(0.75);\n\n if (onExit) {\n onExit(node);\n }\n });\n var handleExited = normalizedTransitionCallback(onExited);\n\n var addEndListener = function addEndListener(nodeOrNext, maybeNext) {\n var next = enableStrictModeCompat ? nodeOrNext : maybeNext;\n\n if (timeout === 'auto') {\n timer.current = setTimeout(next, autoTimeout.current || 0);\n }\n };\n\n React.useEffect(function () {\n return function () {\n clearTimeout(timer.current);\n };\n }, []);\n return /*#__PURE__*/React.createElement(TransitionComponent, _extends({\n appear: true,\n in: inProp,\n nodeRef: enableStrictModeCompat ? nodeRef : undefined,\n onEnter: handleEnter,\n onEntered: handleEntered,\n onEntering: handleEntering,\n onExit: handleExit,\n onExited: handleExited,\n onExiting: handleExiting,\n addEndListener: addEndListener,\n timeout: timeout === 'auto' ? null : timeout\n }, other), function (state, childProps) {\n return /*#__PURE__*/React.cloneElement(children, _extends({\n style: _extends({\n opacity: 0,\n transform: getScale(0.75),\n visibility: state === 'exited' && !inProp ? 'hidden' : undefined\n }, styles[state], style, children.props.style),\n ref: handleRef\n }, childProps));\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? Grow.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * A single child content element.\n */\n children: PropTypes.element,\n\n /**\n * Enable this prop if you encounter 'Function components cannot be given refs',\n * use `unstable_createStrictModeTheme`,\n * and can't forward the ref in the child component.\n */\n disableStrictModeCompat: PropTypes.bool,\n\n /**\n * If `true`, show the component; triggers the enter or exit animation.\n */\n in: PropTypes.bool,\n\n /**\n * @ignore\n */\n onEnter: PropTypes.func,\n\n /**\n * @ignore\n */\n onEntered: PropTypes.func,\n\n /**\n * @ignore\n */\n onEntering: PropTypes.func,\n\n /**\n * @ignore\n */\n onExit: PropTypes.func,\n\n /**\n * @ignore\n */\n onExited: PropTypes.func,\n\n /**\n * @ignore\n */\n onExiting: PropTypes.func,\n\n /**\n * @ignore\n */\n style: PropTypes.object,\n\n /**\n * The duration for the transition, in milliseconds.\n * You may specify a single timeout for all transitions, or individually with an object.\n *\n * Set to 'auto' to automatically calculate transition time based on height.\n */\n timeout: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.shape({\n appear: PropTypes.number,\n enter: PropTypes.number,\n exit: PropTypes.number\n })])\n} : void 0;\nGrow.muiSupportAuto = true;\nexport default Grow;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport * as ReactDOM from 'react-dom';\nimport { chainPropTypes, elementTypeAcceptingRef, refType, HTMLElementType } from '@material-ui/utils';\nimport debounce from '../utils/debounce';\nimport clsx from 'clsx';\nimport ownerDocument from '../utils/ownerDocument';\nimport ownerWindow from '../utils/ownerWindow';\nimport createChainedFunction from '../utils/createChainedFunction';\nimport deprecatedPropType from '../utils/deprecatedPropType';\nimport withStyles from '../styles/withStyles';\nimport Modal from '../Modal';\nimport Grow from '../Grow';\nimport Paper from '../Paper';\nexport function getOffsetTop(rect, vertical) {\n var offset = 0;\n\n if (typeof vertical === 'number') {\n offset = vertical;\n } else if (vertical === 'center') {\n offset = rect.height / 2;\n } else if (vertical === 'bottom') {\n offset = rect.height;\n }\n\n return offset;\n}\nexport function getOffsetLeft(rect, horizontal) {\n var offset = 0;\n\n if (typeof horizontal === 'number') {\n offset = horizontal;\n } else if (horizontal === 'center') {\n offset = rect.width / 2;\n } else if (horizontal === 'right') {\n offset = rect.width;\n }\n\n return offset;\n}\n\nfunction getTransformOriginValue(transformOrigin) {\n return [transformOrigin.horizontal, transformOrigin.vertical].map(function (n) {\n return typeof n === 'number' ? \"\".concat(n, \"px\") : n;\n }).join(' ');\n} // Sum the scrollTop between two elements.\n\n\nfunction getScrollParent(parent, child) {\n var element = child;\n var scrollTop = 0;\n\n while (element && element !== parent) {\n element = element.parentElement;\n scrollTop += element.scrollTop;\n }\n\n return scrollTop;\n}\n\nfunction getAnchorEl(anchorEl) {\n return typeof anchorEl === 'function' ? anchorEl() : anchorEl;\n}\n\nexport var styles = {\n /* Styles applied to the root element. */\n root: {},\n\n /* Styles applied to the `Paper` component. */\n paper: {\n position: 'absolute',\n overflowY: 'auto',\n overflowX: 'hidden',\n // So we see the popover when it's empty.\n // It's most likely on issue on userland.\n minWidth: 16,\n minHeight: 16,\n maxWidth: 'calc(100% - 32px)',\n maxHeight: 'calc(100% - 32px)',\n // We disable the focus ring for mouse, touch and keyboard users.\n outline: 0\n }\n};\nvar Popover = /*#__PURE__*/React.forwardRef(function Popover(props, ref) {\n var action = props.action,\n anchorEl = props.anchorEl,\n _props$anchorOrigin = props.anchorOrigin,\n anchorOrigin = _props$anchorOrigin === void 0 ? {\n vertical: 'top',\n horizontal: 'left'\n } : _props$anchorOrigin,\n anchorPosition = props.anchorPosition,\n _props$anchorReferenc = props.anchorReference,\n anchorReference = _props$anchorReferenc === void 0 ? 'anchorEl' : _props$anchorReferenc,\n children = props.children,\n classes = props.classes,\n className = props.className,\n containerProp = props.container,\n _props$elevation = props.elevation,\n elevation = _props$elevation === void 0 ? 8 : _props$elevation,\n getContentAnchorEl = props.getContentAnchorEl,\n _props$marginThreshol = props.marginThreshold,\n marginThreshold = _props$marginThreshol === void 0 ? 16 : _props$marginThreshol,\n onEnter = props.onEnter,\n onEntered = props.onEntered,\n onEntering = props.onEntering,\n onExit = props.onExit,\n onExited = props.onExited,\n onExiting = props.onExiting,\n open = props.open,\n _props$PaperProps = props.PaperProps,\n PaperProps = _props$PaperProps === void 0 ? {} : _props$PaperProps,\n _props$transformOrigi = props.transformOrigin,\n transformOrigin = _props$transformOrigi === void 0 ? {\n vertical: 'top',\n horizontal: 'left'\n } : _props$transformOrigi,\n _props$TransitionComp = props.TransitionComponent,\n TransitionComponent = _props$TransitionComp === void 0 ? Grow : _props$TransitionComp,\n _props$transitionDura = props.transitionDuration,\n transitionDurationProp = _props$transitionDura === void 0 ? 'auto' : _props$transitionDura,\n _props$TransitionProp = props.TransitionProps,\n TransitionProps = _props$TransitionProp === void 0 ? {} : _props$TransitionProp,\n other = _objectWithoutProperties(props, [\"action\", \"anchorEl\", \"anchorOrigin\", \"anchorPosition\", \"anchorReference\", \"children\", \"classes\", \"className\", \"container\", \"elevation\", \"getContentAnchorEl\", \"marginThreshold\", \"onEnter\", \"onEntered\", \"onEntering\", \"onExit\", \"onExited\", \"onExiting\", \"open\", \"PaperProps\", \"transformOrigin\", \"TransitionComponent\", \"transitionDuration\", \"TransitionProps\"]);\n\n var paperRef = React.useRef(); // Returns the top/left offset of the position\n // to attach to on the anchor element (or body if none is provided)\n\n var getAnchorOffset = React.useCallback(function (contentAnchorOffset) {\n if (anchorReference === 'anchorPosition') {\n if (process.env.NODE_ENV !== 'production') {\n if (!anchorPosition) {\n console.error('Material-UI: You need to provide a `anchorPosition` prop when using ' + '.');\n }\n }\n\n return anchorPosition;\n }\n\n var resolvedAnchorEl = getAnchorEl(anchorEl); // If an anchor element wasn't provided, just use the parent body element of this Popover\n\n var anchorElement = resolvedAnchorEl && resolvedAnchorEl.nodeType === 1 ? resolvedAnchorEl : ownerDocument(paperRef.current).body;\n var anchorRect = anchorElement.getBoundingClientRect();\n\n if (process.env.NODE_ENV !== 'production') {\n var box = anchorElement.getBoundingClientRect();\n\n if (process.env.NODE_ENV !== 'test' && box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {\n console.warn(['Material-UI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', \"Make sure the element is present in the document or that it's not display none.\"].join('\\n'));\n }\n }\n\n var anchorVertical = contentAnchorOffset === 0 ? anchorOrigin.vertical : 'center';\n return {\n top: anchorRect.top + getOffsetTop(anchorRect, anchorVertical),\n left: anchorRect.left + getOffsetLeft(anchorRect, anchorOrigin.horizontal)\n };\n }, [anchorEl, anchorOrigin.horizontal, anchorOrigin.vertical, anchorPosition, anchorReference]); // Returns the vertical offset of inner content to anchor the transform on if provided\n\n var getContentAnchorOffset = React.useCallback(function (element) {\n var contentAnchorOffset = 0;\n\n if (getContentAnchorEl && anchorReference === 'anchorEl') {\n var contentAnchorEl = getContentAnchorEl(element);\n\n if (contentAnchorEl && element.contains(contentAnchorEl)) {\n var scrollTop = getScrollParent(element, contentAnchorEl);\n contentAnchorOffset = contentAnchorEl.offsetTop + contentAnchorEl.clientHeight / 2 - scrollTop || 0;\n } // != the default value\n\n\n if (process.env.NODE_ENV !== 'production') {\n if (anchorOrigin.vertical !== 'top') {\n console.error(['Material-UI: You can not change the default `anchorOrigin.vertical` value ', 'when also providing the `getContentAnchorEl` prop to the popover component.', 'Only use one of the two props.', 'Set `getContentAnchorEl` to `null | undefined`' + ' or leave `anchorOrigin.vertical` unchanged.'].join('\\n'));\n }\n }\n }\n\n return contentAnchorOffset;\n }, [anchorOrigin.vertical, anchorReference, getContentAnchorEl]); // Return the base transform origin using the element\n // and taking the content anchor offset into account if in use\n\n var getTransformOrigin = React.useCallback(function (elemRect) {\n var contentAnchorOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n return {\n vertical: getOffsetTop(elemRect, transformOrigin.vertical) + contentAnchorOffset,\n horizontal: getOffsetLeft(elemRect, transformOrigin.horizontal)\n };\n }, [transformOrigin.horizontal, transformOrigin.vertical]);\n var getPositioningStyle = React.useCallback(function (element) {\n // Check if the parent has requested anchoring on an inner content node\n var contentAnchorOffset = getContentAnchorOffset(element);\n var elemRect = {\n width: element.offsetWidth,\n height: element.offsetHeight\n }; // Get the transform origin point on the element itself\n\n var elemTransformOrigin = getTransformOrigin(elemRect, contentAnchorOffset);\n\n if (anchorReference === 'none') {\n return {\n top: null,\n left: null,\n transformOrigin: getTransformOriginValue(elemTransformOrigin)\n };\n } // Get the offset of of the anchoring element\n\n\n var anchorOffset = getAnchorOffset(contentAnchorOffset); // Calculate element positioning\n\n var top = anchorOffset.top - elemTransformOrigin.vertical;\n var left = anchorOffset.left - elemTransformOrigin.horizontal;\n var bottom = top + elemRect.height;\n var right = left + elemRect.width; // Use the parent window of the anchorEl if provided\n\n var containerWindow = ownerWindow(getAnchorEl(anchorEl)); // Window thresholds taking required margin into account\n\n var heightThreshold = containerWindow.innerHeight - marginThreshold;\n var widthThreshold = containerWindow.innerWidth - marginThreshold; // Check if the vertical axis needs shifting\n\n if (top < marginThreshold) {\n var diff = top - marginThreshold;\n top -= diff;\n elemTransformOrigin.vertical += diff;\n } else if (bottom > heightThreshold) {\n var _diff = bottom - heightThreshold;\n\n top -= _diff;\n elemTransformOrigin.vertical += _diff;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (elemRect.height > heightThreshold && elemRect.height && heightThreshold) {\n console.error(['Material-UI: The popover component is too tall.', \"Some part of it can not be seen on the screen (\".concat(elemRect.height - heightThreshold, \"px).\"), 'Please consider adding a `max-height` to improve the user-experience.'].join('\\n'));\n }\n } // Check if the horizontal axis needs shifting\n\n\n if (left < marginThreshold) {\n var _diff2 = left - marginThreshold;\n\n left -= _diff2;\n elemTransformOrigin.horizontal += _diff2;\n } else if (right > widthThreshold) {\n var _diff3 = right - widthThreshold;\n\n left -= _diff3;\n elemTransformOrigin.horizontal += _diff3;\n }\n\n return {\n top: \"\".concat(Math.round(top), \"px\"),\n left: \"\".concat(Math.round(left), \"px\"),\n transformOrigin: getTransformOriginValue(elemTransformOrigin)\n };\n }, [anchorEl, anchorReference, getAnchorOffset, getContentAnchorOffset, getTransformOrigin, marginThreshold]);\n var setPositioningStyles = React.useCallback(function () {\n var element = paperRef.current;\n\n if (!element) {\n return;\n }\n\n var positioning = getPositioningStyle(element);\n\n if (positioning.top !== null) {\n element.style.top = positioning.top;\n }\n\n if (positioning.left !== null) {\n element.style.left = positioning.left;\n }\n\n element.style.transformOrigin = positioning.transformOrigin;\n }, [getPositioningStyle]);\n\n var handleEntering = function handleEntering(element, isAppearing) {\n if (onEntering) {\n onEntering(element, isAppearing);\n }\n\n setPositioningStyles();\n };\n\n var handlePaperRef = React.useCallback(function (instance) {\n // #StrictMode ready\n paperRef.current = ReactDOM.findDOMNode(instance);\n }, []);\n React.useEffect(function () {\n if (open) {\n setPositioningStyles();\n }\n });\n React.useImperativeHandle(action, function () {\n return open ? {\n updatePosition: function updatePosition() {\n setPositioningStyles();\n }\n } : null;\n }, [open, setPositioningStyles]);\n React.useEffect(function () {\n if (!open) {\n return undefined;\n }\n\n var handleResize = debounce(function () {\n setPositioningStyles();\n });\n window.addEventListener('resize', handleResize);\n return function () {\n handleResize.clear();\n window.removeEventListener('resize', handleResize);\n };\n }, [open, setPositioningStyles]);\n var transitionDuration = transitionDurationProp;\n\n if (transitionDurationProp === 'auto' && !TransitionComponent.muiSupportAuto) {\n transitionDuration = undefined;\n } // If the container prop is provided, use that\n // If the anchorEl prop is provided, use its parent body element as the container\n // If neither are provided let the Modal take care of choosing the container\n\n\n var container = containerProp || (anchorEl ? ownerDocument(getAnchorEl(anchorEl)).body : undefined);\n return /*#__PURE__*/React.createElement(Modal, _extends({\n container: container,\n open: open,\n ref: ref,\n BackdropProps: {\n invisible: true\n },\n className: clsx(classes.root, className)\n }, other), /*#__PURE__*/React.createElement(TransitionComponent, _extends({\n appear: true,\n in: open,\n onEnter: onEnter,\n onEntered: onEntered,\n onExit: onExit,\n onExited: onExited,\n onExiting: onExiting,\n timeout: transitionDuration\n }, TransitionProps, {\n onEntering: createChainedFunction(handleEntering, TransitionProps.onEntering)\n }), /*#__PURE__*/React.createElement(Paper, _extends({\n elevation: elevation,\n ref: handlePaperRef\n }, PaperProps, {\n className: clsx(classes.paper, PaperProps.className)\n }), children)));\n});\nprocess.env.NODE_ENV !== \"production\" ? Popover.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * A ref for imperative actions.\n * It currently only supports updatePosition() action.\n */\n action: refType,\n\n /**\n * A HTML element, or a function that returns it.\n * It's used to set the position of the popover.\n */\n anchorEl: chainPropTypes(PropTypes.oneOfType([HTMLElementType, PropTypes.func]), function (props) {\n if (props.open && (!props.anchorReference || props.anchorReference === 'anchorEl')) {\n var resolvedAnchorEl = getAnchorEl(props.anchorEl);\n\n if (resolvedAnchorEl && resolvedAnchorEl.nodeType === 1) {\n var box = resolvedAnchorEl.getBoundingClientRect();\n\n if (process.env.NODE_ENV !== 'test' && box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {\n return new Error(['Material-UI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', \"Make sure the element is present in the document or that it's not display none.\"].join('\\n'));\n }\n } else {\n return new Error(['Material-UI: The `anchorEl` prop provided to the component is invalid.', \"It should be an Element instance but it's `\".concat(resolvedAnchorEl, \"` instead.\")].join('\\n'));\n }\n }\n\n return null;\n }),\n\n /**\n * This is the point on the anchor where the popover's\n * `anchorEl` will attach to. This is not used when the\n * anchorReference is 'anchorPosition'.\n *\n * Options:\n * vertical: [top, center, bottom];\n * horizontal: [left, center, right].\n */\n anchorOrigin: PropTypes.shape({\n horizontal: PropTypes.oneOfType([PropTypes.oneOf(['center', 'left', 'right']), PropTypes.number]).isRequired,\n vertical: PropTypes.oneOfType([PropTypes.oneOf(['bottom', 'center', 'top']), PropTypes.number]).isRequired\n }),\n\n /**\n * This is the position that may be used\n * to set the position of the popover.\n * The coordinates are relative to\n * the application's client area.\n */\n anchorPosition: PropTypes.shape({\n left: PropTypes.number.isRequired,\n top: PropTypes.number.isRequired\n }),\n\n /**\n * This determines which anchor prop to refer to to set\n * the position of the popover.\n */\n anchorReference: PropTypes.oneOf(['anchorEl', 'anchorPosition', 'none']),\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * A HTML element, component instance, or function that returns either.\n * The `container` will passed to the Modal component.\n *\n * By default, it uses the body of the anchorEl's top-level document object,\n * so it's simply `document.body` most of the time.\n */\n container: PropTypes\n /* @typescript-to-proptypes-ignore */\n .oneOfType([HTMLElementType, PropTypes.instanceOf(React.Component), PropTypes.func]),\n\n /**\n * The elevation of the popover.\n */\n elevation: PropTypes.number,\n\n /**\n * This function is called in order to retrieve the content anchor element.\n * It's the opposite of the `anchorEl` prop.\n * The content anchor element should be an element inside the popover.\n * It's used to correctly scroll and set the position of the popover.\n * The positioning strategy tries to make the content anchor element just above the\n * anchor element.\n */\n getContentAnchorEl: PropTypes.func,\n\n /**\n * Specifies how close to the edge of the window the popover can appear.\n */\n marginThreshold: PropTypes.number,\n\n /**\n * Callback fired when the component requests to be closed.\n */\n onClose: PropTypes.func,\n\n /**\n * Callback fired before the component is entering.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEnter: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the component has entered.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEntered: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the component is entering.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEntering: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired before the component is exiting.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExit: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the component has exited.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExited: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the component is exiting.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExiting: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * If `true`, the popover is visible.\n */\n open: PropTypes.bool.isRequired,\n\n /**\n * Props applied to the [`Paper`](/api/paper/) element.\n */\n PaperProps: PropTypes\n /* @typescript-to-proptypes-ignore */\n .shape({\n component: elementTypeAcceptingRef\n }),\n\n /**\n * This is the point on the popover which\n * will attach to the anchor's origin.\n *\n * Options:\n * vertical: [top, center, bottom, x(px)];\n * horizontal: [left, center, right, x(px)].\n */\n transformOrigin: PropTypes.shape({\n horizontal: PropTypes.oneOfType([PropTypes.oneOf(['center', 'left', 'right']), PropTypes.number]).isRequired,\n vertical: PropTypes.oneOfType([PropTypes.oneOf(['bottom', 'center', 'top']), PropTypes.number]).isRequired\n }),\n\n /**\n * The component used for the transition.\n * [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.\n */\n TransitionComponent: PropTypes.elementType,\n\n /**\n * Set to 'auto' to automatically calculate transition time based on height.\n */\n transitionDuration: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.shape({\n appear: PropTypes.number,\n enter: PropTypes.number,\n exit: PropTypes.number\n })]),\n\n /**\n * Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element.\n */\n TransitionProps: PropTypes.object\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiPopover'\n})(Popover);","import * as React from 'react';\n/**\n * @ignore - internal component.\n */\n\nvar ListContext = React.createContext({});\n\nif (process.env.NODE_ENV !== 'production') {\n ListContext.displayName = 'ListContext';\n}\n\nexport default ListContext;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport withStyles from '../styles/withStyles';\nimport ListContext from './ListContext';\nexport var styles = {\n /* Styles applied to the root element. */\n root: {\n listStyle: 'none',\n margin: 0,\n padding: 0,\n position: 'relative'\n },\n\n /* Styles applied to the root element if `disablePadding={false}`. */\n padding: {\n paddingTop: 8,\n paddingBottom: 8\n },\n\n /* Styles applied to the root element if dense. */\n dense: {},\n\n /* Styles applied to the root element if a `subheader` is provided. */\n subheader: {\n paddingTop: 0\n }\n};\nvar List = /*#__PURE__*/React.forwardRef(function List(props, ref) {\n var children = props.children,\n classes = props.classes,\n className = props.className,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'ul' : _props$component,\n _props$dense = props.dense,\n dense = _props$dense === void 0 ? false : _props$dense,\n _props$disablePadding = props.disablePadding,\n disablePadding = _props$disablePadding === void 0 ? false : _props$disablePadding,\n subheader = props.subheader,\n other = _objectWithoutProperties(props, [\"children\", \"classes\", \"className\", \"component\", \"dense\", \"disablePadding\", \"subheader\"]);\n\n var context = React.useMemo(function () {\n return {\n dense: dense\n };\n }, [dense]);\n return /*#__PURE__*/React.createElement(ListContext.Provider, {\n value: context\n }, /*#__PURE__*/React.createElement(Component, _extends({\n className: clsx(classes.root, className, dense && classes.dense, !disablePadding && classes.padding, subheader && classes.subheader),\n ref: ref\n }, other), subheader, children));\n});\nprocess.env.NODE_ENV !== \"production\" ? List.propTypes = {\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object.isRequired,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: PropTypes\n /* @typescript-to-proptypes-ignore */\n .elementType,\n\n /**\n * If `true`, compact vertical padding designed for keyboard and mouse input will be used for\n * the list and list items.\n * The prop is available to descendant components as the `dense` context.\n */\n dense: PropTypes.bool,\n\n /**\n * If `true`, vertical padding will be removed from the list.\n */\n disablePadding: PropTypes.bool,\n\n /**\n * The content of the subheader, normally `ListSubheader`.\n */\n subheader: PropTypes.node\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiList'\n})(List);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport { isFragment } from 'react-is';\nimport PropTypes from 'prop-types';\nimport * as ReactDOM from 'react-dom';\nimport ownerDocument from '../utils/ownerDocument';\nimport List from '../List';\nimport getScrollbarSize from '../utils/getScrollbarSize';\nimport useForkRef from '../utils/useForkRef';\n\nfunction nextItem(list, item, disableListWrap) {\n if (list === item) {\n return list.firstChild;\n }\n\n if (item && item.nextElementSibling) {\n return item.nextElementSibling;\n }\n\n return disableListWrap ? null : list.firstChild;\n}\n\nfunction previousItem(list, item, disableListWrap) {\n if (list === item) {\n return disableListWrap ? list.firstChild : list.lastChild;\n }\n\n if (item && item.previousElementSibling) {\n return item.previousElementSibling;\n }\n\n return disableListWrap ? null : list.lastChild;\n}\n\nfunction textCriteriaMatches(nextFocus, textCriteria) {\n if (textCriteria === undefined) {\n return true;\n }\n\n var text = nextFocus.innerText;\n\n if (text === undefined) {\n // jsdom doesn't support innerText\n text = nextFocus.textContent;\n }\n\n text = text.trim().toLowerCase();\n\n if (text.length === 0) {\n return false;\n }\n\n if (textCriteria.repeating) {\n return text[0] === textCriteria.keys[0];\n }\n\n return text.indexOf(textCriteria.keys.join('')) === 0;\n}\n\nfunction moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, traversalFunction, textCriteria) {\n var wrappedOnce = false;\n var nextFocus = traversalFunction(list, currentFocus, currentFocus ? disableListWrap : false);\n\n while (nextFocus) {\n // Prevent infinite loop.\n if (nextFocus === list.firstChild) {\n if (wrappedOnce) {\n return;\n }\n\n wrappedOnce = true;\n } // Same logic as useAutocomplete.js\n\n\n var nextFocusDisabled = disabledItemsFocusable ? false : nextFocus.disabled || nextFocus.getAttribute('aria-disabled') === 'true';\n\n if (!nextFocus.hasAttribute('tabindex') || !textCriteriaMatches(nextFocus, textCriteria) || nextFocusDisabled) {\n // Move to the next element.\n nextFocus = traversalFunction(list, nextFocus, disableListWrap);\n } else {\n nextFocus.focus();\n return;\n }\n }\n}\n\nvar useEnhancedEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n/**\n * A permanently displayed menu following https://www.w3.org/TR/wai-aria-practices/#menubutton.\n * It's exposed to help customization of the [`Menu`](/api/menu/) component. If you\n * use it separately you need to move focus into the component manually. Once\n * the focus is placed inside the component it is fully keyboard accessible.\n */\n\nvar MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {\n var actions = props.actions,\n _props$autoFocus = props.autoFocus,\n autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,\n _props$autoFocusItem = props.autoFocusItem,\n autoFocusItem = _props$autoFocusItem === void 0 ? false : _props$autoFocusItem,\n children = props.children,\n className = props.className,\n _props$disabledItemsF = props.disabledItemsFocusable,\n disabledItemsFocusable = _props$disabledItemsF === void 0 ? false : _props$disabledItemsF,\n _props$disableListWra = props.disableListWrap,\n disableListWrap = _props$disableListWra === void 0 ? false : _props$disableListWra,\n onKeyDown = props.onKeyDown,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'selectedMenu' : _props$variant,\n other = _objectWithoutProperties(props, [\"actions\", \"autoFocus\", \"autoFocusItem\", \"children\", \"className\", \"disabledItemsFocusable\", \"disableListWrap\", \"onKeyDown\", \"variant\"]);\n\n var listRef = React.useRef(null);\n var textCriteriaRef = React.useRef({\n keys: [],\n repeating: true,\n previousKeyMatched: true,\n lastTime: null\n });\n useEnhancedEffect(function () {\n if (autoFocus) {\n listRef.current.focus();\n }\n }, [autoFocus]);\n React.useImperativeHandle(actions, function () {\n return {\n adjustStyleForScrollbar: function adjustStyleForScrollbar(containerElement, theme) {\n // Let's ignore that piece of logic if users are already overriding the width\n // of the menu.\n var noExplicitWidth = !listRef.current.style.width;\n\n if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {\n var scrollbarSize = \"\".concat(getScrollbarSize(true), \"px\");\n listRef.current.style[theme.direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;\n listRef.current.style.width = \"calc(100% + \".concat(scrollbarSize, \")\");\n }\n\n return listRef.current;\n }\n };\n }, []);\n\n var handleKeyDown = function handleKeyDown(event) {\n var list = listRef.current;\n var key = event.key;\n /**\n * @type {Element} - will always be defined since we are in a keydown handler\n * attached to an element. A keydown event is either dispatched to the activeElement\n * or document.body or document.documentElement. Only the first case will\n * trigger this specific handler.\n */\n\n var currentFocus = ownerDocument(list).activeElement;\n\n if (key === 'ArrowDown') {\n // Prevent scroll of the page\n event.preventDefault();\n moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, nextItem);\n } else if (key === 'ArrowUp') {\n event.preventDefault();\n moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, previousItem);\n } else if (key === 'Home') {\n event.preventDefault();\n moveFocus(list, null, disableListWrap, disabledItemsFocusable, nextItem);\n } else if (key === 'End') {\n event.preventDefault();\n moveFocus(list, null, disableListWrap, disabledItemsFocusable, previousItem);\n } else if (key.length === 1) {\n var criteria = textCriteriaRef.current;\n var lowerKey = key.toLowerCase();\n var currTime = performance.now();\n\n if (criteria.keys.length > 0) {\n // Reset\n if (currTime - criteria.lastTime > 500) {\n criteria.keys = [];\n criteria.repeating = true;\n criteria.previousKeyMatched = true;\n } else if (criteria.repeating && lowerKey !== criteria.keys[0]) {\n criteria.repeating = false;\n }\n }\n\n criteria.lastTime = currTime;\n criteria.keys.push(lowerKey);\n var keepFocusOnCurrent = currentFocus && !criteria.repeating && textCriteriaMatches(currentFocus, criteria);\n\n if (criteria.previousKeyMatched && (keepFocusOnCurrent || moveFocus(list, currentFocus, false, disabledItemsFocusable, nextItem, criteria))) {\n event.preventDefault();\n } else {\n criteria.previousKeyMatched = false;\n }\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n var handleOwnRef = React.useCallback(function (instance) {\n // #StrictMode ready\n listRef.current = ReactDOM.findDOMNode(instance);\n }, []);\n var handleRef = useForkRef(handleOwnRef, ref);\n /**\n * the index of the item should receive focus\n * in a `variant=\"selectedMenu\"` it's the first `selected` item\n * otherwise it's the very first item.\n */\n\n var activeItemIndex = -1; // since we inject focus related props into children we have to do a lookahead\n // to check if there is a `selected` item. We're looking for the last `selected`\n // item and use the first valid item as a fallback\n\n React.Children.forEach(children, function (child, index) {\n if (! /*#__PURE__*/React.isValidElement(child)) {\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (isFragment(child)) {\n console.error([\"Material-UI: The Menu component doesn't accept a Fragment as a child.\", 'Consider providing an array instead.'].join('\\n'));\n }\n }\n\n if (!child.props.disabled) {\n if (variant === 'selectedMenu' && child.props.selected) {\n activeItemIndex = index;\n } else if (activeItemIndex === -1) {\n activeItemIndex = index;\n }\n }\n });\n var items = React.Children.map(children, function (child, index) {\n if (index === activeItemIndex) {\n var newChildProps = {};\n\n if (autoFocusItem) {\n newChildProps.autoFocus = true;\n }\n\n if (child.props.tabIndex === undefined && variant === 'selectedMenu') {\n newChildProps.tabIndex = 0;\n }\n\n return /*#__PURE__*/React.cloneElement(child, newChildProps);\n }\n\n return child;\n });\n return /*#__PURE__*/React.createElement(List, _extends({\n role: \"menu\",\n ref: handleRef,\n className: className,\n onKeyDown: handleKeyDown,\n tabIndex: autoFocus ? 0 : -1\n }, other), items);\n});\nprocess.env.NODE_ENV !== \"production\" ? MenuList.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * If `true`, will focus the `[role=\"menu\"]` container and move into tab order.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * If `true`, will focus the first menuitem if `variant=\"menu\"` or selected item\n * if `variant=\"selectedMenu\"`.\n */\n autoFocusItem: PropTypes.bool,\n\n /**\n * MenuList contents, normally `MenuItem`s.\n */\n children: PropTypes.node,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * If `true`, will allow focus on disabled items.\n */\n disabledItemsFocusable: PropTypes.bool,\n\n /**\n * If `true`, the menu items will not wrap focus.\n */\n disableListWrap: PropTypes.bool,\n\n /**\n * @ignore\n */\n onKeyDown: PropTypes.func,\n\n /**\n * The variant to use. Use `menu` to prevent selected items from impacting the initial focus\n * and the vertical alignment relative to the anchor element.\n */\n variant: PropTypes.oneOf(['menu', 'selectedMenu'])\n} : void 0;\nexport default MenuList;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport { isFragment } from 'react-is';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { HTMLElementType } from '@material-ui/utils';\nimport withStyles from '../styles/withStyles';\nimport Popover from '../Popover';\nimport MenuList from '../MenuList';\nimport * as ReactDOM from 'react-dom';\nimport setRef from '../utils/setRef';\nimport useTheme from '../styles/useTheme';\nimport deprecatedPropType from '../utils/deprecatedPropType';\nvar RTL_ORIGIN = {\n vertical: 'top',\n horizontal: 'right'\n};\nvar LTR_ORIGIN = {\n vertical: 'top',\n horizontal: 'left'\n};\nexport var styles = {\n /* Styles applied to the `Paper` component. */\n paper: {\n // specZ: The maximum height of a simple menu should be one or more rows less than the view\n // height. This ensures a tapable area outside of the simple menu with which to dismiss\n // the menu.\n maxHeight: 'calc(100% - 96px)',\n // Add iOS momentum scrolling.\n WebkitOverflowScrolling: 'touch'\n },\n\n /* Styles applied to the `List` component via `MenuList`. */\n list: {\n // We disable the focus ring for mouse, touch and keyboard users.\n outline: 0\n }\n};\nvar Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {\n var _props$autoFocus = props.autoFocus,\n autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,\n children = props.children,\n classes = props.classes,\n _props$disableAutoFoc = props.disableAutoFocusItem,\n disableAutoFocusItem = _props$disableAutoFoc === void 0 ? false : _props$disableAutoFoc,\n _props$MenuListProps = props.MenuListProps,\n MenuListProps = _props$MenuListProps === void 0 ? {} : _props$MenuListProps,\n onClose = props.onClose,\n onEnteringProp = props.onEntering,\n open = props.open,\n _props$PaperProps = props.PaperProps,\n PaperProps = _props$PaperProps === void 0 ? {} : _props$PaperProps,\n PopoverClasses = props.PopoverClasses,\n _props$transitionDura = props.transitionDuration,\n transitionDuration = _props$transitionDura === void 0 ? 'auto' : _props$transitionDura,\n _props$TransitionProp = props.TransitionProps;\n _props$TransitionProp = _props$TransitionProp === void 0 ? {} : _props$TransitionProp;\n\n var onEntering = _props$TransitionProp.onEntering,\n TransitionProps = _objectWithoutProperties(_props$TransitionProp, [\"onEntering\"]),\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'selectedMenu' : _props$variant,\n other = _objectWithoutProperties(props, [\"autoFocus\", \"children\", \"classes\", \"disableAutoFocusItem\", \"MenuListProps\", \"onClose\", \"onEntering\", \"open\", \"PaperProps\", \"PopoverClasses\", \"transitionDuration\", \"TransitionProps\", \"variant\"]);\n\n var theme = useTheme();\n var autoFocusItem = autoFocus && !disableAutoFocusItem && open;\n var menuListActionsRef = React.useRef(null);\n var contentAnchorRef = React.useRef(null);\n\n var getContentAnchorEl = function getContentAnchorEl() {\n return contentAnchorRef.current;\n };\n\n var handleEntering = function handleEntering(element, isAppearing) {\n if (menuListActionsRef.current) {\n menuListActionsRef.current.adjustStyleForScrollbar(element, theme);\n }\n\n if (onEnteringProp) {\n onEnteringProp(element, isAppearing);\n }\n\n if (onEntering) {\n onEntering(element, isAppearing);\n }\n };\n\n var handleListKeyDown = function handleListKeyDown(event) {\n if (event.key === 'Tab') {\n event.preventDefault();\n\n if (onClose) {\n onClose(event, 'tabKeyDown');\n }\n }\n };\n /**\n * the index of the item should receive focus\n * in a `variant=\"selectedMenu\"` it's the first `selected` item\n * otherwise it's the very first item.\n */\n\n\n var activeItemIndex = -1; // since we inject focus related props into children we have to do a lookahead\n // to check if there is a `selected` item. We're looking for the last `selected`\n // item and use the first valid item as a fallback\n\n React.Children.map(children, function (child, index) {\n if (! /*#__PURE__*/React.isValidElement(child)) {\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (isFragment(child)) {\n console.error([\"Material-UI: The Menu component doesn't accept a Fragment as a child.\", 'Consider providing an array instead.'].join('\\n'));\n }\n }\n\n if (!child.props.disabled) {\n if (variant !== \"menu\" && child.props.selected) {\n activeItemIndex = index;\n } else if (activeItemIndex === -1) {\n activeItemIndex = index;\n }\n }\n });\n var items = React.Children.map(children, function (child, index) {\n if (index === activeItemIndex) {\n return /*#__PURE__*/React.cloneElement(child, {\n ref: function ref(instance) {\n // #StrictMode ready\n contentAnchorRef.current = ReactDOM.findDOMNode(instance);\n setRef(child.ref, instance);\n }\n });\n }\n\n return child;\n });\n return /*#__PURE__*/React.createElement(Popover, _extends({\n getContentAnchorEl: getContentAnchorEl,\n classes: PopoverClasses,\n onClose: onClose,\n TransitionProps: _extends({\n onEntering: handleEntering\n }, TransitionProps),\n anchorOrigin: theme.direction === 'rtl' ? RTL_ORIGIN : LTR_ORIGIN,\n transformOrigin: theme.direction === 'rtl' ? RTL_ORIGIN : LTR_ORIGIN,\n PaperProps: _extends({}, PaperProps, {\n classes: _extends({}, PaperProps.classes, {\n root: classes.paper\n })\n }),\n open: open,\n ref: ref,\n transitionDuration: transitionDuration\n }, other), /*#__PURE__*/React.createElement(MenuList, _extends({\n onKeyDown: handleListKeyDown,\n actions: menuListActionsRef,\n autoFocus: autoFocus && (activeItemIndex === -1 || disableAutoFocusItem),\n autoFocusItem: autoFocusItem,\n variant: variant\n }, MenuListProps, {\n className: clsx(classes.list, MenuListProps.className)\n }), items));\n});\nprocess.env.NODE_ENV !== \"production\" ? Menu.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * A HTML element, or a function that returns it.\n * It's used to set the position of the menu.\n */\n anchorEl: PropTypes\n /* @typescript-to-proptypes-ignore */\n .oneOfType([HTMLElementType, PropTypes.func]),\n\n /**\n * If `true` (Default) will focus the `[role=\"menu\"]` if no focusable child is found. Disabled\n * children are not focusable. If you set this prop to `false` focus will be placed\n * on the parent modal container. This has severe accessibility implications\n * and should only be considered if you manage focus otherwise.\n */\n autoFocus: PropTypes.bool,\n\n /**\n * Menu contents, normally `MenuItem`s.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n * See [CSS API](#css) below for more details.\n */\n classes: PropTypes.object,\n\n /**\n * When opening the menu will not focus the active item but the `[role=\"menu\"]`\n * unless `autoFocus` is also set to `false`. Not using the default means not\n * following WAI-ARIA authoring practices. Please be considerate about possible\n * accessibility implications.\n */\n disableAutoFocusItem: PropTypes.bool,\n\n /**\n * Props applied to the [`MenuList`](/api/menu-list/) element.\n */\n MenuListProps: PropTypes.object,\n\n /**\n * Callback fired when the component requests to be closed.\n *\n * @param {object} event The event source of the callback.\n * @param {string} reason Can be: `\"escapeKeyDown\"`, `\"backdropClick\"`, `\"tabKeyDown\"`.\n */\n onClose: PropTypes.func,\n\n /**\n * Callback fired before the Menu enters.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEnter: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the Menu has entered.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEntered: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the Menu is entering.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onEntering: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired before the Menu exits.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExit: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the Menu has exited.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExited: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * Callback fired when the Menu is exiting.\n * @deprecated Use the `TransitionProps` prop instead.\n */\n onExiting: deprecatedPropType(PropTypes.func, 'Use the `TransitionProps` prop instead.'),\n\n /**\n * If `true`, the menu is visible.\n */\n open: PropTypes.bool.isRequired,\n\n /**\n * @ignore\n */\n PaperProps: PropTypes.object,\n\n /**\n * `classes` prop applied to the [`Popover`](/api/popover/) element.\n */\n PopoverClasses: PropTypes.object,\n\n /**\n * The length of the transition in `ms`, or 'auto'\n */\n transitionDuration: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.shape({\n appear: PropTypes.number,\n enter: PropTypes.number,\n exit: PropTypes.number\n })]),\n\n /**\n * Props applied to the transition element.\n * By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition) component.\n */\n TransitionProps: PropTypes.object,\n\n /**\n * The variant to use. Use `menu` to prevent selected items from impacting the initial focus\n * and the vertical alignment relative to the anchor element.\n */\n variant: PropTypes.oneOf(['menu', 'selectedMenu'])\n} : void 0;\nexport default withStyles(styles, {\n name: 'MuiMenu'\n})(Menu);","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport { formatMuiErrorMessage as _formatMuiErrorMessage } from \"@material-ui/utils\";\nimport * as React from 'react';\nimport { isFragment } from 'react-is';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport ownerDocument from '../utils/ownerDocument';\nimport capitalize from '../utils/capitalize';\nimport { refType } from '@material-ui/utils';\nimport Menu from '../Menu/Menu';\nimport { isFilled } from '../InputBase/utils';\nimport useForkRef from '../utils/useForkRef';\nimport useControlled from '../utils/useControlled';\n\nfunction areEqualValues(a, b) {\n if (_typeof(b) === 'object' && b !== null) {\n return a === b;\n }\n\n return String(a) === String(b);\n}\n\nfunction isEmpty(display) {\n return display == null || typeof display === 'string' && !display.trim();\n}\n/**\n * @ignore - internal component.\n */\n\n\nvar SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref) {\n var ariaLabel = props['aria-label'],\n autoFocus = props.autoFocus,\n autoWidth = props.autoWidth,\n children = props.children,\n classes = props.classes,\n className = props.className,\n defaultValue = props.defaultValue,\n disabled = props.disabled,\n displayEmpty = props.displayEmpty,\n IconComponent = props.IconComponent,\n inputRefProp = props.inputRef,\n labelId = props.labelId,\n _props$MenuProps = props.MenuProps,\n MenuProps = _props$MenuProps === void 0 ? {} : _props$MenuProps,\n multiple = props.multiple,\n name = props.name,\n onBlur = props.onBlur,\n onChange = props.onChange,\n onClose = props.onClose,\n onFocus = props.onFocus,\n onOpen = props.onOpen,\n openProp = props.open,\n readOnly = props.readOnly,\n renderValue = props.renderValue,\n _props$SelectDisplayP = props.SelectDisplayProps,\n SelectDisplayProps = _props$SelectDisplayP === void 0 ? {} : _props$SelectDisplayP,\n tabIndexProp = props.tabIndex,\n type = props.type,\n valueProp = props.value,\n _props$variant = props.variant,\n variant = _props$variant === void 0 ? 'standard' : _props$variant,\n other = _objectWithoutProperties(props, [\"aria-label\", \"autoFocus\", \"autoWidth\", \"children\", \"classes\", \"className\", \"defaultValue\", \"disabled\", \"displayEmpty\", \"IconComponent\", \"inputRef\", \"labelId\", \"MenuProps\", \"multiple\", \"name\", \"onBlur\", \"onChange\", \"onClose\", \"onFocus\", \"onOpen\", \"open\", \"readOnly\", \"renderValue\", \"SelectDisplayProps\", \"tabIndex\", \"type\", \"value\", \"variant\"]);\n\n var _useControlled = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: 'Select'\n }),\n _useControlled2 = _slicedToArray(_useControlled, 2),\n value = _useControlled2[0],\n setValue = _useControlled2[1];\n\n var inputRef = React.useRef(null);\n\n var _React$useState = React.useState(null),\n displayNode = _React$useState[0],\n setDisplayNode = _React$useState[1];\n\n var _React$useRef = React.useRef(openProp != null),\n isOpenControlled = _React$useRef.current;\n\n var _React$useState2 = React.useState(),\n menuMinWidthState = _React$useState2[0],\n setMenuMinWidthState = _React$useState2[1];\n\n var _React$useState3 = React.useState(false),\n openState = _React$useState3[0],\n setOpenState = _React$useState3[1];\n\n var handleRef = useForkRef(ref, inputRefProp);\n React.useImperativeHandle(handleRef, function () {\n return {\n focus: function focus() {\n displayNode.focus();\n },\n node: inputRef.current,\n value: value\n };\n }, [displayNode, value]);\n React.useEffect(function () {\n if (autoFocus && displayNode) {\n displayNode.focus();\n }\n }, [autoFocus, displayNode]);\n React.useEffect(function () {\n if (displayNode) {\n var label = ownerDocument(displayNode).getElementById(labelId);\n\n if (label) {\n var handler = function handler() {\n if (getSelection().isCollapsed) {\n displayNode.focus();\n }\n };\n\n label.addEventListener('click', handler);\n return function () {\n label.removeEventListener('click', handler);\n };\n }\n }\n\n return undefined;\n }, [labelId, displayNode]);\n\n var update = function update(open, event) {\n if (open) {\n if (onOpen) {\n onOpen(event);\n }\n } else if (onClose) {\n onClose(event);\n }\n\n if (!isOpenControlled) {\n setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);\n setOpenState(open);\n }\n };\n\n var handleMouseDown = function handleMouseDown(event) {\n // Ignore everything but left-click\n if (event.button !== 0) {\n return;\n } // Hijack the default focus behavior.\n\n\n event.preventDefault();\n displayNode.focus();\n update(true, event);\n };\n\n var handleClose = function handleClose(event) {\n update(false, event);\n };\n\n var childrenArray = React.Children.toArray(children); // Support autofill.\n\n var handleChange = function handleChange(event) {\n var index = childrenArray.map(function (child) {\n return child.props.value;\n }).indexOf(event.target.value);\n\n if (index === -1) {\n return;\n }\n\n var child = childrenArray[index];\n setValue(child.props.value);\n\n if (onChange) {\n onChange(event, child);\n }\n };\n\n var handleItemClick = function handleItemClick(child) {\n return function (event) {\n if (!multiple) {\n update(false, event);\n }\n\n var newValue;\n\n if (multiple) {\n newValue = Array.isArray(value) ? value.slice() : [];\n var itemIndex = value.indexOf(child.props.value);\n\n if (itemIndex === -1) {\n newValue.push(child.props.value);\n } else {\n newValue.splice(itemIndex, 1);\n }\n } else {\n newValue = child.props.value;\n }\n\n if (child.props.onClick) {\n child.props.onClick(event);\n }\n\n if (value === newValue) {\n return;\n }\n\n setValue(newValue);\n\n if (onChange) {\n event.persist(); // Preact support, target is read only property on a native event.\n\n Object.defineProperty(event, 'target', {\n writable: true,\n value: {\n value: newValue,\n name: name\n }\n });\n onChange(event, child);\n }\n };\n };\n\n var handleKeyDown = function handleKeyDown(event) {\n if (!readOnly) {\n var validKeys = [' ', 'ArrowUp', 'ArrowDown', // The native select doesn't respond to enter on MacOS, but it's recommended by\n // https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html\n 'Enter'];\n\n if (validKeys.indexOf(event.key) !== -1) {\n event.preventDefault();\n update(true, event);\n }\n }\n };\n\n var open = displayNode !== null && (isOpenControlled ? openProp : openState);\n\n var handleBlur = function handleBlur(event) {\n // if open event.stopImmediatePropagation\n if (!open && onBlur) {\n event.persist(); // Preact support, target is read only property on a native event.\n\n Object.defineProperty(event, 'target', {\n writable: true,\n value: {\n value: value,\n name: name\n }\n });\n onBlur(event);\n }\n };\n\n delete other['aria-invalid'];\n var display;\n var displaySingle;\n var displayMultiple = [];\n var computeDisplay = false;\n var foundMatch = false; // No need to display any value if the field is empty.\n\n if (isFilled({\n value: value\n }) || displayEmpty) {\n if (renderValue) {\n display = renderValue(value);\n } else {\n computeDisplay = true;\n }\n }\n\n var items = childrenArray.map(function (child) {\n if (! /*#__PURE__*/React.isValidElement(child)) {\n return null;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (isFragment(child)) {\n console.error([\"Material-UI: The Select component doesn't accept a Fragment as a child.\", 'Consider providing an array instead.'].join('\\n'));\n }\n }\n\n var selected;\n\n if (multiple) {\n if (!Array.isArray(value)) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? \"Material-UI: The `value` prop must be an array when using the `Select` component with `multiple`.\" : _formatMuiErrorMessage(2));\n }\n\n selected = value.some(function (v) {\n return areEqualValues(v, child.props.value);\n });\n\n if (selected && computeDisplay) {\n displayMultiple.push(child.props.children);\n }\n } else {\n selected = areEqualValues(value, child.props.value);\n\n if (selected && computeDisplay) {\n displaySingle = child.props.children;\n }\n }\n\n if (selected) {\n foundMatch = true;\n }\n\n return /*#__PURE__*/React.cloneElement(child, {\n 'aria-selected': selected ? 'true' : undefined,\n onClick: handleItemClick(child),\n onKeyUp: function onKeyUp(event) {\n if (event.key === ' ') {\n // otherwise our MenuItems dispatches a click event\n // it's not behavior of the native
\n \n
\n );\n}\n\nasync function encodeEncryptedWakuMessage(\n message: string,\n publicKey: Uint8Array,\n address: string\n): Promise {\n const privateMessage = new PrivateMessage({\n toAddress: utils.hexToBytes(address),\n message: message,\n });\n\n const payload = privateMessage.encode();\n return WakuMessage.fromBytes(payload, PrivateMessageContentTopic, {\n encPublicKey: publicKey,\n });\n}\n\nfunction sendMessage(\n waku: Waku,\n recipientAddress: string,\n recipientPublicKey: Uint8Array,\n message: string,\n callback: (res: boolean) => void\n) {\n encodeEncryptedWakuMessage(message, recipientPublicKey, recipientAddress)\n .then((msg) => {\n console.log(\"pushing\");\n waku.lightPush\n .push(msg)\n .then((res) => {\n console.log(\"Message sent\", res);\n callback(res?.isSuccess ?? false);\n })\n .catch((e) => {\n console.error(\"Failed to send message\", e);\n callback(false);\n });\n })\n .catch((e) => {\n console.error(\"Cannot encode & encrypt message\", e);\n callback(false);\n });\n}\n","import Messages, { Message } from \"./Messages\";\nimport { Waku } from \"js-waku\";\nimport SendMessage from \"./SendMessage\";\nimport { makeStyles } from \"@material-ui/core\";\n\nconst useStyles = makeStyles({\n root: {\n display: \"flex\",\n alignItems: \"left\",\n flexDirection: \"column\",\n margin: \"5px\",\n },\n});\n\ninterface Props {\n waku: Waku | undefined;\n recipients: Map;\n messages: Message[];\n}\n\nexport default function Messaging({ waku, recipients, messages }: Props) {\n const classes = useStyles();\n\n return (\n
\n \n \n
\n );\n}\n","export const version = \"providers/5.7.0\";\n","export const version = \"networks/5.7.0\";\n","\"use strict\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { Network, Networkish } from \"./types\";\n\nexport {\n Network,\n Networkish\n};\n\ntype DefaultProviderFunc = (providers: any, options?: any) => any;\n\ninterface Renetworkable extends DefaultProviderFunc {\n renetwork: (network: Network) => DefaultProviderFunc;\n};\n\nfunction isRenetworkable(value: any): value is Renetworkable {\n return (value && typeof(value.renetwork) === \"function\");\n}\n\nfunction ethDefaultProvider(network: string | Network): Renetworkable {\n const func = function(providers: any, options?: any): any {\n if (options == null) { options = { }; }\n const providerList: Array = [];\n\n if (providers.InfuraProvider && options.infura !== \"-\") {\n try {\n providerList.push(new providers.InfuraProvider(network, options.infura));\n } catch(error) { }\n }\n\n if (providers.EtherscanProvider && options.etherscan !== \"-\") {\n try {\n providerList.push(new providers.EtherscanProvider(network, options.etherscan));\n } catch(error) { }\n }\n\n if (providers.AlchemyProvider && options.alchemy !== \"-\") {\n try {\n providerList.push(new providers.AlchemyProvider(network, options.alchemy));\n } catch(error) { }\n }\n\n if (providers.PocketProvider && options.pocket !== \"-\") {\n // These networks are currently faulty on Pocket as their\n // network does not handle the Berlin hardfork, which is\n // live on these ones.\n // @TODO: This goes away once Pocket has upgraded their nodes\n const skip = [ \"goerli\", \"ropsten\", \"rinkeby\" ];\n try {\n const provider = new providers.PocketProvider(network, options.pocket);\n if (provider.network && skip.indexOf(provider.network.name) === -1) {\n providerList.push(provider);\n }\n } catch(error) { }\n }\n\n if (providers.CloudflareProvider && options.cloudflare !== \"-\") {\n try {\n providerList.push(new providers.CloudflareProvider(network));\n } catch(error) { }\n }\n\n if (providers.AnkrProvider && options.ankr !== \"-\") {\n try {\n const skip = [ \"ropsten\" ];\n const provider = new providers.AnkrProvider(network, options.ankr);\n if (provider.network && skip.indexOf(provider.network.name) === -1) {\n providerList.push(provider);\n }\n } catch(error) { }\n }\n\n if (providerList.length === 0) { return null; }\n\n if (providers.FallbackProvider) {\n let quorum = 1;\n if (options.quorum != null) {\n quorum = options.quorum;\n } else if (network === \"homestead\") {\n quorum = 2;\n }\n return new providers.FallbackProvider(providerList, quorum);\n }\n\n return providerList[0];\n };\n\n func.renetwork = function(network: Network) {\n return ethDefaultProvider(network);\n };\n\n return func;\n}\n\nfunction etcDefaultProvider(url: string, network: string | Network): Renetworkable {\n const func = function(providers: any, options?: any): any {\n if (providers.JsonRpcProvider) {\n return new providers.JsonRpcProvider(url, network);\n }\n\n return null;\n };\n\n func.renetwork = function(network: Network) {\n return etcDefaultProvider(url, network);\n };\n\n return func;\n}\n\nconst homestead: Network = {\n chainId: 1,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"homestead\",\n _defaultProvider: ethDefaultProvider(\"homestead\")\n};\n\nconst ropsten: Network = {\n chainId: 3,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"ropsten\",\n _defaultProvider: ethDefaultProvider(\"ropsten\")\n};\n\nconst classicMordor: Network = {\n chainId: 63,\n name: \"classicMordor\",\n _defaultProvider: etcDefaultProvider(\"https://www.ethercluster.com/mordor\", \"classicMordor\")\n};\n\n// See: https://chainlist.org\nconst networks: { [name: string]: Network } = {\n unspecified: { chainId: 0, name: \"unspecified\" },\n\n homestead: homestead,\n mainnet: homestead,\n\n morden: { chainId: 2, name: \"morden\" },\n\n ropsten: ropsten,\n testnet: ropsten,\n\n rinkeby: {\n chainId: 4,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"rinkeby\",\n _defaultProvider: ethDefaultProvider(\"rinkeby\")\n },\n\n kovan: {\n chainId: 42,\n name: \"kovan\",\n _defaultProvider: ethDefaultProvider(\"kovan\")\n },\n\n goerli: {\n chainId: 5,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"goerli\",\n _defaultProvider: ethDefaultProvider(\"goerli\")\n },\n\n kintsugi: { chainId: 1337702, name: \"kintsugi\" },\n\n\n // ETC (See: #351)\n classic: {\n chainId: 61,\n name: \"classic\",\n _defaultProvider: etcDefaultProvider(\"https:/\\/www.ethercluster.com/etc\", \"classic\")\n },\n\n classicMorden: { chainId: 62, name: \"classicMorden\" },\n\n classicMordor: classicMordor,\n classicTestnet: classicMordor,\n\n classicKotti: {\n chainId: 6,\n name: \"classicKotti\",\n _defaultProvider: etcDefaultProvider(\"https:/\\/www.ethercluster.com/kotti\", \"classicKotti\")\n },\n\n xdai: { chainId: 100, name: \"xdai\" },\n\n matic: {\n chainId: 137,\n name: \"matic\",\n _defaultProvider: ethDefaultProvider(\"matic\")\n },\n maticmum: { chainId: 80001, name: \"maticmum\" },\n\n optimism: {\n chainId: 10,\n name: \"optimism\",\n _defaultProvider: ethDefaultProvider(\"optimism\")\n },\n \"optimism-kovan\": { chainId: 69, name: \"optimism-kovan\" },\n \"optimism-goerli\": { chainId: 420, name: \"optimism-goerli\" },\n\n arbitrum: { chainId: 42161, name: \"arbitrum\" },\n \"arbitrum-rinkeby\": { chainId: 421611, name: \"arbitrum-rinkeby\" },\n \"arbitrum-goerli\": { chainId: 421613, name: \"arbitrum-goerli\" },\n\n bnb: { chainId: 56, name: \"bnb\" },\n bnbt: { chainId: 97, name: \"bnbt\" },\n}\n\n/**\n * getNetwork\n *\n * Converts a named common networks or chain ID (network ID) to a Network\n * and verifies a network is a valid Network..\n */\nexport function getNetwork(network: Networkish): Network {\n // No network (null)\n if (network == null) { return null; }\n\n if (typeof(network) === \"number\") {\n for (const name in networks) {\n const standard = networks[name];\n if (standard.chainId === network) {\n return {\n name: standard.name,\n chainId: standard.chainId,\n ensAddress: (standard.ensAddress || null),\n _defaultProvider: (standard._defaultProvider || null)\n };\n }\n }\n\n return {\n chainId: network,\n name: \"unknown\"\n };\n }\n\n if (typeof(network) === \"string\") {\n const standard = networks[network];\n if (standard == null) { return null; }\n return {\n name: standard.name,\n chainId: standard.chainId,\n ensAddress: standard.ensAddress,\n _defaultProvider: (standard._defaultProvider || null)\n };\n }\n\n const standard = networks[network.name];\n\n // Not a standard network; check that it is a valid network in general\n if (!standard) {\n if (typeof(network.chainId) !== \"number\") {\n logger.throwArgumentError(\"invalid network chainId\", \"network\", network);\n }\n return network;\n }\n\n // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155)\n if (network.chainId !== 0 && network.chainId !== standard.chainId) {\n logger.throwArgumentError(\"network chainId mismatch\", \"network\", network);\n }\n\n // @TODO: In the next major version add an attach function to a defaultProvider\n // class and move the _defaultProvider internal to this file (extend Network)\n let defaultProvider: DefaultProviderFunc = network._defaultProvider || null;\n if (defaultProvider == null && standard._defaultProvider) {\n if (isRenetworkable(standard._defaultProvider)) {\n defaultProvider = standard._defaultProvider.renetwork(network);\n } else {\n defaultProvider = standard._defaultProvider;\n }\n }\n\n // Standard Network (allow overriding the ENS address)\n return {\n name: network.name,\n chainId: standard.chainId,\n ensAddress: (network.ensAddress || standard.ensAddress || null),\n _defaultProvider: defaultProvider\n };\n}\n","export const AddressZero = \"0x0000000000000000000000000000000000000000\";\n\n","\"use strict\";\n\nimport { Block, TransactionReceipt, TransactionResponse } from \"@ethersproject/abstract-provider\";\nimport { getAddress, getContractAddress } from \"@ethersproject/address\";\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { hexDataLength, hexDataSlice, hexValue, hexZeroPad, isHexString } from \"@ethersproject/bytes\";\nimport { AddressZero } from \"@ethersproject/constants\";\nimport { shallowCopy } from \"@ethersproject/properties\";\nimport { AccessList, accessListify, parse as parseTransaction } from \"@ethersproject/transactions\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nexport type FormatFunc = (value: any) => any;\n\nexport type FormatFuncs = { [ key: string ]: FormatFunc };\n\nexport type Formats = {\n transaction: FormatFuncs,\n transactionRequest: FormatFuncs,\n receipt: FormatFuncs,\n receiptLog: FormatFuncs,\n block: FormatFuncs,\n blockWithTransactions: FormatFuncs,\n filter: FormatFuncs,\n filterLog: FormatFuncs,\n};\n\nexport class Formatter {\n readonly formats: Formats;\n\n constructor() {\n this.formats = this.getDefaultFormats();\n }\n\n getDefaultFormats(): Formats {\n const formats: Formats = ({ });\n\n const address = this.address.bind(this);\n const bigNumber = this.bigNumber.bind(this);\n const blockTag = this.blockTag.bind(this);\n const data = this.data.bind(this);\n const hash = this.hash.bind(this);\n const hex = this.hex.bind(this);\n const number = this.number.bind(this);\n const type = this.type.bind(this);\n\n const strictData = (v: any) => { return this.data(v, true); };\n\n formats.transaction = {\n hash: hash,\n\n type: type,\n accessList: Formatter.allowNull(this.accessList.bind(this), null),\n\n blockHash: Formatter.allowNull(hash, null),\n blockNumber: Formatter.allowNull(number, null),\n transactionIndex: Formatter.allowNull(number, null),\n\n confirmations: Formatter.allowNull(number, null),\n\n from: address,\n\n // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas)\n // must be set\n gasPrice: Formatter.allowNull(bigNumber),\n maxPriorityFeePerGas: Formatter.allowNull(bigNumber),\n maxFeePerGas: Formatter.allowNull(bigNumber),\n\n gasLimit: bigNumber,\n to: Formatter.allowNull(address, null),\n value: bigNumber,\n nonce: number,\n data: data,\n\n r: Formatter.allowNull(this.uint256),\n s: Formatter.allowNull(this.uint256),\n v: Formatter.allowNull(number),\n\n creates: Formatter.allowNull(address, null),\n\n raw: Formatter.allowNull(data),\n };\n\n formats.transactionRequest = {\n from: Formatter.allowNull(address),\n nonce: Formatter.allowNull(number),\n gasLimit: Formatter.allowNull(bigNumber),\n gasPrice: Formatter.allowNull(bigNumber),\n maxPriorityFeePerGas: Formatter.allowNull(bigNumber),\n maxFeePerGas: Formatter.allowNull(bigNumber),\n to: Formatter.allowNull(address),\n value: Formatter.allowNull(bigNumber),\n data: Formatter.allowNull(strictData),\n type: Formatter.allowNull(number),\n accessList: Formatter.allowNull(this.accessList.bind(this), null),\n };\n\n formats.receiptLog = {\n transactionIndex: number,\n blockNumber: number,\n transactionHash: hash,\n address: address,\n topics: Formatter.arrayOf(hash),\n data: data,\n logIndex: number,\n blockHash: hash,\n };\n\n formats.receipt = {\n to: Formatter.allowNull(this.address, null),\n from: Formatter.allowNull(this.address, null),\n contractAddress: Formatter.allowNull(address, null),\n transactionIndex: number,\n // should be allowNull(hash), but broken-EIP-658 support is handled in receipt\n root: Formatter.allowNull(hex),\n gasUsed: bigNumber,\n logsBloom: Formatter.allowNull(data),// @TODO: should this be data?\n blockHash: hash,\n transactionHash: hash,\n logs: Formatter.arrayOf(this.receiptLog.bind(this)),\n blockNumber: number,\n confirmations: Formatter.allowNull(number, null),\n cumulativeGasUsed: bigNumber,\n effectiveGasPrice: Formatter.allowNull(bigNumber),\n status: Formatter.allowNull(number),\n type: type\n };\n\n formats.block = {\n hash: Formatter.allowNull(hash),\n parentHash: hash,\n number: number,\n\n timestamp: number,\n nonce: Formatter.allowNull(hex),\n difficulty: this.difficulty.bind(this),\n\n gasLimit: bigNumber,\n gasUsed: bigNumber,\n\n miner: Formatter.allowNull(address),\n extraData: data,\n\n transactions: Formatter.allowNull(Formatter.arrayOf(hash)),\n\n baseFeePerGas: Formatter.allowNull(bigNumber)\n };\n\n formats.blockWithTransactions = shallowCopy(formats.block);\n formats.blockWithTransactions.transactions = Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this)));\n\n formats.filter = {\n fromBlock: Formatter.allowNull(blockTag, undefined),\n toBlock: Formatter.allowNull(blockTag, undefined),\n blockHash: Formatter.allowNull(hash, undefined),\n address: Formatter.allowNull(address, undefined),\n topics: Formatter.allowNull(this.topics.bind(this), undefined),\n };\n\n formats.filterLog = {\n blockNumber: Formatter.allowNull(number),\n blockHash: Formatter.allowNull(hash),\n transactionIndex: number,\n\n removed: Formatter.allowNull(this.boolean.bind(this)),\n\n address: address,\n data: Formatter.allowFalsish(data, \"0x\"),\n\n topics: Formatter.arrayOf(hash),\n\n transactionHash: hash,\n logIndex: number,\n };\n\n return formats;\n }\n\n accessList(accessList: Array): AccessList {\n return accessListify(accessList || []);\n }\n\n // Requires a BigNumberish that is within the IEEE754 safe integer range; returns a number\n // Strict! Used on input.\n number(number: any): number {\n if (number === \"0x\") { return 0; }\n return BigNumber.from(number).toNumber();\n }\n\n type(number: any): number {\n if (number === \"0x\" || number == null) { return 0; }\n return BigNumber.from(number).toNumber();\n }\n\n // Strict! Used on input.\n bigNumber(value: any): BigNumber {\n return BigNumber.from(value);\n }\n\n // Requires a boolean, \"true\" or \"false\"; returns a boolean\n boolean(value: any): boolean {\n if (typeof(value) === \"boolean\") { return value; }\n if (typeof(value) === \"string\") {\n value = value.toLowerCase();\n if (value === \"true\") { return true; }\n if (value === \"false\") { return false; }\n }\n throw new Error(\"invalid boolean - \" + value);\n }\n\n hex(value: any, strict?: boolean): string {\n if (typeof(value) === \"string\") {\n if (!strict && value.substring(0, 2) !== \"0x\") { value = \"0x\" + value; }\n if (isHexString(value)) {\n return value.toLowerCase();\n }\n }\n return logger.throwArgumentError(\"invalid hash\", \"value\", value);\n }\n\n data(value: any, strict?: boolean): string {\n const result = this.hex(value, strict);\n if ((result.length % 2) !== 0) {\n throw new Error(\"invalid data; odd-length - \" + value);\n }\n return result;\n }\n\n // Requires an address\n // Strict! Used on input.\n address(value: any): string {\n return getAddress(value);\n }\n\n callAddress(value: any): string {\n if (!isHexString(value, 32)) { return null; }\n const address = getAddress(hexDataSlice(value, 12));\n return (address === AddressZero) ? null: address;\n }\n\n contractAddress(value: any): string {\n return getContractAddress(value);\n }\n\n // Strict! Used on input.\n blockTag(blockTag: any): string {\n if (blockTag == null) { return \"latest\"; }\n\n if (blockTag === \"earliest\") { return \"0x0\"; }\n\n switch (blockTag) {\n case \"earliest\": return \"0x0\";\n case \"latest\": case \"pending\": case \"safe\": case \"finalized\":\n return blockTag;\n }\n\n if (typeof(blockTag) === \"number\" || isHexString(blockTag)) {\n return hexValue(blockTag);\n }\n\n throw new Error(\"invalid blockTag\");\n }\n\n // Requires a hash, optionally requires 0x prefix; returns prefixed lowercase hash.\n hash(value: any, strict?: boolean): string {\n const result = this.hex(value, strict);\n if (hexDataLength(result) !== 32) {\n return logger.throwArgumentError(\"invalid hash\", \"value\", value);\n }\n return result;\n }\n\n // Returns the difficulty as a number, or if too large (i.e. PoA network) null\n difficulty(value: any): number {\n if (value == null) { return null; }\n\n const v = BigNumber.from(value);\n\n try {\n return v.toNumber();\n } catch (error) { }\n\n return null;\n }\n\n uint256(value: any): string {\n if (!isHexString(value)) {\n throw new Error(\"invalid uint256\");\n }\n return hexZeroPad(value, 32);\n }\n\n _block(value: any, format: any): Block {\n if (value.author != null && value.miner == null) {\n value.miner = value.author;\n }\n // The difficulty may need to come from _difficulty in recursed blocks\n const difficulty = (value._difficulty != null) ? value._difficulty: value.difficulty;\n const result = Formatter.check(format, value);\n result._difficulty = ((difficulty == null) ? null: BigNumber.from(difficulty));\n return result;\n }\n\n block(value: any): Block {\n return this._block(value, this.formats.block);\n }\n\n blockWithTransactions(value: any): Block {\n return this._block(value, this.formats.blockWithTransactions);\n }\n\n // Strict! Used on input.\n transactionRequest(value: any): any {\n return Formatter.check(this.formats.transactionRequest, value);\n }\n\n transactionResponse(transaction: any): TransactionResponse {\n\n // Rename gas to gasLimit\n if (transaction.gas != null && transaction.gasLimit == null) {\n transaction.gasLimit = transaction.gas;\n }\n\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (transaction.to && BigNumber.from(transaction.to).isZero()) {\n transaction.to = \"0x0000000000000000000000000000000000000000\";\n }\n\n // Rename input to data\n if (transaction.input != null && transaction.data == null) {\n transaction.data = transaction.input;\n }\n\n // If to and creates are empty, populate the creates from the transaction\n if (transaction.to == null && transaction.creates == null) {\n transaction.creates = this.contractAddress(transaction);\n }\n\n if ((transaction.type === 1 || transaction.type === 2)&& transaction.accessList == null) {\n transaction.accessList = [ ];\n }\n\n const result: TransactionResponse = Formatter.check(this.formats.transaction, transaction);\n\n if (transaction.chainId != null) {\n let chainId = transaction.chainId;\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n result.chainId = chainId;\n\n } else {\n let chainId = transaction.networkId;\n\n // geth-etc returns chainId\n if (chainId == null && result.v == null) {\n chainId = transaction.chainId;\n }\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n if (typeof(chainId) !== \"number\" && result.v != null) {\n chainId = (result.v - 35) / 2;\n if (chainId < 0) { chainId = 0; }\n chainId = parseInt(chainId);\n }\n\n if (typeof(chainId) !== \"number\") { chainId = 0; }\n\n result.chainId = chainId;\n }\n\n // 0x0000... should actually be null\n if (result.blockHash && result.blockHash.replace(/0/g, \"\") === \"x\") {\n result.blockHash = null;\n }\n\n return result;\n }\n\n transaction(value: any): any {\n return parseTransaction(value);\n }\n\n receiptLog(value: any): any {\n return Formatter.check(this.formats.receiptLog, value);\n }\n\n receipt(value: any): TransactionReceipt {\n const result: TransactionReceipt = Formatter.check(this.formats.receipt, value);\n\n // RSK incorrectly implemented EIP-658, so we munge things a bit here for it\n if (result.root != null) {\n if (result.root.length <= 4) {\n // Could be 0x00, 0x0, 0x01 or 0x1\n const value = BigNumber.from(result.root).toNumber();\n if (value === 0 || value === 1) {\n // Make sure if both are specified, they match\n if (result.status != null && (result.status !== value)) {\n logger.throwArgumentError(\"alt-root-status/status mismatch\", \"value\", { root: result.root, status: result.status });\n }\n result.status = value;\n delete result.root;\n } else {\n logger.throwArgumentError(\"invalid alt-root-status\", \"value.root\", result.root);\n }\n } else if (result.root.length !== 66) {\n // Must be a valid bytes32\n logger.throwArgumentError(\"invalid root hash\", \"value.root\", result.root);\n }\n }\n\n if (result.status != null) {\n result.byzantium = true;\n }\n\n return result;\n }\n\n topics(value: any): any {\n if (Array.isArray(value)) {\n return value.map((v) => this.topics(v));\n\n } else if (value != null) {\n return this.hash(value, true);\n }\n\n return null;\n }\n\n filter(value: any): any {\n return Formatter.check(this.formats.filter, value);\n }\n\n filterLog(value: any): any {\n return Formatter.check(this.formats.filterLog, value);\n }\n\n static check(format: { [ name: string ]: FormatFunc }, object: any): any {\n const result: any = {};\n for (const key in format) {\n try {\n const value = format[key](object[key]);\n if (value !== undefined) { result[key] = value; }\n } catch (error) {\n error.checkKey = key;\n error.checkValue = object[key];\n throw error;\n }\n }\n return result;\n }\n\n // if value is null-ish, nullValue is returned\n static allowNull(format: FormatFunc, nullValue?: any): FormatFunc {\n return (function(value: any) {\n if (value == null) { return nullValue; }\n return format(value);\n });\n }\n\n // If value is false-ish, replaceValue is returned\n static allowFalsish(format: FormatFunc, replaceValue: any): FormatFunc {\n return (function(value: any) {\n if (!value) { return replaceValue; }\n return format(value);\n });\n }\n\n // Requires an Array satisfying check\n static arrayOf(format: FormatFunc): FormatFunc {\n return (function(array: any): Array {\n if (!Array.isArray(array)) { throw new Error(\"not an array\"); }\n\n const result: any = [];\n\n array.forEach(function(value) {\n result.push(format(value));\n });\n\n return result;\n });\n }\n}\n\nexport interface CommunityResourcable {\n isCommunityResource(): boolean;\n}\n\nexport function isCommunityResourcable(value: any): value is CommunityResourcable {\n return (value && typeof(value.isCommunityResource) === \"function\");\n}\n\nexport function isCommunityResource(value: any): boolean {\n return (isCommunityResourcable(value) && value.isCommunityResource());\n}\n\n// Show the throttle message only once\nlet throttleMessage = false;\nexport function showThrottleMessage() {\n if (throttleMessage) { return; }\n throttleMessage = true;\n\n console.log(\"========= NOTICE =========\")\n console.log(\"Request-Rate Exceeded (this message will not be repeated)\");\n console.log(\"\");\n console.log(\"The default API keys for each service are provided as a highly-throttled,\");\n console.log(\"community resource for low-traffic projects and early prototyping.\");\n console.log(\"\");\n console.log(\"While your application will continue to function, we highly recommended\");\n console.log(\"signing up for your own API keys to improve performance, increase your\");\n console.log(\"request rate/limit and enable other perks, such as metrics and advanced APIs.\");\n console.log(\"\");\n console.log(\"For more details: https:/\\/docs.ethers.io/api-keys/\");\n console.log(\"==========================\");\n}\n\n","\"use strict\";\n\nimport {\n Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, ForkEvent,\n Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse\n} from \"@ethersproject/abstract-provider\";\nimport { encode as base64Encode } from \"@ethersproject/base64\";\nimport { Base58 } from \"@ethersproject/basex\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { arrayify, BytesLike, concat, hexConcat, hexDataLength, hexDataSlice, hexlify, hexValue, hexZeroPad, isHexString } from \"@ethersproject/bytes\";\nimport { HashZero } from \"@ethersproject/constants\";\nimport { dnsEncode, namehash } from \"@ethersproject/hash\";\nimport { getNetwork, Network, Networkish } from \"@ethersproject/networks\";\nimport { Deferrable, defineReadOnly, getStatic, resolveProperties } from \"@ethersproject/properties\";\nimport { Transaction } from \"@ethersproject/transactions\";\nimport { sha256 } from \"@ethersproject/sha2\";\nimport { toUtf8Bytes, toUtf8String } from \"@ethersproject/strings\";\nimport { fetchJson, poll } from \"@ethersproject/web\";\n\nimport bech32 from \"bech32\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { Formatter } from \"./formatter\";\n\nconst MAX_CCIP_REDIRECTS = 10;\n\n//////////////////////////////\n// Event Serializeing\n\nfunction checkTopic(topic: string): string {\n if (topic == null) { return \"null\"; }\n if (hexDataLength(topic) !== 32) {\n logger.throwArgumentError(\"invalid topic\", \"topic\", topic);\n }\n return topic.toLowerCase();\n}\n\nfunction serializeTopics(topics: Array>): string {\n // Remove trailing null AND-topics; they are redundant\n topics = topics.slice();\n while (topics.length > 0 && topics[topics.length - 1] == null) { topics.pop(); }\n\n return topics.map((topic) => {\n if (Array.isArray(topic)) {\n\n // Only track unique OR-topics\n const unique: { [ topic: string ]: boolean } = { }\n topic.forEach((topic) => {\n unique[checkTopic(topic)] = true;\n });\n\n // The order of OR-topics does not matter\n const sorted = Object.keys(unique);\n sorted.sort();\n\n return sorted.join(\"|\");\n\n } else {\n return checkTopic(topic);\n }\n }).join(\"&\");\n}\n\nfunction deserializeTopics(data: string): Array> {\n if (data === \"\") { return [ ]; }\n\n return data.split(/&/g).map((topic) => {\n if (topic === \"\") { return [ ]; }\n\n const comps = topic.split(\"|\").map((topic) => {\n return ((topic === \"null\") ? null: topic);\n });\n\n return ((comps.length === 1) ? comps[0]: comps);\n });\n}\n\nfunction getEventTag(eventName: EventType): string {\n if (typeof(eventName) === \"string\") {\n eventName = eventName.toLowerCase();\n\n if (hexDataLength(eventName) === 32) {\n return \"tx:\" + eventName;\n }\n\n if (eventName.indexOf(\":\") === -1) {\n return eventName;\n }\n\n } else if (Array.isArray(eventName)) {\n return \"filter:*:\" + serializeTopics(eventName);\n\n } else if (ForkEvent.isForkEvent(eventName)) {\n logger.warn(\"not implemented\");\n throw new Error(\"not implemented\");\n\n } else if (eventName && typeof(eventName) === \"object\") {\n return \"filter:\" + (eventName.address || \"*\") + \":\" + serializeTopics(eventName.topics || []);\n }\n\n throw new Error(\"invalid event - \" + eventName);\n}\n\n//////////////////////////////\n// Helper Object\n\nfunction getTime() {\n return (new Date()).getTime();\n}\n\nfunction stall(duration: number): Promise {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\n\n//////////////////////////////\n// Provider Object\n\n\n/**\n * EventType\n * - \"block\"\n * - \"poll\"\n * - \"didPoll\"\n * - \"pending\"\n * - \"error\"\n * - \"network\"\n * - filter\n * - topics array\n * - transaction hash\n */\n\nconst PollableEvents = [ \"block\", \"network\", \"pending\", \"poll\" ];\n\nexport class Event {\n readonly listener: Listener;\n readonly once: boolean;\n readonly tag: string;\n\n _lastBlockNumber: number\n _inflight: boolean;\n\n constructor(tag: string, listener: Listener, once: boolean) {\n defineReadOnly(this, \"tag\", tag);\n defineReadOnly(this, \"listener\", listener);\n defineReadOnly(this, \"once\", once);\n\n this._lastBlockNumber = -2;\n this._inflight = false;\n }\n\n get event(): EventType {\n switch (this.type) {\n case \"tx\":\n return this.hash;\n case \"filter\":\n return this.filter;\n }\n return this.tag;\n }\n\n get type(): string {\n return this.tag.split(\":\")[0]\n }\n\n get hash(): string {\n const comps = this.tag.split(\":\");\n if (comps[0] !== \"tx\") { return null; }\n return comps[1];\n }\n\n get filter(): Filter {\n const comps = this.tag.split(\":\");\n if (comps[0] !== \"filter\") { return null; }\n const address = comps[1];\n\n const topics = deserializeTopics(comps[2]);\n const filter: Filter = { };\n\n if (topics.length > 0) { filter.topics = topics; }\n if (address && address !== \"*\") { filter.address = address; }\n\n return filter;\n }\n\n pollable(): boolean {\n return (this.tag.indexOf(\":\") >= 0 || PollableEvents.indexOf(this.tag) >= 0);\n }\n}\n\nexport interface EnsResolver {\n\n // Name this Resolver is associated with\n readonly name: string;\n\n // The address of the resolver\n readonly address: string;\n\n // Multichain address resolution (also normal address resolution)\n // See: https://eips.ethereum.org/EIPS/eip-2304\n getAddress(coinType?: 60): Promise\n\n // Contenthash field\n // See: https://eips.ethereum.org/EIPS/eip-1577\n getContentHash(): Promise;\n\n // Storage of text records\n // See: https://eips.ethereum.org/EIPS/eip-634\n getText(key: string): Promise;\n};\n\nexport interface EnsProvider {\n resolveName(name: string): Promise;\n lookupAddress(address: string): Promise;\n getResolver(name: string): Promise;\n}\n\ntype CoinInfo = {\n symbol: string,\n ilk?: string, // General family\n prefix?: string, // Bech32 prefix\n p2pkh?: number, // Pay-to-Public-Key-Hash Version\n p2sh?: number, // Pay-to-Script-Hash Version\n};\n\n// https://github.com/satoshilabs/slips/blob/master/slip-0044.md\nconst coinInfos: { [ coinType: string ]: CoinInfo } = {\n \"0\": { symbol: \"btc\", p2pkh: 0x00, p2sh: 0x05, prefix: \"bc\" },\n \"2\": { symbol: \"ltc\", p2pkh: 0x30, p2sh: 0x32, prefix: \"ltc\" },\n \"3\": { symbol: \"doge\", p2pkh: 0x1e, p2sh: 0x16 },\n \"60\": { symbol: \"eth\", ilk: \"eth\" },\n \"61\": { symbol: \"etc\", ilk: \"eth\" },\n \"700\": { symbol: \"xdai\", ilk: \"eth\" },\n};\n\nfunction bytes32ify(value: number): string {\n return hexZeroPad(BigNumber.from(value).toHexString(), 32);\n}\n\n// Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d)\nfunction base58Encode(data: Uint8Array): string {\n return Base58.encode(concat([ data, hexDataSlice(sha256(sha256(data)), 0, 4) ]));\n}\n\nexport interface Avatar {\n url: string;\n linkage: Array<{ type: string, content: string }>;\n}\n\nconst matcherIpfs = new RegExp(\"^(ipfs):/\\/(.*)$\", \"i\");\nconst matchers = [\n new RegExp(\"^(https):/\\/(.*)$\", \"i\"),\n new RegExp(\"^(data):(.*)$\", \"i\"),\n matcherIpfs,\n new RegExp(\"^eip155:[0-9]+/(erc[0-9]+):(.*)$\", \"i\"),\n];\n\nfunction _parseString(result: string, start: number): null | string {\n try {\n return toUtf8String(_parseBytes(result, start));\n } catch(error) { }\n return null;\n}\n\nfunction _parseBytes(result: string, start: number): null | string {\n if (result === \"0x\") { return null; }\n\n const offset = BigNumber.from(hexDataSlice(result, start, start + 32)).toNumber();\n const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber();\n\n return hexDataSlice(result, offset + 32, offset + 32 + length);\n}\n\n// Trim off the ipfs:// prefix and return the default gateway URL\nfunction getIpfsLink(link: string): string {\n if (link.match(/^ipfs:\\/\\/ipfs\\//i)) {\n link = link.substring(12);\n } else if (link.match(/^ipfs:\\/\\//i)) {\n link = link.substring(7);\n } else {\n logger.throwArgumentError(\"unsupported IPFS format\", \"link\", link);\n }\n\n return `https:/\\/gateway.ipfs.io/ipfs/${ link }`;\n}\n\nfunction numPad(value: number): Uint8Array {\n const result = arrayify(value);\n if (result.length > 32) { throw new Error(\"internal; should not happen\"); }\n\n const padded = new Uint8Array(32);\n padded.set(result, 32 - result.length);\n return padded;\n}\n\nfunction bytesPad(value: Uint8Array): Uint8Array {\n if ((value.length % 32) === 0) { return value; }\n\n const result = new Uint8Array(Math.ceil(value.length / 32) * 32);\n result.set(value);\n return result;\n}\n\n// ABI Encodes a series of (bytes, bytes, ...)\nfunction encodeBytes(datas: Array) {\n const result: Array = [ ];\n\n let byteCount = 0;\n\n // Add place-holders for pointers as we add items\n for (let i = 0; i < datas.length; i++) {\n result.push(null);\n byteCount += 32;\n }\n\n for (let i = 0; i < datas.length; i++) {\n const data = arrayify(datas[i]);\n\n // Update the bytes offset\n result[i] = numPad(byteCount);\n\n // The length and padded value of data\n result.push(numPad(data.length));\n result.push(bytesPad(data));\n byteCount += 32 + Math.ceil(data.length / 32) * 32;\n }\n\n return hexConcat(result);\n}\n\nexport class Resolver implements EnsResolver {\n readonly provider: BaseProvider;\n\n readonly name: string;\n readonly address: string;\n\n readonly _resolvedAddress: null | string;\n\n // For EIP-2544 names, the ancestor that provided the resolver\n _supportsEip2544: null | Promise;\n\n // The resolvedAddress is only for creating a ReverseLookup resolver\n constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string) {\n defineReadOnly(this, \"provider\", provider);\n defineReadOnly(this, \"name\", name);\n defineReadOnly(this, \"address\", provider.formatter.address(address));\n defineReadOnly(this, \"_resolvedAddress\", resolvedAddress);\n }\n\n supportsWildcard(): Promise {\n if (!this._supportsEip2544) {\n // supportsInterface(bytes4 = selector(\"resolve(bytes,bytes)\"))\n this._supportsEip2544 = this.provider.call({\n to: this.address,\n data: \"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000\"\n }).then((result) => {\n return BigNumber.from(result).eq(1);\n }).catch((error) => {\n if (error.code === Logger.errors.CALL_EXCEPTION) { return false; }\n // Rethrow the error: link is down, etc. Let future attempts retry.\n this._supportsEip2544 = null;\n throw error;\n });\n }\n\n return this._supportsEip2544;\n }\n\n async _fetch(selector: string, parameters?: string): Promise {\n\n // e.g. keccak256(\"addr(bytes32,uint256)\")\n const tx = {\n to: this.address,\n ccipReadEnabled: true,\n data: hexConcat([ selector, namehash(this.name), (parameters || \"0x\") ])\n };\n\n // Wildcard support; use EIP-2544 to resolve the request\n let parseBytes = false;\n if (await this.supportsWildcard()) {\n parseBytes = true;\n\n // selector(\"resolve(bytes,bytes)\")\n tx.data = hexConcat([ \"0x9061b923\", encodeBytes([ dnsEncode(this.name), tx.data ]) ]);\n }\n\n try {\n let result = await this.provider.call(tx);\n if ((arrayify(result).length % 32) === 4) {\n logger.throwError(\"resolver threw error\", Logger.errors.CALL_EXCEPTION, {\n transaction: tx, data: result\n });\n }\n if (parseBytes) { result = _parseBytes(result, 0); }\n return result;\n } catch (error) {\n if (error.code === Logger.errors.CALL_EXCEPTION) { return null; }\n throw error;\n }\n }\n\n async _fetchBytes(selector: string, parameters?: string): Promise {\n const result = await this._fetch(selector, parameters);\n if (result != null) { return _parseBytes(result, 0); }\n return null;\n }\n\n _getAddress(coinType: number, hexBytes: string): string {\n const coinInfo = coinInfos[String(coinType)];\n\n if (coinInfo == null) {\n logger.throwError(`unsupported coin type: ${ coinType }`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: `getAddress(${ coinType })`\n });\n }\n\n if (coinInfo.ilk === \"eth\") {\n return this.provider.formatter.address(hexBytes);\n }\n\n const bytes = arrayify(hexBytes);\n\n // P2PKH: OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG\n if (coinInfo.p2pkh != null) {\n const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);\n if (p2pkh) {\n const length = parseInt(p2pkh[1], 16);\n if (p2pkh[2].length === length * 2 && length >= 1 && length <= 75) {\n return base58Encode(concat([ [ coinInfo.p2pkh ], (\"0x\" + p2pkh[2]) ]));\n }\n }\n }\n\n // P2SH: OP_HASH160 OP_EQUAL\n if (coinInfo.p2sh != null) {\n const p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);\n if (p2sh) {\n const length = parseInt(p2sh[1], 16);\n if (p2sh[2].length === length * 2 && length >= 1 && length <= 75) {\n return base58Encode(concat([ [ coinInfo.p2sh ], (\"0x\" + p2sh[2]) ]));\n }\n }\n }\n\n // Bech32\n if (coinInfo.prefix != null) {\n const length = bytes[1];\n\n // https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program\n let version = bytes[0];\n if (version === 0x00) {\n if (length !== 20 && length !== 32) {\n version = -1;\n }\n } else {\n version = -1;\n }\n\n if (version >= 0 && bytes.length === 2 + length && length >= 1 && length <= 75) {\n const words = bech32.toWords(bytes.slice(2));\n words.unshift(version);\n return bech32.encode(coinInfo.prefix, words);\n }\n }\n\n return null;\n }\n\n\n async getAddress(coinType?: number): Promise {\n if (coinType == null) { coinType = 60; }\n\n // If Ethereum, use the standard `addr(bytes32)`\n if (coinType === 60) {\n try {\n // keccak256(\"addr(bytes32)\")\n const result = await this._fetch(\"0x3b3b57de\");\n\n // No address\n if (result === \"0x\" || result === HashZero) { return null; }\n\n return this.provider.formatter.callAddress(result);\n } catch (error) {\n if (error.code === Logger.errors.CALL_EXCEPTION) { return null; }\n throw error;\n }\n }\n\n // keccak256(\"addr(bytes32,uint256\")\n const hexBytes = await this._fetchBytes(\"0xf1cb7e06\", bytes32ify(coinType));\n\n // No address\n if (hexBytes == null || hexBytes === \"0x\") { return null; }\n\n // Compute the address\n const address = this._getAddress(coinType, hexBytes);\n\n if (address == null) {\n logger.throwError(`invalid or unsupported coin data`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: `getAddress(${ coinType })`,\n coinType: coinType,\n data: hexBytes\n });\n }\n\n return address;\n }\n\n async getAvatar(): Promise {\n const linkage: Array<{ type: string, content: string }> = [ { type: \"name\", content: this.name } ];\n try {\n // test data for ricmoo.eth\n //const avatar = \"eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233\";\n const avatar = await this.getText(\"avatar\");\n if (avatar == null) { return null; }\n\n for (let i = 0; i < matchers.length; i++) {\n const match = avatar.match(matchers[i]);\n if (match == null) { continue; }\n\n const scheme = match[1].toLowerCase();\n\n switch (scheme) {\n case \"https\":\n linkage.push({ type: \"url\", content: avatar });\n return { linkage, url: avatar };\n\n case \"data\":\n linkage.push({ type: \"data\", content: avatar });\n return { linkage, url: avatar };\n\n case \"ipfs\":\n linkage.push({ type: \"ipfs\", content: avatar });\n return { linkage, url: getIpfsLink(avatar) };\n\n case \"erc721\":\n case \"erc1155\": {\n // Depending on the ERC type, use tokenURI(uint256) or url(uint256)\n const selector = (scheme === \"erc721\") ? \"0xc87b56dd\": \"0x0e89341c\";\n linkage.push({ type: scheme, content: avatar });\n\n // The owner of this name\n const owner = (this._resolvedAddress || await this.getAddress());\n\n const comps = (match[2] || \"\").split(\"/\");\n if (comps.length !== 2) { return null; }\n\n const addr = await this.provider.formatter.address(comps[0]);\n const tokenId = hexZeroPad(BigNumber.from(comps[1]).toHexString(), 32);\n\n // Check that this account owns the token\n if (scheme === \"erc721\") {\n // ownerOf(uint256 tokenId)\n const tokenOwner = this.provider.formatter.callAddress(await this.provider.call({\n to: addr, data: hexConcat([ \"0x6352211e\", tokenId ])\n }));\n if (owner !== tokenOwner) { return null; }\n linkage.push({ type: \"owner\", content: tokenOwner });\n\n } else if (scheme === \"erc1155\") {\n // balanceOf(address owner, uint256 tokenId)\n const balance = BigNumber.from(await this.provider.call({\n to: addr, data: hexConcat([ \"0x00fdd58e\", hexZeroPad(owner, 32), tokenId ])\n }));\n if (balance.isZero()) { return null; }\n linkage.push({ type: \"balance\", content: balance.toString() });\n }\n\n // Call the token contract for the metadata URL\n const tx = {\n to: this.provider.formatter.address(comps[0]),\n data: hexConcat([ selector, tokenId ])\n };\n\n let metadataUrl = _parseString(await this.provider.call(tx), 0);\n if (metadataUrl == null) { return null; }\n linkage.push({ type: \"metadata-url-base\", content: metadataUrl });\n\n // ERC-1155 allows a generic {id} in the URL\n if (scheme === \"erc1155\") {\n metadataUrl = metadataUrl.replace(\"{id}\", tokenId.substring(2));\n linkage.push({ type: \"metadata-url-expanded\", content: metadataUrl });\n }\n\n // Transform IPFS metadata links\n if (metadataUrl.match(/^ipfs:/i)) {\n metadataUrl = getIpfsLink(metadataUrl);\n }\n\n linkage.push({ type: \"metadata-url\", content: metadataUrl });\n\n // Get the token metadata\n const metadata = await fetchJson(metadataUrl);\n if (!metadata) { return null; }\n linkage.push({ type: \"metadata\", content: JSON.stringify(metadata) });\n\n // Pull the image URL out\n let imageUrl = metadata.image;\n if (typeof(imageUrl) !== \"string\") { return null; }\n\n if (imageUrl.match(/^(https:\\/\\/|data:)/i)) {\n // Allow\n } else {\n // Transform IPFS link to gateway\n const ipfs = imageUrl.match(matcherIpfs);\n if (ipfs == null) { return null; }\n\n linkage.push({ type: \"url-ipfs\", content: imageUrl });\n imageUrl = getIpfsLink(imageUrl);\n }\n\n linkage.push({ type: \"url\", content: imageUrl });\n\n return { linkage, url: imageUrl };\n }\n }\n }\n } catch (error) { }\n\n return null;\n }\n\n async getContentHash(): Promise {\n\n // keccak256(\"contenthash()\")\n const hexBytes = await this._fetchBytes(\"0xbc1c58d1\");\n\n // No contenthash\n if (hexBytes == null || hexBytes === \"0x\") { return null; }\n\n // IPFS (CID: 1, Type: DAG-PB)\n const ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);\n if (ipfs) {\n const length = parseInt(ipfs[3], 16);\n if (ipfs[4].length === length * 2) {\n return \"ipfs:/\\/\" + Base58.encode(\"0x\" + ipfs[1]);\n }\n }\n\n // IPNS (CID: 1, Type: libp2p-key)\n const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);\n if (ipns) {\n const length = parseInt(ipns[3], 16);\n if (ipns[4].length === length * 2) {\n return \"ipns:/\\/\" + Base58.encode(\"0x\" + ipns[1]);\n }\n }\n\n // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)\n const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/)\n if (swarm) {\n if (swarm[1].length === (32 * 2)) {\n return \"bzz:/\\/\" + swarm[1]\n }\n }\n\n const skynet = hexBytes.match(/^0x90b2c605([0-9a-f]*)$/);\n if (skynet) {\n if (skynet[1].length === (34 * 2)) {\n // URL Safe base64; https://datatracker.ietf.org/doc/html/rfc4648#section-5\n const urlSafe: Record = { \"=\": \"\", \"+\": \"-\", \"/\": \"_\" };\n const hash = base64Encode(\"0x\" + skynet[1]).replace(/[=+\\/]/g, (a) => (urlSafe[a]));\n return \"sia:/\\/\" + hash;\n }\n }\n\n return logger.throwError(`invalid or unsupported content hash data`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"getContentHash()\",\n data: hexBytes\n });\n }\n\n async getText(key: string): Promise {\n\n // The key encoded as parameter to fetchBytes\n let keyBytes = toUtf8Bytes(key);\n\n // The nodehash consumes the first slot, so the string pointer targets\n // offset 64, with the length at offset 64 and data starting at offset 96\n keyBytes = concat([ bytes32ify(64), bytes32ify(keyBytes.length), keyBytes ]);\n\n // Pad to word-size (32 bytes)\n if ((keyBytes.length % 32) !== 0) {\n keyBytes = concat([ keyBytes, hexZeroPad(\"0x\", 32 - (key.length % 32)) ])\n }\n\n const hexBytes = await this._fetchBytes(\"0x59d1d43c\", hexlify(keyBytes));\n if (hexBytes == null || hexBytes === \"0x\") { return null; }\n\n return toUtf8String(hexBytes);\n }\n}\n\nlet defaultFormatter: Formatter = null;\n\nlet nextPollId = 1;\n\nexport class BaseProvider extends Provider implements EnsProvider {\n _networkPromise: Promise;\n _network: Network;\n\n _events: Array;\n\n formatter: Formatter;\n\n // To help mitigate the eventually consistent nature of the blockchain\n // we keep a mapping of events we emit. If we emit an event X, we expect\n // that a user should be able to query for that event in the callback,\n // if the node returns null, we stall the response until we get back a\n // meaningful value, since we may be hitting a re-org, or a node that\n // has not indexed the event yet.\n // Events:\n // - t:{hash} - Transaction hash\n // - b:{hash} - BlockHash\n // - block - The most recent emitted block\n _emitted: { [ eventName: string ]: number | \"pending\" };\n\n _pollingInterval: number;\n _poller: NodeJS.Timer;\n _bootstrapPoll: NodeJS.Timer;\n\n _lastBlockNumber: number;\n _maxFilterBlockRange: number;\n\n _fastBlockNumber: number;\n _fastBlockNumberPromise: Promise;\n _fastQueryDate: number;\n\n _maxInternalBlockNumber: number;\n _internalBlockNumber: Promise<{ blockNumber: number, reqTime: number, respTime: number }>;\n\n readonly anyNetwork: boolean;\n\n disableCcipRead: boolean;\n\n\n /**\n * ready\n *\n * A Promise that resolves only once the provider is ready.\n *\n * Sub-classes that call the super with a network without a chainId\n * MUST set this. Standard named networks have a known chainId.\n *\n */\n\n constructor(network: Networkish | Promise) {\n super();\n\n // Events being listened to\n this._events = [];\n\n this._emitted = { block: -2 };\n\n this.disableCcipRead = false;\n\n this.formatter = new.target.getFormatter();\n\n // If network is any, this Provider allows the underlying\n // network to change dynamically, and we auto-detect the\n // current network\n defineReadOnly(this, \"anyNetwork\", (network === \"any\"));\n if (this.anyNetwork) { network = this.detectNetwork(); }\n\n if (network instanceof Promise) {\n this._networkPromise = network;\n\n // Squash any \"unhandled promise\" errors; that do not need to be handled\n network.catch((error) => { });\n\n // Trigger initial network setting (async)\n this._ready().catch((error) => { });\n\n } else {\n const knownNetwork = getStatic<(network: Networkish) => Network>(new.target, \"getNetwork\")(network);\n if (knownNetwork) {\n defineReadOnly(this, \"_network\", knownNetwork);\n this.emit(\"network\", knownNetwork, null);\n\n } else {\n logger.throwArgumentError(\"invalid network\", \"network\", network);\n }\n }\n\n this._maxInternalBlockNumber = -1024;\n\n this._lastBlockNumber = -2;\n this._maxFilterBlockRange = 10;\n\n this._pollingInterval = 4000;\n\n this._fastQueryDate = 0;\n }\n\n async _ready(): Promise {\n if (this._network == null) {\n let network: Network = null;\n if (this._networkPromise) {\n try {\n network = await this._networkPromise;\n } catch (error) { }\n }\n\n // Try the Provider's network detection (this MUST throw if it cannot)\n if (network == null) {\n network = await this.detectNetwork();\n }\n\n // This should never happen; every Provider sub-class should have\n // suggested a network by here (or have thrown).\n if (!network) {\n logger.throwError(\"no network detected\", Logger.errors.UNKNOWN_ERROR, { });\n }\n\n // Possible this call stacked so do not call defineReadOnly again\n if (this._network == null) {\n if (this.anyNetwork) {\n this._network = network;\n } else {\n defineReadOnly(this, \"_network\", network);\n }\n this.emit(\"network\", network, null);\n }\n }\n\n return this._network;\n }\n\n // This will always return the most recently established network.\n // For \"any\", this can change (a \"network\" event is emitted before\n // any change is reflected); otherwise this cannot change\n get ready(): Promise {\n return poll(() => {\n return this._ready().then((network) => {\n return network;\n }, (error) => {\n // If the network isn't running yet, we will wait\n if (error.code === Logger.errors.NETWORK_ERROR && error.event === \"noNetwork\") {\n return undefined;\n }\n throw error;\n });\n });\n }\n\n // @TODO: Remove this and just create a singleton formatter\n static getFormatter(): Formatter {\n if (defaultFormatter == null) {\n defaultFormatter = new Formatter();\n }\n return defaultFormatter;\n }\n\n // @TODO: Remove this and just use getNetwork\n static getNetwork(network: Networkish): Network {\n return getNetwork((network == null) ? \"homestead\": network);\n }\n\n async ccipReadFetch(tx: Transaction, calldata: string, urls: Array): Promise {\n if (this.disableCcipRead || urls.length === 0) { return null; }\n\n const sender = tx.to.toLowerCase();\n const data = calldata.toLowerCase();\n\n const errorMessages: Array = [ ];\n\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n\n // URL expansion\n const href = url.replace(\"{sender}\", sender).replace(\"{data}\", data);\n\n // If no {data} is present, use POST; otherwise GET\n const json: string | null = (url.indexOf(\"{data}\") >= 0) ? null: JSON.stringify({ data, sender });\n\n const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {\n value.status = response.statusCode;\n return value;\n });\n\n if (result.data) { return result.data; }\n\n const errorMessage = (result.message || \"unknown error\");\n\n // 4xx indicates the result is not present; stop\n if (result.status >= 400 && result.status < 500) {\n return logger.throwError(`response not found during CCIP fetch: ${ errorMessage }`, Logger.errors.SERVER_ERROR, { url, errorMessage });\n }\n\n // 5xx indicates server issue; try the next url\n errorMessages.push(errorMessage);\n }\n\n return logger.throwError(`error encountered during CCIP fetch: ${ errorMessages.map((m) => JSON.stringify(m)).join(\", \") }`, Logger.errors.SERVER_ERROR, {\n urls, errorMessages\n });\n }\n\n // Fetches the blockNumber, but will reuse any result that is less\n // than maxAge old or has been requested since the last request\n async _getInternalBlockNumber(maxAge: number): Promise {\n await this._ready();\n\n // Allowing stale data up to maxAge old\n if (maxAge > 0) {\n\n // While there are pending internal block requests...\n while (this._internalBlockNumber) {\n\n // ...\"remember\" which fetch we started with\n const internalBlockNumber = this._internalBlockNumber;\n\n try {\n // Check the result is not too stale\n const result = await internalBlockNumber;\n if ((getTime() - result.respTime) <= maxAge) {\n return result.blockNumber;\n }\n\n // Too old; fetch a new value\n break;\n\n } catch(error) {\n\n // The fetch rejected; if we are the first to get the\n // rejection, drop through so we replace it with a new\n // fetch; all others blocked will then get that fetch\n // which won't match the one they \"remembered\" and loop\n if (this._internalBlockNumber === internalBlockNumber) {\n break;\n }\n }\n }\n }\n\n const reqTime = getTime();\n\n const checkInternalBlockNumber = resolveProperties({\n blockNumber: this.perform(\"getBlockNumber\", { }),\n networkError: this.getNetwork().then((network) => (null), (error) => (error))\n }).then(({ blockNumber, networkError }) => {\n if (networkError) {\n // Unremember this bad internal block number\n if (this._internalBlockNumber === checkInternalBlockNumber) {\n this._internalBlockNumber = null;\n }\n throw networkError;\n }\n\n const respTime = getTime();\n\n blockNumber = BigNumber.from(blockNumber).toNumber();\n if (blockNumber < this._maxInternalBlockNumber) { blockNumber = this._maxInternalBlockNumber; }\n\n this._maxInternalBlockNumber = blockNumber;\n this._setFastBlockNumber(blockNumber); // @TODO: Still need this?\n return { blockNumber, reqTime, respTime };\n });\n\n this._internalBlockNumber = checkInternalBlockNumber;\n\n // Swallow unhandled exceptions; if needed they are handled else where\n checkInternalBlockNumber.catch((error) => {\n // Don't null the dead (rejected) fetch, if it has already been updated\n if (this._internalBlockNumber === checkInternalBlockNumber) {\n this._internalBlockNumber = null;\n }\n });\n\n return (await checkInternalBlockNumber).blockNumber;\n }\n\n async poll(): Promise {\n const pollId = nextPollId++;\n\n // Track all running promises, so we can trigger a post-poll once they are complete\n const runners: Array> = [];\n\n let blockNumber: number = null;\n try {\n blockNumber = await this._getInternalBlockNumber(100 + this.pollingInterval / 2);\n } catch (error) {\n this.emit(\"error\", error);\n return;\n }\n this._setFastBlockNumber(blockNumber);\n\n // Emit a poll event after we have the latest (fast) block number\n this.emit(\"poll\", pollId, blockNumber);\n\n // If the block has not changed, meh.\n if (blockNumber === this._lastBlockNumber) {\n this.emit(\"didPoll\", pollId);\n return;\n }\n\n // First polling cycle, trigger a \"block\" events\n if (this._emitted.block === -2) {\n this._emitted.block = blockNumber - 1;\n }\n\n if (Math.abs(((this._emitted.block)) - blockNumber) > 1000) {\n logger.warn(`network block skew detected; skipping block events (emitted=${ this._emitted.block } blockNumber${ blockNumber })`);\n this.emit(\"error\", logger.makeError(\"network block skew detected\", Logger.errors.NETWORK_ERROR, {\n blockNumber: blockNumber,\n event: \"blockSkew\",\n previousBlockNumber: this._emitted.block\n }));\n this.emit(\"block\", blockNumber);\n\n } else {\n // Notify all listener for each block that has passed\n for (let i = (this._emitted.block) + 1; i <= blockNumber; i++) {\n this.emit(\"block\", i);\n }\n }\n\n // The emitted block was updated, check for obsolete events\n if ((this._emitted.block) !== blockNumber) {\n this._emitted.block = blockNumber;\n\n Object.keys(this._emitted).forEach((key) => {\n // The block event does not expire\n if (key === \"block\") { return; }\n\n // The block we were at when we emitted this event\n const eventBlockNumber = this._emitted[key];\n\n // We cannot garbage collect pending transactions or blocks here\n // They should be garbage collected by the Provider when setting\n // \"pending\" events\n if (eventBlockNumber === \"pending\") { return; }\n\n // Evict any transaction hashes or block hashes over 12 blocks\n // old, since they should not return null anyways\n if (blockNumber - eventBlockNumber > 12) {\n delete this._emitted[key];\n }\n });\n }\n\n // First polling cycle\n if (this._lastBlockNumber === -2) {\n this._lastBlockNumber = blockNumber - 1;\n }\n // Find all transaction hashes we are waiting on\n this._events.forEach((event) => {\n switch (event.type) {\n case \"tx\": {\n const hash = event.hash;\n let runner = this.getTransactionReceipt(hash).then((receipt) => {\n if (!receipt || receipt.blockNumber == null) { return null; }\n this._emitted[\"t:\" + hash] = receipt.blockNumber;\n this.emit(hash, receipt);\n return null;\n }).catch((error: Error) => { this.emit(\"error\", error); });\n\n runners.push(runner);\n\n break;\n }\n\n case \"filter\": {\n // We only allow a single getLogs to be in-flight at a time\n if (!event._inflight) {\n event._inflight = true;\n\n // This is the first filter for this event, so we want to\n // restrict events to events that happened no earlier than now\n if (event._lastBlockNumber === -2) {\n event._lastBlockNumber = blockNumber - 1;\n }\n\n // Filter from the last *known* event; due to load-balancing\n // and some nodes returning updated block numbers before\n // indexing events, a logs result with 0 entries cannot be\n // trusted and we must retry a range which includes it again\n const filter = event.filter;\n filter.fromBlock = event._lastBlockNumber + 1;\n filter.toBlock = blockNumber;\n\n // Prevent fitler ranges from growing too wild, since it is quite\n // likely there just haven't been any events to move the lastBlockNumber.\n const minFromBlock = filter.toBlock - this._maxFilterBlockRange;\n if (minFromBlock > filter.fromBlock) { filter.fromBlock = minFromBlock; }\n\n if (filter.fromBlock < 0) { filter.fromBlock = 0; }\n\n const runner = this.getLogs(filter).then((logs) => {\n // Allow the next getLogs\n event._inflight = false;\n\n if (logs.length === 0) { return; }\n\n logs.forEach((log: Log) => {\n // Only when we get an event for a given block number\n // can we trust the events are indexed\n if (log.blockNumber > event._lastBlockNumber) {\n event._lastBlockNumber = log.blockNumber;\n }\n\n // Make sure we stall requests to fetch blocks and txs\n this._emitted[\"b:\" + log.blockHash] = log.blockNumber;\n this._emitted[\"t:\" + log.transactionHash] = log.blockNumber;\n\n this.emit(filter, log);\n });\n }).catch((error: Error) => {\n this.emit(\"error\", error);\n\n // Allow another getLogs (the range was not updated)\n event._inflight = false;\n });\n runners.push(runner);\n }\n\n break;\n }\n }\n });\n\n this._lastBlockNumber = blockNumber;\n\n // Once all events for this loop have been processed, emit \"didPoll\"\n Promise.all(runners).then(() => {\n this.emit(\"didPoll\", pollId);\n }).catch((error) => { this.emit(\"error\", error); });\n\n return;\n }\n\n // Deprecated; do not use this\n resetEventsBlock(blockNumber: number): void {\n this._lastBlockNumber = blockNumber - 1;\n if (this.polling) { this.poll(); }\n }\n\n get network(): Network {\n return this._network;\n }\n\n // This method should query the network if the underlying network\n // can change, such as when connected to a JSON-RPC backend\n async detectNetwork(): Promise {\n return logger.throwError(\"provider does not support network detection\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"provider.detectNetwork\"\n });\n }\n\n async getNetwork(): Promise {\n const network = await this._ready();\n\n // Make sure we are still connected to the same network; this is\n // only an external call for backends which can have the underlying\n // network change spontaneously\n const currentNetwork = await this.detectNetwork();\n if (network.chainId !== currentNetwork.chainId) {\n\n // We are allowing network changes, things can get complex fast;\n // make sure you know what you are doing if you use \"any\"\n if (this.anyNetwork) {\n this._network = currentNetwork;\n\n // Reset all internal block number guards and caches\n this._lastBlockNumber = -2;\n this._fastBlockNumber = null;\n this._fastBlockNumberPromise = null;\n this._fastQueryDate = 0;\n this._emitted.block = -2;\n this._maxInternalBlockNumber = -1024;\n this._internalBlockNumber = null;\n\n // The \"network\" event MUST happen before this method resolves\n // so any events have a chance to unregister, so we stall an\n // additional event loop before returning from /this/ call\n this.emit(\"network\", currentNetwork, network);\n await stall(0);\n\n return this._network;\n }\n\n const error = logger.makeError(\"underlying network changed\", Logger.errors.NETWORK_ERROR, {\n event: \"changed\",\n network: network,\n detectedNetwork: currentNetwork\n });\n\n this.emit(\"error\", error);\n throw error;\n }\n\n return network;\n }\n\n get blockNumber(): number {\n this._getInternalBlockNumber(100 + this.pollingInterval / 2).then((blockNumber) => {\n this._setFastBlockNumber(blockNumber);\n }, (error) => { });\n\n return (this._fastBlockNumber != null) ? this._fastBlockNumber: -1;\n }\n\n get polling(): boolean {\n return (this._poller != null);\n }\n\n set polling(value: boolean) {\n if (value && !this._poller) {\n this._poller = setInterval(() => { this.poll(); }, this.pollingInterval);\n\n if (!this._bootstrapPoll) {\n this._bootstrapPoll = setTimeout(() => {\n this.poll();\n\n // We block additional polls until the polling interval\n // is done, to prevent overwhelming the poll function\n this._bootstrapPoll = setTimeout(() => {\n // If polling was disabled, something may require a poke\n // since starting the bootstrap poll and it was disabled\n if (!this._poller) { this.poll(); }\n\n // Clear out the bootstrap so we can do another\n this._bootstrapPoll = null;\n }, this.pollingInterval);\n }, 0);\n }\n\n } else if (!value && this._poller) {\n clearInterval(this._poller);\n this._poller = null;\n }\n }\n\n get pollingInterval(): number {\n return this._pollingInterval;\n }\n\n set pollingInterval(value: number) {\n if (typeof(value) !== \"number\" || value <= 0 || parseInt(String(value)) != value) {\n throw new Error(\"invalid polling interval\");\n }\n\n this._pollingInterval = value;\n\n if (this._poller) {\n clearInterval(this._poller);\n this._poller = setInterval(() => { this.poll(); }, this._pollingInterval);\n }\n }\n\n _getFastBlockNumber(): Promise {\n const now = getTime();\n\n // Stale block number, request a newer value\n if ((now - this._fastQueryDate) > 2 * this._pollingInterval) {\n this._fastQueryDate = now;\n this._fastBlockNumberPromise = this.getBlockNumber().then((blockNumber) => {\n if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) {\n this._fastBlockNumber = blockNumber;\n }\n return this._fastBlockNumber;\n });\n }\n\n return this._fastBlockNumberPromise;\n }\n\n _setFastBlockNumber(blockNumber: number): void {\n // Older block, maybe a stale request\n if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { return; }\n\n // Update the time we updated the blocknumber\n this._fastQueryDate = getTime();\n\n // Newer block number, use it\n if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) {\n this._fastBlockNumber = blockNumber;\n this._fastBlockNumberPromise = Promise.resolve(blockNumber);\n }\n }\n\n async waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise {\n return this._waitForTransaction(transactionHash, (confirmations == null) ? 1: confirmations, timeout || 0, null);\n }\n\n async _waitForTransaction(transactionHash: string, confirmations: number, timeout: number, replaceable: { data: string, from: string, nonce: number, to: string, value: BigNumber, startBlock: number }): Promise {\n const receipt = await this.getTransactionReceipt(transactionHash);\n\n // Receipt is already good\n if ((receipt ? receipt.confirmations: 0) >= confirmations) { return receipt; }\n\n // Poll until the receipt is good...\n return new Promise((resolve, reject) => {\n const cancelFuncs: Array<() => void> = [];\n\n let done = false;\n const alreadyDone = function() {\n if (done) { return true; }\n done = true;\n cancelFuncs.forEach((func) => { func(); });\n return false;\n };\n\n const minedHandler = (receipt: TransactionReceipt) => {\n if (receipt.confirmations < confirmations) { return; }\n if (alreadyDone()) { return; }\n resolve(receipt);\n }\n this.on(transactionHash, minedHandler);\n cancelFuncs.push(() => { this.removeListener(transactionHash, minedHandler); });\n\n if (replaceable) {\n let lastBlockNumber = replaceable.startBlock;\n let scannedBlock: number = null;\n const replaceHandler = async (blockNumber: number) => {\n if (done) { return; }\n\n // Wait 1 second; this is only used in the case of a fault, so\n // we will trade off a little bit of latency for more consistent\n // results and fewer JSON-RPC calls\n await stall(1000);\n\n this.getTransactionCount(replaceable.from).then(async (nonce) => {\n if (done) { return; }\n\n if (nonce <= replaceable.nonce) {\n lastBlockNumber = blockNumber;\n\n } else {\n // First check if the transaction was mined\n {\n const mined = await this.getTransaction(transactionHash);\n if (mined && mined.blockNumber != null) { return; }\n }\n\n // First time scanning. We start a little earlier for some\n // wiggle room here to handle the eventually consistent nature\n // of blockchain (e.g. the getTransactionCount was for a\n // different block)\n if (scannedBlock == null) {\n scannedBlock = lastBlockNumber - 3;\n if (scannedBlock < replaceable.startBlock) {\n scannedBlock = replaceable.startBlock;\n }\n }\n\n while (scannedBlock <= blockNumber) {\n if (done) { return; }\n\n const block = await this.getBlockWithTransactions(scannedBlock);\n for (let ti = 0; ti < block.transactions.length; ti++) {\n const tx = block.transactions[ti];\n\n // Successfully mined!\n if (tx.hash === transactionHash) { return; }\n\n // Matches our transaction from and nonce; its a replacement\n if (tx.from === replaceable.from && tx.nonce === replaceable.nonce) {\n if (done) { return; }\n\n // Get the receipt of the replacement\n const receipt = await this.waitForTransaction(tx.hash, confirmations);\n\n // Already resolved or rejected (prolly a timeout)\n if (alreadyDone()) { return; }\n\n // The reason we were replaced\n let reason = \"replaced\";\n if (tx.data === replaceable.data && tx.to === replaceable.to && tx.value.eq(replaceable.value)) {\n reason = \"repriced\";\n } else if (tx.data === \"0x\" && tx.from === tx.to && tx.value.isZero()) {\n reason = \"cancelled\"\n }\n\n // Explain why we were replaced\n reject(logger.makeError(\"transaction was replaced\", Logger.errors.TRANSACTION_REPLACED, {\n cancelled: (reason === \"replaced\" || reason === \"cancelled\"),\n reason,\n replacement: this._wrapTransaction(tx),\n hash: transactionHash,\n receipt\n }));\n\n return;\n }\n }\n scannedBlock++;\n }\n }\n\n if (done) { return; }\n this.once(\"block\", replaceHandler);\n\n }, (error) => {\n if (done) { return; }\n this.once(\"block\", replaceHandler);\n });\n };\n\n if (done) { return; }\n this.once(\"block\", replaceHandler);\n\n cancelFuncs.push(() => {\n this.removeListener(\"block\", replaceHandler);\n });\n }\n\n if (typeof(timeout) === \"number\" && timeout > 0) {\n const timer = setTimeout(() => {\n if (alreadyDone()) { return; }\n reject(logger.makeError(\"timeout exceeded\", Logger.errors.TIMEOUT, { timeout: timeout }));\n }, timeout);\n if (timer.unref) { timer.unref(); }\n\n cancelFuncs.push(() => { clearTimeout(timer); });\n }\n });\n }\n\n async getBlockNumber(): Promise {\n return this._getInternalBlockNumber(0);\n }\n\n async getGasPrice(): Promise {\n await this.getNetwork();\n\n const result = await this.perform(\"getGasPrice\", { });\n try {\n return BigNumber.from(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getGasPrice\",\n result, error\n });\n }\n }\n\n async getBalance(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag)\n });\n\n const result = await this.perform(\"getBalance\", params);\n try {\n return BigNumber.from(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getBalance\",\n params, result, error\n });\n }\n }\n\n async getTransactionCount(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag)\n });\n\n const result = await this.perform(\"getTransactionCount\", params);\n try {\n return BigNumber.from(result).toNumber();\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getTransactionCount\",\n params, result, error\n });\n }\n }\n\n async getCode(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag)\n });\n\n const result = await this.perform(\"getCode\", params);\n try {\n return hexlify(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getCode\",\n params, result, error\n });\n }\n }\n\n async getStorageAt(addressOrName: string | Promise, position: BigNumberish | Promise, blockTag?: BlockTag | Promise): Promise {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag),\n position: Promise.resolve(position).then((p) => hexValue(p))\n });\n const result = await this.perform(\"getStorageAt\", params);\n try {\n return hexlify(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getStorageAt\",\n params, result, error\n });\n }\n }\n\n // This should be called by any subclass wrapping a TransactionResponse\n _wrapTransaction(tx: Transaction, hash?: string, startBlock?: number): TransactionResponse {\n if (hash != null && hexDataLength(hash) !== 32) { throw new Error(\"invalid response - sendTransaction\"); }\n\n const result = tx;\n\n // Check the hash we expect is the same as the hash the server reported\n if (hash != null && tx.hash !== hash) {\n logger.throwError(\"Transaction hash mismatch from Provider.sendTransaction.\", Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n\n result.wait = async (confirms?: number, timeout?: number) => {\n if (confirms == null) { confirms = 1; }\n if (timeout == null) { timeout = 0; }\n\n // Get the details to detect replacement\n let replacement = undefined;\n if (confirms !== 0 && startBlock != null) {\n replacement = {\n data: tx.data,\n from: tx.from,\n nonce: tx.nonce,\n to: tx.to,\n value: tx.value,\n startBlock\n };\n }\n\n const receipt = await this._waitForTransaction(tx.hash, confirms, timeout, replacement);\n if (receipt == null && confirms === 0) { return null; }\n\n // No longer pending, allow the polling loop to garbage collect this\n this._emitted[\"t:\" + tx.hash] = receipt.blockNumber;\n\n if (receipt.status === 0) {\n logger.throwError(\"transaction failed\", Logger.errors.CALL_EXCEPTION, {\n transactionHash: tx.hash,\n transaction: tx,\n receipt: receipt\n });\n }\n return receipt;\n };\n\n return result;\n }\n\n async sendTransaction(signedTransaction: string | Promise): Promise {\n await this.getNetwork();\n const hexTx = await Promise.resolve(signedTransaction).then(t => hexlify(t));\n const tx = this.formatter.transaction(signedTransaction);\n if (tx.confirmations == null) { tx.confirmations = 0; }\n const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n try {\n const hash = await this.perform(\"sendTransaction\", { signedTransaction: hexTx });\n return this._wrapTransaction(tx, hash, blockNumber);\n } catch (error) {\n (error).transaction = tx;\n (error).transactionHash = tx.hash;\n throw error;\n }\n }\n\n async _getTransactionRequest(transaction: Deferrable): Promise {\n const values: any = await transaction;\n\n const tx: any = { };\n\n [\"from\", \"to\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => (v ? this._getAddress(v): null))\n });\n\n [\"gasLimit\", \"gasPrice\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"value\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => (v ? BigNumber.from(v): null));\n });\n\n [\"type\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => ((v != null) ? v: null));\n });\n\n if (values.accessList) {\n tx.accessList = this.formatter.accessList(values.accessList);\n }\n\n [\"data\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => (v ? hexlify(v): null));\n });\n\n return this.formatter.transactionRequest(await resolveProperties(tx));\n }\n\n async _getFilter(filter: Filter | FilterByBlockHash | Promise): Promise {\n filter = await filter;\n\n const result: any = { };\n\n if (filter.address != null) {\n result.address = this._getAddress(filter.address);\n }\n\n [\"blockHash\", \"topics\"].forEach((key) => {\n if ((filter)[key] == null) { return; }\n result[key] = (filter)[key];\n });\n\n [\"fromBlock\", \"toBlock\"].forEach((key) => {\n if ((filter)[key] == null) { return; }\n result[key] = this._getBlockTag((filter)[key]);\n });\n\n return this.formatter.filter(await resolveProperties(result));\n }\n\n async _call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise {\n if (attempt >= MAX_CCIP_REDIRECTS) {\n logger.throwError(\"CCIP read exceeded maximum redirections\", Logger.errors.SERVER_ERROR, {\n redirects: attempt, transaction\n });\n }\n\n const txSender = transaction.to;\n\n const result = await this.perform(\"call\", { transaction, blockTag });\n\n // CCIP Read request via OffchainLookup(address,string[],bytes,bytes4,bytes)\n if (attempt >= 0 && blockTag === \"latest\" && txSender != null && result.substring(0, 10) === \"0x556f1830\" && (hexDataLength(result) % 32 === 4)) {\n try {\n const data = hexDataSlice(result, 4);\n\n // Check the sender of the OffchainLookup matches the transaction\n const sender = hexDataSlice(data, 0, 32);\n if (!BigNumber.from(sender).eq(txSender)) {\n logger.throwError(\"CCIP Read sender did not match\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n\n // Read the URLs from the response\n const urls: Array = [];\n const urlsOffset = BigNumber.from(hexDataSlice(data, 32, 64)).toNumber();\n const urlsLength = BigNumber.from(hexDataSlice(data, urlsOffset, urlsOffset + 32)).toNumber();\n const urlsData = hexDataSlice(data, urlsOffset + 32);\n for (let u = 0; u < urlsLength; u++) {\n const url = _parseString(urlsData, u * 32);\n if (url == null) {\n logger.throwError(\"CCIP Read contained corrupt URL string\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n urls.push(url);\n }\n\n // Get the CCIP calldata to forward\n const calldata = _parseBytes(data, 64);\n\n // Get the callbackSelector (bytes4)\n if (!BigNumber.from(hexDataSlice(data, 100, 128)).isZero()) {\n logger.throwError(\"CCIP Read callback selector included junk\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n const callbackSelector = hexDataSlice(data, 96, 100);\n\n // Get the extra data to send back to the contract as context\n const extraData = _parseBytes(data, 128);\n\n const ccipResult = await this.ccipReadFetch(transaction, calldata, urls);\n if (ccipResult == null) {\n logger.throwError(\"CCIP Read disabled or provided no URLs\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n\n const tx = {\n to: txSender,\n data: hexConcat([ callbackSelector, encodeBytes([ ccipResult, extraData ]) ])\n };\n\n return this._call(tx, blockTag, attempt + 1);\n\n } catch (error) {\n if (error.code === Logger.errors.SERVER_ERROR) { throw error; }\n }\n }\n\n try {\n return hexlify(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"call\",\n params: { transaction, blockTag }, result, error\n });\n }\n\n }\n\n async call(transaction: Deferrable, blockTag?: BlockTag | Promise): Promise {\n await this.getNetwork();\n const resolved = await resolveProperties({\n transaction: this._getTransactionRequest(transaction),\n blockTag: this._getBlockTag(blockTag),\n ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled)\n });\n return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0: -1);\n }\n\n async estimateGas(transaction: Deferrable): Promise {\n await this.getNetwork();\n const params = await resolveProperties({\n transaction: this._getTransactionRequest(transaction)\n });\n\n const result = await this.perform(\"estimateGas\", params);\n try {\n return BigNumber.from(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"estimateGas\",\n params, result, error\n });\n }\n }\n\n async _getAddress(addressOrName: string | Promise): Promise {\n addressOrName = await addressOrName;\n if (typeof(addressOrName) !== \"string\") {\n logger.throwArgumentError(\"invalid address or ENS name\", \"name\", addressOrName);\n }\n\n const address = await this.resolveName(addressOrName);\n if (address == null) {\n logger.throwError(\"ENS name not configured\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: `resolveName(${ JSON.stringify(addressOrName) })`\n });\n }\n return address;\n }\n\n async _getBlock(blockHashOrBlockTag: BlockTag | string | Promise, includeTransactions?: boolean): Promise {\n await this.getNetwork();\n\n blockHashOrBlockTag = await blockHashOrBlockTag;\n\n // If blockTag is a number (not \"latest\", etc), this is the block number\n let blockNumber = -128;\n\n const params: { [key: string]: any } = {\n includeTransactions: !!includeTransactions\n };\n\n if (isHexString(blockHashOrBlockTag, 32)) {\n params.blockHash = blockHashOrBlockTag;\n } else {\n try {\n params.blockTag = await this._getBlockTag(blockHashOrBlockTag);\n if (isHexString(params.blockTag)) {\n blockNumber = parseInt(params.blockTag.substring(2), 16);\n }\n } catch (error) {\n logger.throwArgumentError(\"invalid block hash or block tag\", \"blockHashOrBlockTag\", blockHashOrBlockTag);\n }\n }\n\n return poll(async () => {\n const block = await this.perform(\"getBlock\", params);\n\n // Block was not found\n if (block == null) {\n\n // For blockhashes, if we didn't say it existed, that blockhash may\n // not exist. If we did see it though, perhaps from a log, we know\n // it exists, and this node is just not caught up yet.\n if (params.blockHash != null) {\n if (this._emitted[\"b:\" + params.blockHash] == null) { return null; }\n }\n\n // For block tags, if we are asking for a future block, we return null\n if (params.blockTag != null) {\n if (blockNumber > this._emitted.block) { return null; }\n }\n\n // Retry on the next block\n return undefined;\n }\n\n // Add transactions\n if (includeTransactions) {\n let blockNumber: number = null;\n for (let i = 0; i < block.transactions.length; i++) {\n const tx = block.transactions[i];\n if (tx.blockNumber == null) {\n tx.confirmations = 0;\n\n } else if (tx.confirmations == null) {\n if (blockNumber == null) {\n blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n }\n\n // Add the confirmations using the fast block number (pessimistic)\n let confirmations = (blockNumber - tx.blockNumber) + 1;\n if (confirmations <= 0) { confirmations = 1; }\n tx.confirmations = confirmations;\n }\n }\n\n const blockWithTxs: any = this.formatter.blockWithTransactions(block);\n blockWithTxs.transactions = blockWithTxs.transactions.map((tx: TransactionResponse) => this._wrapTransaction(tx));\n return blockWithTxs;\n }\n\n return this.formatter.block(block);\n\n }, { oncePoll: this });\n }\n\n getBlock(blockHashOrBlockTag: BlockTag | string | Promise): Promise {\n return >(this._getBlock(blockHashOrBlockTag, false));\n }\n\n getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise): Promise {\n return >(this._getBlock(blockHashOrBlockTag, true));\n }\n\n async getTransaction(transactionHash: string | Promise): Promise {\n await this.getNetwork();\n transactionHash = await transactionHash;\n\n const params = { transactionHash: this.formatter.hash(transactionHash, true) };\n\n return poll(async () => {\n const result = await this.perform(\"getTransaction\", params);\n\n if (result == null) {\n if (this._emitted[\"t:\" + transactionHash] == null) {\n return null;\n }\n return undefined;\n }\n\n const tx = this.formatter.transactionResponse(result);\n\n if (tx.blockNumber == null) {\n tx.confirmations = 0;\n\n } else if (tx.confirmations == null) {\n const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n\n // Add the confirmations using the fast block number (pessimistic)\n let confirmations = (blockNumber - tx.blockNumber) + 1;\n if (confirmations <= 0) { confirmations = 1; }\n tx.confirmations = confirmations;\n }\n\n return this._wrapTransaction(tx);\n }, { oncePoll: this });\n }\n\n async getTransactionReceipt(transactionHash: string | Promise): Promise {\n await this.getNetwork();\n\n transactionHash = await transactionHash;\n\n const params = { transactionHash: this.formatter.hash(transactionHash, true) };\n\n return poll(async () => {\n const result = await this.perform(\"getTransactionReceipt\", params);\n\n if (result == null) {\n if (this._emitted[\"t:\" + transactionHash] == null) {\n return null;\n }\n return undefined;\n }\n\n // \"geth-etc\" returns receipts before they are ready\n if (result.blockHash == null) { return undefined; }\n\n const receipt = this.formatter.receipt(result);\n\n if (receipt.blockNumber == null) {\n receipt.confirmations = 0;\n\n } else if (receipt.confirmations == null) {\n const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n\n // Add the confirmations using the fast block number (pessimistic)\n let confirmations = (blockNumber - receipt.blockNumber) + 1;\n if (confirmations <= 0) { confirmations = 1; }\n receipt.confirmations = confirmations;\n }\n\n return receipt;\n }, { oncePoll: this });\n }\n\n async getLogs(filter: Filter | FilterByBlockHash | Promise): Promise> {\n await this.getNetwork();\n const params = await resolveProperties({ filter: this._getFilter(filter) });\n const logs: Array = await this.perform(\"getLogs\", params);\n logs.forEach((log) => {\n if (log.removed == null) { log.removed = false; }\n });\n return Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs);\n }\n\n async getEtherPrice(): Promise {\n await this.getNetwork();\n return this.perform(\"getEtherPrice\", { });\n }\n\n async _getBlockTag(blockTag: BlockTag | Promise): Promise {\n blockTag = await blockTag;\n\n if (typeof(blockTag) === \"number\" && blockTag < 0) {\n if (blockTag % 1) {\n logger.throwArgumentError(\"invalid BlockTag\", \"blockTag\", blockTag);\n }\n\n let blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n blockNumber += blockTag;\n if (blockNumber < 0) { blockNumber = 0; }\n return this.formatter.blockTag(blockNumber)\n }\n\n return this.formatter.blockTag(blockTag);\n }\n\n\n async getResolver(name: string): Promise {\n let currentName = name;\n while (true) {\n if (currentName === \"\" || currentName === \".\") { return null; }\n\n // Optimization since the eth node cannot change and does\n // not have a wildcard resolver\n if (name !== \"eth\" && currentName === \"eth\") { return null; }\n\n // Check the current node for a resolver\n const addr = await this._getResolver(currentName, \"getResolver\");\n\n // Found a resolver!\n if (addr != null) {\n const resolver = new Resolver(this, addr, name);\n\n // Legacy resolver found, using EIP-2544 so it isn't safe to use\n if (currentName !== name && !(await resolver.supportsWildcard())) { return null; }\n\n return resolver;\n }\n\n // Get the parent node\n currentName = currentName.split(\".\").slice(1).join(\".\");\n }\n\n }\n\n async _getResolver(name: string, operation?: string): Promise {\n if (operation == null) { operation = \"ENS\"; }\n\n const network = await this.getNetwork();\n\n // No ENS...\n if (!network.ensAddress) {\n logger.throwError(\n \"network does not support ENS\",\n Logger.errors.UNSUPPORTED_OPERATION,\n { operation, network: network.name }\n );\n }\n\n try {\n // keccak256(\"resolver(bytes32)\")\n const addrData = await this.call({\n to: network.ensAddress,\n data: (\"0x0178b8bf\" + namehash(name).substring(2))\n });\n return this.formatter.callAddress(addrData);\n } catch (error) {\n // ENS registry cannot throw errors on resolver(bytes32)\n }\n\n return null;\n }\n\n async resolveName(name: string | Promise): Promise {\n name = await name;\n\n // If it is already an address, nothing to resolve\n try {\n return Promise.resolve(this.formatter.address(name));\n } catch (error) {\n // If is is a hexstring, the address is bad (See #694)\n if (isHexString(name)) { throw error; }\n }\n\n if (typeof(name) !== \"string\") {\n logger.throwArgumentError(\"invalid ENS name\", \"name\", name);\n }\n\n // Get the addr from the resolver\n const resolver = await this.getResolver(name);\n if (!resolver) { return null; }\n\n return await resolver.getAddress();\n }\n\n async lookupAddress(address: string | Promise): Promise {\n address = await address;\n address = this.formatter.address(address);\n\n const node = address.substring(2).toLowerCase() + \".addr.reverse\";\n\n const resolverAddr = await this._getResolver(node, \"lookupAddress\");\n if (resolverAddr == null) { return null; }\n\n // keccak(\"name(bytes32)\")\n const name = _parseString(await this.call({\n to: resolverAddr,\n data: (\"0x691f3431\" + namehash(node).substring(2))\n }), 0);\n\n const addr = await this.resolveName(name);\n if (addr != address) { return null; }\n\n return name;\n }\n\n async getAvatar(nameOrAddress: string): Promise {\n let resolver: Resolver = null;\n if (isHexString(nameOrAddress)) {\n // Address; reverse lookup\n const address = this.formatter.address(nameOrAddress);\n\n const node = address.substring(2).toLowerCase() + \".addr.reverse\";\n\n const resolverAddress = await this._getResolver(node, \"getAvatar\");\n if (!resolverAddress) { return null; }\n\n // Try resolving the avatar against the addr.reverse resolver\n resolver = new Resolver(this, resolverAddress, node);\n try {\n const avatar = await resolver.getAvatar();\n if (avatar) { return avatar.url; }\n } catch (error) {\n if (error.code !== Logger.errors.CALL_EXCEPTION) { throw error; }\n }\n\n // Try getting the name and performing forward lookup; allowing wildcards\n try {\n // keccak(\"name(bytes32)\")\n const name = _parseString(await this.call({\n to: resolverAddress,\n data: (\"0x691f3431\" + namehash(node).substring(2))\n }), 0);\n resolver = await this.getResolver(name);\n } catch (error) {\n if (error.code !== Logger.errors.CALL_EXCEPTION) { throw error; }\n return null;\n }\n\n } else {\n // ENS name; forward lookup with wildcard\n resolver = await this.getResolver(nameOrAddress);\n if (!resolver) { return null; }\n }\n\n const avatar = await resolver.getAvatar();\n if (avatar == null) { return null; }\n\n return avatar.url;\n }\n\n perform(method: string, params: any): Promise {\n return logger.throwError(method + \" not implemented\", Logger.errors.NOT_IMPLEMENTED, { operation: method });\n }\n\n _startEvent(event: Event): void {\n this.polling = (this._events.filter((e) => e.pollable()).length > 0);\n }\n\n _stopEvent(event: Event): void {\n this.polling = (this._events.filter((e) => e.pollable()).length > 0);\n }\n\n _addEventListener(eventName: EventType, listener: Listener, once: boolean): this {\n const event = new Event(getEventTag(eventName), listener, once)\n this._events.push(event);\n this._startEvent(event);\n\n return this;\n }\n\n on(eventName: EventType, listener: Listener): this {\n return this._addEventListener(eventName, listener, false);\n }\n\n once(eventName: EventType, listener: Listener): this {\n return this._addEventListener(eventName, listener, true);\n }\n\n\n emit(eventName: EventType, ...args: Array): boolean {\n let result = false;\n\n let stopped: Array = [ ];\n\n let eventTag = getEventTag(eventName);\n this._events = this._events.filter((event) => {\n if (event.tag !== eventTag) { return true; }\n\n setTimeout(() => {\n event.listener.apply(this, args);\n }, 0);\n\n result = true;\n\n if (event.once) {\n stopped.push(event);\n return false;\n }\n\n return true;\n });\n\n stopped.forEach((event) => { this._stopEvent(event); });\n\n return result;\n }\n\n listenerCount(eventName?: EventType): number {\n if (!eventName) { return this._events.length; }\n\n let eventTag = getEventTag(eventName);\n return this._events.filter((event) => {\n return (event.tag === eventTag);\n }).length;\n }\n\n listeners(eventName?: EventType): Array {\n if (eventName == null) {\n return this._events.map((event) => event.listener);\n }\n\n let eventTag = getEventTag(eventName);\n return this._events\n .filter((event) => (event.tag === eventTag))\n .map((event) => event.listener);\n }\n\n off(eventName: EventType, listener?: Listener): this {\n if (listener == null) {\n return this.removeAllListeners(eventName);\n }\n\n const stopped: Array = [ ];\n\n let found = false;\n\n let eventTag = getEventTag(eventName);\n this._events = this._events.filter((event) => {\n if (event.tag !== eventTag || event.listener != listener) { return true; }\n if (found) { return true; }\n found = true;\n stopped.push(event);\n return false;\n });\n\n stopped.forEach((event) => { this._stopEvent(event); });\n\n return this;\n }\n\n removeAllListeners(eventName?: EventType): this {\n let stopped: Array = [ ];\n if (eventName == null) {\n stopped = this._events;\n\n this._events = [ ];\n } else {\n const eventTag = getEventTag(eventName);\n this._events = this._events.filter((event) => {\n if (event.tag !== eventTag) { return true; }\n stopped.push(event);\n return false;\n });\n }\n\n stopped.forEach((event) => { this._stopEvent(event); });\n\n return this;\n }\n}\n","\"use strict\";\n\n// See: https://github.com/ethereum/wiki/wiki/JSON-RPC\n\nimport { Provider, TransactionRequest, TransactionResponse } from \"@ethersproject/abstract-provider\";\nimport { Signer, TypedDataDomain, TypedDataField, TypedDataSigner } from \"@ethersproject/abstract-signer\";\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { Bytes, hexlify, hexValue, hexZeroPad, isHexString } from \"@ethersproject/bytes\";\nimport { _TypedDataEncoder } from \"@ethersproject/hash\";\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { checkProperties, deepCopy, Deferrable, defineReadOnly, getStatic, resolveProperties, shallowCopy } from \"@ethersproject/properties\";\nimport { toUtf8Bytes } from \"@ethersproject/strings\";\nimport { AccessList, accessListify } from \"@ethersproject/transactions\";\nimport { ConnectionInfo, fetchJson, poll } from \"@ethersproject/web\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { BaseProvider, Event } from \"./base-provider\";\n\n\nconst errorGas = [ \"call\", \"estimateGas\" ];\n\nfunction spelunk(value: any, requireData: boolean): null | { message: string, data: null | string } {\n if (value == null) { return null; }\n\n // These *are* the droids we're looking for.\n if (typeof(value.message) === \"string\" && value.message.match(\"reverted\")) {\n const data = isHexString(value.data) ? value.data: null;\n if (!requireData || data) {\n return { message: value.message, data };\n }\n }\n\n // Spelunk further...\n if (typeof(value) === \"object\") {\n for (const key in value) {\n const result = spelunk(value[key], requireData);\n if (result) { return result; }\n }\n return null;\n }\n\n // Might be a JSON string we can further descend...\n if (typeof(value) === \"string\") {\n try {\n return spelunk(JSON.parse(value), requireData);\n } catch (error) { }\n }\n\n return null;\n}\n\nfunction checkError(method: string, error: any, params: any): any {\n\n const transaction = params.transaction || params.signedTransaction;\n\n // Undo the \"convenience\" some nodes are attempting to prevent backwards\n // incompatibility; maybe for v6 consider forwarding reverts as errors\n if (method === \"call\") {\n const result = spelunk(error, true);\n if (result) { return result.data; }\n\n // Nothing descriptive..\n logger.throwError(\"missing revert data in call exception; Transaction reverted without a reason string\", Logger.errors.CALL_EXCEPTION, {\n data: \"0x\", transaction, error\n });\n }\n\n if (method === \"estimateGas\") {\n // Try to find something, with a preference on SERVER_ERROR body\n let result = spelunk(error.body, false);\n if (result == null) { result = spelunk(error, false); }\n\n // Found \"reverted\", this is a CALL_EXCEPTION\n if (result) {\n logger.throwError(\"cannot estimate gas; transaction may fail or may require manual gas limit\", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {\n reason: result.message, method, transaction, error\n });\n }\n }\n\n // @TODO: Should we spelunk for message too?\n\n let message = error.message;\n if (error.code === Logger.errors.SERVER_ERROR && error.error && typeof(error.error.message) === \"string\") {\n message = error.error.message;\n } else if (typeof(error.body) === \"string\") {\n message = error.body;\n } else if (typeof(error.responseText) === \"string\") {\n message = error.responseText;\n }\n message = (message || \"\").toLowerCase();\n\n // \"insufficient funds for gas * price + value + cost(data)\"\n if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {\n logger.throwError(\"insufficient funds for intrinsic transaction cost\", Logger.errors.INSUFFICIENT_FUNDS, {\n error, method, transaction\n });\n }\n\n // \"nonce too low\"\n if (message.match(/nonce (is )?too low/i)) {\n logger.throwError(\"nonce has already been used\", Logger.errors.NONCE_EXPIRED, {\n error, method, transaction\n });\n }\n\n // \"replacement transaction underpriced\"\n if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) {\n logger.throwError(\"replacement fee too low\", Logger.errors.REPLACEMENT_UNDERPRICED, {\n error, method, transaction\n });\n }\n\n // \"replacement transaction underpriced\"\n if (message.match(/only replay-protected/i)) {\n logger.throwError(\"legacy pre-eip-155 transactions not supported\", Logger.errors.UNSUPPORTED_OPERATION, {\n error, method, transaction\n });\n }\n\n if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted/)) {\n logger.throwError(\"cannot estimate gas; transaction may fail or may require manual gas limit\", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {\n error, method, transaction\n });\n }\n\n throw error;\n}\n\nfunction timer(timeout: number): Promise {\n return new Promise(function(resolve) {\n setTimeout(resolve, timeout);\n });\n}\n\nfunction getResult(payload: { error?: { code?: number, data?: any, message?: string }, result?: any }): any {\n if (payload.error) {\n // @TODO: not any\n const error: any = new Error(payload.error.message);\n error.code = payload.error.code;\n error.data = payload.error.data;\n throw error;\n }\n\n return payload.result;\n}\n\nfunction getLowerCase(value: string): string {\n if (value) { return value.toLowerCase(); }\n return value;\n}\n\nconst _constructorGuard = {};\n\nexport class JsonRpcSigner extends Signer implements TypedDataSigner {\n readonly provider: JsonRpcProvider;\n _index: number;\n _address: string;\n\n constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number) {\n super();\n\n if (constructorGuard !== _constructorGuard) {\n throw new Error(\"do not call the JsonRpcSigner constructor directly; use provider.getSigner\");\n }\n\n defineReadOnly(this, \"provider\", provider);\n\n if (addressOrIndex == null) { addressOrIndex = 0; }\n\n if (typeof(addressOrIndex) === \"string\") {\n defineReadOnly(this, \"_address\", this.provider.formatter.address(addressOrIndex));\n defineReadOnly(this, \"_index\", null);\n\n } else if (typeof(addressOrIndex) === \"number\") {\n defineReadOnly(this, \"_index\", addressOrIndex);\n defineReadOnly(this, \"_address\", null);\n\n } else {\n logger.throwArgumentError(\"invalid address or index\", \"addressOrIndex\", addressOrIndex);\n }\n }\n\n connect(provider: Provider): JsonRpcSigner {\n return logger.throwError(\"cannot alter JSON-RPC Signer connection\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"connect\"\n });\n }\n\n connectUnchecked(): JsonRpcSigner {\n return new UncheckedJsonRpcSigner(_constructorGuard, this.provider, this._address || this._index);\n }\n\n getAddress(): Promise {\n if (this._address) {\n return Promise.resolve(this._address);\n }\n\n return this.provider.send(\"eth_accounts\", []).then((accounts) => {\n if (accounts.length <= this._index) {\n logger.throwError(\"unknown account #\" + this._index, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"getAddress\"\n });\n }\n return this.provider.formatter.address(accounts[this._index])\n });\n }\n\n sendUncheckedTransaction(transaction: Deferrable): Promise {\n transaction = shallowCopy(transaction);\n\n const fromAddress = this.getAddress().then((address) => {\n if (address) { address = address.toLowerCase(); }\n return address;\n });\n\n // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user\n // wishes to use this, it is easy to specify explicitly, otherwise\n // we look it up for them.\n if (transaction.gasLimit == null) {\n const estimate = shallowCopy(transaction);\n estimate.from = fromAddress;\n transaction.gasLimit = this.provider.estimateGas(estimate);\n }\n\n if (transaction.to != null) {\n transaction.to = Promise.resolve(transaction.to).then(async (to) => {\n if (to == null) { return null; }\n const address = await this.provider.resolveName(to);\n if (address == null) {\n logger.throwArgumentError(\"provided ENS name resolves to null\", \"tx.to\", to);\n }\n return address;\n });\n }\n\n return resolveProperties({\n tx: resolveProperties(transaction),\n sender: fromAddress\n }).then(({ tx, sender }) => {\n\n if (tx.from != null) {\n if (tx.from.toLowerCase() !== sender) {\n logger.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n } else {\n tx.from = sender;\n }\n\n const hexTx = (this.provider.constructor).hexlifyTransaction(tx, { from: true });\n\n return this.provider.send(\"eth_sendTransaction\", [ hexTx ]).then((hash) => {\n return hash;\n }, (error) => {\n if (typeof(error.message) === \"string\" && error.message.match(/user denied/i)) {\n logger.throwError(\"user rejected transaction\", Logger.errors.ACTION_REJECTED, {\n action: \"sendTransaction\",\n transaction: tx\n });\n }\n\n return checkError(\"sendTransaction\", error, hexTx);\n });\n });\n }\n\n signTransaction(transaction: Deferrable): Promise {\n return logger.throwError(\"signing transactions is unsupported\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"signTransaction\"\n });\n }\n\n async sendTransaction(transaction: Deferrable): Promise {\n // This cannot be mined any earlier than any recent block\n const blockNumber = await this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval);\n\n // Send the transaction\n const hash = await this.sendUncheckedTransaction(transaction);\n\n try {\n // Unfortunately, JSON-RPC only provides and opaque transaction hash\n // for a response, and we need the actual transaction, so we poll\n // for it; it should show up very quickly\n return await poll(async () => {\n const tx = await this.provider.getTransaction(hash);\n if (tx === null) { return undefined; }\n return this.provider._wrapTransaction(tx, hash, blockNumber);\n }, { oncePoll: this.provider });\n } catch (error) {\n (error).transactionHash = hash;\n throw error;\n }\n }\n\n async signMessage(message: Bytes | string): Promise {\n const data = ((typeof(message) === \"string\") ? toUtf8Bytes(message): message);\n const address = await this.getAddress();\n\n\n try {\n return await this.provider.send(\"personal_sign\", [ hexlify(data), address.toLowerCase() ]);\n } catch (error) {\n if (typeof(error.message) === \"string\" && error.message.match(/user denied/i)) {\n logger.throwError(\"user rejected signing\", Logger.errors.ACTION_REJECTED, {\n action: \"signMessage\",\n from: address,\n message: data\n });\n }\n throw error;\n }\n }\n\n async _legacySignMessage(message: Bytes | string): Promise {\n const data = ((typeof(message) === \"string\") ? toUtf8Bytes(message): message);\n const address = await this.getAddress();\n\n try {\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n return await this.provider.send(\"eth_sign\", [ address.toLowerCase(), hexlify(data) ]);\n } catch (error) {\n if (typeof(error.message) === \"string\" && error.message.match(/user denied/i)) {\n logger.throwError(\"user rejected signing\", Logger.errors.ACTION_REJECTED, {\n action: \"_legacySignMessage\",\n from: address,\n message: data\n });\n }\n throw error;\n }\n }\n\n async _signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise {\n // Populate any ENS names (in-place)\n const populated = await _TypedDataEncoder.resolveNames(domain, types, value, (name: string) => {\n return this.provider.resolveName(name);\n });\n\n const address = await this.getAddress();\n\n try {\n return await this.provider.send(\"eth_signTypedData_v4\", [\n address.toLowerCase(),\n JSON.stringify(_TypedDataEncoder.getPayload(populated.domain, types, populated.value))\n ]);\n } catch (error) {\n if (typeof(error.message) === \"string\" && error.message.match(/user denied/i)) {\n logger.throwError(\"user rejected signing\", Logger.errors.ACTION_REJECTED, {\n action: \"_signTypedData\",\n from: address,\n message: { domain: populated.domain, types, value: populated.value }\n });\n }\n throw error;\n }\n }\n\n async unlock(password: string): Promise {\n const provider = this.provider;\n\n const address = await this.getAddress();\n\n return provider.send(\"personal_unlockAccount\", [ address.toLowerCase(), password, null ]);\n }\n}\n\nclass UncheckedJsonRpcSigner extends JsonRpcSigner {\n sendTransaction(transaction: Deferrable): Promise {\n return this.sendUncheckedTransaction(transaction).then((hash) => {\n return {\n hash: hash,\n nonce: null,\n gasLimit: null,\n gasPrice: null,\n data: null,\n value: null,\n chainId: null,\n confirmations: 0,\n from: null,\n wait: (confirmations?: number) => { return this.provider.waitForTransaction(hash, confirmations); }\n };\n });\n }\n}\n\nconst allowedTransactionKeys: { [ key: string ]: boolean } = {\n chainId: true, data: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true,\n type: true, accessList: true,\n maxFeePerGas: true, maxPriorityFeePerGas: true\n}\n\nexport class JsonRpcProvider extends BaseProvider {\n readonly connection: ConnectionInfo;\n\n _pendingFilter: Promise;\n _nextId: number;\n\n // During any given event loop, the results for a given call will\n // all be the same, so we can dedup the calls to save requests and\n // bandwidth. @TODO: Try out generalizing this against send?\n _eventLoopCache: Record>;\n get _cache(): Record> {\n if (this._eventLoopCache == null) {\n this._eventLoopCache = { };\n }\n return this._eventLoopCache;\n }\n\n constructor(url?: ConnectionInfo | string, network?: Networkish) {\n let networkOrReady: Networkish | Promise = network;\n\n // The network is unknown, query the JSON-RPC for it\n if (networkOrReady == null) {\n networkOrReady = new Promise((resolve, reject) => {\n setTimeout(() => {\n this.detectNetwork().then((network) => {\n resolve(network);\n }, (error) => {\n reject(error);\n });\n }, 0);\n });\n }\n\n super(networkOrReady);\n\n // Default URL\n if (!url) { url = getStatic<() => string>(this.constructor, \"defaultUrl\")(); }\n\n if (typeof(url) === \"string\") {\n defineReadOnly(this, \"connection\",Object.freeze({\n url: url\n }));\n } else {\n defineReadOnly(this, \"connection\", Object.freeze(shallowCopy(url)));\n }\n\n this._nextId = 42;\n }\n\n static defaultUrl(): string {\n return \"http:/\\/localhost:8545\";\n }\n\n detectNetwork(): Promise {\n if (!this._cache[\"detectNetwork\"]) {\n this._cache[\"detectNetwork\"] = this._uncachedDetectNetwork();\n\n // Clear this cache at the beginning of the next event loop\n setTimeout(() => {\n this._cache[\"detectNetwork\"] = null;\n }, 0);\n }\n return this._cache[\"detectNetwork\"];\n }\n\n async _uncachedDetectNetwork(): Promise {\n await timer(0);\n\n let chainId = null;\n try {\n chainId = await this.send(\"eth_chainId\", [ ]);\n } catch (error) {\n try {\n chainId = await this.send(\"net_version\", [ ]);\n } catch (error) { }\n }\n\n if (chainId != null) {\n const getNetwork = getStatic<(network: Networkish) => Network>(this.constructor, \"getNetwork\");\n try {\n return getNetwork(BigNumber.from(chainId).toNumber());\n } catch (error) {\n return logger.throwError(\"could not detect network\", Logger.errors.NETWORK_ERROR, {\n chainId: chainId,\n event: \"invalidNetwork\",\n serverError: error\n });\n }\n }\n\n return logger.throwError(\"could not detect network\", Logger.errors.NETWORK_ERROR, {\n event: \"noNetwork\"\n });\n }\n\n getSigner(addressOrIndex?: string | number): JsonRpcSigner {\n return new JsonRpcSigner(_constructorGuard, this, addressOrIndex);\n }\n\n getUncheckedSigner(addressOrIndex?: string | number): UncheckedJsonRpcSigner {\n return this.getSigner(addressOrIndex).connectUnchecked();\n }\n\n listAccounts(): Promise> {\n return this.send(\"eth_accounts\", []).then((accounts: Array) => {\n return accounts.map((a) => this.formatter.address(a));\n });\n }\n\n send(method: string, params: Array): Promise {\n const request = {\n method: method,\n params: params,\n id: (this._nextId++),\n jsonrpc: \"2.0\"\n };\n\n this.emit(\"debug\", {\n action: \"request\",\n request: deepCopy(request),\n provider: this\n });\n\n // We can expand this in the future to any call, but for now these\n // are the biggest wins and do not require any serializing parameters.\n const cache = ([ \"eth_chainId\", \"eth_blockNumber\" ].indexOf(method) >= 0);\n if (cache && this._cache[method]) {\n return this._cache[method];\n }\n\n const result = fetchJson(this.connection, JSON.stringify(request), getResult).then((result) => {\n this.emit(\"debug\", {\n action: \"response\",\n request: request,\n response: result,\n provider: this\n });\n\n return result;\n\n }, (error) => {\n this.emit(\"debug\", {\n action: \"response\",\n error: error,\n request: request,\n provider: this\n });\n\n throw error;\n });\n\n // Cache the fetch, but clear it on the next event loop\n if (cache) {\n this._cache[method] = result;\n setTimeout(() => {\n this._cache[method] = null;\n }, 0);\n }\n\n return result;\n }\n\n prepareRequest(method: string, params: any): [ string, Array ] {\n switch (method) {\n case \"getBlockNumber\":\n return [ \"eth_blockNumber\", [] ];\n\n case \"getGasPrice\":\n return [ \"eth_gasPrice\", [] ];\n\n case \"getBalance\":\n return [ \"eth_getBalance\", [ getLowerCase(params.address), params.blockTag ] ];\n\n case \"getTransactionCount\":\n return [ \"eth_getTransactionCount\", [ getLowerCase(params.address), params.blockTag ] ];\n\n case \"getCode\":\n return [ \"eth_getCode\", [ getLowerCase(params.address), params.blockTag ] ];\n\n case \"getStorageAt\":\n return [ \"eth_getStorageAt\", [ getLowerCase(params.address), hexZeroPad(params.position, 32), params.blockTag ] ];\n\n case \"sendTransaction\":\n return [ \"eth_sendRawTransaction\", [ params.signedTransaction ] ]\n\n case \"getBlock\":\n if (params.blockTag) {\n return [ \"eth_getBlockByNumber\", [ params.blockTag, !!params.includeTransactions ] ];\n } else if (params.blockHash) {\n return [ \"eth_getBlockByHash\", [ params.blockHash, !!params.includeTransactions ] ];\n }\n return null;\n\n case \"getTransaction\":\n return [ \"eth_getTransactionByHash\", [ params.transactionHash ] ];\n\n case \"getTransactionReceipt\":\n return [ \"eth_getTransactionReceipt\", [ params.transactionHash ] ];\n\n case \"call\": {\n const hexlifyTransaction = getStatic<(t: TransactionRequest, a?: { [key: string]: boolean }) => { [key: string]: string }>(this.constructor, \"hexlifyTransaction\");\n return [ \"eth_call\", [ hexlifyTransaction(params.transaction, { from: true }), params.blockTag ] ];\n }\n\n case \"estimateGas\": {\n const hexlifyTransaction = getStatic<(t: TransactionRequest, a?: { [key: string]: boolean }) => { [key: string]: string }>(this.constructor, \"hexlifyTransaction\");\n return [ \"eth_estimateGas\", [ hexlifyTransaction(params.transaction, { from: true }) ] ];\n }\n\n case \"getLogs\":\n if (params.filter && params.filter.address != null) {\n params.filter.address = getLowerCase(params.filter.address);\n }\n return [ \"eth_getLogs\", [ params.filter ] ];\n\n default:\n break;\n }\n\n return null;\n }\n\n async perform(method: string, params: any): Promise {\n // Legacy networks do not like the type field being passed along (which\n // is fair), so we delete type if it is 0 and a non-EIP-1559 network\n if (method === \"call\" || method === \"estimateGas\") {\n const tx = params.transaction;\n if (tx && tx.type != null && BigNumber.from(tx.type).isZero()) {\n // If there are no EIP-1559 properties, it might be non-EIP-1559\n if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) {\n const feeData = await this.getFeeData();\n if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) {\n // Network doesn't know about EIP-1559 (and hence type)\n params = shallowCopy(params);\n params.transaction = shallowCopy(tx);\n delete params.transaction.type;\n }\n }\n }\n }\n\n const args = this.prepareRequest(method, params);\n\n if (args == null) {\n logger.throwError(method + \" not implemented\", Logger.errors.NOT_IMPLEMENTED, { operation: method });\n }\n try {\n return await this.send(args[0], args[1])\n } catch (error) {\n return checkError(method, error, params);\n }\n }\n\n _startEvent(event: Event): void {\n if (event.tag === \"pending\") { this._startPending(); }\n super._startEvent(event);\n }\n\n _startPending(): void {\n if (this._pendingFilter != null) { return; }\n const self = this;\n\n const pendingFilter: Promise = this.send(\"eth_newPendingTransactionFilter\", []);\n this._pendingFilter = pendingFilter;\n\n pendingFilter.then(function(filterId) {\n function poll() {\n self.send(\"eth_getFilterChanges\", [ filterId ]).then(function(hashes: Array) {\n if (self._pendingFilter != pendingFilter) { return null; }\n\n let seq = Promise.resolve();\n hashes.forEach(function(hash) {\n // @TODO: This should be garbage collected at some point... How? When?\n self._emitted[\"t:\" + hash.toLowerCase()] = \"pending\";\n seq = seq.then(function() {\n return self.getTransaction(hash).then(function(tx) {\n self.emit(\"pending\", tx);\n return null;\n });\n });\n });\n\n return seq.then(function() {\n return timer(1000);\n });\n }).then(function() {\n if (self._pendingFilter != pendingFilter) {\n self.send(\"eth_uninstallFilter\", [ filterId ]);\n return;\n }\n setTimeout(function() { poll(); }, 0);\n\n return null;\n }).catch((error: Error) => { });\n }\n poll();\n\n return filterId;\n }).catch((error: Error) => { });\n }\n\n _stopEvent(event: Event): void {\n if (event.tag === \"pending\" && this.listenerCount(\"pending\") === 0) {\n this._pendingFilter = null;\n }\n super._stopEvent(event);\n }\n\n // Convert an ethers.js transaction into a JSON-RPC transaction\n // - gasLimit => gas\n // - All values hexlified\n // - All numeric values zero-striped\n // - All addresses are lowercased\n // NOTE: This allows a TransactionRequest, but all values should be resolved\n // before this is called\n // @TODO: This will likely be removed in future versions and prepareRequest\n // will be the preferred method for this.\n static hexlifyTransaction(transaction: TransactionRequest, allowExtra?: { [key: string]: boolean }): { [key: string]: string | AccessList } {\n // Check only allowed properties are given\n const allowed = shallowCopy(allowedTransactionKeys);\n if (allowExtra) {\n for (const key in allowExtra) {\n if (allowExtra[key]) { allowed[key] = true; }\n }\n }\n\n checkProperties(transaction, allowed);\n\n const result: { [key: string]: string | AccessList } = {};\n\n // JSON-RPC now requires numeric values to be \"quantity\" values\n [\"chainId\", \"gasLimit\", \"gasPrice\", \"type\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"nonce\", \"value\"].forEach(function(key) {\n if ((transaction)[key] == null) { return; }\n const value = hexValue(BigNumber.from((transaction)[key]));\n if (key === \"gasLimit\") { key = \"gas\"; }\n result[key] = value;\n });\n\n [\"from\", \"to\", \"data\"].forEach(function(key) {\n if ((transaction)[key] == null) { return; }\n result[key] = hexlify((transaction)[key]);\n });\n\n if ((transaction).accessList) {\n result[\"accessList\"] = accessListify((transaction).accessList);\n }\n\n return result;\n }\n}\n","\"use strict\";\n\nimport { Networkish } from \"@ethersproject/networks\";\nimport { deepCopy, defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { JsonRpcProvider } from \"./json-rpc-provider\";\n\n// Exported Types\nexport type ExternalProvider = {\n isMetaMask?: boolean;\n isStatus?: boolean;\n host?: string;\n path?: string;\n sendAsync?: (request: { method: string, params?: Array }, callback: (error: any, response: any) => void) => void\n send?: (request: { method: string, params?: Array }, callback: (error: any, response: any) => void) => void\n request?: (request: { method: string, params?: Array }) => Promise\n}\n\nlet _nextId = 1;\n\nexport type JsonRpcFetchFunc = (method: string, params?: Array) => Promise;\n\ntype Web3LegacySend = (request: any, callback: (error: Error, response: any) => void) => void;\n\nfunction buildWeb3LegacyFetcher(provider: ExternalProvider, sendFunc: Web3LegacySend) : JsonRpcFetchFunc {\n const fetcher = \"Web3LegacyFetcher\";\n\n return function(method: string, params: Array): Promise {\n const request = {\n method: method,\n params: params,\n id: (_nextId++),\n jsonrpc: \"2.0\"\n };\n\n return new Promise((resolve, reject) => {\n this.emit(\"debug\", {\n action: \"request\",\n fetcher,\n request: deepCopy(request),\n provider: this\n });\n\n sendFunc(request, (error, response) => {\n\n if (error) {\n this.emit(\"debug\", {\n action: \"response\",\n fetcher,\n error,\n request,\n provider: this\n });\n\n return reject(error);\n }\n\n this.emit(\"debug\", {\n action: \"response\",\n fetcher,\n request,\n response,\n provider: this\n });\n\n if (response.error) {\n const error = new Error(response.error.message);\n (error).code = response.error.code;\n (error).data = response.error.data;\n return reject(error);\n }\n\n resolve(response.result);\n });\n });\n }\n}\n\nfunction buildEip1193Fetcher(provider: ExternalProvider): JsonRpcFetchFunc {\n return function(method: string, params: Array): Promise {\n if (params == null) { params = [ ]; }\n\n const request = { method, params };\n\n this.emit(\"debug\", {\n action: \"request\",\n fetcher: \"Eip1193Fetcher\",\n request: deepCopy(request),\n provider: this\n });\n\n return provider.request(request).then((response) => {\n this.emit(\"debug\", {\n action: \"response\",\n fetcher: \"Eip1193Fetcher\",\n request,\n response,\n provider: this\n });\n\n return response;\n\n }, (error) => {\n this.emit(\"debug\", {\n action: \"response\",\n fetcher: \"Eip1193Fetcher\",\n request,\n error,\n provider: this\n });\n\n throw error;\n });\n }\n}\n\nexport class Web3Provider extends JsonRpcProvider {\n readonly provider: ExternalProvider;\n readonly jsonRpcFetchFunc: JsonRpcFetchFunc;\n\n constructor(provider: ExternalProvider | JsonRpcFetchFunc, network?: Networkish) {\n if (provider == null) {\n logger.throwArgumentError(\"missing provider\", \"provider\", provider);\n }\n\n let path: string = null;\n let jsonRpcFetchFunc: JsonRpcFetchFunc = null;\n let subprovider: ExternalProvider = null;\n\n if (typeof(provider) === \"function\") {\n path = \"unknown:\";\n jsonRpcFetchFunc = provider;\n\n } else {\n path = provider.host || provider.path || \"\";\n if (!path && provider.isMetaMask) {\n path = \"metamask\";\n }\n\n subprovider = provider;\n\n if (provider.request) {\n if (path === \"\") { path = \"eip-1193:\"; }\n jsonRpcFetchFunc = buildEip1193Fetcher(provider);\n } else if (provider.sendAsync) {\n jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.sendAsync.bind(provider));\n } else if (provider.send) {\n jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.send.bind(provider));\n } else {\n logger.throwArgumentError(\"unsupported provider\", \"provider\", provider);\n }\n\n if (!path) { path = \"unknown:\"; }\n }\n\n super(path, network);\n\n defineReadOnly(this, \"jsonRpcFetchFunc\", jsonRpcFetchFunc);\n defineReadOnly(this, \"provider\", subprovider);\n }\n\n send(method: string, params: Array): Promise {\n return this.jsonRpcFetchFunc(method, params);\n }\n}\n","import { Button } from \"@material-ui/core\";\nimport React from \"react\";\nimport { ethers } from \"ethers\";\nimport { Web3Provider } from \"@ethersproject/providers/src.ts/web3-provider\";\n\ndeclare let window: any;\n\ninterface Props {\n setAddress: (address: string) => void;\n setProvider: (provider: Web3Provider) => void;\n}\n\nexport default function ConnectWallet({ setAddress, setProvider }: Props) {\n const connectWallet = async () => {\n try {\n const provider = new ethers.providers.Web3Provider(window.ethereum);\n const accounts = await provider.send(\"eth_requestAccounts\", []);\n setAddress(accounts[0]);\n setProvider(provider);\n } catch (e) {\n console.error(\"No web3 provider available\", e);\n }\n };\n\n return (\n \n );\n}\n","import \"@ethersproject/shims\";\n\nimport React, { useEffect, useState } from \"react\";\nimport \"./App.css\";\nimport { Waku } from \"js-waku\";\nimport { KeyPair, PublicKeyMessageEncryptionKey } from \"./crypto\";\nimport { Message } from \"./messaging/Messages\";\nimport \"fontsource-roboto\";\nimport { AppBar, IconButton, Toolbar, Typography } from \"@material-ui/core\";\nimport KeyPairHandling from \"./key_pair_handling/KeyPairHandling\";\nimport {\n createMuiTheme,\n ThemeProvider,\n makeStyles,\n} from \"@material-ui/core/styles\";\nimport { teal, purple, green } from \"@material-ui/core/colors\";\nimport WifiIcon from \"@material-ui/icons/Wifi\";\nimport BroadcastPublicKey from \"./BroadcastPublicKey\";\nimport Messaging from \"./messaging/Messaging\";\nimport {\n PrivateMessageContentTopic,\n handlePrivateMessage,\n handlePublicKeyMessage,\n initWaku,\n PublicKeyContentTopic,\n} from \"./waku\";\nimport { Web3Provider } from \"@ethersproject/providers/src.ts/web3-provider\";\nimport ConnectWallet from \"./ConnectWallet\";\nimport { waku_message } from \"js-waku\";\n\nconst theme = createMuiTheme({\n palette: {\n primary: {\n main: purple[500],\n },\n secondary: {\n main: teal[600],\n },\n },\n});\n\nconst useStyles = makeStyles({\n root: {\n textAlign: \"center\",\n display: \"flex\",\n flexDirection: \"column\",\n minHeight: \"100vh\",\n },\n appBar: {\n // height: '200p',\n },\n container: {\n display: \"flex\",\n flex: 1,\n },\n main: {\n flex: 1,\n margin: \"10px\",\n },\n wakuStatus: {\n marginRight: theme.spacing(2),\n },\n title: {\n flexGrow: 1,\n },\n peers: {},\n});\n\nfunction App() {\n const [waku, setWaku] = useState();\n const [provider, setProvider] = useState();\n const [encryptionKeyPair, setEncryptionKeyPair] = useState<\n KeyPair | undefined\n >();\n const [publicKeys, setPublicKeys] = useState>(\n new Map()\n );\n const [messages, setMessages] = useState([]);\n const [address, setAddress] = useState();\n const [peerStats, setPeerStats] = useState<{\n filterPeers: number;\n lightPushPeers: number;\n }>({\n filterPeers: 0,\n lightPushPeers: 0,\n });\n\n const classes = useStyles();\n\n // Waku initialization\n useEffect(() => {\n (async () => {\n if (waku) return;\n\n const _waku = await initWaku();\n console.log(\"waku: ready\");\n setWaku(_waku);\n })().catch((e) => {\n console.error(\"Failed to initiate Waku\", e);\n });\n }, [waku]);\n\n useEffect(() => {\n if (!waku) return;\n\n const observerPublicKeyMessage = handlePublicKeyMessage.bind(\n {},\n address,\n setPublicKeys\n );\n\n let unsubscribe: undefined | (() => Promise);\n\n waku.filter.addDecryptionKey(PublicKeyMessageEncryptionKey, {\n method: waku_message.DecryptionMethod.Symmetric,\n contentTopics: [PublicKeyContentTopic],\n });\n waku.filter\n .subscribe(observerPublicKeyMessage, [PublicKeyContentTopic])\n .then(\n (_unsubscribe) => {\n console.log(\"subscribed to \", PublicKeyContentTopic);\n unsubscribe = _unsubscribe;\n },\n (e) => {\n console.error(\"Failed to subscribe\", e);\n }\n );\n\n return function cleanUp() {\n if (!waku) return;\n waku.filter.deleteDecryptionKey(PublicKeyMessageEncryptionKey);\n if (typeof unsubscribe === \"undefined\") return;\n unsubscribe().then(\n () => {\n console.log(\"unsubscribed to \", PublicKeyContentTopic);\n },\n (e) => console.error(\"Failed to unsubscribe\", e)\n );\n };\n }, [waku, address]);\n\n useEffect(() => {\n if (!waku) return;\n if (!encryptionKeyPair) return;\n\n waku.filter.addDecryptionKey(encryptionKeyPair.privateKey, {\n method: waku_message.DecryptionMethod.Asymmetric,\n contentTopics: [PrivateMessageContentTopic],\n });\n\n return function cleanUp() {\n if (!waku) return;\n if (!encryptionKeyPair) return;\n\n waku.filter.deleteDecryptionKey(encryptionKeyPair.privateKey);\n };\n }, [waku, encryptionKeyPair]);\n\n useEffect(() => {\n if (!waku) return;\n if (!encryptionKeyPair) return;\n if (!address) return;\n\n const observerPrivateMessage = handlePrivateMessage.bind(\n {},\n setMessages,\n address\n );\n\n let unsubscribe: undefined | (() => Promise);\n\n waku.filter\n .subscribe(observerPrivateMessage, [PrivateMessageContentTopic])\n .then(\n (_unsubscribe) => {\n unsubscribe = _unsubscribe;\n },\n (e) => {\n console.error(\"Failed to subscribe\", e);\n }\n );\n\n return function cleanUp() {\n if (!waku) return;\n if (typeof unsubscribe === \"undefined\") return;\n unsubscribe().catch((e) => console.error(\"Failed to unsubscribe\", e));\n };\n }, [waku, address, encryptionKeyPair]);\n\n useEffect(() => {\n if (!waku) return;\n\n const interval = setInterval(async () => {\n const lightPushPeers = await waku.store.peers();\n const filterPeers = await waku.filter.peers();\n\n setPeerStats({\n filterPeers: filterPeers.length,\n lightPushPeers: lightPushPeers.length,\n });\n }, 1000);\n return () => clearInterval(interval);\n }, [waku]);\n\n let addressDisplay = \"\";\n if (address) {\n addressDisplay =\n address.substr(0, 6) + \"...\" + address.substr(address.length - 4, 4);\n }\n\n return (\n \n
\n \n \n \n \n \n \n Peers: {peerStats.filterPeers} filter, {peerStats.lightPushPeers}{\" \"}\n light push\n \n \n Ethereum Private Message\n \n {addressDisplay}\n \n \n\n
\n
\n
\n Wallet\n \n
\n
\n Encryption Key Pair\n \n \n
\n
\n Messaging\n \n
\n
\n
\n
\n
\n );\n}\n\nexport default App;\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport \"./index.css\";\nimport App from \"./App\";\n\nReactDOM.render(\n \n \n ,\n document.getElementById(\"root\")\n);\n"],"names":["version","logger","Logger","_constructorGuard","ModifiersBytes","calldata","memory","storage","ModifiersNest","checkModifier","type","name","indexOf","throwArgumentError","populate","object","params","key","defineReadOnly","FormatTypes","Object","freeze","sighash","minimal","full","json","paramTypeArray","RegExp","ParamType","constructor","constructorGuard","throwError","operation","this","match","arrayLength","parseInt","arrayChildren","fromObject","components","baseType","_isParamType","format","result","undefined","indexed","map","comp","JSON","parse","stringify","String","join","value","allowIndexed","fromString","isParamType","verifyType","node","param","originalParam","i","newNode","parent","state","allowType","replace","length","c","allowParams","child","allowName","allowArray","sibling","push","readArray","parseParamType","parseParams","allowIndex","trim","accum","depth","offset","splitNesting","Fragment","_isFragment","isFragment","FunctionFragment","EventFragment","ConstructorFragment","ErrorFragment","split","substring","anonymous","inputs","input","isEventFragment","verifyIdentifier","regexParen","forEach","modifier","warn","parseGas","gas","comps","BigNumber","parseModifiers","constant","payable","stateMutability","console","log","verifyState","toNumber","isConstructorFragment","parens","outputs","output","toString","isFunctionFragment","returns","checkForbidden","fragment","sig","isErrorFragment","regexIdentifier","checkResultErrors","errors","checkErrors","path","Array","isArray","childPath","slice","error","Coder","localName","dynamic","_throwError","message","Writer","wordSize","_data","_dataLength","_padding","Uint8Array","data","hexConcat","_writeData","appendWriter","writer","concat","writeBytes","bytes","arrayify","paddingOffset","_getValue","writeValue","writeUpdatableValue","Reader","coerceFunc","allowLoose","_offset","hexlify","consumed","coerce","_coerceFunc","_peekBytes","loose","alignedLength","Math","ceil","subReader","readBytes","readValue","AddressCoder","super","defaultValue","encode","getAddress","decode","reader","hexZeroPad","toHexString","AnonymousCoder","coder","pack","coders","values","arrayValues","unique","argument","staticWriter","dynamicWriter","updateFuncs","index","dynamicOffset","updateFunc","baseOffset","func","unpack","baseReader","offsetReader","code","uniqueNames","reduce","Error","defineProperty","enumerable","get","ArrayCoder","defaultChild","count","checkArgumentCount","BooleanCoder","isZero","DynamicBytesCoder","BytesCoder","FixedBytesCoder","size","NullCoder","NumberCoder","signed","v","maxUintValue","MaxUint256","bounds","mask","gt","lt","add","One","mul","NegativeOne","Zero","toTwos","fromTwos","StringCoder","toUtf8Bytes","toUtf8String","TupleCoder","types","paramTypeBytes","paramTypeNumber","AbiCoder","_getCoder","component","_getWordSize","_getReader","_getWriter","getDefaultValue","from","defaultAbiCoder","LogDescription","Description","TransactionDescription","ErrorDescription","Indexed","_isIndexed","BuiltinErrors","signature","reason","wrapAccessError","property","wrap","Interface","fragments","abi","filter","getStatic","bucket","deploy","functions","events","j","address","hexDataSlice","id","eventFragment","getFunction","nameOrSignatureOrSighash","isHexString","getSighash","matching","keys","f","getEvent","nameOrSignatureOrTopic","topichash","toLowerCase","getEventTopic","getError","_","_decodeParams","_abiCoder","_encodeParams","encodeDeploy","decodeErrorResult","encodeErrorResult","decodeFunctionData","functionFragment","encodeFunctionData","decodeFunctionResult","errorArgs","errorName","errorSignature","selector","builtin","method","encodeFunctionResult","encodeFilterTopics","topics","encodeTopic","keccak256","pop","encodeEventLog","dataTypes","dataValues","decodeEventLog","topicHash","expected","nonIndexed","resultIndexed","resultNonIndexed","nonIndexedIndex","indexedIndex","hash","parseTransaction","tx","args","parseLog","topic","parseError","hexData","errorFragment","_isInterface","ForkEvent","_isForkEvent","Provider","checkAbstract","getFeeData","block","gasPrice","resolveProperties","getBlock","getGasPrice","catch","lastBaseFeePerGas","maxFeePerGas","maxPriorityFeePerGas","baseFeePerGas","addListener","eventName","listener","on","removeListener","off","_isProvider","allowedTransactionKeys","forwardErrors","Signer","getBalance","blockTag","_checkProvider","provider","getTransactionCount","estimateGas","transaction","checkTransaction","call","sendTransaction","populateTransaction","signedTx","signTransaction","getChainId","getNetwork","chainId","resolveName","shallowCopy","Promise","all","resolve","then","to","__awaiter","hasEip1559","feeData","nonce","gasLimit","results","_isSigner","getChecksumAddress","chars","expanded","charCodeAt","hashed","toUpperCase","ibanLookup","fromCharCode","safeDigits","floor","x","log10","LN10","ibanChecksum","checksum","_base36To16","isAddress","getIcapAddress","base36","_base16To36","getContractAddress","stripZeros","getCreate2Address","salt","initCodeHash","hexDataLength","textData","atob","btoa","BaseX","alphabet","charAt","_alphabetMap","source","digits","carry","base","string","k","_leader","q","TypeError","byte","reverse","Base32","Base58","BN","_BN","MAX_SAFE","isBigNumberish","isBigNumber","isBytes","_warnedToStringRadix","hex","_hex","_isBigNumber","toBigNumber","toBN","abs","other","sub","div","throwFault","mod","isNeg","umod","pow","and","isNegative","or","xor","maskn","shl","shln","shr","shrn","eq","lte","gte","toBigInt","BigInt","e","arguments","toJSON","toHex","anyValue","fault","isHexable","addSlice","array","prototype","apply","isBytesLike","isInteger","options","checkSafeUint53","unshift","allowMissingPrefix","hexPad","items","objects","item","set","start","zeroPad","HexCharacters","endOffset","hexValue","trimmed","hexStripZeros","splitSignature","r","s","_vs","recoveryParam","yParityAndS","compact","vs","recId","joinSignature","HashZero","text","messagePrefix","hashMessage","flat","flatDeep","arr","val","read_compressed_payload","pos","read_payload","u16","symbol_count","total","acc","skip","pos_payload","read_width","read_buffer","read_bit","FULL","HALF","QRTR","MASK","register","symbols","low","range","end","mid","a","b","decode_arithmetic","read_ascending","n","next","read_deltas","read_member_array","lookup","vX","vN","read_counts","read_transposed","w","m","fill","read_linear_table","dx","dy","read_zero_terminated_array","ys","j_dy","y","read_replacement_table","VALID","Set","IGNORED","MAPPED","ret","fromEntries","read_mapped_map","EMOJI_ROOT","sorted","sort","read","branches","temp","valid","fe0f","save","check","read_emoji_trie","explode_cp","toUtf8CodePoints","filter_fe0f","cps","cp","ens_normalize_post_check","label","lastIndexOf","every","err","ens_normalize","emoji_filter","emoji","consume_emoji_reversed","has","fromCodePoint","normalize","eaten","saved","stack","find","_a","splice","Zeros","checkComponent","ensNameSplit","last","ensNormalize","isValidName","namehash","dnsEncode","padding","hexTrue","hexFalse","domainFieldTypes","verifyingContract","domainFieldNames","checkString","domainChecks","getBaseEncoder","width","boundsUpper","boundsLower","padOffset","hexPadRight","encodeType","fields","TypedDataEncoder","deepCopy","links","parents","subtypes","field","primaryTypes","t","checkCircular","found","subtype","primaryType","st","_types","getEncoder","encoder","_encoderCache","_getEncoder","subEncoder","encodedType","encodeData","hashStruct","_visit","callback","visit","domain","domainFields","EIP712Domain","hashDomain","ensCache","domainValues","domainTypes","typesWithDomain","Wordlist","locale","mnemonic","words","wordlist","word","getWord","getWordIndex","lang","loadWords","langEn","wordlists","en","N","MasterSecret","HardenedBit","getUpperMask","bits","bytes32","base58check","sha256","getWordlist","defaultPath","HDNode","privateKey","publicKey","parentFingerprint","chainCode","mnemonicOrPath","signingKey","SigningKey","compressedPublicKey","ripemd160","computeAddress","extendedKey","neuter","_derive","I","computeHmac","SupportedAlgorithm","IL","IR","ki","Ki","_addPoint","srcMnemonic","phrase","fingerprint","derivePath","shift","seed","seedArray","password","entropyToMnemonic","mnemonicToEntropy","_fromSeed","mnemonicToSeed","UnicodeNormalizationForm","pbkdf2","checkNormalize","entropy","bit","entropyBits","checksumMask","indices","remainingBits","checksumBits","isValidMnemonic","getAccountPath","CrowdsaleAccount","isCrowdsaleAccount","_isCrowdsaleAccount","decrypt","getPassword","ethaddr","searchPath","encseed","looseArrayify","iv","encryptedSeed","aesCbc","aes","seedHex","seedHexBytes","isCrowdsaleWallet","isKeystoreWallet","getJsonWalletAddress","decryptJsonWallet","progressCallback","account","decryptCrowdsale","decryptKeystore","reject","decryptJsonWalletSync","decryptKeystoreSync","hasMnemonic","KeystoreAccount","isKeystoreAccount","_isKeystoreAccount","_getAccount","ciphertext","counter","aesCtr","_decrypt","mnemonicKey","mnemonicCiphertext","mnemonicIv","mnemonicCounter","mnemonicAesCtr","pbkdf2Sync","passwordBytes","dkLen","prfFunc","_pbkdf2","_computeKdfKey","pbkdf2Func","scryptFunc","kdf","p","prf","decryptSync","scrypt","encrypt","client","randomBytes","uuidRandom","uuid","derivedKey","macPrefix","mac","uuidV4","crypto","cipher","cipherparams","kdfparams","dklen","now","Date","timestamp","getUTCFullYear","zpad","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","gethFilename","hexString","currentChild","matchingChild","sha3","_permanentCensorErrors","_censorErrors","LogLevels","debug","info","warning","_logLevel","_globalLogger","_normalizeError","missing","form","_checkNormalize","LogLevel","ErrorCode","HEX","writable","_log","logLevel","level","levels","DEBUG","INFO","WARNING","makeError","UNKNOWN_ERROR","messageDetails","url","NUMERIC_FAULT","CALL_EXCEPTION","INSUFFICIENT_FUNDS","MISSING_NEW","NONCE_EXPIRED","REPLACEMENT_UNDERPRICED","TRANSACTION_REPLACED","UNPREDICTABLE_GAS_LIMIT","INVALID_ARGUMENT","assert","condition","assertArgument","UNSUPPORTED_OPERATION","expectedCount","MISSING_ARGUMENT","UNEXPECTED_ARGUMENT","checkNew","target","kind","censorship","permanent","globalLogger","iterations","keylen","hashAlgorithm","hLen","l","DK","block1","T","U","destPos","len","ctor","getPrototypeOf","promises","checkProperties","properties","opaque","bigint","boolean","number","_isFrozen","isFrozen","_deepCopy","shuffled","random","tmp","anyGlobal","self","window","global","getGlobal","msCrypto","getRandomValues","buffer","arrayifyInteger","unarrayifyInteger","_encode","payload","_decodeChildren","childOffset","decoded","_decode","lengthLength","update","digest","sha512","algorithm","globalThis","exports","require","o","u","h","codepoint","feature","d","g","C","udata","reduceRight","isHighSurrogate","isLowSurrogate","prepFeature","getDecomp","isCompatibility","isExclude","getCanonicalClass","getComposite","str","cursor","it","canonical","resBuf","procBuf","lastClass","A","B","nfc","nfd","nfkc","nfkd","shimApplied","configurable","RangeError","original","test","ArrayBuffer","isView","nextTick","setTimeout","getTime","FileReader","readAsArrayBuffer","Blob","readyState","LOADING","_setReadyState","_result","_error","onloadend","DONE","readAsDataURL","default","msg","equal","utils","zero2","res","toArray","enc","hi","lo","minAssert","minUtils","getNAF","num","naf","max","bitLength","ws","clone","z","andln","isOdd","isubn","iushrn","getJSF","k1","k2","jsf","m8","d1","d2","cmpn","u1","u2","m14","m24","cachedProperty","obj","computer","parseBytes","intFromLE","BaseCurve","conf","red","prime","zero","toRed","one","two","pointFromJSON","gRed","_wnafT1","_wnafT2","_wnafT3","_wnafT4","_bitLength","adjustCount","redN","_maxwellTrick","BasePoint","curve","precomputed","point","validate","_fixedNafMul","doubles","_getDoubles","step","nafW","repr","jpoint","mixedAdd","points","neg","toP","_wnafMul","nafPoints","_getNAFPoints","wnd","dblp","_wnafMulAdd","defW","coeffs","jacobianResult","wndWidth","comb","cmp","toJ","redNeg","ja","jb","decodePoint","byteLength","pointFromX","encodeCompressed","getX","getY","isEven","precompute","power","beta","_getBeta","_hasDoubles","dbl","create","module","superCtor","super_","TempCtor","ShortCurve","Base","tinv","redInvm","zeroA","fromRed","threeA","endo","_getEndomorphism","_endoWnafT1","_endoWnafT2","inherits","Point","isRed","inf","forceRed","JPoint","zOne","modn","lambda","betas","_getEndoRoots","lambdas","redMul","basis","vec","_getEndoBasis","ntinv","redSqrt","redAdd","redSub","a0","b0","a1","b1","a2","b2","prevR","aprxSqrt","ushrn","x1","y1","x2","y2","len1","sqr","negative","_endoSplit","v1","v2","c1","divRound","c2","p1","p2","q1","q2","odd","redSqr","redIAdd","ax","rhs","redISub","_endoWnafMulAdd","npoints","ncoeffs","ineg","fromJSON","pre","endoMul","obj2point","inspect","isInfinity","nx","ny","ys1","dyinv","mulAdd","jmulAdd","_precompute","negate","zinv","zinv2","ay","pz2","z2","s1","s2","h2","h3","nz","jx","jy","jz","jz4","jyd","jx2","jyd2","jyd4","t1","t2","dny","_zeroDbl","_threeDbl","_dbl","xx","yy","yyyy","yyyy8","c8","delta","gamma","alpha","beta4","beta8","ggamma8","jy2","jxd4","jyd8","trpl","zz","mm","ee","yyu4","kbase","z3","pz3","eqXToP","zs","rx","xc","iadd","require$$0","short","require$$1","mont","edwards","curves","PresetCurve","defineCurve","HmacDRBG","predResist","outLen","outSize","minEntropy","hmacStrength","_reseed","reseedInterval","K","V","entropyEnc","nonceEnc","pers","persEnc","_init","_update","_hmac","kmac","reseed","addEnc","generate","KeyPair","ec","priv","pub","_importPrivate","privEnc","_importPublic","pubEnc","fromPublic","fromPrivate","getPublic","getPrivate","derive","sign","verify","Signature","_importDER","Position","place","getLength","buf","initial","octetLen","rmPadding","constructLength","octets","LN2","rlen","slen","toDER","backHalf","rand","EC","hasOwnProperty","nh","keyPair","keyFromPrivate","keyFromPublic","genKeyPair","drbg","ns2","iaddn","_truncateToN","truncOnly","bkey","ns1","iter","kp","kpX","invm","sinv","recoverPubKey","isYOdd","isSecondKey","rInv","getKeyRecoveryParam","Q","Qprime","elliptic","require$$2","require$$3","eddsa","_curve","getCurve","p0","signDigest","digestBytes","computeSharedSecret","otherKey","otherKeyPair","computePublicKey","_isSigningKey","recoverPublicKey","rs","compressed","regexBytes","regexNumber","regexArray","_pack","tight","hashKeccak256","hashSha256","formatBytes32String","parseBytes32String","createTable","pair","createRangeTable","matchMap","ranges","Table_A_1_ranges","Table_B_1_flags","Table_B_2_ranges","Table_B_2_lut_abs","Table_B_2_lut_rel","Table_B_2_complex","Table_C_ranges","nameprep","codes","codesTableB2","_nameprepTableB2","_toUtf8String","Utf8ErrorReason","ignoreFunc","badCodepoint","BAD_PREFIX","UNEXPECTED_CONTINUE","OVERRUN","Utf8ErrorFuncs","ignore","OVERLONG","getUtf8CodePoints","onError","extraLength","overlongMask","nextChar","MISSING_CONTINUE","OUT_OF_RANGE","UTF16_SURROGATE","current","escapeChar","_toEscapedUtf8String","codePoint","codePoints","TransactionTypes","handleAddress","handleNumber","transactionFields","maxLength","numeric","recoverAddress","formatNumber","accessSetify","addr","storageKeys","storageKey","accessListify","localeCompare","formatAccessList","_serializeEip1559","accessList","RLP","_serializeEip2930","serialize","raw","fieldInfo","_serialize","transactionType","_parseEipSignature","recid","rawTransaction","_parse","_parseEip2930","_parseEip1559","zeros","getMultiplier","decimals","formatFixed","multiplier","fraction","whole","parseFixed","wholeValue","fractionValue","wei","FixedFormat","_multiplier","FixedNumber","_value","_isFixedNumber","_checkFormat","addUnsafe","fromValue","subUnsafe","mulUnsafe","divUnsafe","hasFraction","ONE","toFormat","ceiling","round","factor","bump","BUMP","toUnsafeFloat","parseFloat","fixedFormat","decimal","fromBytes","names","commify","suffix","formatted","formatUnits","unitName","parseUnits","formatEther","parseEther","ether","Wallet","_mnemonic","_signingKey","connect","signMessage","_signTypedData","populated","_TypedDataEncoder","encryptKeystore","extraEntropy","fromMnemonic","verifyMessage","verifyTypedData","getUrl","href","request","headers","body","skipFetchSetup","mode","cache","credentials","redirect","referrer","fetchOptions","opts","response","fetch","arrayBuffer","statusCode","status","statusMessage","statusText","staller","duration","bodyify","_fetchData","connection","processFunc","attemptLimit","throttleLimit","throttleCallback","throttleSlotInterval","errorPassThrough","allow304","timeout","allowGzip","user","allowInsecureAuthentication","authorization","base64Encode","reData","dataMatch","base64Decode","requestBody","requestMethod","flatHeaders","header","runningTimeout","timer","promise","cancel","clearTimeout","runningFetch","attempt","location","tryAgain","stall","retryAfter","serverError","throttleRetry","race","fetchJson","updated","poll","interval","done","retryLimit","oncePoll","once","onceBlock","A100","A200","A400","A700","clamp","min","decomposeColor","color","substr","re","colors","hexToRgb","marker","_formatMuiErrorMessage","recomposeColor","getContrastRatio","foreground","background","lumA","getLuminance","lumB","rgb","hslToRgb","Number","toFixed","darken","coefficient","lighten","createBreakpoints","breakpoints","_breakpoints$values","xs","sm","md","lg","xl","_breakpoints$unit","unit","_breakpoints$step","_objectWithoutProperties","up","between","endIndex","_extends","down","upperbound","only","createMixins","spacing","mixins","_toolbar","gutters","styles","paddingLeft","paddingRight","_defineProperty","toolbar","minHeight","black","white","light","primary","secondary","disabled","hint","divider","paper","common","grey","action","active","hover","hoverOpacity","selected","selectedOpacity","disabledBackground","disabledOpacity","focus","focusOpacity","activatedOpacity","dark","icon","addLightOrDark","intent","direction","shade","tonalOffset","tonalOffsetLight","tonalOffsetDark","main","createPalette","palette","_palette$primary","indigo","_palette$secondary","pink","_palette$error","_palette$warning","orange","_palette$info","blue","_palette$success","success","green","_palette$type","_palette$contrastThre","contrastThreshold","_palette$tonalOffset","getContrastText","augmentColor","mainShade","lightShade","darkShade","contrastText","deepmerge","roundWithDeprecationWarning","caseAllCaps","textTransform","defaultFontFamily","createTypography","typography","_ref","_ref$fontFamily","fontFamily","_ref$fontSize","fontSize","_ref$fontWeightLight","fontWeightLight","_ref$fontWeightRegula","fontWeightRegular","_ref$fontWeightMedium","fontWeightMedium","_ref$fontWeightBold","fontWeightBold","_ref$htmlFontSize","htmlFontSize","allVariants","pxToRem2","pxToRem","coef","buildVariant","fontWeight","lineHeight","letterSpacing","casing","variants","h1","h4","h5","h6","subtitle1","subtitle2","body1","body2","button","caption","overline","createShadow","borderRadius","defaultBreakpoints","directions","aliases","marginX","marginY","paddingX","paddingY","getCssProperties","fn","arg","memoize","prop","_prop$split","_prop$split2","_slicedToArray","dir","spacingKeys","createUnarySpacing","theme","themeSpacing","getStyleFromPropValue","cssProperties","transformer","propValue","cssProperty","transformed","getValue","props","styleFromPropValue","themeBreakpoints","_typeof","_themeBreakpoints","breakpoint","handleBreakpoints","merge","propTypes","filterProps","createSpacing","spacingInput","mui","transform","_len","_key","easing","easeInOut","easeOut","easeIn","sharp","shortest","shorter","standard","complex","enteringScreen","leavingScreen","formatMs","milliseconds","_options$duration","durationOption","_options$easing","easingOption","_options$delay","delay","animatedProp","getAutoHeightDuration","height","createTheme","_options$breakpoints","breakpointsInput","_options$mixins","mixinsInput","_options$palette","paletteInput","_options$typography","typographyInput","muiTheme","overrides","shadows","shape","transitions","zIndex","createMuiTheme","stylesOrCreator","Component","defaultTheme","_options$withTheme","withTheme","stylesOptions","classNamePrefix","useStyles","makeStyles","displayName","WithStyles","React","ref","classes","innerRef","defaultProps","more","useTheme","getThemeProps","hoistNonReactStatics","withStylesWithoutDefault","mobileStepper","speedDial","appBar","drawer","modal","snackbar","tooltip","capitalize","createChainedFunction","funcs","_len2","_key2","SvgIcon","children","className","_props$color","_props$component","_props$fontSize","htmlColor","titleAccess","_props$viewBox","viewBox","clsx","root","focusable","role","muiName","withStyles","userSelect","display","flexShrink","transition","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeLarge","createSvgIcon","debounce","wait","debounced","that","later","clear","deprecatedPropType","validator","requirePropFactory","componentNameInError","unsupportedProp","propName","componentName","propFullName","useId","idOverride","_React$useState","defaultId","setDefaultId","isMuiElement","element","muiNames","ownerDocument","document","ownerWindow","defaultView","setRef","useControlled","controlled","defaultProp","isControlled","valueState","setValue","newValue","useEnhancedEffect","useEventCallback","useForkRef","refA","refB","refValue","hadKeyboardEvent","hadFocusVisibleRecently","hadFocusVisibleRecentlyTimeout","inputTypesWhitelist","search","tel","email","date","month","week","time","datetime","handleKeyDown","event","metaKey","altKey","ctrlKey","handlePointerDown","handleVisibilityChange","visibilityState","isFocusVisible","matches","tagName","readOnly","isContentEditable","focusTriggersKeyboardModality","handleBlurVisible","useIsFocusVisible","onBlurVisible","instance","doc","ReactDOM","addEventListener","_interopRequireDefault","_interopRequireWildcard","_default","createElement","_utils","Symbol","for","iterator","nodeType","plainObjectConstrurctor","cloneStyle","style","newStyle","createRule","decl","jss","declCopy","rule","plugins","onCreateRule","by","toCssValue","cssValue","getWhitespaceSymbols","linebreak","space","indentStr","indent","toCss","_options$indent","fallbacks","Infinity","_getWhitespaceSymbols","fallback","_prop","_prop2","_value2","allowEmpty","escapeRegex","nativeEscape","CSS","escape","BaseStyleRule","isProcessed","sheet","Renderer","renderer","force","process","onChangeValue","isEmpty","isDefined","remove","renderable","removeProperty","setProperty","attached","StyleRule","_BaseStyleRule","_this","scoped","generateId","selectorText","_assertThisInitialized","_inheritsLoose","_proto2","applyTo","link","_createClass","setSelector","replaceRule","pluginStyleRule","defaultToStringOptions","atRegExp","ConditionalRule","atMatch","at","query","rules","RuleList","_proto","getRule","addRule","onProcessRule","newRule","keyRegExp","pluginConditionalRule","defaultToStringOptions$1","nameRegExp","KeyframesRule","frames","nameMatch","keyRegExp$1","refRegExp","findReferencedKeyframe","keyframes","replaceRef","refKeyframe","pluginKeyframesRule","onProcessStyle","KeyframeRule","pluginKeyframeRule","FontFaceRule","keyRegExp$2","pluginFontFaceRule","ViewportRule","pluginViewportRule","SimpleRule","keysMap","pluginSimpleRule","defaultUpdateOptions","forceUpdateOptions","ruleOptions","_this$options","oldRule","oldIndex","nameOrSelector","unregister","updateOne","_this$options2","onUpdate","nextValue","_nextValue","_prevValue","css","StyleSheet","deployed","attach","detach","queue","insertRule","deleteRule","addRules","added","_this$rules","PluginsRegistry","internal","external","registry","onProcessSheet","processedValue","use","newPlugin","plugin","SheetsRegistry","reset","_temp","_objectWithoutPropertiesLoose","sheets","globalThis$1","Function","ns","moduleId","createGenerateId","ruleCounter","jssId","prefix","minify","getPropertyValue","cssRule","attributeStyleMap","indexOfImportantFlag","cssValueWithoutImportantFlag","delete","getHead","querySelector","findPrevNode","insertionPoint","findHigherSheet","parentNode","findHighestSheet","nextSibling","comment","head","childNodes","nodeValue","findCommentNode","getNonce","getAttribute","_insertRule","container","appendRule","cssRules","getValidRuleInsertionIndex","maxIndex","DomRenderer","hasInsertedRules","media","meta","el","textContent","createStyle","setAttribute","nextNode","insertBefore","insertionPointElement","appendChild","insertStyle","Boolean","removeChild","insertRules","nativeParent","latestNativeParent","_insertionIndex","refCssRule","ruleStr","insertionIndex","nativeRule","getRules","instanceCounter","Jss","isInBrowser","setup","createStyleSheet","removeStyleSheet","createJss","hasCSSTOMSupport","getDynamicStyles","extracted","multiKeyStore","key1","key2","subCache","Map","pseudoClasses","fnValuesNs","fnRuleNs","fnValues","styleRule","fnRule","atPrefix","GlobalContainerRule","GlobalPrefixedRule","separatorRegExp","addScope","scope","parts","handleNestedGlobalContainerRule","handlePrefixedGlobalRule","parentRegExp","getReplaceRef","replaceParentRefs","nestedProp","parentProp","parentSelectors","nestedSelectors","nested","getOptions","prevOptions","nestingLevel","isNested","isNestedConditional","uppercasePattern","msPattern","toHyphenLower","hName","convertCase","converted","hyphenate","hyphenatedProp","px","ms","percent","addCamelCasedVersion","regExp","newObj","units","border","margin","bottom","left","top","right","inset","motion","outline","perspective","gap","grid","iterate","innerProp","_innerProp","isNaN","camelCasedOptions","js","vendor","browser","isTouch","documentElement","jsCssMap","Moz","O","Webkit","appearence","noPrefill","supportedProperty","colorAdjust","toUpper","camelize","pascalize","longhand","textOrientation","writingMode","breakPropsOld","inlineLogicalOld","newProp","unprefixed","prefixed","pascalized","scrollSnap","overscrollBehavior","propMap","order","flex2012","propMap$1","flex","propKeys","prefixCss","flex2009","multiple","propertyDetectors","_toConsumableArray","computed","getComputedStyle","key$1","el$1","cache$1","transitionProperties","transPropsRegExp","prefixTransitionCallback","prefixedValue","supportedValue","cacheKey","prefixStyle","changeProp","supportedProp","changeValue","supportedValue$1","atRule","supportedKeyframes","prop0","prop1","camelCase","defaultUnit","vendorPrefixer","propsSort","generateClassName","_options$disableGloba","disableGlobal","_options$productionPr","productionPrefix","_options$seed","seedPrefix","getNextCounterId","styleSheet","createGenerateClassName","defaultOptions","disableGeneration","sheetsCache","sheetsManager","sheetsRegistry","StylesContext","indexCounter","increment","getStylesCreator","themingEnabled","stylesWithOverrides","getClasses","cacheClasses","lastProp","lastJSS","mergeClasses","baseClasses","newClasses","_ref2","stylesCreator","sheetManager","refs","staticSheet","dynamicStyles","flip","serverGenerateClassName","dynamicSheet","_ref3","_ref4","useSynchronousEffect","currentKey","classNamePrefixOption","_options$defaultTheme","noopTheme","stylesOptions2","shouldUpdate","nextClasses","ThemeContext","isPlainObject","formatMuiErrorMessage","encodeURIComponent","ctx","pending","base64","b64","s64","chunk","invalidEncoding","codegen","functionParams","functionName","Codegen","formatStringOrScope","verbose","scopeKeys","scopeParams","scopeValues","scopeOffset","formatParams","formatOffset","$0","$1","functionNameOverride","EventEmitter","_listeners","evt","listeners","emit","asPromise","fs","inquire","filename","xhr","readFile","contents","XMLHttpRequest","binary","onreadystatechange","responseText","overrideMimeType","responseType","open","send","factory","Float32Array","f32","f8b","le","writeFloat_f32_cpy","writeFloat_f32_rev","readFloat_f32_cpy","readFloat_f32_rev","writeFloatLE","writeFloatBE","readFloatLE","readFloatBE","writeFloat_ieee754","writeUint","exponent","readFloat_ieee754","readUint","uint","mantissa","NaN","bind","writeUintLE","writeUintBE","readUintLE","readUintBE","Float64Array","f64","writeDouble_f64_cpy","writeDouble_f64_rev","readDouble_f64_cpy","readDouble_f64_rev","writeDoubleLE","writeDoubleBE","readDoubleLE","readDoubleBE","writeDouble_ieee754","off0","off1","readDouble_ieee754","moduleName","eval","isAbsolute","absolute","originPath","includePath","alreadyNormalized","alloc","SIZE","MAX","slab","utf8","write","writeUint16BE","out","writeUint16LE","readInt32BE","readUint32BE","readInt32LE","readUint32LE","writeUint32BE","writeUint32LE","writeUint64BE","writeUint64LE","int_1","DataView","byteOffset","getFloat32","getFloat64","setFloat32","setFloat64","core","j0","j1","j2","j3","j4","j5","j6","j7","j8","j9","j10","j11","j12","j13","j14","j15","x0","x3","x4","x5","x6","x7","x8","x9","x10","x11","x12","x13","x14","x15","binary_1","streamXOR","src","dst","nonceInplaceCounterLength","nc","counterLength","incrementCounter","wipe_1","ZEROS","nonceLength","tagLength","ChaCha20Poly1305","plaintext","associatedData","authKey","chacha_1","resultLength","_authenticate","subarray","sealed","calculatedTag","constant_time_1","tagOut","poly1305_1","tag","clean","compare","subject","resultIfOne","resultIfZero","saveState","restoreState","cleanSavedState","_counter","_hash","_info","okm","hmac_1","_buffer","digestLength","_bufpos","HKDF","ctr","finish","_fillBuffer","_finished","_inner","_outer","blockSize","pad","hash_1","_innerKeyedState","_outerKeyedState","HMAC","savedState","imul","al","bl","isFinite","_r","Uint16Array","_h","_pad","_leftover","_fin","t0","t3","t4","t5","t6","t7","Poly1305","mpos","hibit","h0","h7","h8","h9","r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","d0","d3","d4","d5","d6","d7","d8","d9","macpos","_blocks","want","prng","system_1","wipe","ALPHANUMERIC","randomString","charset","charsLen","maxByte","randomByte","isAvailable","isInstantiated","browserCrypto","_crypto","nodeCrypto","_source","browser_1","node_1","_state","Int32Array","_bufferLength","_bytesHashed","SHA256","_initState","dataLength","dataPos","hashBlocks","bytesHashed","bitLenHi","bitLenLo","padLength","bufferLength","gf","init","_9","_121665","car25519","sel25519","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20","t21","t22","t23","t24","t25","t26","t27","t28","t29","t30","b3","b4","b5","b6","b7","b8","b9","b10","b11","b12","b13","b14","b15","square","scalarMult","unpack25519","x32","x16","inp","inv25519","pack25519","scalarMultBase","generateKeyPairFromSeed","secretKey","mySecretKey","theirPublicKey","rejectZero","checkInt","checkInts","arrayish","coerceArray","copy","createArray","copyArray","sourceArray","targetArray","targetStart","sourceStart","sourceEnd","convertUtf8","toBytes","encodeURI","convertHex","Hex","numberOfRounds","rcon","S","Si","T1","T2","T3","T4","T5","T6","T7","T8","U1","U2","U3","U4","convertToInt32","AES","_prepare","rounds","_Ke","_Kd","roundKeyCount","KC","tk","tt","rconpointer","ModeOfOperationECB","description","_aes","ModeOfOperationCBC","_lastCipherblock","ModeOfOperationCFB","segmentSize","_shiftRegister","xorSegment","encrypted","ModeOfOperationOFB","_lastPrecipher","_lastPrecipherIndex","Counter","initialValue","setBytes","ModeOfOperationCTR","_remainingCounter","_remainingCounterIndex","aesjs","ModeOfOperation","ecb","cbc","cfb","ofb","pkcs7","padder","strip","_arrayTest","anySignal","signals","controller","AbortController","onAbort","abort","signal","removeEventListener","aborted","ALPHABET","ALPHABET_MAP","polymodStep","prefixChk","chk","__decode","LIMIT","lowered","uppered","wordChars","convert","inBits","outBits","maxV","decodeUnsafe","toWordsUnsafe","toWords","fromWordsUnsafe","fromWords","endian","isBN","Buffer","parseHex4Bits","parseHexByte","lowerBound","parseBase","move","dest","_initNumber","_initArray","_parseHex","_parseBase","_strip","limbLen","limbPow","imuln","_iaddn","_move","_expand","_normSign","groupSizes","groupBases","groupSize","groupBase","modrn","idivn","toBuffer","toArrayLike","smallMulTo","ncarry","rword","maxJ","ArrayType","reqLength","allocUnsafe","allocate","_toArrayLikeLE","position","_toArrayLikeBE","clz32","_countBits","_zeroBits","zeroBits","inotn","testn","notn","iuor","ior","uor","iuand","iand","uand","iuxor","ixor","uxor","bytesNeeded","bitsLeft","setn","wbit","isub","comb10MulTo","al0","ah0","al1","ah1","al2","ah2","a3","al3","ah3","a4","al4","ah4","a5","al5","ah5","a6","al6","ah6","a7","al7","ah7","a8","al8","ah8","a9","al9","ah9","bl0","bh0","bl1","bh1","bl2","bh2","bl3","bh3","bl4","bh4","bl5","bh5","bl6","bh6","bl7","bh7","bl8","bh8","bl9","bh9","w0","w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18","bigMulTo","hncarry","jumboMulTo","FFTM","mulTo","makeRBT","revBin","rb","permute","rbt","rws","iws","rtws","itws","rtwdf","cos","PI","itwdf","sin","rtwdf_","itwdf_","ie","ro","io","guessLen13b","conjugate","normalize13b","convert13b","stub","ph","mulp","rwst","iwst","nrws","nrwst","niwst","rmws","mulf","isNegNum","muln","isqr","toBitArray","iushln","carryMask","newCarry","ishln","extended","maskedWords","ishrn","ushln","imaskn","addn","subn","iabs","_ishlnsubmul","_wordDiv","bhi","diff","qj","divmod","positive","divn","dm","half","egcd","D","yp","xp","im","jm","gcd","_invmp","bincn","ucmp","gtn","gten","ltn","lten","eqn","Red","convertTo","_forceRed","convertFrom","redShl","_verify2","redIMul","_verify1","redISqr","sqrt","redPow","primes","k256","p224","p192","p25519","MPrime","_tmp","K256","P224","P192","P25519","_prime","Mont","imod","rinv","minv","ireduce","imulK","prev","mod3","nOne","lpow","inv","currentLen","plural","msAbs","isPlural","exec","long","fmtLong","fmtShort","formatArgs","useColors","namespace","humanize","lastC","namespaces","setItem","removeItem","load","getItem","__nwjs","navigator","userAgent","WebkitAppearance","firebug","exception","table","localStorage","localstorage","destroy","warned","formatters","env","createDebug","prevTime","namespacesCache","enabledCache","enableOverride","enabled","curr","formatter","logFn","selectColor","extend","delimiter","newDebug","toNamespace","regexp","disable","skips","enable","Denque","_head","_tail","_capacity","capacity","_capacityMask","_list","_fromArray","peekAt","peek","peekFront","peekBack","_growArray","_shrinkArray","tail","removeOne","removed","del_count","arg_len","arguments_index","leng","_copyArray","fullCopy","newArray","list","assign","ErrClass","abi_1","address_1","basex_1","bytes_1","hdnode_1","json_wallets_1","keccak256_1","logger_1","sha2_1","solidity_1","random_1","properties_1","signing_key_1","strings_1","transactions_1","units_1","wallet_1","web_1","sha2_2","strings_2","event_iterator_1","EventIterator","EventQueue","pullQueue","pushQueue","eventHandlers","isPaused","isStopped","resolution","placeholder","highWaterMark","highWater","stop","fail","rejection","removeCallback","asyncIterator","lowWaterMark","lowWater","return","listen","Events","EE","context","emitter","_events","_eventsCount","clearEvent","__proto__","eventNames","getOwnPropertySymbols","handlers","listenerCount","removeAllListeners","ReflectOwnKeys","R","Reflect","ReflectApply","receiver","ownKeys","getOwnPropertyNames","NumberIsNaN","errorListener","resolver","eventTargetAgnosticAddListener","handler","flags","addErrorHandlerIfEventEmitter","_maxListeners","defaultMaxListeners","checkListener","_getMaxListeners","_addListener","prepend","existing","newListener","ProcessEmitWarning","onceWrapper","fired","wrapFn","_onceWrap","wrapped","unwrap","evlistener","unwrapListeners","arrayClone","wrapListener","setMaxListeners","getMaxListeners","doError","er","prependListener","prependOnceListener","originalListener","spliceOne","rawListeners","hwm","btm","FixedFIFO","sha","ripemd","hmac","sha1","sha224","sha384","BlockHash","pendingTotal","_delta8","_delta32","join32","_digest","Hmac","Hash","inner","outer","rotl32","sum32","sum32_3","sum32_4","RIPEMD160","Kh","E","Ah","Bh","Ch","Dh","Eh","rh","sh","toHex32","split32","shaCommon","sum32_5","ft_1","sha1_K","SHA1","W","SHA224","ch32","maj32","s0_256","s1_256","g0_256","g1_256","sha256_K","SHA512","SHA384","rotr64_hi","rotr64_lo","shr64_hi","shr64_lo","sum64","sum64_hi","sum64_lo","sum64_4_hi","sum64_4_lo","sum64_5_hi","sum64_5_lo","sha512_K","ch64_hi","xh","yh","yl","zh","ch64_lo","zl","maj64_hi","maj64_lo","s0_512_hi","s0_512_lo","s1_512_hi","s1_512_lo","g0_512_hi","g0_512_lo","g1_512_hi","g1_512_lo","_prepareBlock","c0_hi","c0_lo","c1_hi","c1_lo","c2_hi","c2_lo","c3_hi","c3_lo","ah","bh","ch","cl","dh","dl","eh","fh","fl","gh","gl","hh","hl","c4_hi","c4_lo","T1_hi","T1_lo","T2_hi","T2_lo","rotr32","p32","isSurrogatePair","htonl","zero8","_cache","reactIs","REACT_STATICS","childContextTypes","contextType","contextTypes","getDefaultProps","getDerivedStateFromError","getDerivedStateFromProps","KNOWN_STATICS","caller","callee","arity","MEMO_STATICS","TYPE_STATICS","getStatics","isMemo","ForwardRef","render","Memo","getOwnPropertyDescriptor","objectPrototype","targetComponent","sourceComponent","blacklist","inheritedComponent","targetStatics","sourceStatics","descriptor","$$typeof","AsyncMode","ConcurrentMode","ContextConsumer","ContextProvider","Element","Lazy","Portal","Profiler","StrictMode","Suspense","isAsyncMode","isConcurrentMode","isContextConsumer","isContextProvider","isElement","isForwardRef","isLazy","isPortal","isProfiler","isStrictMode","isSuspense","isValidElementType","typeOf","includeBoundaries","v4","v6seg","v6","v46Exact","v4exact","v6exact","ip","exact","ipv4Part","ipv4Regexes","fourOctet","threeOctet","twoOctet","longValue","octalRegex","hexRegex","zoneIndex","ipv6Part","ipv6Regexes","deprecatedTransitional","transitional","expandIPv6","replacement","replacementCount","colonCount","lastColon","zoneId","matchCIDR","first","second","partSize","cidrBits","part","parseIntAuto","padPart","ipaddr","IPv4","octet","SpecialRanges","unspecified","broadcast","multicast","linkLocal","loopback","carrierGradeNat","reserved","cidrRange","prefixLengthFromSubnetMask","cidr","zerotable","subnetMatch","toByteArray","toIPv4MappedAddress","IPv6","toNormalizedString","broadcastAddressFromCIDR","parseCIDR","ipInterfaceOctets","subnetMaskOctets","subnetMaskFromPrefixLength","isIPv4","parser","isValid","isValidFourPartDecimal","networkAddressFromCIDR","maskLength","parsed","filledOctetCount","uniqueLocal","ipv4Mapped","rfc6145","rfc6052","teredo","isIPv4MappedAddress","toFixedLengthString","toIPv4Address","high","toRFC5952String","regex","bestMatchIndex","bestMatchLength","isIPv6","native","fromByteArray","e2","rangeList","defaultName","rangeName","rangeSubnets","subnet","versions","electron","URLWithLegacySupport","URLSearchParams","defaultBase","relative","URL","urlParsed","protocolMap","defaultProtocol","protocol","host","isReactNative","product","pathname","auth","username","startsWith","hostname","origin","port","searchParams","createObjectURL","revokeObjectURL","userPass","async","entry","thing","pushable","sources","FIFO","onEnd","onNext","ended","bufferNext","bufferError","writev","throw","_pushable","sorter","limit","INPUT_ERROR","WINDOW","JS_SHA3_NO_WINDOW","WEB_WORKER","JS_SHA3_NO_NODE_JS","COMMON_JS","JS_SHA3_NO_COMMON_JS","AMD","define","ARRAY_BUFFER","JS_SHA3_NO_ARRAY_BUFFER","HEX_CHARS","CSHAKE_PADDING","SHIFT","RC","BITS","SHAKE_BITS","OUTPUT_TYPES","CSHAKE_BYTEPAD","JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW","createOutputMethod","outputType","Keccak","createShakeOutputMethod","outputBits","createCshakeOutputMethod","methods","createKmacOutputMethod","createOutputMethods","createMethod","algorithms","bytepad","Kmac","methodNames","methodName","newMethodName","blocks","finalized","blockCount","byteCount","outputBlocks","extraBytes","notString","lastByteIndex","encodeString","strs","paddingBytes","finalize","Uint32Array","c0","c3","c4","c5","c6","c7","c9","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","isOptionObject","propertyIsEnumerable","defaultMergeOptions","concatArrays","ignoreUndefined","getEnumerableOwnPropertyKeys","symbol","cloneArray","cloneOptionObject","mergeKeys","merged","config","resultIndex","includes","option","arr2","defaultTarget","mutableHandler","mutableTarget","setTarget","setHandler","Proxy","getTarget","getHandler","proxy","Netmask","chr","chr0","chrA","chra","ip2long","long2ip","dmax","net","maskLong","error1","bitmask","netLong","hostmask","contains","lastLong","forge","registerAlgorithm","Algorithm","startEncrypting","_createCipher","createEncryptionCipher","startDecrypting","createDecryptionCipher","initialize","inBlock","outBlock","_updateBlock","_w","util","createBuffer","putByte","getInt32","encryptOp","_expandKey","modes","gcm","sbox","isbox","mix","imix","xtime","e4","e8","sx","sx2","me","ime","ei","iNk","Nk","m0","m1","m2","m3","wnew","wi","Nr","createDecipher","createCipher","ByteBuffer","asn1","_checkBufferLength","remaining","available","requested","Class","UNIVERSAL","APPLICATION","CONTEXT_SPECIFIC","PRIVATE","Type","NONE","BOOLEAN","INTEGER","BITSTRING","OCTETSTRING","NULL","OID","ODESC","EXTERNAL","REAL","ENUMERATED","EMBEDDED","UTF8","ROID","SEQUENCE","SET","PRINTABLESTRING","IA5STRING","UTCTIME","GENERALIZEDTIME","BMPSTRING","tagClass","constructed","composed","bitStringContents","excludeBitStringContents","equals","obj1","obj2","includeBitStringContents","getBerValueLength","getByte","getInt","_fromDer","longFormBytes","_getValueLength","strict","getBytes","decodeBitStrings","savedRead","savedRemaining","unused","used","tc","ex","getInt16","asn1Options","fromDer","parseAllBytes","toDer","useBitStringContents","putBytes","putBuffer","putInt16","lenBytes","oidToDer","oid","valueBytes","derToOid","utcTimeToDate","utc","year","MM","DD","ss","setUTCFullYear","setUTCHours","setTime","generalizedTimeToDate","gentime","YYYY","fff","isUTC","setFullYear","setHours","dateToUtcTime","rval","dateToGeneralizedTime","integerToDer","putSignedInt","integer","derToInteger","getSignedInt","capture","optional","captureAsn1","captureBitStringContents","captureBitStringValue","_nonLatinRegex","prettyPrint","indentation","IA5String","subvalues","pki","oids","bytesToHex","decodeUtf8","api","_reverseAlphabets","maxline","_encodeWithByteBuffer","getAlgorithm","BlockCipher","_finish","_input","_op","unpad","overflow","afterFinish","transformIV","ints","inc32","from64To32","_ints","_inBlock","_outBlock","putInt32","fillWithByte","truncate","_prev","_iv","_partialBlock","_partialOutput","_partialBytes","inputLength","partialBytes","_R","additionalData","_cipherLength","_tagLength","_tag","_hashBlock","_hashSubkey","componentBits","_m","generateHashTable","ivLength","_j0","ghash","_aDataLength","_s","lengths","multiply","z_i","v_i","lsb","tableMultiply","x_i","perInt","shft","generateSubHashTable","m_i","m_j","des","_keys","pc2bytes0","pc2bytes1","pc2bytes2","pc2bytes3","pc2bytes4","pc2bytes5","pc2bytes6","pc2bytes7","pc2bytes8","pc2bytes9","pc2bytes10","pc2bytes11","pc2bytes12","pc2bytes13","shifts","lefttmp","righttmp","_createKeys","spfunction1","spfunction2","spfunction3","spfunction4","spfunction5","spfunction6","spfunction7","spfunction8","looping","endloop","loopinc","right1","right2","usePureJavaScript","_md","_ipadding","_opadding","blockLength","getMac","dbits","jsbn","BigInteger","fromNumber","nbi","am3","am","appName","DB","DM","DV","FV","F1","F2","rr","vv","BI_RC","int2char","intAt","nbv","fromInt","nbits","Classic","Montgomery","mp","invDigit","mpl","mph","um","mt2","op_and","op_or","op_xor","op_andnot","lbit","cbit","NullExp","nNop","Barrett","q3","dlShiftTo","mu","divide","compareTo","revert","divRemTo","multiplyTo","sqrTo","squareTo","ZERO","subTo","copyTo","u0","drShiftTo","fromRadix","mi","lShiftTo","bs","cbs","bm","ds","rShiftTo","pm","pt","ts","nsh","y0","yt","qd","exp","toRadix","km","modPowInt","multiplyUpperTo","multiplyLowerTo","dAddOffset","lowprimes","lplim","chunkSize","signum","cs","intValue","dMultiply","testBit","bitwiseTo","shiftLeft","isProbablePrime","nextBytes","op","changeBit","addTo","modInt","millerRabin","n1","subtract","getLowestSetBit","shiftRight","modPow","byteValue","shortValue","andNot","not","bitCount","setBit","clearBit","flipBit","remainder","divideAndRemainder","g2","is1","modInverse","ac","mgf","mgf1","maskLen","_IN","_I_","pbe","encryptedPrivateKeyValidator","PBES2AlgorithmsValidator","pkcs12PbeParamsValidator","prfOidToMessageDigest","prfOid","prfAlgorithm","supported","prfAlgorithmToMessageDigest","encryptPrivateKeyInfo","saltSize","encryptionAlgorithm","encryptedData","getBytesSync","countBytes","ivLen","encOid","cipherFn","dk","pkcs5","hexToBytes","createPbkdf2Params","saltBytes","generatePkcs12Key","decryptPrivateKeyInfo","encryptionOid","getCipher","encryptionParams","encryptedPrivateKeyToPem","epki","pem","encryptedPrivateKeyFromPem","headerType","procType","encryptRsaPrivateKey","rsaKey","legacy","wrapRsaPrivateKey","privateKeyToAsn1","opensslDeriveBytes","dekInfo","parameters","decryptRsaPrivateKey","rc2","privateKeyFromAsn1","passBuf","Slen","Plen","P","Inew","setAt","getCipherForPBES2","getCipherForPKCS12PBE","supportedOids","kdfOid","kdfSalt","kdfIterationCount","encIv","dIvLen","md5","digests","isNodejs","u_c","u_c1","int32ToBytes","xorBytes","setImmediate","foldHeader","insertSpace","candidate","insert","ltrim","contentDomain","encode64","rMessage","rHeader","rCRLF","decode64","lines","li","line","nl","vi","pkcs1","rsa_mgf1","encode_rsa_oaep","mgf1Md","keyLength","lHash","PS","PS_length","seedLength","dbMask","maskedDB","seedMask","maskedSeed","decode_rsa_oaep","em","expectedLength","db","lHashPrime","in_ps","is_0","error_mask","p7","_recipientFromAsn1","recipientInfoValidator","issuer","RDNAttributesAsArray","serialNumber","serial","encryptedContent","encAlgorithm","parameter","encParameter","content","encKey","_recipientsToAsn1","recipients","distinguishedNameToAsn1","attributes","_signerToAsn1","digestAlgorithm","authenticatedAttributesAsn1","signatureAlgorithm","unauthenticatedAttributes","attrsAsn1","attr","_attributeToAsn1","contentType","messageDigest","signingTime","jan_1_1950","jan_1_2050","_fromAsn1","rawCapture","_decryptContent","ciph","messageFromPem","messageFromAsn1","messageToPem","pemObj","toAsn1","contentInfoValidator","envelopedData","createEnvelopedData","createEncryptedData","signedData","createSignedData","fromAsn1","certificates","crls","signers","digestAlgorithmIdentifiers","contentInfo","signerInfos","signedDataValidator","certs","certificateFromAsn1","certificateToAsn1","addSigner","signer","certificate","cert","certificateFromPem","privateKeyFromPem","authenticatedAttributes","rsaEncryption","encodeUtf8","detached","detachedContent","mds","ai","_signersToAsn1","addSignerInfos","addDigestAlgorithmIds","addCertificate","addCertificateRevokationList","crl","encryptedDataValidator","envelopedDataValidator","infos","_recipientsFromAsn1","recipientInfos","findRecipient","sAttr","rAttr","recipient","privKey","desCBC","addRecipient","keyLen","ciphFn","p7v","pkcs7asn1","encryptedContentInfoValidator","signerValidator","GCD_30_DELTA","THIRTY","generateProbablePrime","rng","Worker","primeincFindPrimeWithoutWorkers","generateRandom","numWorkers","workers","workLoad","workerScript","estimateCores","cores","workerMessage","terminate","postMessage","primeincFindPrimeWithWorkers","primeincFindPrime","mrTests","getMillerRabinTests","millerRabinTests","maxBlockTime","_primeinc","deltaIdx","bits1","reseeds","generated","keyBytes","pools","_reseedSync","messageLength","_seed","needed","collect","seedFileSync","_2powK","seedBytes","formatKey","formatSeed","defaultSeedFile","globalScope","QuotaExceededError","pool","generateSync","seedFile","collectInt","registerWorker","worker","pss","saltLength","sLen","salt_","pssobj","modBits","emBits","emLen","mHash","m_","ps","checkLen","jQuery","prng_aes","_prng_aes_output","_prng_aes_buffer","spawnPrng","_ctx","_navBytes","mousemove","clientX","clientY","keypress","charCode","createInstance","piTable","rol","ror","expandKey","effKeyBits","L","TM","mixRound","mashRound","_output","getInt16Le","runPlan","plan","putInt16Le","ptr","rsa","privateKeyValidator","rsaPrivateKeyValidator","rsaPublicKeyValidator","publicKeyValidator","digestInfoValidator","emsaPkcs1v15encode","oidBytes","digestInfo","_modPow","dP","dQ","qInv","xq","_encodePkcs1_v1_5","bt","eb","padByte","padNum","numZeros","padBytes","_decodePkcs1_v1_5","ml","_generateKeyPair","getPrime","pBits","qBits","phi","setPrivateKey","setPublicKey","_bnToBytes","_getMillerRabinTests","_detectNodeCrypto","_detectSubtleCrypto","subtle","_detectSubtleMsCrypto","_intToUint8Array","yhex","ed","xhex","createKeyPairGenerationState","eInt","pqState","stepKeyPairGenerationState","generateKeyPair","modulusLength","publicExponent","publicKeyEncoding","privateKeyEncoding","publicKeyFromPem","generateKey","exportKey","pkcs8","setRsaPublicKey","genOp","oncomplete","exportOp","onerror","keypair","generateKeyPairSync","scheme","schemeOptions","_parseAllDigestBytes","algorithmIdentifier","md2","setRsaPrivateKey","privateKeyModulus","privateKeyPublicExponent","privateKeyPrivateExponent","privateKeyPrime1","privateKeyPrime2","privateKeyExponent1","privateKeyExponent2","privateKeyCoefficient","privateKeyToRSAPrivateKey","publicKeyFromAsn1","publicKeyOid","rsaPublicKey","publicKeyModulus","publicKeyExponent","publicKeyToAsn1","publicKeyToSubjectPublicKeyInfo","publicKeyToRSAPublicKey","_initialized","fillString","fullMessageLength","messageLengthSize","messageLength64","int32s","encoding","finalBlock","_k","s0","maj","_states","messageLength128","hlen","t1_hi","t1_lo","t2_hi","t2_lo","s0_hi","s0_lo","s1_hi","ch_hi","maj_hi","maj_lo","a_hi","a_lo","b_hi","b_lo","c_hi","c_lo","d_hi","d_lo","e_hi","e_lo","f_hi","f_lo","g_hi","g_lo","h_hi","h_lo","baseN","_checkBitsParam","ByteStringBuffer","isArrayBuffer","isArrayBufferView","_constructedStringLength","callbacks","stopPropagation","MutationObserver","observe","oldSetImmediate","_optimizeConstructedString","putString","putInt24","putInt24Le","putInt32Le","putInt","getInt24","getInt24Le","getInt32Le","DataBuffer","readOffset","growSize","writeOffset","accommodate","amount","setUint8","view","utf16","setInt16","setInt8","setInt32","getInt8","getUint8","s3","_base64","_base64Idx","_base58","chr1","chr2","chr3","enc1","enc2","enc3","enc4","unescape","decodeURIComponent","base58","deflate","inflate","_setStorageObject","_getStorageObject","_setItem","_getItem","_removeItem","empty","_clearItems","_callStorageFunction","idx","clearItems","argi","lastIndex","dec_point","thousands_sep","formatSize","bytesFromIP","bytesFromIPv4","bytesFromIPv6","blanks","bytesToIP","bytesToIPv4","bytesToIPv6","zeroGroups","zeroMaxGroup","group","hardwareConcurrency","blobUrl","et","sample","samples","avg","overlaps","overlap","_shortNames","x509CertificateValidator","rsassaPssParameterValidator","certificationRequestInfoValidator","certificationRequestValidator","_getAttribute","shortName","rdn","si","valueTagClass","CRIAttributesAsArray","seq","extensionRequest","extensions","certificateExtensionFromAsn1","_readSignatureParameters","fillDefaults","algorithmOid","hashOid","maskGenOid","maskGenHashOid","_createSignatureDigest","signatureOid","_verifySignature","sha1WithRSAEncryption","sha1WithRSASignature","signatureParameters","_dnToAsn1","attrs","_fillMissingFields","attribute","valueConstructed","certificateExtensionToAsn1","_fillMissingExtensionFields","extension","digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly","cA","pathLenConstraint","server","objsign","sslCA","emailCA","objCA","altNames","altName","ski","generateSubjectKeyIdentifier","subjectKeyIdentifier","keyIdentifier","authorityCertIssuer","subSeq","fullNameGeneralNames","_signatureParametersToAsn1","_CRIAttributesToAsn1","csr","computeHash","certificateToPem","publicKeyToPem","publicKeyToRSAPublicKeyPem","getPublicKeyFingerprint","certificationRequestFromPem","certificationRequestFromAsn1","certificationRequestToPem","certificationRequestToAsn1","createCertificate","siginfo","validity","notBefore","notAfter","getField","sn","addField","setSubject","uniqueId","setIssuer","setExtensions","exts","getExtension","ext","tbsCertificate","getTBSCertificate","issued","expectedIssuer","actualIssuer","isIssuer","iattr","sattr","verifySubjectKeyIdentifier","certVersion","certSerialNumber","certSignatureOid","certSignatureParams","certinfoSignatureOid","certinfoSignatureParams","certSignature","certValidity1UTCTime","certValidity2GeneralizedTime","certValidity3UTCTime","certValidity4GeneralizedTime","imd","ibytes","certIssuer","certIssuerUniqueId","smd","sbytes","certSubject","certSubjectUniqueId","certExtensions","certificateExtensionsFromAsn1","subjectPublicKeyInfo","extseq","critical","ev","gn","createCertificationRequest","csrVersion","csrSignatureOid","csrSignatureParams","csrSignature","certificationRequestInfo","certificationRequestInfoSubject","addAttribute","certificationRequestInfoAttributes","setAttributes","getCertificationRequestInfo","cri","_dateToAsn1","tbs","certificateExtensionsToAsn1","dn","createCaStore","caStore","getBySubject","ensureSubjectHasHash","getIssuer","hasCertificate","der1","listAllCertificates","certList","removeCertificate","certificateError","bad_certificate","unsupported_certificate","certificate_revoked","certificate_expired","certificate_unknown","unknown_ca","verifyCertificateChain","chain","validityCheckDate","selfSigned","verified","se","keyUsage","basicConstraints","bcExt","keyUsageExt","vfd","Fifo","defer","_waitingConsumers","_consume","nextConsumer","nextChunk","deferred","__importDefault","__esModule","netmask_1","ip_regex_1","is_ip_1","ipaddr_js_1","NETMASK_RANGES","ip_range","ipv6_check","ip_addr","ipv4_check","ipRegex","isIp","timeType","commonRe","google","protobuf","Any","type_url","Duration","seconds","nanos","Timestamp","Empty","Struct","keyType","Value","oneofs","oneof","nullValue","numberValue","stringValue","boolValue","structValue","listValue","NullValue","NULL_VALUE","ListValue","DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue","FieldMask","paths","file","converter","Enum","genValuePartial_fromObject","gen","fieldIndex","resolvedType","typeDefault","repeated","fullName","isUnsigned","genValuePartial_toObject","mtype","fieldsArray","safeProp","toObject","compareFieldsById","repeatedFields","mapFields","normalFields","partOf","valuesById","unsigned","arrayDefault","hasKs2","_fieldsArray","defaults","basic","packed","rfield","required","wireType","mapKey","genTypePartial","ReflectionObject","Namespace","comments","valuesOptions","enm","toJSONOptions","keepComments","isString","isReservedId","isReservedName","allow_alias","Field","ruleRe","isObject","Long","extensionField","declaringField","_packed","getOption","setOption","ifNotSet","resolved","lookupTypeOrEnum","proto3_optional","newBuffer","emptyObject","emptyArray","fieldId","fieldType","fieldRule","decorateType","decorateEnum","fieldName","_configure","Type_","build","Root","loadSync","decoder","verifier","OneOf","MapField","Service","Method","Message","wrappers","configure","BufferWriter","BufferReader","rpc","roots","tokenize","resolvedKeyType","fieldKeyType","fieldValueType","$type","encodeDelimited","decodeDelimited","requestType","requestStream","responseStream","parsedOptions","resolvedRequestType","resolvedResponseType","lookupType","arrayToJSON","_nestedArray","clearCache","addJSON","nestedArray","nestedJson","getEnum","setOptions","onAdd","onRemove","resolveAll","filterTypes","parentAlreadyChecked","lookupEnum","lookupService","Service_","Enum_","defineProperties","_handleAdd","_handleRemove","setParsedOption","opt","newOpt","Root_","fieldNames","addFieldsToParent","oneofName","oneOfGetter","oneOfSetter","keepCase","base10Re","base10NegRe","base16Re","base16NegRe","base8Re","base8NegRe","numberRe","nameRe","typeRefRe","fqTypeRefRe","pkg","imports","weakImports","syntax","token","preferTrailingComment","tn","alternateCommentMode","cmnt","isProto3","applyCase","illegal","insideTryCatch","readString","acceptTypeRef","parseNumber","readRanges","acceptStrings","parseId","acceptNegative","parsePackage","parseImport","whichImports","parseSyntax","parseCommon","parseOption","parseType","parseEnum","service","ifBlock","commentText","parseMethod","parseService","reference","parseField","parseExtension","fnIf","fnElse","trailingLine","valueType","parseInlineOptions","parseMapField","parseOneOf","lcFirst","ucFirst","parseGroup","dummy","parseEnumValue","isCustom","parseOptionValue","objectResult","lastValue","prevValue","simpleValue","LongBits","indexOutOfRange","writeLength","create_array","isBuffer","readLongVarint","readFixed32_end","readFixed64","_slice","uint32","int32","sint32","bool","fixed32","sfixed32","float","double","skipType","BufferReader_","int64","uint64","sint64","zzDecode","fixed64","sfixed64","utf8Slice","files","SYNC","resolvePath","sync","cb","getBundledFileName","altname","queued","weak","readFileSync","isNode","exposeRe","tryHandleExtension","extendedType","sisterField","parse_","common_","rpcImpl","requestDelimited","responseDelimited","rpcCall","requestCtor","responseCtor","endedByRPC","_methodsArray","inherited","methodsArray","rpcService","isReserved","delimRe","stringDoubleRe","stringSingleRe","setCommentRe","setCommentAltRe","setCommentSplitRe","whitespaceRe","unescapeRe","unescapeMap","lastCommentLine","stringDelim","setComment","isLeading","lineEmpty","leading","commentOffset","isDoubleSlashCommentLine","startOffset","findEndOfLine","lineText","repeat","isDoc","isLeadingComment","actual","_fieldsById","_oneofsArray","_ctor","fieldsById","oneofsArray","generateConstructor","ctorProperties","wrapper","originalThis","fork","ldelim","typeName","bake","safePropBackslashRe","safePropQuoteRe","camelCaseRe","decorateRoot","decorateEnumIndex","setProp","zzEncode","zeroHash","toLong","fromHash","toHash","part0","part1","part2","newError","CustomError","captureStackTrace","isset","isSet","utf8Write","_Buffer_from","_Buffer_allocUnsafe","sizeOrArray","dcodeIO","key2Re","key32Re","key64Re","longToHash","longFromHash","fromBits","ProtocolError","fieldMap","longs","enums","seenFirstField","invalid","genVerifyKey","genVerifyValue","oneofProp","Op","noop","State","states","writeByte","VarintOp","writeVarint64","writeFixed32","_push","BufferWriter_","writeStringBuffer","writeBytesBuffer","aa","ca","da","ea","fa","ha","ia","ka","la","ma","acceptsBooleans","attributeName","attributeNamespace","mustUseProperty","propertyName","sanitizeURL","removeEmptyString","ra","sa","ta","pa","qa","oa","removeAttribute","setAttributeNS","xlinkHref","ua","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","va","wa","ya","za","Aa","Ba","Ca","Da","Ea","Fa","Ga","Ha","Ia","Ja","Ka","La","Ma","Na","Oa","prepareStackTrace","construct","Pa","Qa","_context","_payload","Ra","Sa","Ta","nodeName","Va","_valueTracker","stopTracking","Ua","Wa","checked","Xa","activeElement","Ya","defaultChecked","_wrapperState","initialChecked","Za","ab","bb","fb","defaultSelected","gb","dangerouslySetInnerHTML","hb","ib","kb","lb","mb","nb","namespaceURI","innerHTML","valueOf","firstChild","MSApp","execUnsafeLocalFunction","ob","lastChild","pb","animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flexGrow","flexPositive","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","lineClamp","opacity","orphans","tabSize","widows","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","qb","sb","tb","menuitem","area","br","col","embed","hr","img","keygen","track","wbr","ub","vb","is","wb","xb","srcElement","correspondingUseElement","yb","zb","Ab","Bb","Cb","stateNode","Db","Eb","Fb","Gb","Hb","Ib","Jb","Kb","Lb","Mb","Nb","Ob","Pb","Qb","Rb","Sb","Tb","Vb","alternate","Wb","memoizedState","dehydrated","Xb","Zb","Yb","$b","unstable_scheduleCallback","bc","unstable_cancelCallback","cc","unstable_shouldYield","dc","unstable_requestPaint","unstable_now","unstable_getCurrentPriorityLevel","fc","unstable_ImmediatePriority","gc","unstable_UserBlockingPriority","hc","unstable_NormalPriority","ic","unstable_LowPriority","jc","unstable_IdlePriority","kc","lc","oc","pc","qc","rc","sc","uc","pendingLanes","suspendedLanes","pingedLanes","entangledLanes","entanglements","vc","yc","zc","Ac","eventTimes","Cc","Dc","Ec","Fc","Gc","Hc","Ic","Jc","Kc","Lc","Mc","Nc","Oc","Pc","Qc","Rc","Sc","pointerId","Tc","nativeEvent","blockedOn","domEventName","eventSystemFlags","targetContainers","Vc","Wc","priority","isDehydrated","containerInfo","Xc","Yc","dispatchEvent","Zc","$c","ad","bd","cd","ReactCurrentBatchConfig","dd","fd","gd","hd","Uc","jd","kd","ld","nd","od","keyCode","pd","rd","_reactName","_targetInst","currentTarget","isDefaultPrevented","defaultPrevented","returnValue","isPropagationStopped","preventDefault","cancelBubble","persist","isPersistent","wd","xd","yd","sd","eventPhase","bubbles","cancelable","timeStamp","isTrusted","td","ud","detail","vd","Ad","screenX","screenY","pageX","pageY","shiftKey","getModifierState","zd","buttons","relatedTarget","fromElement","toElement","movementX","movementY","Bd","Dd","dataTransfer","Fd","Hd","animationName","elapsedTime","pseudoElement","Id","clipboardData","Jd","Ld","Md","Esc","Spacebar","Left","Up","Right","Down","Del","Win","Menu","Apps","Scroll","MozPrintableKey","Nd","Od","Alt","Control","Meta","Shift","Pd","Qd","which","Rd","Td","pressure","tangentialPressure","tiltX","tiltY","twist","pointerType","isPrimary","Vd","touches","targetTouches","changedTouches","Xd","Yd","deltaX","wheelDeltaX","deltaY","wheelDeltaY","wheelDelta","deltaZ","deltaMode","Zd","$d","ae","be","documentMode","ce","de","fe","ge","he","ne","oe","pe","qe","te","ue","ve","we","xe","ye","ze","oninput","Ae","detachEvent","Be","Ce","attachEvent","De","Ee","Fe","He","Ie","Je","Ke","Le","compareDocumentPosition","Me","HTMLIFrameElement","contentWindow","Ne","contentEditable","Oe","focusedElem","selectionRange","selectionStart","selectionEnd","getSelection","rangeCount","anchorNode","anchorOffset","focusNode","focusOffset","createRange","setStart","removeAllRanges","addRange","setEnd","scrollLeft","scrollTop","Pe","Qe","Re","Se","Te","Ue","Ve","We","animationend","animationiteration","animationstart","transitionend","Xe","Ye","Ze","animation","$e","af","bf","cf","df","ef","ff","hf","lf","mf","nf","Ub","of","pf","qf","rf","sf","passive","J","F","tf","uf","parentWindow","vf","wf","na","xa","$a","ba","je","char","ke","xf","yf","zf","Af","Bf","Cf","Df","Ef","__html","Ff","Gf","Hf","Jf","queueMicrotask","If","Kf","Lf","Mf","previousSibling","Nf","Of","Pf","Qf","Rf","Sf","Tf","Uf","G","Vf","H","Wf","Xf","Yf","__reactInternalMemoizedUnmaskedChildContext","__reactInternalMemoizedMaskedChildContext","Zf","$f","ag","bg","getChildContext","cg","__reactInternalMemoizedMergedChildContext","dg","eg","fg","gg","hg","jg","kg","mg","ng","og","pg","qg","rg","sg","tg","ug","vg","wg","xg","yg","zg","Ag","Bg","elementType","deletions","Cg","pendingProps","treeContext","retryLane","Dg","Eg","Fg","Gg","memoizedProps","Hg","Ig","Jg","Kg","Lg","Mg","Ng","Og","Pg","Qg","Rg","_currentValue","Sg","childLanes","Tg","dependencies","firstContext","lanes","Ug","Vg","memoizedValue","Wg","Xg","Yg","interleaved","Zg","$g","updateQueue","baseState","firstBaseUpdate","lastBaseUpdate","shared","effects","eventTime","lane","ih","jh","kh","isMounted","_reactInternals","enqueueSetState","lh","mh","enqueueReplaceState","enqueueForceUpdate","oh","shouldComponentUpdate","isPureReactComponent","updater","qh","componentWillReceiveProps","UNSAFE_componentWillReceiveProps","getSnapshotBeforeUpdate","UNSAFE_componentWillMount","componentWillMount","componentDidMount","_owner","_stringRef","th","uh","vh","wh","implementation","Fh","Gh","Hh","Ih","Jh","Lh","M","Mh","revealOrder","Nh","Oh","_workInProgressVersionPrimary","Ph","ReactCurrentDispatcher","Qh","Rh","Sh","Th","Uh","Vh","Wh","Xh","Yh","Zh","$h","bi","ci","baseQueue","di","fi","lastRenderedReducer","hasEagerState","eagerState","lastRenderedState","dispatch","gi","ii","ji","getSnapshot","ni","lastEffect","stores","oi","pi","qi","ri","deps","ti","ui","xi","yi","zi","Ai","Bi","Ci","Di","Ei","Fi","Gi","Hi","Ii","Ji","readContext","useCallback","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","unstable_isNewReconciler","identifierPrefix","Li","Mi","Ni","WeakMap","Oi","Pi","Qi","Ri","componentDidCatch","componentStack","Ti","pingCache","Ui","Vi","Wi","Xi","ReactCurrentOwner","Yi","Zi","$i","aj","bj","cj","dj","ej","baseLanes","cachePool","fj","gj","hj","ij","jj","UNSAFE_componentWillUpdate","componentWillUpdate","componentDidUpdate","kj","lj","pendingContext","mj","Aj","Cj","Dj","nj","oj","pj","rj","tj","dataset","dgst","uj","vj","_reactRetry","sj","subtreeFlags","wj","xj","isBackwards","rendering","renderingStartTime","tailMode","yj","Ej","Fj","Gj","wasMultiple","suppressHydrationWarning","onClick","onclick","createElementNS","autoFocus","createTextNode","Hj","Ij","Jj","Kj","Lj","WeakSet","Mj","Nj","Oj","Qj","Rj","Sj","Tj","Uj","Vj","Wj","_reactRootContainer","Xj","X","Yj","Zj","ak","onCommitFiberUnmount","componentWillUnmount","bk","ck","ek","fk","isHidden","gk","hk","ik","jk","kk","lk","__reactInternalSnapshotBeforeUpdate","Wk","mk","nk","ok","pk","Y","Z","qk","rk","sk","uk","vk","wk","xk","yk","zk","Ak","Bk","Ck","Dk","Ek","callbackNode","expirationTimes","expiredLanes","wc","callbackPriority","ig","Fk","Gk","Hk","Ik","Jk","Kk","Lk","Mk","Ok","Pk","finishedWork","finishedLanes","Qk","timeoutHandle","Rk","Sk","Tk","Uk","Vk","mutableReadLanes","Bc","Pj","onCommitFiberRoot","mc","onRecoverableError","Xk","onPostCommitFiberRoot","Yk","Zk","isReactComponent","pendingChildren","mutableSourceEagerHydrationData","pendingSuspenseBoundaries","il","jl","zj","$k","ll","reportError","_internalRoot","ol","pl","ql","sl","rl","unmount","unstable_scheduleHydration","querySelectorAll","tl","usingClientEntryPoint","ul","findFiberByHostInstance","bundleType","rendererPackageName","vl","rendererConfig","overrideHookState","overrideHookStateDeletePath","overrideHookStateRenamePath","overrideProps","overridePropsDeletePath","overridePropsRenamePath","setErrorHandler","setSuspenseHandler","scheduleUpdate","currentDispatcherRef","findHostInstanceByFiber","findHostInstancesForRefresh","scheduleRefresh","scheduleRoot","setRefreshHandler","getCurrentFiber","reconcilerVersion","__REACT_DEVTOOLS_GLOBAL_HOOK__","wl","isDisabled","supportsFiber","inject","createPortal","createRoot","unstable_strictMode","findDOMNode","flushSync","hydrate","hydrateRoot","hydratedSources","_getVersion","unmountComponentAtNode","unstable_batchedUpdates","unstable_renderSubtreeIntoContainer","checkDCE","__self","__source","jsx","jsxs","setState","forceUpdate","_status","Children","PureComponent","cloneElement","createContext","_currentValue2","_threadCount","Consumer","_defaultValue","_globalName","createFactory","createRef","forwardRef","isValidElement","lazy","memo","startTransition","unstable_act","Receptacle","toMS","_lookup","lastModified","ttl","expires","expire","record","refresh","oldRecord","Retimer","_started","_rescheduled","_scheduled","_args","_triggered","_timerWrapper","_schedule","_timer","reschedule","illegalRe","controlRe","reservedRe","windowsReservedRe","windowsTrailingRe","sanitize","sanitized","sortIndex","performance","startTime","expirationTime","priorityLevel","scheduling","isInputPending","MessageChannel","port2","port1","onmessage","unstable_Profiling","unstable_continueExecution","unstable_forceFrameRate","unstable_getFirstCallbackNode","unstable_next","unstable_pauseExecution","unstable_runWithPriority","unstable_wrapCallback","MAX_VALUE","bytesLeft","PBKDF2_HMAC_SHA256_OneIter","innerLen","outerKey","blockmix_salsa8","BY","_X","arraycopy","blockxor","salsa20_8","srcPos","checkBufferish","ensureInteger","_scrypt","XY","totalOps","i1","currentOp","lastPercent10","i0","incrementalSMix","steps","percent10","lib","lastProgress","progress","syncScrypt","intervals","setDelayedInterval","task","_timeout","_runPeriodically","clearDelayedInterval","retimer","TimeoutController","_ms","setPrototypeOf","segment","charLength","curByteLength","prevCodePoint","MAX_SAFE_INTEGER","oldOffset","INT","encodingLength","N1","N2","N3","N4","N5","N6","N7","N8","N9","_getRequireWildcardCache","nodeInterop","cacheBabelInterop","cacheNodeInterop","hasPropertyDescriptor","desc","_arrayLikeToArray","ReferenceError","_defineProperties","Constructor","protoProps","staticProps","_setPrototypeOf","subClass","superClass","excluded","sourceSymbolKeys","sourceKeys","_i","_e","_arr","_n","_d","unsupportedIterableToArray","arrayLikeToArray","_unsupportedIterableToArray","minLen","__webpack_module_cache__","__webpack_require__","cachedModule","loaded","__webpack_modules__","amdO","getter","leafPrototypes","getProto","def","definition","toStringTag","nmd","PublicKeyMessage","encryptionPublicKey","ethAddress","PrivateMessage","toAddress","DefaultPubSubTopic","StoreCodecs","_0n","_1n","_2n","_3n","_8n","POW_2_256","CURVE","Gx","Gy","weistrass","USE_ENDOMORPHISM","JacobianPoint","toInv","nums","scratch","lastMultiplied","inverted","invert","invertBatch","toAffine","toAffineBatch","fromAffine","X1","Y1","Z1","X2","Y2","Z2","Z1Z1","Z2Z2","S1","S2","X3","Y3","Z3","HH","HHH","multiplyUnsafe","scalar","P0","normalizeScalar","k1neg","k2neg","splitScalarEndo","k1p","k2p","precomputeWindow","windows","wNAF","affinePoint","BASE","_WINDOW_SIZE","precomputes","pointPrecomputes","normalizeZ","windowSize","maxNumber","shiftBy","wbits","pr","cached","fake","f1p","f2p","invZ","iz1","iz2","iz3","_setWindowSize","isShort","bytesToNumber","isValidFieldElement","_6n","_11n","_22n","_23n","_44n","_88n","pow2","b88","b176","b220","b223","sqrtMod","assertValidity","ensureBytes","fromCompressedHex","fromUncompressedHex","normalizePrivateKey","msgHash","recovery","truncateHash","normalizeSignature","fromHex","numTo32bStr","multiplyAndAddUnsafe","toRawBytes","isCompressed","toHexX","toRawX","aP","bQ","sum","sliceDER","parseDERInt","isUint8a","hexToNumber","sBytes","rBytesLeft","parseDERSignature","fromDER","isWithinCurveOrder","hasHighS","normalizeS","toDERRawBytes","toDERHex","sHex","numberToHexUnpadded","rHex","rLen","toCompactRawBytes","toCompactHex","concatBytes","arrays","hexes","padStart","uint8a","numTo32b","hexByte","isSafeInteger","modulo","divNearest","POW_2_128","HmacDrbg","hmacSha256","hmacSync","hmacSha256Sync","incr","reseedSync","kmdToSig","kBytes","normalizePublicKey","fromCompact","getPublicKey","fromPrivateKey","isPub","bits2int","bits2octets","z1","int2octets","initSigArgs","seedArgs","finalizeSig","recSig","der","recovered","vopts","web","TAGGED_HASH_PREFIXES","isValidPrivateKey","privateAdd","tweak","privateNegate","pointAddScalar","pointMultiply","hashToPrivateKey","bytesLength","randomPrivateKey","messages","createHash","ckey","importKey","createHmac","sha256Sync","taggedHash","tagP","tagH","taggedHashSync","BASE_MAP","LEADER","FACTOR","iFACTOR","psz","zeroes","b256","it3","it4","vch","pbegin","pend","b58","it1","it2","Encoder","baseEncode","Decoder","baseDecode","codePointAt","prefixCodePoint","ComposedDecoder","decoders","Codec","baseX","basex","rfc4648","bitsPerChar","written","SyntaxError","identity","TextDecoder","TextEncoder","base2","base8","base10","base16","base16upper","base32","base32upper","base32pad","base32padupper","base32hex","base32hexupper","base32hexpad","base32hexpadupper","base32z","base36upper","base58btc","base58flickr","base64pad","base64url","base64urlpad","alphabetBytesToChars","alphabetCharsToBytes","base256emoji","byts","byt","encode_1","varint","encodeTo","int","sizeOffset","digestOffset","Digest","multihash","Hasher","textEncoder","textDecoder","CID","asCID","_baseCache","hidden","readonly","toV0","DAG_PB_CODE","SHA_256_CODE","createV0","toV1","createV1","equalBytes","toStringV0","toStringV1","deprecate","IS_CID_DEPRECATION","cidSymbol","toBaseEncodedString","codec","multibaseName","encodeCID","cid","decodeFirst","specs","inspectBytes","prefixSize","multihashSize","multihashBytes","digestSize","multihashCode","initialBytes","parseCIDtoBytes","codeOffset","hashOffset","bases","identityBase","createCodec","ascii","latin1","bytesToUtf8","utf8ToBytes","byteArrays","totalLength","Symmetric","Asymmetric","getSubtle","webcrypto","secp","compressPublicKey","boundry","v6segment","functionTimeout","function_","wrappedFunction","isRegexp","flagMap","ignoreCase","multiline","dotAll","sticky","unicode","clonedRegexp","flag","isMatch","cloneRegexp","isIP","isV4","isV6","sections","v4Buffer","uint8ArrayToString","argv","getProtocol","proto","row","resolvable","createProtocol","convertToString","ipBuff","ipString","getUint16","bytes2ip","bytes2port","bytes2str","bytes2mh","bytes2onion","bytes2mb","convertToBytes","ip2bytes","port2bytes","uint8ArrayFromString","uint8ArrayConcat","str2bytes","mh2bytes","portBuf","onion2bytes","onion32bytes","mbstr","anybaseDecoder","mb2bytes","setUint16","addrBytes","portBytes","ERR_INVALID_ID","decodeMessage","encodeMessage","lengthDelimited","CODEC_TYPES","KeyType","__KeyTypeValues","PublicKey","PrivateKey","enumeration","findValue","VARINT","enumValue","LENGTH_DELIMITED","_codec","Data","RSA","nativeCrypto","bigIntegerToUintBase64url","base64urlToBigInteger","base64urlToBuffer","aesGcm","deriveParams","rawKey","cryptoKey","deriveKey","errcode","unmarshalPrivateKey","derivePublicFromPrivate","jwKey","kty","convertKey","handle","fkey","jwk2pub","jwk2priv","exporter","ciphers","encryptedKey","RsaPublicKey","marshal","jwk","pbm","uint8ArrayEquals","RsaPrivateKey","_publicKey","genSecret","public","dp","dq","unmarshalRsaPrivateKey","alg","unmarshalRsaPublicKey","fromJwk","_255n","CURVE_ORDER","MAX_256B","SQRT_M1","SQRT_AD_MINUS_ONE","INVSQRT_A_MINUS_D","ONE_MINUS_D_SQ","D_MINUS_ONE_SQ","ExtendedPoint","assertExtPoint","X1Z2","X2Z1","Y1Z2","Y2Z1","isSmallOrder","isTorsionFree","fromRistrettoBytes","legacyRist","toRistrettoBytes","fromRistrettoHash","assertRstPoint","RistrettoPoint","ep","Ns","Ns_D_is_sq","uvRatio","s_","edIsNegative","Nt","W0","W1","W2","W3","bytes255ToNumberLE","R1","calcElligatorRistrettoMap","R2","emsg","numberTo32BytesLE","u1_2","u2_2","invertSqrt","Dx","Dy","invsqrt","D1","D2","zInv","_x","_y","normed","bytesToNumberLE","isXOdd","getExtendedPublicKey","toX25519","u8","numberTo32BytesBE","pow_2_252_3","_5n","_10n","_20n","_40n","_80n","b80","b160","b240","b250","pow_p_5_8","v3","v7","vx2","root1","root2","useRoot1","useRoot2","noRoot","modlLE","adjustBytes25519","checkPrivateKey","getKeyFromHash","pointBytes","_sha512Sync","prepareVerification","SB","finishVerification","kA","TORSION_SUBGROUP","hashToPrivateScalar","sha512Sync","PRIVATE_KEY_BYTE_LENGTH","hashAndSign","privateKeyRaw","hashAndVerify","concatKeys","Ed25519PublicKey","ensureKey","Ed25519PrivateKey","unmarshalEd25519PrivateKey","privateKeyBytes","publicKeyBytes","unmarshalEd25519PublicKey","validatePublicKey","Secp256k1PublicKey","keysProtobuf","Secp256k1PrivateKey","unmarshalSecp256k1PrivateKey","unmarshalSecp256k1PublicKey","supportedKeys","ed25519","Ed25519","secp256k1","Secp256k1","unsupportedKey","typeToKey","unmarshalPublicKey","keysPBM","marshalPublicKey","importer","isPeerId","baseDecoder","PeerIdImpl","toCID","peerIdFromString","RSAPeerIdImpl","Ed25519PeerIdImpl","Secp256k1PeerIdImpl","peerIdFromPeerId","peerIdFromBytes","peerIdFromCID","peerIdFromKeys","KeypairType","Secp256k1Keypair","_privateKey","privateKeyVerify","publicKeyVerify","hasPrivateKey","ERR_TYPE_NOT_IMPLEMENTED","createKeypair","tuplesToStringTuples","tuples","tup","protoFromTuple","tuplesToBytes","sizeForAddr","bytesToTuples","ParseError","bytesToString","cleanPath","stringTuplesToString","stringToBytes","stringToStringTuples","validateBytes","DNS_CODES","P2P_CODES","resolvers","Multiaddr","isMultiaddr","toOptions","protoCodes","transport","family","protos","protoNames","stringTuples","encapsulate","decapsulate","addrString","decapsulateCode","getPeerId","tuple","ipfs","peerIdStr","getPath","resolvableProto","errCode","nodeAddress","isThinWaistAddress","some","dbg","ENR","kvs","entries","enr","keypairType","peerId","createPeerIdFromKeypair","createKeypairFromPeerId","createV4","hexSeq","rlpEncodedBytes","encoded","decodeFromValues","RECORD_PREFIX","nodeId","pubKey","uncompressedPubkey","tcp","udp","ip6","tcp6","udp6","multiaddrs","multiaddrBytes","multiaddr","decodeMultiaddrs","multiaddrsBuf","dataView","encodeMultiaddrs","getLocationMultiaddr","isIpv6","endsWith","ipVal","isUdp","isTcp","protoName","protoVal","ipFamily","ipBytes","protocolBytes","multiaddrFromFields","setLocationMultiaddr","getFullMultiaddr","locationMultiaddr","getFullMultiaddrs","waku2","relay","store","lightPush","decodeWaku2","protocols","encodeWaku2","verifySignature","encodeToValues","WakuMessage","contentTopic","timestampDeprecated","findBufAndOffset","bufs","bufEnd","isUint8ArrayList","Uint8ArrayList","appendAll","append","prependAll","consume","trunc","beginInclusive","endExclusive","_subList","sublist","bufStart","sliceStartInBuf","sliceEndsInBuf","littleEndian","getBigInt64","setBigInt64","getUint32","setUint32","getBigUint64","setBigUint64","accessor","TWO_32","access","defaultEncoder","lengthBuf","encodeLength","lengthEncoder","single","ReadMode","defaultDecoder","LENGTH","lengthDecoder","maxLengthLength","maxDataLength","dataLengthLength","onLength","DATA","onData","fromReader","varByteSource","splitLimit","calculateSize","getNext","objectMode","readableLength","rawPipe","fns","isIterable","isDuplex","sink","duplexPipelineFn","duplex","stream","sourceWrap","pipe","rest","selectRandomPeer","peers","getPeersForProtocol","libp2p","peerStore","peer","secret","outputLength","willBeResult","counters","countersSecret","willBeHashResult","hashResult","_hashResult","privateKeyA","publicKeyB","privateA","publicB","publicKeyTo","ephemPrivateKey","sharedPx","encryptionKey","cipherText","ivCipherText","macKey","hmacSha256Sign","ephemPublicKey","cipherTextLength","cipherAndIv","msgMac","hmacSha256Verify","clearEncode","messagePayload","sigPrivKey","envelope","fieldSize","computeSizeOfPayloadSizeField","addPayloadSizeField","rawSize","paddingSize","expectedSize","findIndex","validateDataIntegrity","bytesSignature","recoveryId","clearDecode","sizeOfPayloadSizeField","getSizeOfPayloadSizeField","payloadSize","payloadSizeBytes","getPayloadSize","payloadStart","isSigned","isMessageSigned","getSignature","getHash","messageHash","_signature","fromSignature","ecRecoverPubKey","decryptAsymmetric","ecies","encryptSymmetric","clearText","symmetric","decryptSymmetric","ivStart","OneMillion","DecryptionMethod","_signaturePublicKey","encPublicKey","symKey","version_1","decryptionParams","protoBuf","decodeProto","signaturePublicKey","allResults","contentTopics","dec","decodedResults","payloadAsUtf8","rnds8","REGEX","byteToHex","rnds","FilterRequest","MessagePush","FilterRPC","ContentFilter","subscribe","contentFilters","requestId","FilterCodec","WakuFilter","subscriptions","decryptionKeys","pubSubTopic","onRequest","pubsubTopic","createRequest","getPeer","newStream","lp","addCallback","unsubscribe","streamData","pushMessages","unsubscribeRequest","connections","connectionManager","getConnections","randomPeer","addDecryptionKey","deleteDecryptionKey","PushRequest","PushResponse","PushRPC","isSuccess","LightPushCodec","WakuLightPush","RelayCodecs","Index","PagingInfo","HistoryQuery","HistoryResponse","HistoryRPC","receivedTime","senderTime","Direction","__DirectionValues","pageSize","pagingInfo","endTime","HistoryError","__HistoryErrorValues","PageDirection","storeCodec","historyRpc","protoV2Beta3","protoV2Beta4","pageDirection","BACKWARD","FORWARD","directionToProto","WakuStore","timeFilter","queryOpts","historyRpcQuery","createQuery","remoteAddr","reply","ERROR_NONE_UNSPECIFIED","pageMessages","protoMsg","responsePageSize","queryPageSize","codecs","Protocols","Waku","pubsub","pingKeepAliveTimers","relayKeepAliveTimers","pingKeepAlive","relayKeepAlive","startKeepAlive","remotePeer","stopKeepAlive","_protocols","Relay","Store","LightPush","Filter","dialProtocol","addPeerToAddressBook","addresses","addressBook","stopAllKeepAlives","isStarted","getLocalMultiaddrWithID","localMultiaddr","getMultiaddrs","pingPeriodSecs","relayPeriodSecs","setInterval","ping","wakuMsg","clearInterval","Envelope","payloadType","RecordEnvelope","marshaled","Protobuf","signData","formatSignaturePayload","envelopeData","createFromProtobuf","domainUint8Array","uint8arraysFromString","domainLength","payloadTypeLength","payloadLength","PeerRecord","AddressInfo","ENVELOPE_PAYLOAD_TYPE_PEER_RECORD","DOMAIN","CODEC","seqNumber","arrayEquals","trace","peerRecord","topologySymbol","TopologyImpl","onConnect","onDisconnect","registrar","disconnect","EventTarget","_EventEmitter_listeners","__classPrivateFieldGet","CustomEventPolyfill","Event","CustomEvent","MessageCache","gossip","historyCapacity","msgIdToStrFn","history","msgs","put","messageId","validated","msgIdStr","originatingPeers","iwantCounts","observeDuplicate","msgId","fromPeerIdStr","getWithIWantCount","getGossipIDs","msgIdsByTopic","msgIds","RPC","cjs","FloodsubID","GossipsubIDv10","GossipsubIDv11","GossipsubMaxIHaveLength","createGossipRpc","control","graft","prune","ihave","iwant","shuffle","messageIdToString","StrictSign","StrictNoSign","SignaturePolicy","PublishConfigType","MessageAcceptance","RejectReason","ValidateError","MessageStatus","rejectReasonFromAcceptance","acceptance","Ignore","Reject","ERR_INVALID_PEER_SCORE_PARAMS","defaultPeerScoreParams","topicScoreCap","appSpecificScore","appSpecificWeight","IPColocationFactorWeight","IPColocationFactorThreshold","IPColocationFactorWhitelist","behaviourPenaltyWeight","behaviourPenaltyThreshold","behaviourPenaltyDecay","decayInterval","decayToZero","retainScore","defaultTopicScoreParams","topicWeight","timeInMeshWeight","timeInMeshQuantum","timeInMeshCap","firstMessageDeliveriesWeight","firstMessageDeliveriesDecay","firstMessageDeliveriesCap","meshMessageDeliveriesWeight","meshMessageDeliveriesDecay","meshMessageDeliveriesCap","meshMessageDeliveriesThreshold","meshMessageDeliveriesWindow","meshMessageDeliveriesActivation","meshFailurePenaltyWeight","meshFailurePenaltyDecay","invalidMessageDeliveriesWeight","invalidMessageDeliveriesDecay","createPeerScoreParams","topicScoreParams","createTopicScoreParams","validateTopicScoreParams","defaultPeerScoreThresholds","gossipThreshold","publishThreshold","graylistThreshold","acceptPXThreshold","opportunisticGraftThreshold","createPeerScoreThresholds","computeScore","pstats","peerIPs","score","tstats","topicParams","topicScore","inMesh","meshTime","firstMessageDeliveries","meshMessageDeliveriesActive","meshMessageDeliveries","deficit","meshFailurePenalty","invalidMessageDeliveries","p5","ips","peersInIP","numPeersInIP","surplus","behaviourPenalty","excess","DeliveryRecordStatus","MessageDeliveries","records","ensureRecord","drec","unknown","firstSeen","isStartable","isInitializable","Components","started","setPeerId","addressManager","setAddressManager","setPeerStore","upgrader","setUpgrader","metrics","setMetrics","setRegistrar","setConnectionManager","transportManager","setTransportManager","connectionGater","setConnectionGater","contentRouting","setContentRouting","peerRouting","setPeerRouting","datastore","setDatastore","connectionProtector","setConnectionProtector","dht","setDHT","setPubSub","startable","beforeStart","afterStart","beforeStop","afterStop","getMetrics","getAddressManager","getPeerStore","getUpgrader","getRegistrar","getConnectionManager","getTransportManager","getConnectionGater","getContentRouting","getPeerRouting","getDatastore","getConnectionProtector","getDHT","getPubSub","PeerScore","validatePeerScoreParams","scoreCacheValidityMs","peerStats","_backgroundInterval","deliveryRecords","refreshScores","updateIPs","dumpPeerScoreStats","stats","connected","tparams","graftTime","removeIPs","scoreCache","scoreFnCalls","inc","cacheEntry","cacheUntil","scoreFnRuns","scoreCachedDelta","addPenalty","penalty","penaltyLabel","onScorePenalty","addPeer","getIPs","setIPs","removePeer","threshold","getPtopicStats","validateMessage","deliverMessage","markFirstMessageDelivery","markDuplicateMessageDelivery","rejectInvalidMessage","markInvalidMessageDelivery","rejectMessage","duplicateMessage","cap","validatedTime","deliveryDelayMs","isLateDelivery","onDuplicateMsgDelivery","newIPs","oldIPs","addNewIPs","xip","removeOldIPs","topicStats","IWantTracer","gossipsubIWantFollowupMs","requestMsByMsgExpire","requestMsByMsgSize","requestMsByMsg","addPromise","expireByPeer","iwantPromiseStarted","getBrokenPromises","brokenPromises","iwantPromiseBroken","trackMessage","iwantPromiseResolved","iwantPromiseResolvedPeers","maxMs","requestMs","iwantPromiseDeliveryTime","SimpleTimeCache","validityMs","validUntilMs","MessageSource","InclusionReason","ChurnReason","ScorePenalty","IHaveIgnoreReason","ScoreThreshold","hashName","keySize","dek","forgePbkdf2","forgeUtil","SignPrefix","msgIdFnStrictSign","sequenceNumber","seqno","seqnoBytes","msgIdFnStrictNoSign","computeScoreWeights","topicStrToLabel","byTopic","topicLabel","topicScores","p1w","p2w","p3w","p3bw","p4w","capF","p5w","p6w","p7w","removeItemsFromSet","superSet","ineed","cond","subset","AbortError","abortableSource","getIterator","nextAbortHandler","abortHandler","abortMessage","abortCode","isKnownAborter","onReturnError","returnOnAbort","abortable","abortableSink","abortableDuplex","OutboundStream","rawStream","errCallback","closeController","maxBufferSize","stat","close","InboundStream","GossipStatusCode","GossipSub","constants","stopped","heartbeatDuration","startTimer","heartbeat","finally","heartbeatTimeout","msToNextHeartbeat","heartbeatInterval","hearbeatStartMs","heartbeatSkipped","runHeartbeat","fallbackToFloodsub","floodPublish","doPX","directPeers","Dlo","Dhi","Dscore","Dout","Dlazy","fanoutTTL","minute","mcacheLength","mcacheGossip","seenTTL","prunePeers","pruneBackoff","graftFloodThreshold","opportunisticGraftPeers","opportunisticGraftTicks","directConnectTicks","scoreParams","scoreThresholds","globalSignaturePolicy","multicodecs","debugName","direct","seenCache","publishedMessageIds","msgIdFn","fastMsgIdFn","fastMsgIdCache","mcache","messageCache","dataTransform","metricsRegister","metricsTopicStrToLabel","maxMeshMessageDeliveriesWindowMs","topicParam","protocolsEnabled","gauge","help","labelNames","topicSubscriptionStatus","topicPeersCount","meshPeerCounts","meshPeerInclusionEvents","meshPeerChurnEvents","peersPerProtocol","histogram","buckets","asyncValidationResult","asyncValidationMcacheHit","rpcRecvBytes","rpcRecvCount","rpcRecvSubscription","rpcRecvMessage","rpcRecvControl","rpcRecvIHave","rpcRecvIWant","rpcRecvGraft","rpcRecvPrune","rpcRecvNotAccepted","rpcSentBytes","rpcSentCount","rpcSentSubscription","rpcSentMessage","rpcSentControl","rpcSentIHave","rpcSentIWant","rpcSentGraft","rpcSentPrune","msgPublishCount","msgPublishPeers","msgPublishPeersByGroup","msgPublishBytes","msgForwardCount","msgForwardPeers","msgReceivedPreValidation","msgReceivedStatus","msgReceivedInvalid","duplicateMsgDeliveryDelay","maxMeshMessageDeliveriesWindowSec","duplicateMsgLateDelivery","peersByScoreThreshold","avgMinMax","scoreWeights","scorePerMesh","scoringPenalties","ihaveRcvIgnored","ihaveRcvMsgids","ihaveRcvNotSeenMsgids","iwantRcvMsgids","iwantRcvDonthaveMsgids","gossipPromiseExpireSec","cacheSize","mcacheSize","toTopic","topicStr","onJoin","onLeave","onAddToMesh","onRemoveFromMesh","onReportValidationMcacheHit","hit","onReportValidation","onIhaveRcv","idonthave","onIwantRcv","iwantByTopic","iwantDonthave","onForwardMsg","tosendCount","onPublishMsg","tosendGroupCount","dataLen","peerGroup","floodsub","mesh","fanout","onMsgRecvPreValidation","onMsgRecvResult","onMsgRecvInvalid","onRpcRecv","rpcBytes","onRpcSent","registerScores","scores","graylist","publish","registerScoreWeights","sw","wsTopic","registerScorePerMesh","scoreByPeer","peersPerTopicLabel","peersInMesh","meshScores","addCollect","onScrapeMetrics","gossipTracer","maxInboundStreams","maxOutboundStreams","getPeers","publishConfig","signaturePolicy","author","getPublishConfigFromPeerId","outboundInflightQueue","createOutboundStream","addrs","multicodec","onIncomingStream","topology","onPeerConnected","onPeerDisconnected","registrarTopologyIds","directPeerInitial","outboundStream","streamsOutbound","inboundStream","streamsInbound","heartbeatTimer","fanoutLastpub","peerhave","iasked","backoff","outbound","createInboundStream","maxOutboundBufferSize","floodsubPeers","sendSubscriptions","priorInboundStream","pipePeerReadStream","acceptFromWhitelist","getMeshPeers","peersInTopic","getSubscribers","getTopics","awaitRpcHandler","handleReceivedRpc","acceptFrom","subOpt","handleReceivedSubscription","handleReceivedMessagePromise","handleReceivedMessage","awaitRpcMessageHandler","handleControlMessage","topicSet","rpcMsg","validationResult","validateReceivedMessage","asyncValidation","emitSelf","propagationSource","forwardMessage","fastMsgIdStr","msgIdCached","fromPeerId","rpcMsgPreSign","validateToRawMessage","inboundTransform","topicValidator","topicValidators","getScore","toPeer","sendRpc","controlMsg","handleIHave","handleIWant","handleGraft","handlePrune","messagesAccepted","acceptUntil","topicID","messageIDs","iask","iwantList","floodCutoff","addBackoff","makePrune","doAddBackoff","pxConnect","applyIwantPenalties","clearBackoff","heartbeatTicks","toconnect","peerID","signedPeerRecord","eid","consumePeerRecord","openConnection","getTopologies","wasSubscribed","leave","toAdd","fanoutPeers","fanoutCount","getRandomGossipPeers","sendGraft","meshPeers","sendPrune","selectPeersToForward","excludePeers","tosend","selectPeersToPublish","newFanoutPeers","rawMsg","transformedData","outboundTransform","originalData","buildRawMessage","willSendToSelf","allowPublishToZeroPeers","reportMessageValidationResult","rejectReason","ctrl","piggybackControl","piggybackGossip","outRpc","tograft","toprune","noPX","pruning","emitGossip","peersToGossipByTopic","gossipIDsByTopic","peersToGossip","doEmitGossip","candidateToGossip","peerMessageIDs","pushGossip","flush","controlIHaveMsgs","xid","getRawEnvelope","directConnect","candidateMeshPeers","shuffledPeers","peerStreams","prunePeer","graftPeer","newMeshPeers","removeFirstNItemsFromSet","peersArray","rotate","peersList","medianIndex","medianScore","lastpb","topicPeers","candidateFanoutPeers","sendGraftPrune","backoffSize","peerIdStrs","swPeer","swPeerTopic","swTopic","computeAllPeersScoreWeights","WakuRelay","observers","addObserver","deleteObserver","callbackFn","stablelib","hashSHA256","getHKDF","ikm","expand","generateX25519KeyPair","x25519","generateX25519KeyPairFromSeed","generateX25519SharedKey","chaCha20Poly1305Encrypt","seal","chaCha20Poly1305Decrypt","pDefer","handshake","sourcePromise","sinkErr","sinkPromise","pbStream","shake","lpReader","readLP","readPB","writeLP","writePB","piped","NOISE_MSG_MAX_LENGTH_BYTES","DUMP_SESSION_KEYS","uint16BEEncode","uint16BEDecode","UnexpectedPeerError","InvalidCryptoExchangeError","InvalidCryptoTransmissionError","NoiseHandshakePayload","identityKey","identitySig","NoiseHandshakePayloadProto","getPayload","localPeer","staticPublicKey","earlyData","signedPayload","signPayload","getHandshakePayload","earlyDataPayload","libp2pPublicKey","createHandshakePayload","getPeerIdFromPayload","decodePayload","verifySignedPayload","noiseStaticKey","payloadPeerId","generatedPayload","isValidPublicKey","keyLogger","logLocalEphemeralKeys","logRemoteEphemeralKey","Nonce","getUint64","assertValue","XX","encryptWithAd","decryptWithAd","hasKey","isEmptyKey","createEmptyKey","encryptAndHash","mixHash","encryptedMessage","decryptAndHash","derivedU8","mixKey","tempK","initializeKey","initializeSymmetric","protocolName","protocolNameBytes","hashProtocolName","tempk1","tempk2","cs1","cs2","writeMessageRegular","readMessageRegular","initializeInitiator","prologue","psk","initializeResponder","writeMessageA","hs","writeMessageB","spk","writeMessageC","messageBuffer","readMessageA","readMessageB","valid1","valid2","readMessageC","initSession","initiator","sendMessage","session","ephemeral","resultingBuffer","recvMessage","resultingPlaintext","resultingValid","XXHandshake","isInitiator","staticKeypair","remoteEarlyData","encode0","receivedMessageBuffer","decode0","decode1","decodedPayload","setRemoteEarlyData","encode1","encode2","decode2","getCS","getRemoteStaticKey","encryption","Noise","staticNoiseKey","prologueBytes","staticKeys","wrappedConnection","performHandshake","conn","createSecureConnection","performXXHandshake","propose","exchange","secure","duplexPair","network","encryptStream","decrypted","decryptStream","MessageTypes","MessageTypeNames","InitiatorMessageTypes","NEW_STREAM","MESSAGE","MESSAGE_INITIATOR","CLOSE","CLOSE_INITIATOR","RESET","RESET_INITIATOR","ReceiverMessageTypes","MESSAGE_RECEIVER","CLOSE_RECEIVER","RESET_RECEIVER","POOL_SIZE","_pool","_poolOffset","_headerInfo","_decodeHeader","readVarInt","REST","MAX_MSG_SIZE","ERR_STREAM_RESET","TrackedMap","system","metric","updateComponentMetric","deleted","trackedMap","printMessage","MplexStreamMuxer","_streamId","_streams","initiators","receivers","_createSink","_createSource","streams","_newStream","_newReceiverStream","maxMsgSize","abortController","resetController","Types","externalId","streamName","endErr","sourceEnded","sinkEnded","sinkSunk","timeline","onSinkEnd","closeRead","closeWrite","uint8ArrayList","toSend","metadata","createStream","onStreamEnd","abortSignals","maxSize","checkSize","restrictSize","_handleIncoming","pushableV","maxStreamBufferSize","Mplex","createStreamMuxer","socket","cleanup","handleOpen","handleErr","closeOnEnd","ready","wasClean","connectedSource","binaryType","isConnected","connError","cleanUp","cont","onOpen","onMessage","remoteAddress","remotePort","CONNECTING","OPEN","http","https","wsurl","WebSocket","websocket","reduceValue","Reducers","ip4","assumeHttp","explicitPort","tcpUri","dnsaddr","dns4","dns6","p2p","wss","isEnvWithDom","isElectron","detectElectron","isBrowser","isElectronMain","isElectronRenderer","release","isWebWorker","importScripts","WorkerGlobalScope","TimeoutError","getDOMException","errorMessage","DOMException","getAbortedReason","socketToMaConn","maConn","customTimers","cancelablePromise","POSITIVE_INFINITY","timeoutError","pTimeout","DNS4","DNS6","DNSADDR","DNS","IP","TCP","UDP","UTP","QUIC","WebSockets","WebSocketsSecure","HTTP","HTTPS","WebRTCStar","WebRTCDirect","Reliable","_P2P","_Circuit","CircuitRecursive","Circuit","makeMatchesFunction","partialMatch","pnames","testMa","mafmt","_connect","upgradeOutbound","cOpts","errorPromise","errfn","rawSocket","toUri","createListener","filters","sortAll","iterable","pathSepS","pathSepB","pathSep","Key","_buf","uint8Array","nanoid","less","list1","list2","withNamespaces","baseNamespace","namespaceType","namespaceValue","isAncestorOf","isDecendantOf","isTopLevel","MemoryDatastore","batch","puts","dels","commit","drain","putMany","deleteMany","_all","orders","take","queryKeys","_allKeys","storeAddresses","uniquePeers","seen","requirePeers","DefaultPeerRouting","routers","refreshManagerInit","refreshManager","_findClosestPeersTask","timeoutId","bootDelay","getClosestPeers","router","findPeer","NOT_FOUND","CompoundContentRouting","findProviders","provide","NOT_STARTED_YET","nVals","gotValues","idStr","peerIdFromMultiaddr","defaultAddressFilter","DefaultAddressManager","announce","observed","announceFilter","getListenAddrs","getAnnounceAddrs","getObservedAddrs","addObservedAddr","getAddresses","getAddrs","addrSet","VisibilityChangeEmitter","visibilityChange","_initializeVisibilityVarNames","_addVisibilityChangeListener","mozHidden","msHidden","webkitHidden","_handleVisibilityChange","isVisible","visible","LatencyMonitor","latencyCheckIntervalMs","dataEmitIntervalMs","asyncTestFn","latencyRandomPercentage","latencyCheckMultiply","latencyCheckSubtract","hrtime","getDeltaMS","latencyData","initLatencyData","visibilityChangeEmitter","pageInFocus","_startTimers","_emitSummary","_stopTimers","checkLatencyID","checkLatency","emitIntervalID","unref","summary","getSummary","latency","minMs","avgMs","totalMs","lengthMs","randomness","localData","deltaOffset","deltaMS","NEGATIVE_INFINITY","CLOSING","CLOSED","DialRequest","dialAction","dialer","tokens","getTokens","tokenHolder","dialAbortControllers","completedDials","any","releaseToken","isPrivate","isIpPrivate","publicAddressesFirst","isAPrivate","isBPrivate","isCertified","METRICS","METRICS_COMPONENT","Dialer","addressSorter","maxAddrsToDial","dialTimeout","maxDialsPerPeer","maxParallelDials","pendingDials","pendingDialTargets","dial","pendingTarget","denyDialPeer","dialTarget","_createCancellableDialTarget","pendingDial","_createPendingDial","cancellablePromise","_createDialTarget","knownAddrs","denyDialMultiaddr","_resolve","supportedAddrs","transportForMultiaddr","dialRequest","timeoutController","run","resolvedMultiaddrs","_resolveRecord","nm","newM","mapIterable","PeerMap","PeerSet","predicate","PeerList","peerIds","maxConnections","minConnections","maxData","maxSentData","maxReceivedData","maxEventLoopDelay","pollInterval","autoDialInterval","movingAverageInterval","METRICS_SYSTEM","DefaultConnectionManager","mergeOptions","_checkMetrics","latencyMonitor","startupReconnectTimeout","inbound","conns","allStreams","counts","_onLatencyMeasure","keepAlivePeers","getTags","connectOnStartupController","_close","tasks","connectionList","movingAverages","getMovingAverages","received","dataReceived","movingAverage","_checkMaxLimit","sent","dataSent","_onConnect","storedConns","keyBook","numConnections","toPrune","storedConn","existingConnections","peerConnections","trackedConnection","getAll","STATUS","_maybePruneConnections","peerValues","tags","sortedConnections","peerAValue","peerBValue","toClose","AutoDialler","running","_autoDial","autoDialTimeout","allPeers","CircuitRelay","Status","__StatusValues","__TypeValues","Peer","srcPeer","dstPeer","streamToMaConnection","mapSource","RELAY_CODEC","writeResponse","streamHandler","validateAddrs","HOP","HOP_DST_MULTIADDR_INVALID","STOP_DST_MULTIADDR_INVALID","HOP_SRC_MULTIADDR_INVALID","STOP_SRC_MULTIADDR_INVALID","StreamHandler","handleHop","hopRequest","circuit","hopEnabled","CircuitPB","destinationPeer","destinationConnections","hopActive","stopRequest","destinationStream","sourceStream","_onProtocol","hop","virtualConnection","canHop","handleCanHop","handleStop","localAddr","upgradeInbound","relayAddr","destinationAddr","relayId","destinationId","errMsg","relayPeer","disconnectOnFailure","relayConnection","Errors","listeningAddrs","relayPeerStr","relayPeerId","relayConn","relayedAddr","namespaceToCid","HOP_METADATA_KEY","HOP_METADATA_VALUE","RELAY_RENDEZVOUS_NS","AutoRelay","maxListeners","listenRelays","_onProtocolChange","_onPeerDisconnected","supportsHop","metadataBook","_addListenRelay","_removeListenRelay","remoteAddrs","_listenOnAvailableHopRelays","peersToIgnore","knownHopsToDial","_tryToListenOnRelay","autoRelay","_advertiseService","advertise","privates","CMS","keychain","plain","findKeyByName","getPrivateKey","getFullYear","serverAuth","clientAuth","codeSigning","emailProtection","timeStamping","certificateForKey","cmsData","cms","keyId","asyncCompare","findAsync","findKeyById","missingKeys","infoPrefix","NIST","iterationCount","validateKeyName","randomDelay","DsName","DsInfoName","KeyChain","pass","dsname","keyInfo","kid","export","listKeys","oldName","newName","oldDsname","newDsname","oldInfoName","newInfoName","oldPass","newPass","oldDek","newDek","keyAsPEM","DefaultMovingAverage","timespan","variance","deviation","forecast","previousTime","createMovingAverage","DefaultStats","frequencyLastTime","frequencyAccumulators","computeThrottleMaxQueueSize","computeThrottleTimeout","movingAverageIntervals","initialCounters","_resetComputeTimeout","_nextTimeout","urgency","_applyOp","_updateFrequency","latestTime","timeDiff","_updateFrequencyFor","timeDiffMS","hz","directionToEvent","in","DefaultMetrics","statsInit","globalStats","protocolStats","oldPeers","LRU","maxOldPeersRetention","_onMessage","systems","getComponentMetrics","systemMetrics","componentMetrics","calculate","forPeer","idString","getProtocols","forProtocol","updatePlaceholder","placeholderString","placeholderStats","peerIdString","existingStats","mergedStats","trackStream","each","pReflect","isFulfilled","isRejected","_classPrivateFieldInitSpec","privateMap","privateCollection","_classExtractFieldDescriptor","_classPrivateFieldSet","_classPrivateFieldGet","Node","Queue","enqueue","dequeue","pLimit","concurrency","activeCount","generator","pendingCount","clearQueue","pSettle","DefaultTransportManager","transports","faultTolerance","FaultTolerance","FATAL_ALL","getTransports","couldNotListen","NO_FATAL","PROTOCOL_ID","NewLine","writeAll","buffers","select","shakeStream","multistream","ConnectionImpl","getStreams","_getStreams","_closing","addStream","removeStream","DefaultRegistrar","topologies","_onDisconnect","protoBook","protocolList","peerProtocols","oldProtocols","findOutgoingStreamLimit","countStreams","streamCount","DefaultUpgrader","connectionEncryption","encrypter","muxers","muxer","inboundUpgradeTimeout","encryptedConn","upgradedConn","muxerFactory","cryptoProtocol","setPeer","proxyPeer","abortableStream","denyInboundConnection","mutableProxy","protectedConn","protector","protect","_encryptInbound","denyInboundEncryptedConnection","multiplexed","_multiplexInbound","denyInboundUpgradedConnection","_createConnection","remotePeerId","denyOutboundConnection","toB58String","_encryptOutbound","denyOutboundEncryptedConnection","_multiplexOutbound","denyOutboundUpgradedConnection","muxedStream","mss","incomingLimit","findIncomingStreamLimit","_onStream","outgoingLimit","_timeline","upgraded","errConnectionNotMultiplexed","multiplexer","secureInbound","secureOutbound","Identify","protocolVersion","agentVersion","listenAddrs","observedAddr","AGENT_VERSION","IdentifyService","identifyProtocolStr","protocolPrefix","identifyPushProtocolStr","identify","pushToPeerStore","_handleIdentify","_handlePush","maxPushIncomingStreams","maxPushOutgoingStreams","unhandle","pushes","maxIdentifyMessageSize","_identify","cleanObservedAddr","getCleanMultiaddr","openAndCertify","peerData","peerRecordEnvelope","FetchRequest","FetchResponse","identifier","StatusCode","__StatusCodeValues","FetchService","lookupFunctions","handleMessage","OK","ERROR","errmsg","_getLookupFunction","registerLookupFunction","unregisterLookupFunction","PingService","isLoopback","DEFAULT_TTL","highPort","NatManager","externalAddress","localAddress","keepAlive","gateway","_start","_getClient","publicIp","externalIp","isPrivateIp","publicPort","localPort","fromNodeAddress","upnpNat","PeerRecordUpdater","DHTPeerRouting","closer","EVENT_NAME","allowAll","PeerStoreAddressBook","addressFilter","lock","writeLock","updatedPeer","storedEnvelope","storedRecord","filterMultiaddrs","patchOrCreate","oldMultiaddrs","readLock","hasPeer","mergeOrCreate","PeerStoreKeyBook","updatedKey","uint8arrayEquals","oldPublicKey","PeerStoreMetadataBook","oldMetadata","existingValue","patch","PeerStoreProtoBook","protocolSet","Address","Metadata","_PriorityQueue_queue","PriorityQueue","comparator","_PQueue_instances","_PQueue_carryoverConcurrencyCount","_PQueue_isIntervalIgnored","_PQueue_intervalCount","_PQueue_intervalCap","_PQueue_interval","_PQueue_intervalEnd","_PQueue_intervalId","_PQueue_timeoutId","_PQueue_queue","_PQueue_queueClass","_PQueue_pendingCount","_PQueue_concurrency","_PQueue_isPaused","_PQueue_throwOnTimeout","_PQueue_doesIntervalAllowAnother_get","_PQueue_doesConcurrentAllowAnother_get","_PQueue_next","_PQueue_emitEvents","_PQueue_onResumeInterval","_PQueue_isIntervalPaused_get","_PQueue_tryToStartAnother","_PQueue_initializeIntervalIfNeeded","_PQueue_onInterval","_PQueue_processQueue","_PQueue_onEvent","__classPrivateFieldSet","PQueue","_b","_c","carryoverConcurrencyCount","intervalCap","autoStart","queueClass","throwOnTimeout","newConcurrency","pause","sizeBy","canInitializeInterval","job","WORKER_REQUEST_READ_LOCK","WORKER_RELEASE_READ_LOCK","MASTER_GRANT_READ_LOCK","WORKER_REQUEST_WRITE_LOCK","WORKER_RELEASE_WRITE_LOCK","MASTER_GRANT_WRITE_LOCK","observable","handleWorkerLockRequest","masterEvent","releaseType","grantType","requestEvent","MessageEvent","releaseEventListener","releaseEvent","makeWorkerLockRequest","responseEvent","singleProcess","mutexes","createReleaseable","createMortice","observer","isWorker","impl","masterQueue","readQueue","localReadQueue","readPromise","onIdle","createMutex","NAMESPACE_COMMON","PersistentStore","mortice","_peerIdToDatastoreKey","b32key","PeerPB","addressSet","_patch","_merge","addrStr","base32Str","Tags","Tag","expiry","PersistentPeerStore","providedValue","unexpiredTags","DHTContentRouting","providers","AutoDialer","globalFetch","globalHeaders","Headers","Request","Response","buildResource","serverResolver","recordType","resource","req","nativeFetch","accept","getCacheKey","maxCache","_TXTcache","_servers","_request","_abortControllers","getServers","_getShuffledServers","newServers","setServers","servers","rrType","resolve4","resolve6","resolveTxt","Answer","TTL","dnsaddrCode","DefaultConfig","noAnnounce","autoDial","Resolver","nat","PeerIdProto","createFromPrivKey","marshalPrivateKey","DummyDHT","wan","DHT_DISABLED","lan","DummyPubSub","PUBSUB_DISABLED","Libp2pNode","initializables","filterMultiaddrForPeer","services","configureComponent","streamMuxers","keychainOpts","generateOptions","identifyService","peerRouters","onDiscoveryPeer","contentRouters","fetchService","pingService","autoDialer","peerDiscovery","servce","importPeer","peerSet","closeConnections","peerInfo","peerKey","createLibp2pNode","createEd25519PeerId","resultingOptions","ERR_TRANSPORTS_REQUIRED","CONN_ENCRYPTION_REQUIRED","LIBP2P_FORCE_PNET","ERR_PROTECTOR_REQUIRED","validateConfig","getPseudoRandomSubset","wantedNumber","randInt","PeerDiscoveryStaticPeers","DefaultInterval","maxPeers","peerMas","_startTimer","_returnPeers","Fleet","getPredefinedBootstrapNodes","nodes","fleet","Prod","fleets","Test","createWaku","libp2pOptions","defaultBootstrap","wakuRelay","createLibp2p","filterAll","defaultLibp2p","wakuStore","wakuLightPush","wakuFilter","normalizeEmitter","pEvent","arrayPromise","rejectionEvents","multiArgs","resolveImmediately","onItem","arguments_","rejectHandler","rejectionEvent","pEventMultiple","waitForRemotePeer","waku","timeoutMs","waitForGossipSubPeerInMesh","waitForConnectedPeer","awaitTimeout","rejectOnTimeout","PublicKeyContentTopic","PrivateMessageContentTopic","handlePublicKeyMessage","myAddress","setter","publicKeyMsg","buildMsgParams","validatePublicKeyMessage","prevPks","handlePrivateMessage","privateMessage","prevMsgs","PublicKeyMessageEncryptionKey","generateEncryptionKeyPair","createPublicKeyMessage","fromAddress","signEncryptionKey","ownerAddress","PublishEncryptionPublicKey","Paper","_props$square","_props$elevation","elevation","_props$variant","variant","outlined","rounded","elevations","shadow","boxShadow","backgroundColor","AppBar","_props$position","backgroundColorDefault","flexDirection","boxSizing","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorInherit","colorTransparent","Toolbar","_props$disableGutters","disableGutters","alignItems","regular","dense","getChildMapping","mapFn","mapper","getProp","getNextChildMapping","nextProps","prevChildMapping","onExited","nextChildMapping","getValueForKey","nextKeysPending","pendingKeys","prevKey","childMapping","nextKey","pendingNextKey","mergeChildMappings","hasPrev","hasNext","prevChild","isLeaving","exit","enter","TransitionGroup","_React$Component","handleExited","contextValue","isMounting","firstRender","mounted","appear","currentChildMapping","_this$props","childFactory","TransitionGroupContext","_props$pulsate","pulsate","rippleX","rippleY","rippleSize","inProp","_props$onExited","leaving","setLeaving","rippleClassName","ripple","rippleVisible","ripplePulsate","rippleStyles","childClassName","childLeaving","childPulsate","TouchRipple","_props$center","center","centerProp","ripples","setRipples","rippleCallback","ignoringMouseDown","startTimerCommit","startCommit","oldRipples","Ripple","_options$pulsate","_options$center","_options$fakeElement","fakeElement","rect","getBoundingClientRect","sizeX","clientWidth","sizeY","clientHeight","pointerEvents","animationDuration","ButtonBase","buttonRefProp","buttonRef","_props$centerRipple","centerRipple","_props$disabled","_props$disableRipple","disableRipple","_props$disableTouchRi","disableTouchRipple","_props$focusRipple","focusRipple","focusVisibleClassName","onBlur","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","onDragLeave","_props$tabIndex","tabIndex","TouchRippleProps","_props$type","rippleRef","focusVisible","setFocusVisible","_useIsFocusVisible","focusVisibleRef","useRippleHandler","rippleAction","eventCallback","skipRippleAction","handleMouseDown","handleDragLeave","handleMouseUp","handleMouseLeave","handleTouchStart","handleTouchEnd","handleTouchMove","handleBlur","handleFocus","isNonNativeButton","keydownRef","handleKeyUp","ComponentProp","buttonProps","handleUserRef","handleOwnRef","handleRef","_React$useState2","mountedState","setMountedState","enableTouchRipple","justifyContent","WebkitTapHighlightColor","verticalAlign","textDecoration","borderStyle","IconButton","_props$edge","edge","_props$disableFocusRi","disableFocusRipple","_props$size","edgeStart","edgeEnd","textAlign","marginLeft","marginRight","sizeSmall","defaultVariantMapping","Typography","_props$align","align","_props$display","_props$gutterBottom","gutterBottom","_props$noWrap","noWrap","_props$paragraph","paragraph","_props$variantMapping","variantMapping","srOnly","alignLeft","alignCenter","alignRight","alignJustify","textOverflow","whiteSpace","marginBottom","colorTextPrimary","colorTextSecondary","displayInline","displayBlock","Button","_props$disableElevati","disableElevation","endIconProp","endIcon","_props$fullWidth","fullWidth","startIconProp","startIcon","minWidth","textPrimary","textSecondary","outlinedPrimary","outlinedSecondary","contained","containedPrimary","containedSecondary","borderColor","textSizeSmall","textSizeLarge","outlinedSizeSmall","outlinedSizeLarge","containedSizeSmall","containedSizeLarge","sizeLarge","iconSizeSmall","iconSizeMedium","iconSizeLarge","saveKeyPairToStorage","EncryptionKeyPair","encryptionKeyPair","keyMaterial","getKeyMaterial","wrappingKey","getWrapKey","encodedKeyPair","encryptKey","loadKeyPairFromStorage","cipherKeyPair","decryptKey","LoadKeyPair","setEncryptionKeyPair","SaveKeyPair","makeStylesWithoutDefault","formControlState","muiFormControl","FormControlContext","getStyleValue","computedStyle","visibility","onChange","rows","rowsMax","rowsMinProp","rowsMin","maxRowsProp","maxRows","_props$minRows","minRows","minRowsProp","inputRef","shadowRef","renders","syncHeight","inputShallow","innerHeight","scrollHeight","singleRowHeight","outerHeight","outerHeightStyle","prevState","handleResize","hasValue","isFilled","SSR","InputBase","ariaDescribedby","autoComplete","endAdornment","_props$inputComponent","inputComponent","_props$inputProps","inputProps","inputPropsProp","inputRefProp","_props$multiline","renderSuffix","startAdornment","valueProp","handleInputRefWarning","handleInputPropsRefProp","handleInputRefProp","handleInputRef","focused","setFocused","fcs","onFilled","onEmpty","checkDirty","InputComponent","TextareaAutosize","setAdornedStart","formControl","adornedStart","adornedEnd","marginDense","onAnimationStart","inputMultiline","hiddenLabel","inputHiddenLabel","inputAdornedStart","inputAdornedEnd","inputTypeSearch","inputMarginDense","placeholderHidden","placeholderVisible","paddingTop","font","resize","Input","disableUnderline","underline","bottomLineColor","marginTop","borderBottomColor","borderBottom","borderBottomStyle","FilledInput","borderTopLeftRadius","borderTopRightRadius","paddingBottom","WebkitBoxShadow","WebkitTextFillColor","caretColor","useThemeWithoutDefault","NotchedOutline","labelWidthProp","labelWidth","notched","legendLabelled","legendNotched","legend","borderWidth","maxWidth","OutlinedInput","_props$labelWidth","notchedOutline","filled","useFormControl","FormLabel","asterisk","InputLabel","_props$disableAnimati","disableAnimation","shrinkProp","shrink","animated","transformOrigin","FormControl","_props$error","visuallyFocused","_props$hiddenLabel","_props$margin","_props$required","initialAdornedStart","initialFilled","setFilled","_React$useState3","_focused","childContext","registerEffect","marginNormal","FormHelperText","_props$disablePortal","disablePortal","onRendered","mountNode","setMountNode","getContainer","getScrollbarSize","scrollDiv","scrollbarSize","offsetWidth","ariaHidden","show","getPaddingRight","ariaHiddenSiblings","currentNode","nodesToExclude","blacklistTagNames","findIndexOf","handleContainer","fixedNodes","restoreStyle","restorePaddings","disableScrollLock","innerWidth","isOverflowing","parentElement","scrollContainer","ModalManager","_classCallCheck","modals","containers","modalIndex","modalRef","hiddenSiblingNodes","hiddenSiblings","getHiddenSiblings","containerIndex","restore","nextTop","_props$disableAutoFoc","disableAutoFocus","_props$disableEnforce","disableEnforceFocus","_props$disableRestore","disableRestoreFocus","getDoc","isEnabled","ignoreNextEnforceFocus","sentinelStart","sentinelEnd","nodeToRestore","rootRef","prevOpenRef","hasAttribute","contain","hasFocus","loopFocus","invisible","_props$invisible","defaultManager","Modal","inProps","_props$BackdropCompon","BackdropComponent","SimpleBackdrop","BackdropProps","_props$closeAfterTran","closeAfterTransition","_props$disableBackdro","disableBackdropClick","_props$disableEscapeK","disableEscapeKeyDown","_props$disableScrollL","_props$hideBackdrop","hideBackdrop","_props$keepMounted","keepMounted","_props$manager","manager","onBackdropClick","onClose","onEscapeKeyDown","exited","setExited","mountNodeRef","hasTransition","getHasTransition","getModal","handleMounted","mount","resolvedContainer","isTopModal","handlePortalRef","handleClose","inlineStyle","childProps","onEnter","TrapFocus","UNMOUNTED","EXITED","ENTERING","ENTERED","EXITING","Transition","initialStatus","appearStatus","unmountOnExit","mountOnEnter","nextCallback","updateStatus","prevProps","nextStatus","cancelNextCallback","getTimeouts","mounting","nodeRef","forceReflow","performEnter","performExit","_this2","appearing","maybeNode","maybeAppearing","timeouts","enterTimeout","safeSetState","onEntered","onEntering","onTransitionEnd","_this3","onExit","onExiting","nextState","setNextCallback","_this4","doesNotHaveTimeoutOrListener","addEndListener","maybeNextCallback","getTransitionProps","_props$style","transitionDuration","transitionDelay","getScale","entering","entered","Grow","_props$disableStrictM","disableStrictModeCompat","_props$timeout","_props$TransitionComp","TransitionComponent","autoTimeout","enableStrictModeCompat","foreignRef","normalizedTransitionCallback","nodeOrAppearing","isAppearing","handleEntering","handleEnter","reflow","_getTransitionProps","handleEntered","handleExiting","handleExit","_getTransitionProps2","nodeOrNext","maybeNext","muiSupportAuto","getOffsetTop","vertical","getOffsetLeft","horizontal","getTransformOriginValue","getAnchorEl","anchorEl","Popover","_props$anchorOrigin","anchorOrigin","anchorPosition","_props$anchorReferenc","anchorReference","containerProp","getContentAnchorEl","_props$marginThreshol","marginThreshold","_props$PaperProps","PaperProps","_props$transformOrigi","_props$transitionDura","transitionDurationProp","_props$TransitionProp","TransitionProps","paperRef","getAnchorOffset","contentAnchorOffset","resolvedAnchorEl","anchorRect","anchorVertical","getContentAnchorOffset","contentAnchorEl","getScrollParent","offsetTop","getTransformOrigin","elemRect","getPositioningStyle","offsetHeight","elemTransformOrigin","containerWindow","heightThreshold","widthThreshold","_diff","_diff2","_diff3","setPositioningStyles","positioning","handlePaperRef","updatePosition","overflowY","overflowX","maxHeight","List","_props$dense","_props$disablePadding","disablePadding","subheader","ListContext","listStyle","nextItem","disableListWrap","nextElementSibling","previousItem","previousElementSibling","textCriteriaMatches","nextFocus","textCriteria","innerText","repeating","moveFocus","currentFocus","disabledItemsFocusable","traversalFunction","wrappedOnce","nextFocusDisabled","MenuList","actions","_props$autoFocus","_props$autoFocusItem","autoFocusItem","_props$disabledItemsF","_props$disableListWra","listRef","textCriteriaRef","previousKeyMatched","lastTime","adjustStyleForScrollbar","containerElement","noExplicitWidth","activeItemIndex","newChildProps","criteria","lowerKey","currTime","keepFocusOnCurrent","RTL_ORIGIN","LTR_ORIGIN","disableAutoFocusItem","_props$MenuListProps","MenuListProps","onEnteringProp","PopoverClasses","menuListActionsRef","contentAnchorRef","WebkitOverflowScrolling","areEqualValues","ariaLabel","autoWidth","displayEmpty","IconComponent","labelId","_props$MenuProps","MenuProps","openProp","renderValue","_props$SelectDisplayP","SelectDisplayProps","tabIndexProp","_useControlled","_useControlled2","displayNode","setDisplayNode","isOpenControlled","menuMinWidthState","setMenuMinWidthState","openState","setOpenState","getElementById","isCollapsed","displaySingle","childrenArray","handleItemClick","itemIndex","displayMultiple","computeDisplay","menuMinWidth","buttonId","selectMenu","nativeInput","iconOpen","iconFilled","iconOutlined","defaultInput","NativeSelect","_props$IconComponent","ArrowDropDownIcon","_props$input","NativeSelectInput","nativeSelectStyles","Select","_props$autoWidth","_props$displayEmpty","_props$multiple","_props$native","variantProps","SelectInput","variantComponent","TextField","FormHelperTextProps","helperText","InputLabelProps","InputProps","_props$select","SelectProps","InputMore","_InputLabelProps$requ","displayRequired","helperTextId","inputLabelId","InputElement","htmlFor","PasswordInput","setPassword","loadSave","loadSaveButton","KeyPairHandling","localTheme","outerTheme","mergeOuterLocalTheme","BroadcastPublicKey","setPublicKeyMsg","encodePublicKeyWakuMessage","publicKeyMessage","ListItem","_props$alignItems","_props$button","childrenProp","componentProp","_props$ContainerCompo","ContainerComponent","_props$ContainerProps","ContainerProps","ContainerClassName","_props$divider","_props$selected","listItemRef","hasSecondaryAction","componentProps","alignItemsFlexStart","secondaryAction","backgroundClip","ListItemText","_props$disableTypogra","disableTypography","_props$inset","primaryProp","primaryTypographyProps","secondaryProp","secondaryTypographyProps","Messages","formatDisplayDate","toLocaleString","day","hour","hour12","MenuItem","ListItemClasses","_props$role","selectEmpty","SendMessage","setRecipient","setMessage","flexWrap","recipientAddress","recipientPublicKey","encodeEncryptedWakuMessage","Messaging","ethDefaultProvider","providerList","InfuraProvider","infura","EtherscanProvider","etherscan","AlchemyProvider","alchemy","PocketProvider","pocket","CloudflareProvider","cloudflare","AnkrProvider","ankr","FallbackProvider","quorum","renetwork","etcDefaultProvider","JsonRpcProvider","homestead","ensAddress","_defaultProvider","ropsten","classicMordor","networks","mainnet","morden","testnet","rinkeby","kovan","goerli","kintsugi","classic","classicMorden","classicTestnet","classicKotti","xdai","matic","maticmum","optimism","arbitrum","bnb","bnbt","Formatter","formats","getDefaultFormats","bigNumber","allowNull","blockHash","blockNumber","transactionIndex","confirmations","uint256","creates","transactionRequest","receiptLog","transactionHash","arrayOf","logIndex","receipt","contractAddress","gasUsed","logsBloom","logs","cumulativeGasUsed","effectiveGasPrice","parentHash","difficulty","miner","extraData","transactions","blockWithTransactions","transactionResponse","fromBlock","toBlock","filterLog","allowFalsish","callAddress","_block","_difficulty","networkId","byzantium","checkKey","checkValue","replaceValue","checkTopic","serializeTopics","getEventTag","PollableEvents","_lastBlockNumber","_inflight","pollable","coinInfos","p2pkh","p2sh","ilk","bytes32ify","base58Encode","matcherIpfs","matchers","_parseString","_parseBytes","getIpfsLink","numPad","padded","bytesPad","encodeBytes","datas","resolvedAddress","supportsWildcard","_supportsEip2544","_fetch","ccipReadEnabled","_fetchBytes","_getAddress","coinType","hexBytes","coinInfo","bech32","getAvatar","linkage","avatar","getText","owner","_resolvedAddress","tokenId","tokenOwner","balance","metadataUrl","imageUrl","image","getContentHash","ipns","swarm","skynet","urlSafe","defaultFormatter","nextPollId","BaseProvider","_emitted","disableCcipRead","getFormatter","anyNetwork","detectNetwork","_networkPromise","_ready","knownNetwork","_maxInternalBlockNumber","_maxFilterBlockRange","_pollingInterval","_fastQueryDate","_network","defaultProvider","ccipReadFetch","urls","sender","errorMessages","_getInternalBlockNumber","maxAge","_internalBlockNumber","internalBlockNumber","respTime","reqTime","checkInternalBlockNumber","perform","networkError","_setFastBlockNumber","pollId","runners","pollingInterval","previousBlockNumber","eventBlockNumber","runner","getTransactionReceipt","minFromBlock","getLogs","resetEventsBlock","polling","currentNetwork","_fastBlockNumber","_fastBlockNumberPromise","detectedNetwork","_poller","_bootstrapPoll","_getFastBlockNumber","getBlockNumber","waitForTransaction","_waitForTransaction","replaceable","cancelFuncs","alreadyDone","minedHandler","lastBlockNumber","startBlock","scannedBlock","replaceHandler","mined","getTransaction","getBlockWithTransactions","cancelled","_wrapTransaction","addressOrName","_getBlockTag","getCode","getStorageAt","expectedHash","returnedHash","confirms","signedTransaction","hexTx","_getTransactionRequest","_getFilter","_call","redirects","txSender","urlsOffset","urlsLength","urlsData","callbackSelector","ccipResult","_getBlock","blockHashOrBlockTag","includeTransactions","blockWithTxs","getEtherPrice","getResolver","currentName","_getResolver","addrData","lookupAddress","resolverAddr","nameOrAddress","resolverAddress","_startEvent","_stopEvent","_addEventListener","eventTag","errorGas","spelunk","requireData","checkError","getResult","getLowerCase","JsonRpcSigner","addressOrIndex","connectUnchecked","UncheckedJsonRpcSigner","_address","_index","accounts","sendUncheckedTransaction","estimate","hexlifyTransaction","_legacySignMessage","unlock","networkOrReady","_nextId","_eventLoopCache","_uncachedDetectNetwork","getSigner","getUncheckedSigner","listAccounts","jsonrpc","prepareRequest","_startPending","_pendingFilter","pendingFilter","filterId","hashes","allowExtra","allowed","buildWeb3LegacyFetcher","sendFunc","fetcher","Web3Provider","jsonRpcFetchFunc","subprovider","isMetaMask","buildEip1193Fetcher","sendAsync","ConnectWallet","setAddress","setProvider","ethers","ethereum","purple","teal","wakuStatus","title","setWaku","publicKeys","setPublicKeys","setMessages","setPeerStats","filterPeers","lightPushPeers","_waku","initWaku","observerPublicKeyMessage","waku_message","_unsubscribe","observerPrivateMessage","addressDisplay","Wifi"],"sourceRoot":""} \ No newline at end of file diff --git a/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff b/eth-pm/static/media/roboto-all-400-normal.b5a0a0df312d3423493b.woff new file mode 100644 index 0000000000000000000000000000000000000000..7245f5cae759e4e1de840e3d31a2c9e2933f0429 GIT binary patch literal 66044 zcmZU(1ymeCvo^fAySuxyxCRIsoFurrEbat%cemgk+%34fySux?Pu};t=fCIN-KTc9 zYpQy7ru#fy)l)7C5)uF~00006_6k7%{04`R{cQi!{GXTPS8<6?!-P*^{FGx`3s97# zqJqk&(_a99JQ@IyZ&`A%%#&34AqoIcDFOhH-2ebQ_@wL1xPl4`I{-kB`Pr%Rr|2d7 zRTmqA^ld+NW&i-(4*&pNLb2?1+tAsO6aWBz_6PX>PZ)|}GEHnvK>z^9r!N@ir?j~| z>Xn)5JAC?b%6{4){zqT|7^YTkCZ9Sr0HFCh0L+n60}fB#%n0NP0GyY9`hD6$obEm^ zj+zA|K!zT+TH9^2>@KOezr+Jg%Z96&c_Vo`00E3c^$By{~g80bb?vm z%Es{1?lAxWfcf<)-9cy6w}Cxb^qF9pXYYO|G|rDYvbVf zsk{8tVf?fE00E3_?TtTu!5}}|51)3@xhBs;uFFUh5XHEPfWWPfRepwXt{JP9hBKyz z?NNah=Pc05eNuyI=Zx;gkQ1seI^cIaWQ$^a!yx}WHBa?qXrDZzgFyjCnYs;k&Dgoq zHt9e}hW$38>6thUGr!$jXuABW)3y-GDFyLLk$l^h|J!M=3ys(H$~)DJ34bgDnYg&7 zR3L~hu@>ul*H0x*O)<{U(xPXn$k|1%A1W&{6(AU=hPBzXdu0;-FA%4CNR5UZ^YXJ_ z`PJjk9OW8;oGasVTKu{F^BDfqsHQx^#LluL z3ySObzdBKNvZmJnVbD)s*X4vbFe3te%z=-in!07K751|vj(N?Zvrvu=mk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`P literal 0 HcmV?d00001 diff --git a/eth-pm/static/media/roboto-cyrillic-400-normal.3605d18d8a4ce5bd39c3.woff2 b/eth-pm/static/media/roboto-cyrillic-400-normal.3605d18d8a4ce5bd39c3.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..de226b374ad4d078cab153d4252d24da1d430a2f GIT binary patch literal 9900 zcmV;dCR5pWPew8T0RR9104A&e5&!@I09!Z!047KP0RR9100000000000000000000 z0000QY8#eT95x1E0EY|+R0)GT5ey1}fo$_c3xW^;5`h!}HUcCAgd7AQ1%h-3APj;@ z8^}==Y+PlAjRSzO??Z{Aq=`^B3W1FS1;bw_`2Smi95KeG-GI-`g9PZVI0|K`$X47r z83^+|Eu-6Ai)J3PjpGWA!qJ7}dVX~rp3i|754TVNj=LB+^29z^xVqf1xIUXV@=Eu} z$iKJtT{%Tf#YHjrNc0SB8~Kx*ygoc_>;K%DJA_mi=q`~fWfT@FU^KWsFba&siVZf( zm!0E{c7&L3*jc8_cQF&hzcPI6mV40n0w<(;kJVriehSc@BcUV zIg{|aGno%1TcJ^?o(dCM#1uI2OtRl4yTa60NH+RYtH^rqbM~4fy-w;YaDgwe6-byq zT15i?)mqLT!t5~y$N?FdD8mXqc7Dch9!Ium5b6u>1eNRHOg;TYIGK zlXT`u`fLZx30hhjUqWWSWY0W(jnrd(jawUQ+em3mu5sDgP>1z!OWR6kVT({$0HS-$ zvWG8#c>Vv@`n2!Xzz6Kwuu2@Ta8(N|MbGT|Kif6CedB zSEvB1J?nCOgo;orbcA)WC7KPOh@=Y;#(Sid|95`8b*!()PBKY$NoMxd*LzI0dm~k1 zP!Y{&j;qUXndpn1D7q3z0$#fR*8&0tasU7@gn<-hW&|!C1b%)5<;oFMszwmdfuKtl zf*yScqM`_fO(2-Eh+x?b1OyBKDF7)500JNfehp~oMArZcp6;zLq2T5E^dbu0O>VBB z00n?-Rsld3pRcb#1b_e_pkM$n$l+25ZlVAhihz0T@Y-@azF2a~ck}#UjxWYQ*kH@R zpfqGz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-normal.dd55ea0a2e90d5d86e15.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..e3eabe7e95fff46920025c7f570e57946192b21d GIT binary patch literal 15520 zcmV;RJYU0iPew8T0RR9106d@o5&!@I0FRIW06aYa0RR9100000000000000000000 z0000QfleEeLL4>*U;u{<2viA!JP`~Ef#@)S&^Zf(S^yG(cmXy7Bm;*q1Rw>1bO#^| zf=L^NfCb#~Zif)W|K-MJBdTVN*8HdlHVy%V|7OAew*yXwNIO$-yI!==&B#_#qU+ zg$IIjdpRuw=svd|XBRk`*=0Ww@zRRQ+aM=j{Dg0EFb#J<3Q=p*$BQa2l^7f`d40CV zv_!_V17QF)LXy8$Zo;!uQ+^UC@K6H3Tyn=B#25JnGPxbouSS z*cj{-&4rr_g;E~ME1{xXhMxM{6qM-~E-<;La=!6w6x}z>l zLrwGllh$9-x4gU3?#1$Y59}j5XfL7H2f+PJ>hw#KA)<4yH{=cTZw(o))(j0N1)CL!gRCE|_ zQmP6UcGpDIJI1M0Zc0msj!1X+k~`}o-+n{K-rctxR-l$3rErv|nIjYDk>Ng-g8Eg9Zc z0mJR#=l*3d;x0mi7%&1cVFF^o3dF`OaE_cnJa~e5@dEJ|01^rd5+xcWRy;_uWRNr& zAi45D@bDl-ia>~nAZ02*s#Jm8a}T6JBS^D{AQT%Q+qOYoc@6T`9tZ>mSRAk-7>Er! zK!K-b5mi^Q?76qGH4r-^COi;`ofGaA0K_hIj|c{0SO9ikrwh&s4+d-^f<>V?U>`a= zG-|GUYZHYNiZ4T@u$Y&jAvyDiKT}k&B@+eX4{WjaDN$xYp_v22j(QRtk1Ba6eFD>j z@xw#~3~M}SRhL|4$cXER3mD#f=kdZ}rAe0|XOw>i8?|Ud(T=J^r!L)Q13eAKFy@Kp zCQN#1%Cs4?maW^c>yN}OGIJBndxTa)24yhyKms)Csh7jIOCH}G*O zic_U|RX&4M*o1)YBMYDS*;DANO8a2^>=UD*n3&*djZer9$!}eZcj7I}*I%g(74d=0 zrJwLamqb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9(T>$D^fj zT0$_(Yp!js51{gMAkR|3|1K=2UK4|`RM!tu5>kmqP|c(esX%Izj*wI|l6p;Ym68G; iN$4p6qyr=sji9-5k%q8jl>?Fh literal 0 HcmV?d00001 diff --git a/eth-pm/static/media/roboto-greek-400-normal.352cc77aaed5208ce13c.woff2 b/eth-pm/static/media/roboto-greek-400-normal.352cc77aaed5208ce13c.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..76fc366160eb2e26c77db025736534be511bc514 GIT binary patch literal 7296 zcmV-`9Dn0?Pew8T0RR91033h-5&!@I06RDU0309y0RR9100000000000000000000 z0000QWE+f195x1E0EH9?R0)GT5ey2?bjKMBfk*%nZ~-;~Bm;vC1Rw>1bO#^|f=L_S zGzIL~G_Y|1WZpYX6v4&`n8h3y{9h-SDqCxW{n{9yh@@i}nwE8pMeOVH-YgCDw4*e46_X$YC8yMOi5@Q>~5KB95+2TX$j=X$?B(nzLG@Avj(6VgHD1%G^ zQj#Oe0YNT@nB)qW0;RwtyFlbV02bLi{JTc)o#Z7S5ekf+6rgZ`7HD?Pswv6GD-to6(oT}6Eq7M4~AD|}jN@v~)47;-Q3Kn&Gnm!ej zId}xU9Rl0iocx`Yw5hRZfI(mg@PIp`FKPty-yfg={^9xmxqq{F=N14IV7h8V>uPk3 zx$mTqlYF9^(g(^fAgDSLszO!*;9FG$LoDQ|u`|Ni%0c1As%1*2@BLSQ%KMT_*Z>-^ zeN&^52sJy6!d_55Ii+xWO1p2Rj4brrfaUj_A^b7-bYB!7HV?#@i>;GWHZruKR zM@3=g#?8q)cci17gEDdLd6yiK3y?(C#T<*k?6Iu@P#C79)c<5cD)IV|QX`4#z15`a#omg%7< zgfcxrgegE2#2@F47{J2iQz=Jg!!-~)*b>Ls%WsADL$+>QA{Kl1FUi@JM;yi;X7J_U z1O%4IMMwK~Gd67P|8y}BKs_B0qMhw>0m#IzaR9LRg5(|(SMepa`uwN*t#@X?5%Hds z-xln-VwAa1%%iWle(x4P3-F2T8@TDVsE0p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EotZrPW)2gR{#Jn|1By3z%RRH|9|KF{iWKe3;>Li=bZr z<_Txdvl+JL^K7#@IRnyOq(e8n8|R(9%EPOrc05)%)zlx@Ym^~J6$A6H+7=f(F5WdI z-gJFjWPSdNWqFP5akgtx441}0-Zp^8LdW40@9(WrZj&pA?JSeg9Tz*MJfcb;cV>CY z!g7vvWtqcqhHdeTn}VVv&bBF**cxT*kF#AI7dS3m>7_WJoIh}1ylh>s3q2Y0tZi5t zy)G=bT3xQuSFdzj-0awx*1ps^=GpmsoY&;a!|i5juTLtMwe8Yfx66*Um#%EpIEZ}* zgoSj1heNCCzhsFG0$ZR7T!AEb2u^}egjK`WScmj!Tf!Gw;NAiOY;~cS6{L_Ea~+DV zgkaxFu>(Uw1+WoVlL*7cNt9{N;f#McCzB)%j+rE+-B7G)g(ppS&>_d_x7$v;403hr z)WycRW;^K8;C;4FJJ$hQb?DT9edWtWrvpsC-2nIfj%t3Jj=&$ZB{3*Mey1bjx*25E zxPAk6rw2^av1)`dCIC5djGCjhzlw3!@~2hlLcyM$%^7=Lxej$S@`73r_aIEO~{H;A4|> al=P9{!r;B2Zl*X&4w6RCB?C_8k^ulM$p{7j literal 0 HcmV?d00001 diff --git a/eth-pm/static/media/roboto-greek-ext-400-normal.bc7ace6e50c7d9d4d959.woff2 b/eth-pm/static/media/roboto-greek-ext-400-normal.bc7ace6e50c7d9d4d959.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..c49a20477eb9cb2b2a38eea1e931f22ee6813091 GIT binary patch literal 1528 zcmV1bO#^|f=L_j2ndeD zbZaN$ET|YT`HcX+KdXB0E9&kcGUN$VvLdqUBXonZqOag-czoX5yq|ojVp1@utQ1OD z;!&raWXY?1^^N@h_jC2ito|3;#O^r@T|!%H@4wA4)zb$d(vl_7B%1IHrO+B7L>P28 zz(IH4P7rkh`XF*a5Jc2a6A(}_RTg?lQAGpz9D4Tjaqv0v6ln~6jyrhfB>14=PuX;= zG<^~b_yMWNqD!J)XlsBVD`2jz$)8XYVd``V9Ks>)kQ%|sNqR-tDkHlkiw6ip^L5E5 zj)?FK7sOk&e0_B>vP+XK7I#g91(sLJ1fv-Z^M>Od$*oUAuQL zJMiac1W;q!B*1JY{{Q60JLDoQXL;l>Robj^kR}N+11@>g^JqK}%2hA3pZzJ3WGK`Mi{iE!Qz6Z zub+Q-Yik;h>3&Stu5ZGo`shwPYLke+liC?qzIzf@)2MC1rAr3lf+cts%QA)SYpqed zwqzjdHL1y;YUiEjk9a*AirPGiRF)1Z)U!ek8Psg8ul5GBco7>J*c#EaNnYOZTmYJo z(~DGSA#Yf^VWO}!Dfwb;HLqpjX$mHIzsN11DfyVF`N{ zAfl4Ecdsr`fKHS#4>+ohwZV^Mf>PXCmnQHcJ#4yCciRH{Sqp|o4aauak0HlaFSPX8 z&z07%-);*RfA?GUnqR)L?a~)=^y@8_e#8E{@3x=YZq}$AVfMw=ElANK zExIpXddB)Bm;2dqT540|^4|1!{VgUlYI zRS}DOp_ULJ^j001Vn|!Fd;LwF=r#Jw0RgpgkrMN?fPgr{WnVJ)RCm{$uciJ5fY<-- zJ{f>7!lo}f2JZf%Jk>A*Kv@KV;<$e`$}4{j+_S1Y6^J0FNUn95FA#Q;UF3|U4s!P9 zp6Lh*H|V2*RsfwuaU|#jlpKK)(lQPJwO~+lKrrfbOnK5TPhl`K+T37nki$3aw8aIB z$)?OR-H0K>W@5yN5gU0K#bk}FaZ+@tN&SS{Tpb**soPvJqk0#~43g<)lME2lk@b7quB$<47EFZZT0|ign{%P e0@X~lo3_wh`VZM^mMZs(buy#UUMDjE0002Zh1UrH literal 0 HcmV?d00001 diff --git a/eth-pm/static/media/roboto-latin-400-normal.176f8f5bd5f02b3abfcf.woff2 b/eth-pm/static/media/roboto-latin-400-normal.176f8f5bd5f02b3abfcf.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..1a537015109f44983c26738a436c8f5edc44b9ae GIT binary patch literal 15736 zcmV-;J%_?~Pew8T0RR9106lmB5&!@I0FFoi06h`_0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LEMM3l zT=6?k&c%!7Rk8h)UGQxDMi%aEU88l2Cd5r3R^!_!qLK*d= zo;t;=F3@S(%4RX<^(GpHrnsZnmY(IpcFHl+ignYKhRg zD55oy%5SGDT~qZWU-pu3rOwt8Rr#Z}6$>xy@p=x4sntSTrLy`(NkNZ~)JW7cr*|q> zJ|#Nr_p?>8 zB2t)rQy3zLcp60zJ4ELy8e{zY9!$a4@i5**t25c1t+5^5+Zo2E$I7zM0kQs^Mdk6g?eVQpMyib29Zi#u z1EOY}1}bZubTpAp9568zT>?$+jWx^l7%_Fy*2tzkjaTSyO_PF5%fw`=nhrJPvQov1 zp{Z)>jI|;Os54Fmue;Xb#+fa99(;*v_{i3VhGIb@G0_e=EPgc>sKGFTN2wvh1Vm0@ zoIuuAlE4G^6vh!JQ%yPHlw%wfMMz|F#Fui)Wld=Lv?vEAr|gnxPz_) zi>oR#jI6-oJ{0F=BF^IRvo};0X7OfFTn(ji_>M$-=vn-ahEGz>SOUU$ejXf4&`fua zB!MMlrN387coE*q+FcbGCh~EqvEW~F+lMX15&Ce%H>Ln-4Nn{PWDYPD%pkLaWQL~? qTQU($K}1Lz`3Hdcgk(672rw1QEoKKj3JBA0RR9bB$P@3 literal 0 HcmV?d00001 diff --git a/eth-pm/static/media/roboto-vietnamese-400-normal.52cebac009baf5592e7d.woff2 b/eth-pm/static/media/roboto-vietnamese-400-normal.52cebac009baf5592e7d.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..165cbac8994ab77076a1ea9e3b5a7388b45d9617 GIT binary patch literal 5468 zcmV-i6{G5RPew8T0RR9102N#S5&!@I05r$|02KKE0RR9100000000000000000000 z0000QE*phT95x1E0D(*hR0)GT5ey2<2*p4Pf(`%@fe-;U0we>37z7{%f^-KU41!4; zI4=d`m?a(uK=b>f_`ggrb-30Xrti=lV%Z%FL98Q=ArKdd$1LrQb}5cFo^6M|G-;YY zmH17GrTS>*Eu69^(k*=G4Se;s5t7XQJipC9m-l#t3^0}gg4l_LQ?U9g7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aD0x=S~zP^ zyh%f)p$U`hQjBCvc?aNhHy93(D#$DcXjs3WR`;Q#f>H@Vw``0Ln$(nPl`{}Dz1E;C zB?oEbLdk`&jivk`A*HH6y!?7f2mqRO8Ydpr_jCYk018k{5Vu#OLmmte&H#XP@HdKp z1?f==u%T!q);ki1C>6}ih!ViF=EJffULQpWP_DvERSM-RFolp42ab8MP>^zy@DjQ8 zLzKy8=lIXDq&aqMM&)yIyUn?(OcT91?B>1YvK&s4nBDVDRU-2k{N@1pq8SQpD zbLS;vv^z-!+neMTa&rX<`%I@hcH2&cce0N-xwGDKRoBqoDcs2CDii6b$jgNb5kMwV z92r{?YaL+ldSlu*a=a+nuqMG;4{|Bis7DvoZ{m=y#KF{%3v_EZguz~RB7;GnLzJXo zkMmhnF<5MXi|M!+JUznOdSVRK&Bk~lCx)m@lRFv4(B@B1m55{LbMm7-C&e)0Wo~8$ zG0bThVQ&0&It@9I=or>WPkXj^%oqbMi$TP&y`9W?x-lH7izVM+IXBv0+F{V6r$e(Q z;r}O#d;BILRgdyLsR4U!N>3CiC!J&u(SngSwa1SrNlh>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.push(n.RPC.SubOpts.decode(e,e.uint32()));break;case 2:s.messages&&s.messages.length||(s.messages=[]),s.messages.push(n.RPC.Message.decode(e,e.uint32()));break;case 3:s.control=n.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC)return e;var t=new n.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r>>3){case 1:s.subscribe=e.bool();break;case 2:s.topic=e.string();break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.SubOpts)return e;var t=new n.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topic&&(t.topic=String(e.topic)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic,t.oneofs&&(r._topic="topic")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.Message=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:a.from=e.bytes();break;case 2:a.data=e.bytes();break;case 3:a.seqno=e.bytes();break;case 4:a.topic=e.string();break;case 5:a.signature=e.bytes();break;case 6:a.key=e.bytes();break;default:e.skipType(7&i)}}if(!a.hasOwnProperty("topic"))throw o.ProtocolError("missing required 'topic'",{instance:a});return a},s.fromObject=function(e){if(e instanceof n.RPC.Message)return e;var t=new n.RPC.Message;return null!=e.from&&("string"===typeof e.from?o.base64.decode(e.from,t.from=o.newBuffer(o.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"===typeof e.data?o.base64.decode(e.data,t.data=o.newBuffer(o.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"===typeof e.seqno?o.base64.decode(e.seqno,t.seqno=o.newBuffer(o.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),null!=e.topic&&(t.topic=String(e.topic)),null!=e.signature&&("string"===typeof e.signature?o.base64.decode(e.signature,t.signature=o.newBuffer(o.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"===typeof e.key?o.base64.decode(e.key,t.key=o.newBuffer(o.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},s.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.topic=""),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?o.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?o.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?o.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?o.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?o.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlMessage=function(){function s(e){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:s.ihave&&s.ihave.length||(s.ihave=[]),s.ihave.push(n.RPC.ControlIHave.decode(e,e.uint32()));break;case 2:s.iwant&&s.iwant.length||(s.iwant=[]),s.iwant.push(n.RPC.ControlIWant.decode(e,e.uint32()));break;case 3:s.graft&&s.graft.length||(s.graft=[]),s.graft.push(n.RPC.ControlGraft.decode(e,e.uint32()));break;case 4:s.prune&&s.prune.length||(s.prune=[]),s.prune.push(n.RPC.ControlPrune.decode(e,e.uint32()));break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlMessage)return e;var t=new n.RPC.ControlMessage;if(e.ihave){if(!Array.isArray(e.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");t.ihave=[];for(var r=0;r>>3){case 1:s.topicID=e.string();break;case 2:s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes());break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlIHave)return e;var t=new n.RPC.ControlIHave;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");t.messageIDs=[];for(var r=0;r>>3===1)s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes());else e.skipType(7&a)}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlIWant)return e;var t=new n.RPC.ControlIWant;if(e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");t.messageIDs=[];for(var r=0;r>>3===1)s.topicID=e.string();else e.skipType(7&a)}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlGraft)return e;var t=new n.RPC.ControlGraft;return null!=e.topicID&&(t.topicID=String(e.topicID)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlPrune=function(){function s(e){if(this.peers=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:s.topicID=e.string();break;case 2:s.peers&&s.peers.length||(s.peers=[]),s.peers.push(n.RPC.PeerInfo.decode(e,e.uint32()));break;case 3:s.backoff=e.uint64();break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.ControlPrune)return e;var t=new n.RPC.ControlPrune;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.peers){if(!Array.isArray(e.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");t.peers=[];for(var r=0;r>>0,e.backoff.high>>>0).toNumber(!0))),t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.peers=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.peers&&e.peers.length){r.peers=[];for(var s=0;s>>0,e.backoff.high>>>0).toNumber(!0):e.backoff,t.oneofs&&(r._backoff="backoff")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.PeerInfo=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:s.peerID=e.bytes();break;case 2:s.signedPeerRecord=e.bytes();break;default:e.skipType(7&a)}}return s},s.fromObject=function(e){if(e instanceof n.RPC.PeerInfo)return e;var t=new n.RPC.PeerInfo;return null!=e.peerID&&("string"===typeof e.peerID?o.base64.decode(e.peerID,t.peerID=o.newBuffer(o.base64.length(e.peerID)),0):e.peerID.length&&(t.peerID=e.peerID)),null!=e.signedPeerRecord&&("string"===typeof e.signedPeerRecord?o.base64.decode(e.signedPeerRecord,t.signedPeerRecord=o.newBuffer(o.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.peerID&&e.hasOwnProperty("peerID")&&(r.peerID=t.bytes===String?o.base64.encode(e.peerID,0,e.peerID.length):t.bytes===Array?Array.prototype.slice.call(e.peerID):e.peerID,t.oneofs&&(r._peerID="peerID")),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?o.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord,t.oneofs&&(r._signedPeerRecord="signedPeerRecord")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s}(),n})); \ No newline at end of file