@depay/web3-wallets-evm 14.1.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.evm.js +3 -19
- package/dist/umd/index.evm.js +6 -23
- package/package.json +4 -5
package/dist/esm/index.evm.js
CHANGED
|
@@ -3,6 +3,7 @@ import { ethers } from 'ethers';
|
|
|
3
3
|
import { CONSTANTS } from '@depay/web3-constants';
|
|
4
4
|
import { request as request$3 } from '@depay/web3-client-evm';
|
|
5
5
|
import { WalletConnectClient, QRCodeModal } from '@depay/walletconnect-v1';
|
|
6
|
+
import { Core, SignClient } from '@depay/walletconnect-v2';
|
|
6
7
|
import { CoinbaseWalletSDK } from '@depay/coinbase-wallet-sdk';
|
|
7
8
|
|
|
8
9
|
function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
@@ -60196,23 +60197,6 @@ class WalletConnectV1 {
|
|
|
60196
60197
|
WalletConnectV1.getConnectedInstance = getConnectedInstance$2;
|
|
60197
60198
|
WalletConnectV1.setConnectedInstance = setConnectedInstance$2;
|
|
60198
60199
|
|
|
60199
|
-
var WalletConnectV2$1=function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=132)}([function(e,t,r){(function(e){r.d(t,"a",(function(){return m})),r.d(t,"b",(function(){return X})),r.d(t,"c",(function(){return Q})),r.d(t,"d",(function(){return ee})),r.d(t,"e",(function(){return j})),r.d(t,"f",(function(){return I})),r.d(t,"g",(function(){return E})),r.d(t,"h",(function(){return P})),r.d(t,"i",(function(){return R})),r.d(t,"j",(function(){return se})),r.d(t,"k",(function(){return ie})),r.d(t,"l",(function(){return W})),r.d(t,"m",(function(){return re})),r.d(t,"n",(function(){return ge})),r.d(t,"o",(function(){return _})),r.d(t,"p",(function(){return w})),r.d(t,"q",(function(){return B})),r.d(t,"r",(function(){return _e})),r.d(t,"s",(function(){return ce})),r.d(t,"t",(function(){return oe})),r.d(t,"u",(function(){return be})),r.d(t,"v",(function(){return we})),r.d(t,"w",(function(){return O})),r.d(t,"x",(function(){return S})),r.d(t,"y",(function(){return $e})),r.d(t,"z",(function(){return Z})),r.d(t,"A",(function(){return Te})),r.d(t,"B",(function(){return Ie})),r.d(t,"C",(function(){return xe})),r.d(t,"D",(function(){return x})),r.d(t,"E",(function(){return Se})),r.d(t,"F",(function(){return Le})),r.d(t,"G",(function(){return He})),r.d(t,"H",(function(){return Fe})),r.d(t,"I",(function(){return Ve})),r.d(t,"J",(function(){return ze})),r.d(t,"K",(function(){return We})),r.d(t,"L",(function(){return Ye})),r.d(t,"M",(function(){return Ge})),r.d(t,"N",(function(){return Oe})),r.d(t,"O",(function(){return qe})),r.d(t,"P",(function(){return ke})),r.d(t,"Q",(function(){return Ke})),r.d(t,"R",(function(){return Je})),r.d(t,"S",(function(){return Xe})),r.d(t,"T",(function(){return De})),r.d(t,"U",(function(){return Be})),r.d(t,"V",(function(){return je})),r.d(t,"W",(function(){return Ne})),r.d(t,"X",(function(){return Y})),r.d(t,"Y",(function(){return $})),r.d(t,"Z",(function(){return ne})),r.d(t,"ab",(function(){return pe})),r.d(t,"bb",(function(){return N})),r.d(t,"cb",(function(){return T}));var i=r(40),n=r(71),s=r(18),o=r(34),c=r(41),a=r(5),u=r(74),l=r(1),h=r(20),d=r(72),f=r(28),p=r(73);const g="base10",y="base16",b="base64pad",v="utf8",m=1;function _(){const e=c.generateKeyPair();return {privateKey:Object(a.toString)(e.secretKey,y),publicKey:Object(a.toString)(e.publicKey,y)}}function w(){const e=Object(s.randomBytes)(32);return Object(a.toString)(e,y)}function E(e,t){const r=c.sharedKey(Object(a.fromString)(e,y),Object(a.fromString)(t,y)),i=new n.HKDF(o.SHA256,r).expand(32);return Object(a.toString)(i,y)}function O(e){const t=Object(o.hash)(Object(a.fromString)(e,y));return Object(a.toString)(t,y)}function S(e){const t=Object(o.hash)(Object(a.fromString)(e,v));return Object(a.toString)(t,y)}function j(e){return Number(Object(a.toString)(e,g))}function R(e){const t=function(e){return Object(a.fromString)(""+e,g)}(typeof e.type<"u"?e.type:0);if(j(t)===m&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof e.senderPublicKey<"u"?Object(a.fromString)(e.senderPublicKey,y):void 0,n=typeof e.iv<"u"?Object(a.fromString)(e.iv,y):Object(s.randomBytes)(12);return function(e){if(j(e.type)===m){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Object(a.toString)(Object(a.concat)([e.type,e.senderPublicKey,e.iv,e.sealed]),b)}return Object(a.toString)(Object(a.concat)([e.type,e.iv,e.sealed]),b)}({type:t,sealed:new i.ChaCha20Poly1305(Object(a.fromString)(e.symKey,y)).seal(n,Object(a.fromString)(e.message,v)),iv:n,senderPublicKey:r})}function I(e){const t=new i.ChaCha20Poly1305(Object(a.fromString)(e.symKey,y)),{sealed:r,iv:n}=P(e.encoded),s=t.open(n,r);if(null===s)throw new Error("Failed to decrypt");return Object(a.toString)(s,v)}function P(e){const t=Object(a.fromString)(e,b),r=t.slice(0,1);if(j(r)===m){const e=33,i=e+12,n=t.slice(1,e),s=t.slice(e,i);return {type:r,sealed:t.slice(i),iv:s,senderPublicKey:n}}const i=t.slice(1,13);return {type:r,sealed:t.slice(13),iv:i}}function N(e,t){const r=P(e);return T({type:j(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Object(a.toString)(r.senderPublicKey,y):void 0,receiverPublicKey:null==t?void 0:t.receiverPublicKey})}function T(e){const t=(null==e?void 0:e.type)||0;if(t===m){if(typeof(null==e?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(null==e?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return {type:t,senderPublicKey:null==e?void 0:e.senderPublicKey,receiverPublicKey:null==e?void 0:e.receiverPublicKey}}function x(e){return e.type===m&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}var L=Object.defineProperty,A=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,C=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,D=(e,t)=>{for(var r in t||(t={}))U.call(t,r)&&C(e,r,t[r]);if(A)for(var r of A(t))M.call(t,r)&&C(e,r,t[r]);return e};const z="react-native",k="node",K="browser",V="unknown",q="js";function H(){return typeof e<"u"&&typeof e.versions<"u"&&typeof e.versions.node<"u"}function J(){return !Object(h.getDocument)()&&Object(h.getNavigator)()&&"ReactNative"===navigator.product?z:H()?k:!H()&&Object(h.getNavigator)()?K:V}function B(){return Object(d.getWindowMetadata)()||{name:"",description:"",url:"",icons:[""]}}function F(e,t,r){const i=function(){const e=Object(u.a)();if(null===e)return "unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return "browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}(),n=function(){var e;const t=J();return t===K?[t,(null==(e=Object(h.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return [[e,t].join("-"),[q,r].join("-"),i,n].join("/")}function W({protocol:e,version:t,relayUrl:r,sdkVersion:i,auth:n,projectId:s}){const o=r.split("?"),c={auth:n,ua:F(e,t,i),projectId:s},a=function(e,t){let r=f.parse(e);return r=D(D({},r),t),e=f.stringify(r)}(o[1]||"",c);return o[0]+"?"+a}function G(e,t){return e.filter(e=>t.includes(e)).length===e.length}function Y(e){return Object.fromEntries(e.entries())}function $(e){return new Map(Object.entries(e))}function X(e,t){return Object(l.fromMiliseconds)((t||Date.now())+Object(l.toMiliseconds)(e))}function Z(e){return Object(l.fromMiliseconds)(Date.now())>=Object(l.toMiliseconds)(e)}function Q(e){const t=Object(l.toMiliseconds)(e||l.FIVE_MINUTES);let r,i,n;return {resolve:e=>{n&&r&&(clearTimeout(n),r(e));},reject:e=>{n&&i&&(clearTimeout(n),i(e));},done:()=>new Promise((e,s)=>{n=setTimeout(s,t),r=e,i=s;})}}function ee(e,t){return new Promise((r,i)=>{return n=this,s=null,o=function*(){const n=setTimeout(()=>i(),t),s=yield e;clearTimeout(n),r(s);},new Promise((e,t)=>{var r=e=>{try{c(o.next(e));}catch(e){t(e);}},i=e=>{try{c(o.throw(e));}catch(e){t(e);}},c=t=>t.done?e(t.value):Promise.resolve(t.value).then(r,i);c((o=o.apply(n,s)).next());});var n,s,o;})}function te(e,t){if("string"==typeof t&&t.startsWith(e+":"))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return "topic:"+t}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return "id:"+t}throw new Error("Unknown expirer target type: "+e)}function re(e){return te("topic",e)}function ie(e){return te("id",e)}function ne(e){const[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else {if("id"!==t||!Number.isInteger(Number(r)))throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);i.id=Number(r);}return i}function se(e,t){return `${e}${t?":"+t:""}`}function oe(e){return (null==e?void 0:e.relay)||{protocol:"irn"}}function ce(e){const t=p.RELAY_JSONRPC[e];if(typeof t>"u")throw new Error("Relay Protocol not supported: "+e);return t}var ae=Object.defineProperty,ue=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,de=(e,t,r)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;function fe(e,t="-"){const r={},i="relay"+t;return Object.keys(e).forEach(t=>{if(t.startsWith(i)){const n=t.replace(i,""),s=e[t];r[n]=s;}}),r}function pe(e){const t=e.indexOf(":"),r=-1!==e.indexOf("?")?e.indexOf("?"):void 0,i=e.substring(0,t),n=e.substring(t+1,r).split("@"),s=typeof r<"u"?e.substring(r):"",o=f.parse(s);return {protocol:i,topic:n[0],version:parseInt(n[1],10),symKey:o.symKey,relay:fe(o)}}function ge(e){return `${e.protocol}:${e.topic}@${e.version}?`+f.stringify(((e,t)=>{for(var r in t||(t={}))le.call(t,r)&&de(e,r,t[r]);if(ue)for(var r of ue(t))he.call(t,r)&&de(e,r,t[r]);return e})({symKey:e.symKey},function(e,t="-"){const r={};return Object.keys(e).forEach(i=>{const n="relay"+t+i;e[i]&&(r[n]=e[i]);}),r}(e.relay)))}function ye(e){const t=[];return e.forEach(e=>{const[r,i]=e.split(":");t.push(`${r}:${i}`);}),t}function be(e,t){const r=ze(e,t);if(r)throw new Error(r.message);const i={};for(const[t,r]of Object.entries(e))i[t]={methods:r.methods,events:r.events,chains:r.accounts.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)};return i}const ve={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},me={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function _e(e,t){const{message:r,code:i}=me[e];return {message:t?`${r} ${t}`:r,code:i}}function we(e,t){const{message:r,code:i}=ve[e];return {message:t?`${r} ${t}`:r,code:i}}function Ee(e,t){return !!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function Oe(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Se(e){return typeof e>"u"}function je(e,t){return !(!t||!Se(e))||"string"==typeof e&&Boolean(e.trim().length)}function Re(e,t){return !(!t||!Se(e))||"number"==typeof e&&!isNaN(e)}function Ie(e,t){const{requiredNamespaces:r}=t,i=Object.keys(e.namespaces),n=Object.keys(r);let s=!0;return !!G(n,i)&&(i.forEach(t=>{const{accounts:i,methods:n,events:o}=e.namespaces[t],c=ye(i),a=r[t];G(a.chains,c)&&G(a.methods,n)&&G(a.events,o)||(s=!1);}),s)}function Pe(e){return !(!je(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Ne(e){if(je(e,!1))try{return typeof new URL(e)<"u"}catch(e){return !1}return !1}function Te(e){var t;return null==(t=null==e?void 0:e.proposer)?void 0:t.publicKey}function xe(e){return null==e?void 0:e.topic}function Le(e,t){let r=null;return je(null==e?void 0:e.publicKey,!1)||(r=_e("MISSING_OR_INVALID",t+" controller public key should be a string")),r}function Ae(e){let t=!0;return Ee(e)?e.length&&(t=e.every(e=>je(e,!1))):t=!1,t}function Ue(e,t){let r=null;return Object.entries(e).forEach(([e,i])=>{if(r)return;const n=function(e,t,r){let i=null;return Ee(t)?t.forEach(t=>{i||(!Pe(t)||!t.includes(e))&&(i=we("UNSUPPORTED_CHAINS",`${r}, chain ${t} should be a string and conform to "namespace:chainId" format`));}):i=we("UNSUPPORTED_CHAINS",`${r}, chains ${t} should be an array of strings conforming to "namespace:chainId" format`),i}(e,null==i?void 0:i.chains,t+" requiredNamespace");n&&(r=n);}),r}function Me(e,t){let r=null;return Ee(e)?e.forEach(e=>{r||function(e){if(je(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return !!t[2]&&Pe(e)}}return !1}(e)||(r=we("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`));}):r=we("UNSUPPORTED_ACCOUNTS",t+', accounts should be an array of strings conforming to "namespace:chainId:address" format'),r}function Ce(e,t){let r=null;return Object.values(e).forEach(e=>{if(r)return;const i=function(e,t){let r=null;return Ae(null==e?void 0:e.methods)?Ae(null==e?void 0:e.events)||(r=we("UNSUPPORTED_EVENTS",t+", events should be an array of strings or empty array for no events")):r=we("UNSUPPORTED_METHODS",t+", methods should be an array of strings or empty array for no methods"),r}(e,t+", namespace");i&&(r=i);}),r}function De(e,t){let r=null;if(e&&Oe(e)){const i=Ce(e,t);i&&(r=i);const n=Ue(e,t);n&&(r=n);}else r=_e("MISSING_OR_INVALID",t+", requiredNamespaces should be an object with data");return r}function ze(e,t){let r=null;if(e&&Oe(e)){const i=Ce(e,t);i&&(r=i);const n=function(e,t){let r=null;return Object.values(e).forEach(e=>{if(r)return;const i=Me(null==e?void 0:e.accounts,t+" namespace");i&&(r=i);}),r}(e,t);n&&(r=n);}else r=_e("MISSING_OR_INVALID",t+", namespaces should be an object with data");return r}function ke(e){return je(e.protocol,!0)}function Ke(e,t){let r=!1;return t&&!e?r=!0:e&&Ee(e)&&e.length&&e.forEach(e=>{r=ke(e);}),r}function Ve(e){return "number"==typeof e}function qe(e){return typeof e<"u"&&null!==typeof e}function He(e){return !!(e&&"object"==typeof e&&e.code&&Re(e.code,!1)&&e.message&&je(e.message,!1))}function Je(e){return !(Se(e)||!je(e.method,!1))}function Be(e){return !(Se(e)||Se(e.result)&&Se(e.error)||!Re(e.id,!1)||!je(e.jsonrpc,!1))}function Fe(e){return !(Se(e)||!je(e.name,!1))}function We(e,t){return !(!Pe(t)||!function(e){const t=[];return Object.values(e).forEach(e=>{t.push(...ye(e.accounts));}),t}(e).includes(t))}function Ge(e,t,r){return !!je(r,!1)&&function(e,t){const r=[];return Object.values(e).forEach(e=>{ye(e.accounts).includes(t)&&r.push(...e.methods);}),r}(e,t).includes(r)}function Ye(e,t,r){return !!je(r,!1)&&function(e,t){const r=[];return Object.values(e).forEach(e=>{ye(e.accounts).includes(t)&&r.push(...e.events);}),r}(e,t).includes(r)}function $e(e,t,r){let i=null;const n=Object.keys(e);return G(n,Object.keys(t))?n.forEach(n=>{if(i)return;G(e[n].chains,ye(t[n].accounts))?G(e[n].methods,t[n].methods)?G(e[n].events,t[n].events)||(i=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy requiredNamespaces events for ${n}`)):i=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy requiredNamespaces methods for ${n}`):i=_e("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy requiredNamespaces chains for ${n}`);}):i=_e("NON_CONFORMING_NAMESPACES",r+" namespaces keys don't satisfy requiredNamespaces"),i}function Xe(e,t){return Re(e,!1)&&e<=t.max&&e>=t.min}}).call(this,r(37));},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);i.__exportStar(r(82),t),i.__exportStar(r(87),t),i.__exportStar(r(88),t),i.__exportStar(r(43),t);},function(e,t,r){r(7);var i=r(19);r.d(t,"parseConnectionError",(function(){return i.d}));var n=r(59);r.o(n,"IJsonRpcProvider")&&r.d(t,"IJsonRpcProvider",(function(){return n.IJsonRpcProvider})),r.o(n,"formatJsonRpcError")&&r.d(t,"formatJsonRpcError",(function(){return n.formatJsonRpcError})),r.o(n,"formatJsonRpcRequest")&&r.d(t,"formatJsonRpcRequest",(function(){return n.formatJsonRpcRequest})),r.o(n,"formatJsonRpcResult")&&r.d(t,"formatJsonRpcResult",(function(){return n.formatJsonRpcResult})),r.o(n,"isJsonRpcError")&&r.d(t,"isJsonRpcError",(function(){return n.isJsonRpcError})),r.o(n,"isJsonRpcRequest")&&r.d(t,"isJsonRpcRequest",(function(){return n.isJsonRpcRequest})),r.o(n,"isJsonRpcResponse")&&r.d(t,"isJsonRpcResponse",(function(){return n.isJsonRpcResponse})),r.o(n,"isJsonRpcResult")&&r.d(t,"isJsonRpcResult",(function(){return n.isJsonRpcResult})),r.o(n,"isLocalhostUrl")&&r.d(t,"isLocalhostUrl",(function(){return n.isLocalhostUrl})),r.o(n,"isReactNative")&&r.d(t,"isReactNative",(function(){return n.isReactNative})),r.o(n,"isWsUrl")&&r.d(t,"isWsUrl",(function(){return n.isWsUrl}));var s=r(60);r.d(t,"formatJsonRpcError",(function(){return s.a})),r.d(t,"formatJsonRpcRequest",(function(){return s.b})),r.d(t,"formatJsonRpcResult",(function(){return s.c}));r(61);var o=r(62);r.o(o,"IJsonRpcProvider")&&r.d(t,"IJsonRpcProvider",(function(){return o.IJsonRpcProvider})),r.o(o,"isJsonRpcError")&&r.d(t,"isJsonRpcError",(function(){return o.isJsonRpcError})),r.o(o,"isJsonRpcRequest")&&r.d(t,"isJsonRpcRequest",(function(){return o.isJsonRpcRequest})),r.o(o,"isJsonRpcResponse")&&r.d(t,"isJsonRpcResponse",(function(){return o.isJsonRpcResponse})),r.o(o,"isJsonRpcResult")&&r.d(t,"isJsonRpcResult",(function(){return o.isJsonRpcResult})),r.o(o,"isLocalhostUrl")&&r.d(t,"isLocalhostUrl",(function(){return o.isLocalhostUrl})),r.o(o,"isReactNative")&&r.d(t,"isReactNative",(function(){return o.isReactNative})),r.o(o,"isWsUrl")&&r.d(t,"isWsUrl",(function(){return o.isWsUrl}));var c=r(67);r.d(t,"isLocalhostUrl",(function(){return c.a})),r.d(t,"isWsUrl",(function(){return c.b}));var a=r(68);r.d(t,"isJsonRpcError",(function(){return a.a})),r.d(t,"isJsonRpcRequest",(function(){return a.b})),r.d(t,"isJsonRpcResponse",(function(){return a.c})),r.d(t,"isJsonRpcResult",(function(){return a.d}));},function(e,t,r){r.d(t,"h",(function(){return i})),r.d(t,"i",(function(){return n})),r.d(t,"f",(function(){return s})),r.d(t,"g",(function(){return o})),r.d(t,"e",(function(){return c})),r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return u})),r.d(t,"d",(function(){return l})),r.d(t,"c",(function(){return h})),r.d(t,"l",(function(){return d})),r.d(t,"k",(function(){return f})),r.d(t,"m",(function(){return p})),r.d(t,"n",(function(){return g})),r.d(t,"j",(function(){return y}));const i="EdDSA",n="JWT",s=".",o="base64url",c="utf8",a="utf8",u=":",l="did",h="key",d="base58btc",f="z",p="K36",g=32,y=32;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const i=r(9),n=i.__importDefault(r(22));Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return n.default}}),i.__exportStar(r(46),t),i.__exportStar(r(92),t);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(118),n=r(119),s=r(120),o=r(121),c=r(122),a=r(123);t.compare=i.compare,t.concat=n.concat,t.equals=s.equals,t.fromString=o.fromString,t.toString=c.toString,t.xor=a.xor;},function(e,t,r){var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function c(){c.init.call(this);}e.exports=c,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r);}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments));}b(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&b(e,"error",t,r);}(e,n,{once:!0});}))},c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var a=10;function u(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?c.defaultMaxListeners:e._maxListeners}function h(e,t,r,i){var n,s,o,c;if(u(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=l(e))>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,c=a,console&&console.warn&&console.warn(c);}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=d.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return [];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):y(n,n.length)}function g(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function b(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else {if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s);}));}}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e;}}),c.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},c.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},c.prototype.getMaxListeners=function(){return l(this)},c.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return !1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var c=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw c.context=o,c}var a=n[e];if(void 0===a)return !1;if("function"==typeof a)s(a,this,t);else {var u=a.length,l=y(a,u);for(r=0;r<u;++r)s(l[r],this,t);}return !0},c.prototype.addListener=function(e,t){return h(this,e,t,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(e,t){return h(this,e,t,!0)},c.prototype.once=function(e,t){return u(t),this.on(e,f(this,e,t)),this},c.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,f(this,e,t)),this},c.prototype.removeListener=function(e,t){var r,i,n,s,o;if(u(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop();}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t);}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},c.prototype.listeners=function(e){return p(this,e,!0)},c.prototype.rawListeners=function(e){return p(this,e,!1)},c.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},c.prototype.listenerCount=g,c.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};},function(e,t,r){r.d(t,"b",(function(){return i})),r.d(t,"d",(function(){return n})),r.d(t,"c",(function(){return s})),r.d(t,"e",(function(){return o})),r.d(t,"f",(function(){return c})),r.d(t,"a",(function(){return a}));const i="INTERNAL_ERROR",n="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],o=[-32e3,-32099],c={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[i]:{code:-32603,message:"Internal error"},[n]:{code:-32e3,message:"Server error"}},a=n;},function(e,t,r){function i(e,t,r="string"){if(!e[t]||typeof e[t]!==r)throw new Error(`Missing or invalid "${t}" param`)}function n(e,t,r){return !!(!r.length?function(e,t){return Array.isArray(e)?e.length===t:Object.keys(e).length===t}(e,t.length):function(e,t){return Array.isArray(e)?e.length>=t:Object.keys(e).length>=t}(e,t.length))&&function(e,t){let r=!0;return t.forEach(t=>{t in e||(r=!1);}),r}(e,t)}function s(e,t,r="_"){const i=e.split(r);return i[i.length-1].trim().toLowerCase()===t.trim().toLowerCase()}r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return s}));},function(e,t,r){r.r(t),r.d(t,"__extends",(function(){return n})),r.d(t,"__assign",(function(){return s})),r.d(t,"__rest",(function(){return o})),r.d(t,"__decorate",(function(){return c})),r.d(t,"__param",(function(){return a})),r.d(t,"__metadata",(function(){return u})),r.d(t,"__awaiter",(function(){return l})),r.d(t,"__generator",(function(){return h})),r.d(t,"__createBinding",(function(){return d})),r.d(t,"__exportStar",(function(){return f})),r.d(t,"__values",(function(){return p})),r.d(t,"__read",(function(){return g})),r.d(t,"__spread",(function(){return y})),r.d(t,"__spreadArrays",(function(){return b})),r.d(t,"__await",(function(){return v})),r.d(t,"__asyncGenerator",(function(){return m})),r.d(t,"__asyncDelegator",(function(){return _})),r.d(t,"__asyncValues",(function(){return w})),r.d(t,"__makeTemplateObject",(function(){return E})),r.d(t,"__importStar",(function(){return O})),r.d(t,"__importDefault",(function(){return S})),r.d(t,"__classPrivateFieldGet",(function(){return j})),r.d(t,"__classPrivateFieldSet",(function(){return R}));
|
|
60200
|
-
/*! *****************************************************************************
|
|
60201
|
-
Copyright (c) Microsoft Corporation.
|
|
60202
|
-
|
|
60203
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
60204
|
-
purpose with or without fee is hereby granted.
|
|
60205
|
-
|
|
60206
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
60207
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
60208
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
60209
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
60210
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
60211
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
60212
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
60213
|
-
***************************************************************************** */
|
|
60214
|
-
var i=function(e,t){return (i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);})(e,t)};function n(e,t){function r(){this.constructor=e;}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r);}var s=function(){return (s=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);}return r}function c(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function a(e,t){return function(r,i){t(r,i,e);}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{a(i.next(e));}catch(e){s(e);}}function c(e){try{a(i.throw(e));}catch(e){s(e);}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t);}))).then(o,c);}a((i=i.apply(e,t||[])).next());}))}function h(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o);}catch(e){s=[6,e],i=0;}finally{r=n=0;}if(5&s[0])throw s[1];return {value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function d(e,t,r,i){void 0===i&&(i=r),e[i]=t[r];}function f(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r]);}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return {next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value);}catch(e){n={error:e};}finally{try{i&&!i.done&&(r=s.return)&&r.call(s);}finally{if(n)throw n.error}}return o}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function b(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=Array(e),n=0;for(t=0;t<r;t++)for(var s=arguments[t],o=0,c=s.length;o<c;o++,n++)i[n]=s[o];return i}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function m(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){n[e]&&(i[e]=function(t){return new Promise((function(r,i){s.push([e,t,r,i])>1||c(e,t);}))});}function c(e,t){try{(r=n[e](t)).value instanceof v?Promise.resolve(r.value.v).then(a,u):l(s[0][2],r);}catch(e){l(s[0][3],e);}var r;}function a(e){c("next",e);}function u(e){c("throw",e);}function l(e,t){e(t),s.shift(),s.length&&c(s[0][0],s[0][1]);}}function _(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return (r=!r)?{value:v(e[i](t)),done:"return"===i}:n?n(t):t}:n;}}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r});}),t);})(i,n,(t=e[r](t)).done,t.value);}))};}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function O(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function S(e){return e&&e.__esModule?e:{default:e}}function j(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function R(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e};},function(e,t,r){r.d(t,"c",(function(){return n})),r.d(t,"d",(function(){return s})),r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return c})),r.d(t,"g",(function(){return a})),r.d(t,"h",(function(){return u})),r.d(t,"e",(function(){return l})),r.d(t,"f",(function(){return h}));var i=r(8);function n(e){return Object(i.c)(e,"subscribe")}function s(e){return Object(i.b)(e,["topic"],[])}function o(e){return Object(i.c)(e,"publish")}function c(e){return Object(i.b)(e,["message","topic","ttl"],["prompt","tag"])}function a(e){return Object(i.c)(e,"unsubscribe")}function u(e){return Object(i.b)(e,["id","topic"],[])}function l(e){return Object(i.c)(e,"subscription")}function h(e){return Object(i.b)(e,["id","data"],[])}},function(e,t,r){var i=Object.defineProperty,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,c=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,a=(e,t)=>{for(var r in t||(t={}))s.call(t,r)&&c(e,r,t[r]);if(n)for(var r of n(t))o.call(t,r)&&c(e,r,t[r]);return e};Object.defineProperty(t,"__esModule",{value:!0});var u=r(100),l=r(14);class h{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r;}encode(e){if(e instanceof Uint8Array)return `${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class d{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r;}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return p(this,e)}}class f{constructor(e){this.decoders=e;}or(e){return p(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const p=(e,t)=>new f(a(a({},e.decoders||{[e.prefix]:e}),t.decoders||{[t.prefix]:t}));class g{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new h(e,t,r),this.decoder=new d(e,t,i);}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const y=({name:e,prefix:t,encode:r,decode:i})=>new g(e,t,r,i);t.Codec=g,t.baseX=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:n}=u(r,t);return y({prefix:e,name:t,encode:i,decode:e=>l.coerce(n(e))})},t.from=y,t.or=p,t.rfc4648=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>y({prefix:t,name:e,encode:e=>((e,t,r)=>{const i="="===t[t.length-1],n=(1<<r)-1;let s="",o=0,c=0;for(let i=0;i<e.length;++i)for(c=c<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&c>>o];if(o&&(s+=t[n&c<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{const n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;const o=new Uint8Array(s*r/8|0);let c=0,a=0,u=0;for(let t=0;t<s;++t){const s=n[e[t]];if(void 0===s)throw new SyntaxError(`Non-${i} character`);a=a<<r|s,c+=r,c>=8&&(c-=8,o[u++]=255&a>>c);}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return o})(t,i,r,e)});},function(e,t,r){function i(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}}function n(e){return "string"==typeof e?e:JSON.stringify(e)}r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return n}));},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=new Uint8Array(0);t.coerce=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},t.empty=i,t.equals=(e,t)=>{if(e===t)return !0;if(e.byteLength!==t.byteLength)return !1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return !1;return !0},t.fromHex=e=>{const t=e.match(/../g);return t?new Uint8Array(t.map(e=>parseInt(e,16))):i},t.fromString=e=>(new TextEncoder).encode(e),t.isBinary=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),t.toHex=e=>e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),t.toString=e=>(new TextDecoder).decode(e);},function(e,t,r){r.d(t,"d",(function(){return l})),r.d(t,"a",(function(){return h})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"b",(function(){return p}));var i=r(70),n=r(21),s=r(17),o=r(13),c=r(3);function a(e){return Object(o.a)(Object(n.toString)(Object(s.fromString)(e,c.g),c.e))}function u(e){return Object(n.toString)(Object(s.fromString)(Object(o.b)(e),c.e),c.g)}function l(e){const t=Object(s.fromString)(c.m,c.l),r=c.k+Object(n.toString)(Object(i.concat)([t,e]),c.l);return [c.d,c.c,r].join(c.b)}function h(e){const[t,r,i]=e.split(c.b);if(t!==c.d||r!==c.c)throw new Error('Issuer must be a DID with method "key"');if(i.slice(0,1)!==c.k)throw new Error("Issuer must be a key in mulicodec format");const o=Object(s.fromString)(i.slice(1),c.l);if(Object(n.toString)(o.slice(0,2),c.l)!==c.m)throw new Error('Issuer must be a public key with type "Ed25519"');const a=o.slice(2);if(a.length!==c.n)throw new Error("Issuer must be a public key with length 32 bytes");return a}function d(e){return Object(s.fromString)([u(e.header),u(e.payload)].join(c.f),c.a)}function f(e){return [u(e.header),u(e.payload),(t=e.signature,Object(n.toString)(t,c.g))].join(c.f);var t;}function p(e){const t=e.split(c.f);var r;return {header:a(t[0]),payload:a(t[1]),signature:(r=t[2],Object(s.fromString)(r,c.g)),data:Object(s.fromString)(t.slice(0,2).join(c.f),c.a)}}},function(e,t,r){r.r(t),r.d(t,"IEvents",(function(){return i}));class i{}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(49),n=r(35);t.fromString=function(e,t="utf8"){const r=i[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return "utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):n.asUint8Array(globalThis.Buffer.from(e,"utf-8"))};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const i=r(93),n=r(23),s=r(10);function o(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new i.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(e=t.defaultRandomSource){const r=o(4,e),i=(0, n.readUint32LE)(r);return (0, s.wipe)(r),i};const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(e,r=c,i=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 n="";const a=r.length,u=256-256%a;for(;e>0;){const t=o(Math.ceil(256*e/u),i);for(let i=0;i<t.length&&e>0;i++){const s=t[i];s<u&&(n+=r.charAt(s%a),e--);}(0, s.wipe)(t);}return n}t.randomString=a,t.randomStringForEntropy=function(e,r=c,i=t.defaultRandomSource){return a(Math.ceil(e/(Math.log(r.length)/Math.LN2)),r,i)};},function(e,t,r){r.d(t,"c",(function(){return n})),r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return o})),r.d(t,"d",(function(){return c}));var i=r(7);function n(e){return i.c.includes(e)}function s(e){return Object.keys(i.f).includes(e)?i.f[e]:i.f[i.a]}function o(e){const t=Object.values(i.f).find(t=>t.code===e);return t||i.f[i.a]}function c(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${t}`):e}},function(e,t,r){function i(e){let t=void 0;return "undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function n(e){const t=i(e);if(!t)throw new Error(e+" is not defined in Window");return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=i,t.getFromWindowOrThrow=n,t.getDocumentOrThrow=function(){return n("document")},t.getDocument=function(){return i("document")},t.getNavigatorOrThrow=function(){return n("navigator")},t.getNavigator=function(){return i("navigator")},t.getLocationOrThrow=function(){return n("location")},t.getLocation=function(){return i("location")},t.getCryptoOrThrow=function(){return n("crypto")},t.getCrypto=function(){return i("crypto")},t.getLocalStorageOrThrow=function(){return n("localStorage")},t.getLocalStorage=function(){return i("localStorage")};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(49);t.toString=function(e,t="utf8"){const r=i[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return "utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")};},function(e,t,r){const i=r(76);e.exports=o;const n=function(){function e(e){return void 0!==e&&e}try{return "undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},s={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:g,wrapResponseSerializer:g,wrapErrorSerializer:g,req:p,res:p,err:function(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t}};function o(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const r=e.browser.write||n;e.browser.write&&(e.browser.asObject=!0);const i=e.serializers||{},s=function(e,t){if(Array.isArray(e)){return e.filter((function(e){return "!stdSerializers.err"!==e}))}return !0===e&&Object.keys(t)}(e.browser.serialize,i);let a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);"function"==typeof r&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),!1===e.enabled&&(e.level="silent");const h=e.level||"info",p=Object.create(r);p.log||(p.log=y),Object.defineProperty(p,"levelVal",{get:function(){return "silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(p,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,c(g,p,"error","log"),c(g,p,"fatal","error"),c(g,p,"warn","error"),c(g,p,"info","log"),c(g,p,"debug","log"),c(g,p,"trace","log");}});const g={transmit:t,serialize:s,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:f(e)};return p.levels=o.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=y,p.serializers=i,p._serialize=s,p._stdErrSerialize=a,p.child=function(r,n){if(!r)throw new Error("missing bindings for child Pino");n=n||{},s&&r.serializers&&(n.serializers=r.serializers);const o=n.serializers;if(s&&o){var c=Object.assign({},i,o),a=!0===e.browser.serialize?Object.keys(c):s;delete r.serializers,u([r],a,c,this._stdErrSerialize);}function h(e){this._childLevel=1+(0|e._childLevel),this.error=l(e,r,"error"),this.fatal=l(e,r,"fatal"),this.warn=l(e,r,"warn"),this.info=l(e,r,"info"),this.debug=l(e,r,"debug"),this.trace=l(e,r,"trace"),c&&(this.serializers=c,this._serialize=a),t&&(this._logEvent=d([].concat(e._logEvent.bindings,r)));}return h.prototype=this,new h(this)},t&&(p._logEvent=d()),p}function c(e,t,r,i){const s=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?y:s[r]?s[r]:n[r]||n[i]||y,function(e,t,r){if(!e.transmit&&t[r]===y)return;t[r]=(i=t[r],function(){const s=e.timestamp(),c=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var d=0;d<c.length;d++)c[d]=arguments[d];if(e.serialize&&!e.asObject&&u(c,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?i.call(l,a(this,r,c,s)):i.apply(l,c),e.transmit){const i=e.transmit.level||t.level,n=o.levels.values[i],a=o.levels.values[r];if(a<n)return;h(this,{ts:s,methodLevel:r,methodValue:a,transmitLevel:i,transmitValue:o.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},c);}});var i;}(e,t,r);}function a(e,t,r,n){e._serialize&&u(r,e._serialize,e.serializers,e._stdErrSerialize);const s=r.slice();let c=s[0];const a={};n&&(a.time=n),a.level=o.levels.values[t];let l=1+(0|e._childLevel);if(l<1&&(l=1),null!==c&&"object"==typeof c){for(;l--&&"object"==typeof s[0];)Object.assign(a,s.shift());c=s.length?i(s.shift(),s):void 0;}else "string"==typeof c&&(c=i(s.shift(),s));return void 0!==c&&(a.msg=c),a}function u(e,t,r,i){for(const n in e)if(i&&e[n]instanceof Error)e[n]=o.stdSerializers.err(e[n]);else if("object"==typeof e[n]&&!Array.isArray(e[n]))for(const i in e[n])t&&t.indexOf(i)>-1&&i in r&&(e[n][i]=r[i](e[n][i]));}function l(e,t,r){return function(){const i=new Array(1+arguments.length);i[0]=t;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return e[r].apply(this,i)}}function h(e,t,r){const i=t.send,n=t.ts,s=t.methodLevel,o=t.methodValue,c=t.val,a=e._logEvent.bindings;u(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=n,e._logEvent.messages=r.filter((function(e){return -1===a.indexOf(e)})),e._logEvent.level.label=s,e._logEvent.level.value=o,i(s,e._logEvent,c),e._logEvent=d(a);}function d(e){return {ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function f(e){return "function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?b:v}function p(){return {}}function g(e){return e}function y(){}function b(){return !1}function v(){return Date.now()}o.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},o.stdSerializers=s,o.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:v,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}});},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(97);function n(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 s(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 o(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function c(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function a(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(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),l(e/4294967296>>>0,t,r),l(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=n,t.writeInt16BE=n,t.writeUint16LE=s,t.writeInt16LE=s,t.readInt32BE=o,t.readUint32BE=c,t.readInt32LE=a,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=h,t.writeInt32LE=h,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=o(e,t),i=o(e,t+4);return 4294967296*r+i-4294967296*(i>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*c(e,t)+c(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=a(e,t);return 4294967296*a(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(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 i=0,n=1,s=e/8+r-1;s>=r;s--)i+=t[s]*n,n*=256;return i},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 i=0,n=1,s=r;s<r+e/8;s++)i+=t[s]*n,n*=256;return i},t.writeUintBE=function(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!i.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,o=e/8+n-1;o>=n;o--)r[o]=t/s&255,s*=256;return r},t.writeUintLE=function(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!i.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,o=n;o<n+e/8;o++)r[o]=t/s&255,s*=256;return r},t.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},t.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},t.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},t.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},t.writeFloat32BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t},t.writeFloat32LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t},t.writeFloat64BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t},t.writeFloat64LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),n=r(30);class s{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i;}}t.Digest=s,t.create=(e,t)=>{const r=t.byteLength,i=n.encodingLength(e),o=i+n.encodingLength(r),c=new Uint8Array(o+r);return n.encodeTo(e,c,0),n.encodeTo(r,c,i),c.set(t,o),new s(e,r,t,c)},t.decode=e=>{const t=i.coerce(e),[r,o]=n.decode(t),[c,a]=n.decode(t.subarray(o)),u=t.subarray(o+a);if(u.byteLength!==c)throw new Error("Incorrect length");return new s(r,c,u,t)},t.equals=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&i.equals(e.bytes,t.bytes);},function(e,t,r){r.d(t,"a",(function(){return i}));class i{}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);i.__exportStar(r(81),t),i.__exportStar(r(44),t),i.__exportStar(r(45),t);},function(e,t,r){var i=r(47);r.d(t,"generateKeyPair",(function(){return i.a})),r.d(t,"signJWT",(function(){return i.b}));r(3);var n=r(54);r.o(n,"encodeIss")&&r.d(t,"encodeIss",(function(){return n.encodeIss}));var s=r(15);r.d(t,"encodeIss",(function(){return s.d}));},function(e,t,r){const i=r(124),n=r(125),s=r(126),o=r(127),c=Symbol("encodeFragmentIdentifier");function a(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?i(e):encodeURIComponent(e):e}function l(e,t){return t.decode?n(e):e}function h(e){const t=e.indexOf("#");return -1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=h(e)).indexOf("?");return -1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function p(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return (e,r,i)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===i[e]&&(i[e]={}),i[e][t[1]]=r):i[e]=r;};case"bracket":return (e,r,i)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==i[e]?i[e]=[].concat(i[e],r):i[e]=[r]:i[e]=r;};case"colon-list-separator":return (e,r,i)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==i[e]?i[e]=[].concat(i[e],r):i[e]=[r]:i[e]=r;};case"comma":case"separator":return (t,r,i)=>{const n="string"==typeof r&&r.includes(e.arrayFormatSeparator),s="string"==typeof r&&!n&&l(r,e).includes(e.arrayFormatSeparator);r=s?l(r,e):r;const o=n||s?r.split(e.arrayFormatSeparator).map(t=>l(t,e)):null===r?r:l(r,e);i[t]=o;};case"bracket-separator":return (t,r,i)=>{const n=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!n)return void(i[t]=r?l(r,e):r);const s=null===r?[]:r.split(e.arrayFormatSeparator).map(t=>l(t,e));void 0!==i[t]?i[t]=[].concat(i[t],s):i[t]=s;};default:return (e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t;}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const n of e.split("&")){if(""===n)continue;let[e,o]=s(t.decode?n.replace(/\+/g," "):n,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?o:l(o,t),r(l(e,t),o,i);}for(const e of Object.keys(i)){const r=i[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=f(r[e],t);else i[e]=f(r,t);}return !1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce((e,t)=>{const r=i[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=d,t.parse=p,t.stringify=(e,t)=>{if(!e)return "";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],i=function(e){switch(e.arrayFormat){case"index":return t=>(r,i)=>{const n=r.length;return void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[u(t,e),"[",n,"]"].join("")]:[...r,[u(t,e),"[",u(n,e),"]=",u(i,e)].join("")]};case"bracket":return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[u(t,e),"[]"].join("")]:[...r,[u(t,e),"[]=",u(i,e)].join("")];case"colon-list-separator":return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[u(t,e),":list="].join("")]:[...r,[u(t,e),":list=",u(i,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(i,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?i:(n=null===n?"":n,0===i.length?[[u(r,e),t,u(n,e)].join("")]:[[i,u(n,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,u(t,e)]:[...r,[u(t,e),"=",u(i,e)].join("")]}}(t),n={};for(const t of Object.keys(e))r(t)||(n[t]=e[t]);const s=Object.keys(n);return !1!==t.sort&&s.sort(t.sort),s.map(r=>{const n=e[r];return void 0===n?"":null===n?u(r,t):Array.isArray(n)?0===n.length&&"bracket-separator"===t.arrayFormat?u(r,t)+"[]":n.reduce(i(r),[]).join("&"):u(r,t)+"="+u(n,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,i]=s(e,"#");return Object.assign({url:r.split("?")[0]||"",query:p(d(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:l(i,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0,[c]:!0},r);const i=h(e.url).split("?")[0]||"",n=t.extract(e.url),s=t.parse(n,{sort:!1}),o=Object.assign(s,e.query);let a=t.stringify(o,r);a&&(a="?"+a);let l=function(e){let t="";const r=e.indexOf("#");return -1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(l="#"+(r[c]?u(e.fragmentIdentifier,r):e.fragmentIdentifier)),`${i}${a}${l}`},t.pick=(e,r,i)=>{i=Object.assign({parseFragmentIdentifier:!0,[c]:!1},i);const{url:n,query:s,fragmentIdentifier:a}=t.parseUrl(e,i);return t.stringifyUrl({url:n,query:o(s,r),fragmentIdentifier:a},i)},t.exclude=(e,r,i)=>{const n=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,n,i)};},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")();}catch(e){"object"==typeof window&&(r=window);}e.exports=r;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(109);t.decode=(e,t=0)=>[i.decode(e,t),i.decode.bytes],t.encodeTo=(e,t,r=0)=>(i.encode(e,t,r),t),t.encodingLength=e=>i.encodingLength(e);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);i.__exportStar(r(128),t),i.__exportStar(r(129),t);},function(e,t,r){(function(e){var i=r(6),n=r(13),s=r(2),o=(e,t,r)=>new Promise((i,n)=>{var s=e=>{try{c(r.next(e));}catch(e){n(e);}},o=e=>{try{c(r.throw(e));}catch(e){n(e);}},c=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);c((r=r.apply(e,t)).next());});const c=void 0!==e&&void 0!==e.WebSocket?e.WebSocket:"undefined"!=typeof window&&void 0!==window.WebSocket?window.WebSocket:r(130);t.a=class{constructor(e){if(this.url=e,this.events=new i.EventEmitter,this.registering=!1,!Object(s.isWsUrl)(e))throw new Error("Provided URL is not compatible with WebSocket connection: "+e);this.url=e;}get connected(){return void 0!==this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t);}once(e,t){this.events.once(e,t);}off(e,t){this.events.off(e,t);}removeListener(e,t){this.events.removeListener(e,t);}open(){return o(this,arguments,(function*(e=this.url){yield this.register(e);}))}close(){return o(this,null,(function*(){return new Promise((e,t)=>{void 0!==this.socket?(this.socket.onclose=()=>{this.onClose(),e();},this.socket.close()):t(new Error("Connection already closed"));})}))}send(e,t){return o(this,null,(function*(){void 0===this.socket&&(this.socket=yield this.register());try{this.socket.send(Object(n.b)(e));}catch(t){this.onError(e.id,t);}}))}register(e=this.url){if(!Object(s.isWsUrl)(e))throw new Error("Provided URL is not compatible with WebSocket connection: "+e);if(this.registering){const e=this.events.getMaxListeners();return (this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e);}),this.events.once("open",()=>{if(this.resetMaxListeners(),void 0===this.socket)return t(new Error("WebSocket connection is missing or invalid"));e(this.socket);});})}return this.url=e,this.registering=!0,new Promise((t,r)=>{const i=Object(s.isReactNative)()?void 0:{rejectUnauthorized:!Object(s.isLocalhostUrl)(e)},n=new c(e,[],i);"undefined"!=typeof window?n.onerror=e=>{const t=e;r(this.emitError(t.error));}:n.on("error",e=>{r(this.emitError(e));}),n.onopen=()=>{this.onOpen(n),t(n);};})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=()=>this.onClose(),this.socket=e,this.registering=!1,this.events.emit("open");}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close");}onPayload(e){if(void 0===e.data)return;const t="string"==typeof e.data?Object(n.a)(e.data):e.data;this.events.emit("payload",t);}onError(e,t){const r=this.parseError(t),i=r.message||r.toString(),n=Object(s.formatJsonRpcError)(e,i);this.events.emit("payload",n);}parseError(e,t=this.url){return Object(s.parseConnectionError)(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10);}emitError(e){const t=this.parseError(new Error((null==e?void 0:e.message)||"WebSocket connection failed for URL: "+this.url));return this.events.emit("register_error",t),t}};}).call(this,r(29));},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const i=r(18),n=r(98),s=r(10);function o(e){const t=new Float64Array(16);if(e)for(let r=0;r<e.length;r++)t[r]=e[r];return t}t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;new Uint8Array(32)[0]=9;const c=o(),a=o([1]),u=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(e,t){for(let r=0;r<16;r++)e[r]=0|t[r];}function g(e){let t=1;for(let r=0;r<16;r++){let i=e[r]+t+65535;t=Math.floor(i/65536),e[r]=i-65536*t;}e[0]+=t-1+37*(t-1);}function y(e,t,r){const i=~(r-1);for(let r=0;r<16;r++){const n=i&(e[r]^t[r]);e[r]^=n,t[r]^=n;}}function b(e,t){const r=o(),i=o();for(let e=0;e<16;e++)i[e]=t[e];g(i),g(i),g(i);for(let e=0;e<2;e++){r[0]=i[0]-65517;for(let e=1;e<15;e++)r[e]=i[e]-65535-(r[e-1]>>16&1),r[e-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,y(i,r,1-e);}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8;}function v(e,t){let r=0;for(let i=0;i<32;i++)r|=e[i]^t[i];return (1&r-1>>>8)-1}function m(e,t){const r=new Uint8Array(32),i=new Uint8Array(32);return b(r,e),b(i,t),v(r,i)}function _(e){const t=new Uint8Array(32);return b(t,e),1&t[0]}function w(e,t,r){for(let i=0;i<16;i++)e[i]=t[i]+r[i];}function E(e,t,r){for(let i=0;i<16;i++)e[i]=t[i]-r[i];}function O(e,t,r){let i,n,s=0,o=0,c=0,a=0,u=0,l=0,h=0,d=0,f=0,p=0,g=0,y=0,b=0,v=0,m=0,_=0,w=0,E=0,O=0,S=0,j=0,R=0,I=0,P=0,N=0,T=0,x=0,L=0,A=0,U=0,M=0,C=r[0],D=r[1],z=r[2],k=r[3],K=r[4],V=r[5],q=r[6],H=r[7],J=r[8],B=r[9],F=r[10],W=r[11],G=r[12],Y=r[13],$=r[14],X=r[15];i=t[0],s+=i*C,o+=i*D,c+=i*z,a+=i*k,u+=i*K,l+=i*V,h+=i*q,d+=i*H,f+=i*J,p+=i*B,g+=i*F,y+=i*W,b+=i*G,v+=i*Y,m+=i*$,_+=i*X,i=t[1],o+=i*C,c+=i*D,a+=i*z,u+=i*k,l+=i*K,h+=i*V,d+=i*q,f+=i*H,p+=i*J,g+=i*B,y+=i*F,b+=i*W,v+=i*G,m+=i*Y,_+=i*$,w+=i*X,i=t[2],c+=i*C,a+=i*D,u+=i*z,l+=i*k,h+=i*K,d+=i*V,f+=i*q,p+=i*H,g+=i*J,y+=i*B,b+=i*F,v+=i*W,m+=i*G,_+=i*Y,w+=i*$,E+=i*X,i=t[3],a+=i*C,u+=i*D,l+=i*z,h+=i*k,d+=i*K,f+=i*V,p+=i*q,g+=i*H,y+=i*J,b+=i*B,v+=i*F,m+=i*W,_+=i*G,w+=i*Y,E+=i*$,O+=i*X,i=t[4],u+=i*C,l+=i*D,h+=i*z,d+=i*k,f+=i*K,p+=i*V,g+=i*q,y+=i*H,b+=i*J,v+=i*B,m+=i*F,_+=i*W,w+=i*G,E+=i*Y,O+=i*$,S+=i*X,i=t[5],l+=i*C,h+=i*D,d+=i*z,f+=i*k,p+=i*K,g+=i*V,y+=i*q,b+=i*H,v+=i*J,m+=i*B,_+=i*F,w+=i*W,E+=i*G,O+=i*Y,S+=i*$,j+=i*X,i=t[6],h+=i*C,d+=i*D,f+=i*z,p+=i*k,g+=i*K,y+=i*V,b+=i*q,v+=i*H,m+=i*J,_+=i*B,w+=i*F,E+=i*W,O+=i*G,S+=i*Y,j+=i*$,R+=i*X,i=t[7],d+=i*C,f+=i*D,p+=i*z,g+=i*k,y+=i*K,b+=i*V,v+=i*q,m+=i*H,_+=i*J,w+=i*B,E+=i*F,O+=i*W,S+=i*G,j+=i*Y,R+=i*$,I+=i*X,i=t[8],f+=i*C,p+=i*D,g+=i*z,y+=i*k,b+=i*K,v+=i*V,m+=i*q,_+=i*H,w+=i*J,E+=i*B,O+=i*F,S+=i*W,j+=i*G,R+=i*Y,I+=i*$,P+=i*X,i=t[9],p+=i*C,g+=i*D,y+=i*z,b+=i*k,v+=i*K,m+=i*V,_+=i*q,w+=i*H,E+=i*J,O+=i*B,S+=i*F,j+=i*W,R+=i*G,I+=i*Y,P+=i*$,N+=i*X,i=t[10],g+=i*C,y+=i*D,b+=i*z,v+=i*k,m+=i*K,_+=i*V,w+=i*q,E+=i*H,O+=i*J,S+=i*B,j+=i*F,R+=i*W,I+=i*G,P+=i*Y,N+=i*$,T+=i*X,i=t[11],y+=i*C,b+=i*D,v+=i*z,m+=i*k,_+=i*K,w+=i*V,E+=i*q,O+=i*H,S+=i*J,j+=i*B,R+=i*F,I+=i*W,P+=i*G,N+=i*Y,T+=i*$,x+=i*X,i=t[12],b+=i*C,v+=i*D,m+=i*z,_+=i*k,w+=i*K,E+=i*V,O+=i*q,S+=i*H,j+=i*J,R+=i*B,I+=i*F,P+=i*W,N+=i*G,T+=i*Y,x+=i*$,L+=i*X,i=t[13],v+=i*C,m+=i*D,_+=i*z,w+=i*k,E+=i*K,O+=i*V,S+=i*q,j+=i*H,R+=i*J,I+=i*B,P+=i*F,N+=i*W,T+=i*G,x+=i*Y,L+=i*$,A+=i*X,i=t[14],m+=i*C,_+=i*D,w+=i*z,E+=i*k,O+=i*K,S+=i*V,j+=i*q,R+=i*H,I+=i*J,P+=i*B,N+=i*F,T+=i*W,x+=i*G,L+=i*Y,A+=i*$,U+=i*X,i=t[15],_+=i*C,w+=i*D,E+=i*z,O+=i*k,S+=i*K,j+=i*V,R+=i*q,I+=i*H,P+=i*J,N+=i*B,T+=i*F,x+=i*W,L+=i*G,A+=i*Y,U+=i*$,M+=i*X,s+=38*w,o+=38*E,c+=38*O,a+=38*S,u+=38*j,l+=38*R,h+=38*I,d+=38*P,f+=38*N,p+=38*T,g+=38*x,y+=38*L,b+=38*A,v+=38*U,m+=38*M,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=_+n+65535,n=Math.floor(i/65536),_=i-65536*n,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=_+n+65535,n=Math.floor(i/65536),_=i-65536*n,s+=n-1+37*(n-1),e[0]=s,e[1]=o,e[2]=c,e[3]=a,e[4]=u,e[5]=l,e[6]=h,e[7]=d,e[8]=f,e[9]=p,e[10]=g,e[11]=y,e[12]=b,e[13]=v,e[14]=m,e[15]=_;}function S(e,t){O(e,t,t);}function j(e,t){const r=o();let i;for(i=0;i<16;i++)r[i]=t[i];for(i=253;i>=0;i--)S(r,r),2!==i&&4!==i&&O(r,r,t);for(i=0;i<16;i++)e[i]=r[i];}function R(e,t){const r=o(),i=o(),n=o(),s=o(),c=o(),a=o(),u=o(),h=o(),d=o();E(r,e[1],e[0]),E(d,t[1],t[0]),O(r,r,d),w(i,e[0],e[1]),w(d,t[0],t[1]),O(i,i,d),O(n,e[3],t[3]),O(n,n,l),O(s,e[2],t[2]),w(s,s,s),E(c,i,r),E(a,s,n),w(u,s,n),w(h,i,r),O(e[0],c,a),O(e[1],h,u),O(e[2],u,a),O(e[3],c,h);}function I(e,t,r){for(let i=0;i<4;i++)y(e[i],t[i],r);}function P(e,t){const r=o(),i=o(),n=o();j(n,t[2]),O(r,t[0],n),O(i,t[1],n),b(e,i),e[31]^=_(r)<<7;}function N(e,t,r){p(e[0],c),p(e[1],a),p(e[2],a),p(e[3],c);for(let i=255;i>=0;--i){const n=r[i/8|0]>>(7&i)&1;I(e,t,n),R(t,e),R(e,e),I(e,t,n);}}function T(e,t){const r=[o(),o(),o(),o()];p(r[0],h),p(r[1],d),p(r[2],a),O(r[3],h,d),N(e,r,t);}function x(e){if(e.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const r=(0, n.hash)(e);r[0]&=248,r[31]&=127,r[31]|=64;const i=new Uint8Array(32),s=[o(),o(),o(),o()];T(s,r),P(i,s);const c=new Uint8Array(64);return c.set(e),c.set(i,32),{publicKey:i,secretKey:c}}t.generateKeyPairFromSeed=x,t.generateKeyPair=function(e){const t=(0, i.randomBytes)(32,e),r=x(t);return (0, s.wipe)(t),r},t.extractPublicKeyFromSecretKey=function(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(e.subarray(32))};const L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function A(e,t){let r,i,n,s;for(i=63;i>=32;--i){for(r=0,n=i-32,s=i-12;n<s;++n)t[n]+=r-16*t[i]*L[n-(i-32)],r=Math.floor((t[n]+128)/256),t[n]-=256*r;t[n]+=r,t[i]=0;}for(r=0,n=0;n<32;n++)t[n]+=r-(t[31]>>4)*L[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*L[n];for(i=0;i<32;i++)t[i+1]+=t[i]>>8,e[i]=255&t[i];}function U(e){const t=new Float64Array(64);for(let r=0;r<64;r++)t[r]=e[r];for(let t=0;t<64;t++)e[t]=0;A(e,t);}function M(e,t){const r=o(),i=o(),n=o(),s=o(),l=o(),h=o(),d=o();return p(e[2],a),function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767;}(e[1],t),S(n,e[1]),O(s,n,u),E(n,n,e[2]),w(s,e[2],s),S(l,s),S(h,l),O(d,h,l),O(r,d,n),O(r,r,s),function(e,t){const r=o();let i;for(i=0;i<16;i++)r[i]=t[i];for(i=250;i>=0;i--)S(r,r),1!==i&&O(r,r,t);for(i=0;i<16;i++)e[i]=r[i];}(r,r),O(r,r,n),O(r,r,s),O(r,r,s),O(e[0],r,s),S(i,e[0]),O(i,i,s),m(i,n)&&O(e[0],e[0],f),S(i,e[0]),O(i,i,s),m(i,n)?-1:(_(e[0])===t[31]>>7&&E(e[0],c,e[0]),O(e[3],e[0],e[1]),0)}t.sign=function(e,t){const r=new Float64Array(64),i=[o(),o(),o(),o()],s=(0, n.hash)(e.subarray(0,32));s[0]&=248,s[31]&=127,s[31]|=64;const c=new Uint8Array(64);c.set(s.subarray(32),32);const a=new n.SHA512;a.update(c.subarray(32)),a.update(t);const u=a.digest();a.clean(),U(u),T(i,u),P(c,i),a.reset(),a.update(c.subarray(0,32)),a.update(e.subarray(32)),a.update(t);const l=a.digest();U(l);for(let e=0;e<32;e++)r[e]=u[e];for(let e=0;e<32;e++)for(let t=0;t<32;t++)r[e+t]+=l[e]*s[t];return A(c.subarray(32),r),c},t.verify=function(e,r,i){const s=new Uint8Array(32),c=[o(),o(),o(),o()],a=[o(),o(),o(),o()];if(i.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(M(a,e))return !1;const u=new n.SHA512;u.update(i.subarray(0,32)),u.update(e),u.update(r);const l=u.digest();return U(l),N(c,a,l),T(a,i.subarray(32)),R(c,a),P(s,c),!v(i,s)},t.convertPublicKeyToX25519=function(e){let t=[o(),o(),o(),o()];if(M(t,e))throw new Error("Ed25519: invalid public key");let r=o(),i=o(),n=t[1];w(r,a,n),E(i,a,n),j(i,i),O(r,r,i);let s=new Uint8Array(32);return b(s,r),s},t.convertSecretKeyToX25519=function(e){const t=(0, n.hash)(e.subarray(0,32));t[0]&=248,t[31]&=127,t[31]|=64;const r=new Uint8Array(t.subarray(0,32));return (0, s.wipe)(t),r};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(23),n=r(10);t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var s=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,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(){n.wipe(this._buffer),n.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._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(c(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0);}for(t>=this.blockSize&&(r=c(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,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[r]=128;for(var a=r+1;a<o-8;a++)this._buffer[a]=0;i.writeUint32BE(n,this._buffer,o-8),i.writeUint32BE(s,this._buffer,o-4),c(this._temp,this._state,this._buffer,0,o),this._finished=!0;}for(a=0;a<this.digestLength/4;a++)i.writeUint32BE(this._state[a],e,4*a);return this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return {state:new Int32Array(this._state),buffer:this._bufferLength>0?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){n.wipe(e.state),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0;},e}();t.SHA256=s;var o=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 c(e,t,r,n,s){for(;s>=64;){for(var c=t[0],a=t[1],u=t[2],l=t[3],h=t[4],d=t[5],f=t[6],p=t[7],g=0;g<16;g++){var y=n+4*g;e[g]=i.readUint32BE(r,y);}for(g=16;g<64;g++){var b=e[g-2],v=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,m=((b=e[g-15])>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;e[g]=(v+e[g-7]|0)+(m+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+(o[g]+e[g]|0)|0)|0,m=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&a^c&u^a&u)|0;p=f,f=d,d=h,h=l+v|0,l=u,u=a,a=c,c=v+m|0;}t[0]+=c,t[1]+=a,t[2]+=u,t[3]+=l,t[4]+=h,t[5]+=d,t[6]+=f,t[7]+=p,n+=64,s-=64;}return n}t.hash=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.asUint8Array=function(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(24);class n{constructor(e,t,r){this.name=e,this.code=t,this.encode=r;}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?i.create(this.code,t):t.then(e=>i.create(this.code,e))}throw Error("Unknown type, must be binary type")}}t.Hasher=n,t.from=({name:e,code:t,encode:r})=>new n(e,t,r);},function(e,t){var r,i,n=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s;}catch(e){r=s;}try{i="function"==typeof clearTimeout?clearTimeout:o;}catch(e){i=o;}}();var a,u=[],l=!1,h=-1;function d(){l&&a&&(l=!1,a.length?u=a.concat(u):h=-1,u.length&&f());}function f(){if(!l){var e=c(d);l=!0;for(var t=u.length;t;){for(a=u,u=[];++h<t;)a&&a[h].run();h=-1,t=u.length;}a=null,l=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e);}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e);}}function p(e,t){this.fun=e,this.array=t;}function g(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new p(e,t)),1!==u.length||l||c(f);},p.prototype.run=function(){this.fun.apply(null,this.array);},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return []},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return "/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};},function(e,t,r){function i(e,t){if(e.length!==t.length)return 0;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 1&r-1>>>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=i,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==i(e,t)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.alloc=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.alloc?globalThis.Buffer.alloc(e):new Uint8Array(e)},t.allocUnsafe=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(114),n=r(115),s=r(10),o=r(23),c=r(38);t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var a=new Uint8Array(16),u=function(){function e(e){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,e.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e);}return e.prototype.seal=function(e,t,r,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var o=new Uint8Array(16);o.set(e,o.length-e.length);var c=new Uint8Array(32);i.stream(this._key,o,c,4);var a,u=t.length+this.tagLength;if(n){if(n.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");a=n;}else a=new Uint8Array(u);return i.streamXOR(this._key,o,t,a,4),this._authenticate(a.subarray(a.length-this.tagLength,a.length),c,a.subarray(0,a.length-this.tagLength),r),s.wipe(o),a},e.prototype.open=function(e,t,r,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);i.stream(this._key,o,a,4);var u=new Uint8Array(this.tagLength);if(this._authenticate(u,a,t.subarray(0,t.length-this.tagLength),r),!c.equal(u,t.subarray(t.length-this.tagLength,t.length)))return null;var l,h=t.length-this.tagLength;if(n){if(n.length!==h)throw new Error("ChaCha20Poly1305: incorrect destination length");l=n;}else l=new Uint8Array(h);return i.streamXOR(this._key,o,t.subarray(0,t.length-this.tagLength),l,4),s.wipe(o),l},e.prototype.clean=function(){return s.wipe(this._key),this},e.prototype._authenticate=function(e,t,r,i){var c=new n.Poly1305(t);i&&(c.update(i),i.length%16>0&&c.update(a.subarray(i.length%16))),c.update(r),r.length%16>0&&c.update(a.subarray(r.length%16));var u=new Uint8Array(8);i&&o.writeUint64LE(i.length,u),c.update(u),o.writeUint64LE(r.length,u),c.update(u);for(var l=c.digest(),h=0;h<l.length;h++)e[h]=l[h];c.clean(),s.wipe(l),s.wipe(u);},e}();t.ChaCha20Poly1305=u;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const i=r(18),n=r(10);function s(e){const t=new Float64Array(16);if(e)for(let r=0;r<e.length;r++)t[r]=e[r];return t}t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;const o=new Uint8Array(32);o[0]=9;const c=s([56129,1]);function a(e){let t=1;for(let r=0;r<16;r++){let i=e[r]+t+65535;t=Math.floor(i/65536),e[r]=i-65536*t;}e[0]+=t-1+37*(t-1);}function u(e,t,r){const i=~(r-1);for(let r=0;r<16;r++){const n=i&(e[r]^t[r]);e[r]^=n,t[r]^=n;}}function l(e,t,r){for(let i=0;i<16;i++)e[i]=t[i]+r[i];}function h(e,t,r){for(let i=0;i<16;i++)e[i]=t[i]-r[i];}function d(e,t,r){let i,n,s=0,o=0,c=0,a=0,u=0,l=0,h=0,d=0,f=0,p=0,g=0,y=0,b=0,v=0,m=0,_=0,w=0,E=0,O=0,S=0,j=0,R=0,I=0,P=0,N=0,T=0,x=0,L=0,A=0,U=0,M=0,C=r[0],D=r[1],z=r[2],k=r[3],K=r[4],V=r[5],q=r[6],H=r[7],J=r[8],B=r[9],F=r[10],W=r[11],G=r[12],Y=r[13],$=r[14],X=r[15];i=t[0],s+=i*C,o+=i*D,c+=i*z,a+=i*k,u+=i*K,l+=i*V,h+=i*q,d+=i*H,f+=i*J,p+=i*B,g+=i*F,y+=i*W,b+=i*G,v+=i*Y,m+=i*$,_+=i*X,i=t[1],o+=i*C,c+=i*D,a+=i*z,u+=i*k,l+=i*K,h+=i*V,d+=i*q,f+=i*H,p+=i*J,g+=i*B,y+=i*F,b+=i*W,v+=i*G,m+=i*Y,_+=i*$,w+=i*X,i=t[2],c+=i*C,a+=i*D,u+=i*z,l+=i*k,h+=i*K,d+=i*V,f+=i*q,p+=i*H,g+=i*J,y+=i*B,b+=i*F,v+=i*W,m+=i*G,_+=i*Y,w+=i*$,E+=i*X,i=t[3],a+=i*C,u+=i*D,l+=i*z,h+=i*k,d+=i*K,f+=i*V,p+=i*q,g+=i*H,y+=i*J,b+=i*B,v+=i*F,m+=i*W,_+=i*G,w+=i*Y,E+=i*$,O+=i*X,i=t[4],u+=i*C,l+=i*D,h+=i*z,d+=i*k,f+=i*K,p+=i*V,g+=i*q,y+=i*H,b+=i*J,v+=i*B,m+=i*F,_+=i*W,w+=i*G,E+=i*Y,O+=i*$,S+=i*X,i=t[5],l+=i*C,h+=i*D,d+=i*z,f+=i*k,p+=i*K,g+=i*V,y+=i*q,b+=i*H,v+=i*J,m+=i*B,_+=i*F,w+=i*W,E+=i*G,O+=i*Y,S+=i*$,j+=i*X,i=t[6],h+=i*C,d+=i*D,f+=i*z,p+=i*k,g+=i*K,y+=i*V,b+=i*q,v+=i*H,m+=i*J,_+=i*B,w+=i*F,E+=i*W,O+=i*G,S+=i*Y,j+=i*$,R+=i*X,i=t[7],d+=i*C,f+=i*D,p+=i*z,g+=i*k,y+=i*K,b+=i*V,v+=i*q,m+=i*H,_+=i*J,w+=i*B,E+=i*F,O+=i*W,S+=i*G,j+=i*Y,R+=i*$,I+=i*X,i=t[8],f+=i*C,p+=i*D,g+=i*z,y+=i*k,b+=i*K,v+=i*V,m+=i*q,_+=i*H,w+=i*J,E+=i*B,O+=i*F,S+=i*W,j+=i*G,R+=i*Y,I+=i*$,P+=i*X,i=t[9],p+=i*C,g+=i*D,y+=i*z,b+=i*k,v+=i*K,m+=i*V,_+=i*q,w+=i*H,E+=i*J,O+=i*B,S+=i*F,j+=i*W,R+=i*G,I+=i*Y,P+=i*$,N+=i*X,i=t[10],g+=i*C,y+=i*D,b+=i*z,v+=i*k,m+=i*K,_+=i*V,w+=i*q,E+=i*H,O+=i*J,S+=i*B,j+=i*F,R+=i*W,I+=i*G,P+=i*Y,N+=i*$,T+=i*X,i=t[11],y+=i*C,b+=i*D,v+=i*z,m+=i*k,_+=i*K,w+=i*V,E+=i*q,O+=i*H,S+=i*J,j+=i*B,R+=i*F,I+=i*W,P+=i*G,N+=i*Y,T+=i*$,x+=i*X,i=t[12],b+=i*C,v+=i*D,m+=i*z,_+=i*k,w+=i*K,E+=i*V,O+=i*q,S+=i*H,j+=i*J,R+=i*B,I+=i*F,P+=i*W,N+=i*G,T+=i*Y,x+=i*$,L+=i*X,i=t[13],v+=i*C,m+=i*D,_+=i*z,w+=i*k,E+=i*K,O+=i*V,S+=i*q,j+=i*H,R+=i*J,I+=i*B,P+=i*F,N+=i*W,T+=i*G,x+=i*Y,L+=i*$,A+=i*X,i=t[14],m+=i*C,_+=i*D,w+=i*z,E+=i*k,O+=i*K,S+=i*V,j+=i*q,R+=i*H,I+=i*J,P+=i*B,N+=i*F,T+=i*W,x+=i*G,L+=i*Y,A+=i*$,U+=i*X,i=t[15],_+=i*C,w+=i*D,E+=i*z,O+=i*k,S+=i*K,j+=i*V,R+=i*q,I+=i*H,P+=i*J,N+=i*B,T+=i*F,x+=i*W,L+=i*G,A+=i*Y,U+=i*$,M+=i*X,s+=38*w,o+=38*E,c+=38*O,a+=38*S,u+=38*j,l+=38*R,h+=38*I,d+=38*P,f+=38*N,p+=38*T,g+=38*x,y+=38*L,b+=38*A,v+=38*U,m+=38*M,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=_+n+65535,n=Math.floor(i/65536),_=i-65536*n,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=_+n+65535,n=Math.floor(i/65536),_=i-65536*n,s+=n-1+37*(n-1),e[0]=s,e[1]=o,e[2]=c,e[3]=a,e[4]=u,e[5]=l,e[6]=h,e[7]=d,e[8]=f,e[9]=p,e[10]=g,e[11]=y,e[12]=b,e[13]=v,e[14]=m,e[15]=_;}function f(e,t){d(e,t,t);}function p(e,t){const r=new Uint8Array(32),i=new Float64Array(80),n=s(),o=s(),p=s(),g=s(),y=s(),b=s();for(let t=0;t<31;t++)r[t]=e[t];r[31]=127&e[31]|64,r[0]&=248,function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767;}(i,t);for(let e=0;e<16;e++)o[e]=i[e];n[0]=g[0]=1;for(let e=254;e>=0;--e){const t=r[e>>>3]>>>(7&e)&1;u(n,o,t),u(p,g,t),l(y,n,p),h(n,n,p),l(p,o,g),h(o,o,g),f(g,y),f(b,n),d(n,p,n),d(p,o,y),l(y,n,p),h(n,n,p),f(o,n),h(p,g,b),d(n,p,c),l(n,n,g),d(p,p,n),d(n,g,b),d(g,o,i),f(o,y),u(n,o,t),u(p,g,t);}for(let e=0;e<16;e++)i[e+16]=n[e],i[e+32]=p[e],i[e+48]=o[e],i[e+64]=g[e];const v=i.subarray(32),m=i.subarray(16);!function(e,t){const r=s();for(let e=0;e<16;e++)r[e]=t[e];for(let e=253;e>=0;e--)f(r,r),2!==e&&4!==e&&d(r,r,t);for(let t=0;t<16;t++)e[t]=r[t];}(v,v),d(m,m,v);const _=new Uint8Array(32);return function(e,t){const r=s(),i=s();for(let e=0;e<16;e++)i[e]=t[e];a(i),a(i),a(i);for(let e=0;e<2;e++){r[0]=i[0]-65517;for(let e=1;e<15;e++)r[e]=i[e]-65535-(r[e-1]>>16&1),r[e-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,u(i,r,1-e);}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8;}(_,m),_}function g(e){return p(e,o)}function y(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const r=new Uint8Array(e);return {publicKey:g(r),secretKey:r}}t.scalarMult=p,t.scalarMultBase=g,t.generateKeyPairFromSeed=y,t.generateKeyPair=function(e){const t=(0, i.randomBytes)(32,e),r=y(t);return (0, n.wipe)(t),r},t.sharedKey=function(e,r,i=!1){if(e.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const n=p(e,r);if(i){let e=0;for(let t=0;t<n.length;t++)e|=n[t];if(0===e)throw new Error("X25519: invalid shared key")}return n};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.safeJsonParse=function(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}},t.safeJsonStringify=function(e){return "string"==typeof e?e:JSON.stringify(e,(e,t)=>void 0===t?null:t)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);i.__exportStar(r(85),t),i.__exportStar(r(86),t);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});r(9).__exportStar(r(90),t);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});r(9).__exportStar(r(91),t);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.PINO_CUSTOM_CONTEXT_KEY=t.PINO_LOGGER_DEFAULTS=void 0,t.PINO_LOGGER_DEFAULTS={level:"info"},t.PINO_CUSTOM_CONTEXT_KEY="custom_context";},function(e,t,r){r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return l}));var i=r(33),n=r(18),s=r(1),o=r(3),c=r(15),a=(e,t,r)=>new Promise((i,n)=>{var s=e=>{try{c(r.next(e));}catch(e){n(e);}},o=e=>{try{c(r.throw(e));}catch(e){n(e);}},c=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);c((r=r.apply(e,t)).next());});function u(e=Object(n.randomBytes)(o.j)){return i.generateKeyPairFromSeed(e)}function l(e,t,r,n){return a(this,arguments,(function*(e,t,r,n,a=Object(s.fromMiliseconds)(Date.now())){const u={alg:o.h,typ:o.i},l={iss:Object(c.d)(n.publicKey),sub:e,aud:t,iat:a,exp:a+r},h=Object(c.c)({header:u,payload:l}),d=i.sign(n.secretKey,h);return Object(c.e)({header:u,payload:l,signature:d})}))}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(35);t.alloc=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.alloc?i.asUint8Array(globalThis.Buffer.alloc(e)):new Uint8Array(e)},t.allocUnsafe=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?i.asUint8Array(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)};},function(e,t,r){var i=Object.defineProperty,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,c=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,a=r(50),u=r(48);function l(e,t,r,i){return {name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}const h=l("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>(new TextEncoder).encode(e.substring(1))),d=l("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);const t=u.allocUnsafe(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),f=((e,t)=>{for(var r in t||(t={}))s.call(t,r)&&c(e,r,t[r]);if(n)for(var r of n(t))o.call(t,r)&&c(e,r,t[r]);return e})({utf8:h,"utf-8":h,hex:a.bases.base16,latin1:d,ascii:d,binary:d},a.bases);e.exports=f;},function(e,t,r){var i=Object.defineProperty,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,c=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,a=(e,t)=>{for(var r in t||(t={}))s.call(t,r)&&c(e,r,t[r]);if(n)for(var r of n(t))o.call(t,r)&&c(e,r,t[r]);return e};Object.defineProperty(t,"__esModule",{value:!0});var u=r(99),l=r(101),h=r(102),d=r(103),f=r(104),p=r(51),g=r(105),y=r(52),b=r(106),v=r(107),m=r(108),_=r(110),w=r(111),E=r(112);r(113);var O=r(53),S=r(36),j=r(24),R=r(30),I=r(14);const P=a(a(a(a(a(a(a(a(a(a({},u),l),h),d),f),p),g),y),b),v),N=a(a({},m),_),T={raw:w,json:E};t.CID=O.CID,t.hasher=S,t.digest=j,t.varint=R,t.bytes=I,t.bases=P,t.codecs=T,t.hashes=N;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);const n=i.rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s=i.rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o=i.rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),c=i.rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),a=i.rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),u=i.rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l=i.rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),h=i.rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),d=i.rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});t.base32=n,t.base32hex=a,t.base32hexpad=l,t.base32hexpadupper=h,t.base32hexupper=u,t.base32pad=o,t.base32padupper=c,t.base32upper=s,t.base32z=d;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);const n=i.baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),s=i.baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});t.base58btc=n,t.base58flickr=s;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(30),n=r(24),s=r(52),o=r(51),c=r(14);class a{constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:b,byteLength:b,code:y,version:y,multihash:y,bytes:y,_baseCache:b,asCID:b});}toV0(){switch(this.version){case 0:return this;default:{const{code:e,multihash:t}=this;if(e!==d)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==f)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return a.createV0(t)}}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=n.create(e,t);return a.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&n.equals(this.multihash,e.multihash)}toString(e){const{bytes:t,version:r,_baseCache:i}=this;switch(r){case 0:return l(t,i,e||s.base58btc.encoder);default:return h(t,i,e||o.base32.encoder)}}toJSON(){return {code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return "CID"}[Symbol.for("nodejs.util.inspect.custom")](){return "CID("+this.toString()+")"}static isCID(e){return v(/^0\.0/,m),!(!e||!e[g]&&e.asCID!==e)}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof a)return e;if(null!=e&&e.asCID===e){const{version:t,code:r,multihash:i,bytes:n}=e;return new a(t,r,i,n||p(t,r,i.bytes))}if(null!=e&&!0===e[g]){const{version:t,multihash:r,code:i}=e,s=n.decode(r);return a.create(t,i,s)}return null}static create(e,t,r){if("number"!=typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==d)throw new Error(`Version 0 CID must use dag-pb (code: ${d}) block encoding`);return new a(e,t,r,r.bytes);case 1:{const i=p(e,t,r.bytes);return new a(e,t,r,i)}default:throw new Error("Invalid version")}}static createV0(e){return a.create(0,d,e)}static createV1(e,t){return a.create(1,e,t)}static decode(e){const[t,r]=a.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=a.inspectBytes(e),r=t.size-t.multihashSize,i=c.coerce(e.subarray(r,r+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");const s=i.subarray(t.multihashSize-t.digestSize),o=new n.Digest(t.multihashCode,t.digestSize,s,i);return [0===t.version?a.createV0(o):a.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=i.decode(e.subarray(t));return t+=n,r};let n=r(),s=d;if(18===n?(n=0,t=0):1===n&&(s=r()),0!==n&&1!==n)throw new RangeError("Invalid CID version "+n);const o=t,c=r(),a=r(),u=t+a;return {version:n,codec:s,multihashCode:c,digestSize:a,multihashSize:u-o,size:u}}static parse(e,t){const[r,i]=u(e,t),n=a.decode(i);return n._baseCache.set(r,e),n}}const u=(e,t)=>{switch(e[0]){case"Q":{const r=t||s.base58btc;return [s.base58btc.prefix,r.decode(`${s.base58btc.prefix}${e}`)]}case s.base58btc.prefix:{const r=t||s.base58btc;return [s.base58btc.prefix,r.decode(e)]}case o.base32.prefix:{const r=t||o.base32;return [o.base32.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return [e[0],t.decode(e)]}},l=(e,t,r)=>{const{prefix:i}=r;if(i!==s.base58btc.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const n=t.get(i);if(null==n){const n=r.encode(e).slice(1);return t.set(i,n),n}return n},h=(e,t,r)=>{const{prefix:i}=r,n=t.get(i);if(null==n){const n=r.encode(e);return t.set(i,n),n}return n},d=112,f=18,p=(e,t,r)=>{const n=i.encodingLength(e),s=n+i.encodingLength(t),o=new Uint8Array(s+r.byteLength);return i.encodeTo(e,o,0),i.encodeTo(t,o,n),o.set(r,s),o},g=Symbol.for("@ipld/js-cid/CID"),y={writable:!1,configurable:!1,enumerable:!0},b={writable:!1,enumerable:!1,configurable:!1},v=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t);},m="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n";t.CID=a;},function(e,t){},function(e,t,r){var i=Object.defineProperty,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,c=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,a=r(50),u=r(39);function l(e,t,r,i){return {name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}const h=l("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>(new TextEncoder).encode(e.substring(1))),d=l("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);const t=u.allocUnsafe(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),f=((e,t)=>{for(var r in t||(t={}))s.call(t,r)&&c(e,r,t[r]);if(n)for(var r of n(t))o.call(t,r)&&c(e,r,t[r]);return e})({utf8:h,"utf-8":h,hex:a.bases.base16,latin1:d,ascii:d,binary:d},a.bases);e.exports=f;},function(e,t){},function(e,t,r){r(8),r(11);},function(e,t,r){r.d(t,"a",(function(){return i}));const i={waku:{publish:"waku_publish",subscribe:"waku_subscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe"},irn:{publish:"irn_publish",subscribe:"irn_subscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe"},iridium:{publish:"iridium_publish",subscribe:"iridium_subscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe"}};},function(e,t,r){var i=r(31);r.o(i,"IJsonRpcProvider")&&r.d(t,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),r.o(i,"formatJsonRpcError")&&r.d(t,"formatJsonRpcError",(function(){return i.formatJsonRpcError})),r.o(i,"formatJsonRpcRequest")&&r.d(t,"formatJsonRpcRequest",(function(){return i.formatJsonRpcRequest})),r.o(i,"formatJsonRpcResult")&&r.d(t,"formatJsonRpcResult",(function(){return i.formatJsonRpcResult})),r.o(i,"isJsonRpcError")&&r.d(t,"isJsonRpcError",(function(){return i.isJsonRpcError})),r.o(i,"isJsonRpcRequest")&&r.d(t,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),r.o(i,"isJsonRpcResponse")&&r.d(t,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),r.o(i,"isJsonRpcResult")&&r.d(t,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),r.o(i,"isLocalhostUrl")&&r.d(t,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),r.o(i,"isReactNative")&&r.d(t,"isReactNative",(function(){return i.isReactNative})),r.o(i,"isWsUrl")&&r.d(t,"isWsUrl",(function(){return i.isWsUrl}));i.isNode;},function(e,t,r){r.d(t,"b",(function(){return s})),r.d(t,"c",(function(){return o})),r.d(t,"a",(function(){return c}));var i=r(19),n=r(7);function s(e,t,r){return {id:r||Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3)),jsonrpc:"2.0",method:e,params:t}}function o(e,t){return {id:e,jsonrpc:"2.0",result:t}}function c(e,t,r){return {id:e,jsonrpc:"2.0",error:a(t,r)}}function a(e,t){return void 0===e?Object(i.a)(n.b):("string"==typeof e&&(e=Object.assign(Object.assign({},Object(i.a)(n.d)),{message:e})),void 0!==t&&(e.data=t),Object(i.c)(e.code)&&(e=Object(i.b)(e.code)),e)}},function(e,t,r){},function(e,t,r){var i=r(63);r.o(i,"IJsonRpcProvider")&&r.d(t,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),r.o(i,"isJsonRpcError")&&r.d(t,"isJsonRpcError",(function(){return i.isJsonRpcError})),r.o(i,"isJsonRpcRequest")&&r.d(t,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),r.o(i,"isJsonRpcResponse")&&r.d(t,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),r.o(i,"isJsonRpcResult")&&r.d(t,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),r.o(i,"isLocalhostUrl")&&r.d(t,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),r.o(i,"isReactNative")&&r.d(t,"isReactNative",(function(){return i.isReactNative})),r.o(i,"isWsUrl")&&r.d(t,"isWsUrl",(function(){return i.isWsUrl}));},function(e,t,r){var i=r(64);r.o(i,"IJsonRpcProvider")&&r.d(t,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),r.o(i,"isJsonRpcError")&&r.d(t,"isJsonRpcError",(function(){return i.isJsonRpcError})),r.o(i,"isJsonRpcRequest")&&r.d(t,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),r.o(i,"isJsonRpcResponse")&&r.d(t,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),r.o(i,"isJsonRpcResult")&&r.d(t,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),r.o(i,"isLocalhostUrl")&&r.d(t,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),r.o(i,"isReactNative")&&r.d(t,"isReactNative",(function(){return i.isReactNative})),r.o(i,"isWsUrl")&&r.d(t,"isWsUrl",(function(){return i.isWsUrl}));r(25);var n=r(65);r.d(t,"IJsonRpcProvider",(function(){return n.a}));var s=r(66);r.o(s,"isJsonRpcError")&&r.d(t,"isJsonRpcError",(function(){return s.isJsonRpcError})),r.o(s,"isJsonRpcRequest")&&r.d(t,"isJsonRpcRequest",(function(){return s.isJsonRpcRequest})),r.o(s,"isJsonRpcResponse")&&r.d(t,"isJsonRpcResponse",(function(){return s.isJsonRpcResponse})),r.o(s,"isJsonRpcResult")&&r.d(t,"isJsonRpcResult",(function(){return s.isJsonRpcResult})),r.o(s,"isLocalhostUrl")&&r.d(t,"isLocalhostUrl",(function(){return s.isLocalhostUrl})),r.o(s,"isReactNative")&&r.d(t,"isReactNative",(function(){return s.isReactNative})),r.o(s,"isWsUrl")&&r.d(t,"isWsUrl",(function(){return s.isWsUrl}));},function(e,t){},function(e,t,r){r.d(t,"a",(function(){return s}));var i=r(25);i.a;class n extends i.a{constructor(){super();}}class s extends n{constructor(e){super();}}},function(e,t){},function(e,t,r){r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return s}));function i(e,t){const r=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}function n(e){return i(e,"^wss?:")}function s(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}},function(e,t,r){function i(e){return "object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function n(e){return i(e)&&"method"in e}function s(e){return i(e)&&(o(e)||c(e))}function o(e){return "result"in e}function c(e){return "error"in e}r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return o})),r.d(t,"a",(function(){return c}));},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.KeyValueStorage=void 0;const i=r(9),n=r(42),s=i.__importDefault(r(77)),o=r(78);class c{constructor(){this.localStorage=s.default;}getKeys(){return i.__awaiter(this,void 0,void 0,(function*(){return Object.keys(this.localStorage)}))}getEntries(){return i.__awaiter(this,void 0,void 0,(function*(){return Object.entries(this.localStorage).map(o.parseEntry)}))}getItem(e){return i.__awaiter(this,void 0,void 0,(function*(){const t=this.localStorage.getItem(e);if(null!==t)return n.safeJsonParse(t)}))}setItem(e,t){return i.__awaiter(this,void 0,void 0,(function*(){this.localStorage.setItem(e,n.safeJsonStringify(t));}))}removeItem(e){return i.__awaiter(this,void 0,void 0,(function*(){this.localStorage.removeItem(e);}))}}t.KeyValueStorage=c,t.default=c;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(48),n=r(35);t.concat=function(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));const r=i.allocUnsafe(t);let s=0;for(const t of e)r.set(t,s),s+=t.length;return n.asUint8Array(r)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(116),n=r(10),s=function(){function e(e,t,r,n){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=i.hmac(this._hash,r,t);this._hmac=new i.HMAC(e,s),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<t.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[r]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),n.wipe(this._buffer),n.wipe(this._counter),this._bufpos=0;},e}();t.HKDF=s;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getWindowMetadata=void 0;const i=r(20);t.getWindowMetadata=function(){let e,t;try{e=i.getDocumentOrThrow(),t=i.getLocationOrThrow();}catch(e){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const i=r[e],n=["itemprop","property","name"].map(e=>i.getAttribute(e)).filter(e=>!!e&&t.includes(e));if(n.length&&n){const e=i.getAttribute("content");if(e)return e}}return ""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return {description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),i=[];for(let e=0;e<r.length;e++){const n=r[e],s=n.getAttribute("rel");if(s&&s.toLowerCase().indexOf("icon")>-1){const e=n.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else {const i=t.pathname.split("/");i.pop();r+=i.join("/")+"/"+e;}i.push(r);}else if(0===e.indexOf("//")){const r=t.protocol+e;i.push(r);}else i.push(e);}}return i}(),name:n}};},function(e,t,r){var i=r(56);r.o(i,"RELAY_JSONRPC")&&r.d(t,"RELAY_JSONRPC",(function(){return i.RELAY_JSONRPC}));r(57);var n=r(58);r.d(t,"RELAY_JSONRPC",(function(){return n.a}));r(11);},function(e,t,r){(function(e){r.d(t,"a",(function(){return d}));var i=function(e,t,r){if(r||2===arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},n=function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser";},s=function(t){this.version=t,this.type="node",this.name="node",this.os=e.platform;},o=function(e,t,r,i){this.name=e,this.version=t,this.os=r,this.bot=i,this.type="bot-device";},c=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null;},a=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null;},u=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,l=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],h=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function d(t){return t?p(t):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new a:"undefined"!=typeof navigator?p(navigator.userAgent):void 0!==e&&e.version?new s(e.version.slice(1)):null}function f(e){return ""!==e&&l.reduce((function(t,r){var i=r[0],n=r[1];if(t)return t;var s=n.exec(e);return !!s&&[i,s]}),!1)}function p(e){var t=f(e);if(!t)return null;var r=t[0],s=t[1];if("searchbot"===r)return new c;var a=s[1]&&s[1].split(".").join("_").split("_").slice(0,3);a?a.length<3&&(a=i(i([],a,!0),function(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}(3-a.length),!0)):a=[];var l=a.join("."),d=function(e){for(var t=0,r=h.length;t<r;t++){var i=h[t],n=i[0];if(i[1].exec(e))return n}return null}(e),p=u.exec(e);return p&&p[1]?new o(r,l,d,p[1]):new n(r,l,d)}}).call(this,r(37));},function(e,t,r){(function(e,r){var i="[object Arguments]",n="[object Map]",s="[object Object]",o="[object Set]",c=/^\[object .+?Constructor\]$/,a=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[i]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u[n]=u["[object Number]"]=u[s]=u["[object RegExp]"]=u[o]=u["[object String]"]=u["[object WeakMap]"]=!1;var l="object"==typeof e&&e&&e.Object===Object&&e,h="object"==typeof self&&self&&self.Object===Object&&self,d=l||h||Function("return this")(),f=t&&!t.nodeType&&t,p=f&&"object"==typeof r&&r&&!r.nodeType&&r,g=p&&p.exports===f,y=g&&l.process,b=function(){try{return y&&y.binding&&y.binding("util")}catch(e){}}(),v=b&&b.isTypedArray;function m(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return !0;return !1}function _(e){var t=-1,r=Array(e.size);return e.forEach((function(e,i){r[++t]=[i,e];})),r}function w(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e;})),r}var E,O,S,j=Array.prototype,R=Function.prototype,I=Object.prototype,P=d["__core-js_shared__"],N=R.toString,T=I.hasOwnProperty,x=(E=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",L=I.toString,A=RegExp("^"+N.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=g?d.Buffer:void 0,M=d.Symbol,C=d.Uint8Array,D=I.propertyIsEnumerable,z=j.splice,k=M?M.toStringTag:void 0,K=Object.getOwnPropertySymbols,V=U?U.isBuffer:void 0,q=(O=Object.keys,S=Object,function(e){return O(S(e))}),H=be(d,"DataView"),J=be(d,"Map"),B=be(d,"Promise"),F=be(d,"Set"),W=be(d,"WeakMap"),G=be(Object,"create"),Y=we(H),$=we(J),X=we(B),Z=we(F),Q=we(W),ee=M?M.prototype:void 0,te=ee?ee.valueOf:void 0;function re(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1]);}}function ie(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1]);}}function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1]);}}function se(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new ne;++t<r;)this.add(e[t]);}function oe(e){var t=this.__data__=new ie(e);this.size=t.size;}function ce(e,t){var r=Se(e),i=!r&&Oe(e),n=!r&&!i&&je(e),s=!r&&!i&&!n&&Te(e),o=r||i||n||s,c=o?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],a=c.length;for(var u in e)!t&&!T.call(e,u)||o&&("length"==u||n&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||_e(u,a))||c.push(u);return c}function ae(e,t){for(var r=e.length;r--;)if(Ee(e[r][0],t))return r;return -1}function ue(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":k&&k in Object(e)?function(e){var t=T.call(e,k),r=e[k];try{e[k]=void 0;var i=!0;}catch(e){}var n=L.call(e);i&&(t?e[k]=r:delete e[k]);return n}(e):function(e){return L.call(e)}(e)}function le(e){return Ne(e)&&ue(e)==i}function he(e,t,r,c,a){return e===t||(null==e||null==t||!Ne(e)&&!Ne(t)?e!=e&&t!=t:function(e,t,r,c,a,u){var l=Se(e),h=Se(t),d=l?"[object Array]":me(e),f=h?"[object Array]":me(t),p=(d=d==i?s:d)==s,g=(f=f==i?s:f)==s,y=d==f;if(y&&je(e)){if(!je(t))return !1;l=!0,p=!1;}if(y&&!p)return u||(u=new oe),l||Te(e)?pe(e,t,r,c,a,u):function(e,t,r,i,s,c,a){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return !1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return !(e.byteLength!=t.byteLength||!c(new C(e),new C(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ee(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case n:var u=_;case o:var l=1&i;if(u||(u=w),e.size!=t.size&&!l)return !1;var h=a.get(e);if(h)return h==t;i|=2,a.set(e,t);var d=pe(u(e),u(t),i,s,c,a);return a.delete(e),d;case"[object Symbol]":if(te)return te.call(e)==te.call(t)}return !1}(e,t,d,r,c,a,u);if(!(1&r)){var b=p&&T.call(e,"__wrapped__"),v=g&&T.call(t,"__wrapped__");if(b||v){var m=b?e.value():e,E=v?t.value():t;return u||(u=new oe),a(m,E,r,c,u)}}if(!y)return !1;return u||(u=new oe),function(e,t,r,i,n,s){var o=1&r,c=ge(e),a=c.length,u=ge(t).length;if(a!=u&&!o)return !1;var l=a;for(;l--;){var h=c[l];if(!(o?h in t:T.call(t,h)))return !1}var d=s.get(e);if(d&&s.get(t))return d==t;var f=!0;s.set(e,t),s.set(t,e);var p=o;for(;++l<a;){h=c[l];var g=e[h],y=t[h];if(i)var b=o?i(y,g,h,t,e,s):i(g,y,h,e,t,s);if(!(void 0===b?g===y||n(g,y,r,i,s):b)){f=!1;break}p||(p="constructor"==h);}if(f&&!p){var v=e.constructor,m=t.constructor;v==m||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof m&&m instanceof m||(f=!1);}return s.delete(e),s.delete(t),f}(e,t,r,c,a,u)}(e,t,r,c,he,a))}function de(e){return !(!Pe(e)||function(e){return !!x&&x in e}(e))&&(Re(e)?A:c).test(we(e))}function fe(e){if(r=(t=e)&&t.constructor,i="function"==typeof r&&r.prototype||I,t!==i)return q(e);var t,r,i,n=[];for(var s in Object(e))T.call(e,s)&&"constructor"!=s&&n.push(s);return n}function pe(e,t,r,i,n,s){var o=1&r,c=e.length,a=t.length;if(c!=a&&!(o&&a>c))return !1;var u=s.get(e);if(u&&s.get(t))return u==t;var l=-1,h=!0,d=2&r?new se:void 0;for(s.set(e,t),s.set(t,e);++l<c;){var f=e[l],p=t[l];if(i)var g=o?i(p,f,l,t,e,s):i(f,p,l,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(d){if(!m(t,(function(e,t){if(o=t,!d.has(o)&&(f===e||n(f,e,r,i,s)))return d.push(t);var o;}))){h=!1;break}}else if(f!==p&&!n(f,p,r,i,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function ge(e){return function(e,t,r){var i=t(e);return Se(e)?i:function(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}(i,r(e))}(e,xe,ve)}function ye(e,t){var r,i,n=e.__data__;return ("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof t?"string":"hash"]:n.map}function be(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return de(r)?r:void 0}re.prototype.clear=function(){this.__data__=G?G(null):{},this.size=0;},re.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},re.prototype.get=function(e){var t=this.__data__;if(G){var r=t[e];return "__lodash_hash_undefined__"===r?void 0:r}return T.call(t,e)?t[e]:void 0},re.prototype.has=function(e){var t=this.__data__;return G?void 0!==t[e]:T.call(t,e)},re.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=G&&void 0===t?"__lodash_hash_undefined__":t,this},ie.prototype.clear=function(){this.__data__=[],this.size=0;},ie.prototype.delete=function(e){var t=this.__data__,r=ae(t,e);return !(r<0)&&(r==t.length-1?t.pop():z.call(t,r,1),--this.size,!0)},ie.prototype.get=function(e){var t=this.__data__,r=ae(t,e);return r<0?void 0:t[r][1]},ie.prototype.has=function(e){return ae(this.__data__,e)>-1},ie.prototype.set=function(e,t){var r=this.__data__,i=ae(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this},ne.prototype.clear=function(){this.size=0,this.__data__={hash:new re,map:new(J||ie),string:new re};},ne.prototype.delete=function(e){var t=ye(this,e).delete(e);return this.size-=t?1:0,t},ne.prototype.get=function(e){return ye(this,e).get(e)},ne.prototype.has=function(e){return ye(this,e).has(e)},ne.prototype.set=function(e,t){var r=ye(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this},se.prototype.add=se.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},se.prototype.has=function(e){return this.__data__.has(e)},oe.prototype.clear=function(){this.__data__=new ie,this.size=0;},oe.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},oe.prototype.get=function(e){return this.__data__.get(e)},oe.prototype.has=function(e){return this.__data__.has(e)},oe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ie){var i=r.__data__;if(!J||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new ne(i);}return r.set(e,t),this.size=r.size,this};var ve=K?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o);}return s}(K(e),(function(t){return D.call(e,t)})))}:function(){return []},me=ue;function _e(e,t){return !!(t=null==t?9007199254740991:t)&&("number"==typeof e||a.test(e))&&e>-1&&e%1==0&&e<t}function we(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return ""}function Ee(e,t){return e===t||e!=e&&t!=t}(H&&"[object DataView]"!=me(new H(new ArrayBuffer(1)))||J&&me(new J)!=n||B&&"[object Promise]"!=me(B.resolve())||F&&me(new F)!=o||W&&"[object WeakMap]"!=me(new W))&&(me=function(e){var t=ue(e),r=t==s?e.constructor:void 0,i=r?we(r):"";if(i)switch(i){case Y:return "[object DataView]";case $:return n;case X:return "[object Promise]";case Z:return o;case Q:return "[object WeakMap]"}return t});var Oe=le(function(){return arguments}())?le:function(e){return Ne(e)&&T.call(e,"callee")&&!D.call(e,"callee")},Se=Array.isArray;var je=V||function(){return !1};function Re(e){if(!Pe(e))return !1;var t=ue(e);return "[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ie(e){return "number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Pe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ne(e){return null!=e&&"object"==typeof e}var Te=v?function(e){return function(t){return e(t)}}(v):function(e){return Ne(e)&&Ie(e.length)&&!!u[ue(e)]};function xe(e){return null!=(t=e)&&Ie(t.length)&&!Re(t)?ce(e):fe(e);var t;}r.exports=function(e,t){return he(e,t)};}).call(this,r(29),r(131)(e));},function(e,t,r){function i(e){try{return JSON.stringify(e)}catch(e){return '"[Circular]"'}}e.exports=function(e,t,r){var n=r&&r.stringify||i;if("object"==typeof e&&null!==e){var s=t.length+1;if(1===s)return e;var o=new Array(s);o[0]=n(e);for(var c=1;c<s;c++)o[c]=n(t[c]);return o.join(" ")}if("string"!=typeof e)return e;var a=t.length;if(0===a)return e;for(var u="",l=0,h=-1,d=e&&e.length||0,f=0;f<d;){if(37===e.charCodeAt(f)&&f+1<d){switch(h=h>-1?h:0,e.charCodeAt(f+1)){case 100:case 102:if(l>=a)break;if(null==t[l])break;h<f&&(u+=e.slice(h,f)),u+=Number(t[l]),h=f+2,f++;break;case 105:if(l>=a)break;if(null==t[l])break;h<f&&(u+=e.slice(h,f)),u+=Math.floor(Number(t[l])),h=f+2,f++;break;case 79:case 111:case 106:if(l>=a)break;if(void 0===t[l])break;h<f&&(u+=e.slice(h,f));var p=typeof t[l];if("string"===p){u+="'"+t[l]+"'",h=f+2,f++;break}if("function"===p){u+=t[l].name||"<anonymous>",h=f+2,f++;break}u+=n(t[l]),h=f+2,f++;break;case 115:if(l>=a)break;h<f&&(u+=e.slice(h,f)),u+=String(t[l]),h=f+2,f++;break;case 37:h<f&&(u+=e.slice(h,f)),u+="%",h=f+2,f++,l--;}++l;}++f;}if(-1===h)return e;h<d&&(u+=e.slice(h));return u};},function(e,t,r){(function(t){!function(){let r;function i(){}r=i,r.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},r.prototype.setItem=function(e,t){this[e]=String(t);},r.prototype.removeItem=function(e){delete this[e];},r.prototype.clear=function(){const e=this;Object.keys(e).forEach((function(t){e[t]=void 0,delete e[t];}));},r.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},r.prototype.__defineGetter__("length",(function(){return Object.keys(this).length})),void 0!==t&&t.localStorage?e.exports=t.localStorage:"undefined"!=typeof window&&window.localStorage?e.exports=window.localStorage:e.exports=new i;}();}).call(this,r(29));},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);i.__exportStar(r(79),t),i.__exportStar(r(80),t);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.IKeyValueStorage=void 0;t.IKeyValueStorage=class{};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parseEntry=void 0;const i=r(42);t.parseEntry=function(e){var t;return [e[0],i.safeJsonParse(null!==(t=e[1])&&void 0!==t?t:"")]};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.HeartBeat=void 0;const i=r(9),n=r(6),s=r(1),o=r(44),c=r(45);class a extends o.IHeartBeat{constructor(e){super(e),this.events=new n.EventEmitter,this.interval=c.HEARTBEAT_INTERVAL,this.interval=(null==e?void 0:e.interval)||c.HEARTBEAT_INTERVAL;}static init(e){return i.__awaiter(this,void 0,void 0,(function*(){const t=new a(e);return yield t.init(),t}))}init(){return i.__awaiter(this,void 0,void 0,(function*(){yield this.initialize();}))}stop(){clearInterval(this.intervalRef);}on(e,t){this.events.on(e,t);}once(e,t){this.events.once(e,t);}off(e,t){this.events.off(e,t);}removeListener(e,t){this.events.removeListener(e,t);}initialize(){return i.__awaiter(this,void 0,void 0,(function*(){this.intervalRef=setInterval(()=>this.pulse(),s.toMiliseconds(this.interval));}))}pulse(){this.events.emit(c.HEARTBEAT_EVENTS.pulse);}}t.HeartBeat=a;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(9);i.__exportStar(r(83),t),i.__exportStar(r(84),t);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise(t=>{setTimeout(()=>{t(!0);},e);})};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;const i=r(43);t.toMiliseconds=function(e){return e*i.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/i.ONE_THOUSAND)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class i{constructor(){this.timestamps=new Map;}start(e){if(this.timestamps.has(e))throw new Error("Watch already started for label: "+e);this.timestamps.set(e,{started:Date.now()});}stop(e){const t=this.get(e);if(void 0!==t.elapsed)throw new Error("Watch already stopped for label: "+e);const r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r});}get(e){const t=this.timestamps.get(e);if(void 0===t)throw new Error("No timestamp found for label: "+e);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=i,t.default=i;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});r(9).__exportStar(r(89),t);},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;t.IWatch=class{};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.IHeartBeat=void 0;const i=r(16);class n extends i.IEvents{constructor(e){super();}}t.IHeartBeat=n;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.HEARTBEAT_EVENTS=t.HEARTBEAT_INTERVAL=void 0;const i=r(1);t.HEARTBEAT_INTERVAL=i.FIVE_SECONDS,t.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.generateChildLogger=t.formatChildLoggerContext=t.getLoggerContext=t.setBrowserLoggerContext=t.getBrowserLoggerContext=t.getDefaultLoggerOptions=void 0;const i=r(46);function n(e,t=i.PINO_CUSTOM_CONTEXT_KEY){return e[t]||""}function s(e,t,r=i.PINO_CUSTOM_CONTEXT_KEY){return e[r]=t,e}function o(e,t=i.PINO_CUSTOM_CONTEXT_KEY){let r="";return r=void 0===e.bindings?n(e,t):e.bindings().context||"",r}function c(e,t,r=i.PINO_CUSTOM_CONTEXT_KEY){const n=o(e,r);return n.trim()?`${n}/${t}`:t}t.getDefaultLoggerOptions=function(e){return Object.assign(Object.assign({},e),{level:(null==e?void 0:e.level)||i.PINO_LOGGER_DEFAULTS.level})},t.getBrowserLoggerContext=n,t.setBrowserLoggerContext=s,t.getLoggerContext=o,t.formatChildLoggerContext=c,t.generateChildLogger=function(e,t,r=i.PINO_CUSTOM_CONTEXT_KEY){const n=c(e,t,r);return s(e.child({context:n}),n,r)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const i=r(94),n=r(95);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new i.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new n.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)}};},function(e,t,r){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 e=0;e<t.length;e+=65536)this._crypto.getRandomValues(t.subarray(e,e+Math.min(t.length-e,65536)));return t}};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const i=r(10);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(96);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 e=0;e<r.length;e++)r[e]=t[e];return (0, i.wipe)(t),r}};},function(e,t){},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,i=65535&t;return r*i+((e>>>16&65535)*i+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<<t|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};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(23),n=r(10);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var s=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset();}return e.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209;},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset();},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=e[i++],r--;this._bufferLength===this.blockSize&&(c(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0);}for(r>=this.blockSize&&(i=c(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[i++],r--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[r]=128;for(var a=r+1;a<o-8;a++)this._buffer[a]=0;i.writeUint32BE(n,this._buffer,o-8),i.writeUint32BE(s,this._buffer,o-4),c(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,o),this._finished=!0;}for(a=0;a<this.digestLength/8;a++)i.writeUint32BE(this._stateHi[a],e,8*a),i.writeUint32BE(this._stateLo[a],e,8*a+4);return this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return {stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){n.wipe(e.stateHi),n.wipe(e.stateLo),e.buffer&&n.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0;},e}();t.SHA512=s;var o=new Int32Array([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 c(e,t,r,n,s,c,a){for(var u,l,h,d,f,p,g,y,b=r[0],v=r[1],m=r[2],_=r[3],w=r[4],E=r[5],O=r[6],S=r[7],j=n[0],R=n[1],I=n[2],P=n[3],N=n[4],T=n[5],x=n[6],L=n[7];a>=128;){for(var A=0;A<16;A++){var U=8*A+c;e[A]=i.readUint32BE(s,U),t[A]=i.readUint32BE(s,U+4);}for(A=0;A<80;A++){var M,C,D=b,z=v,k=m,K=_,V=w,q=E,H=O,J=j,B=R,F=I,W=P,G=N,Y=T,$=x;if(f=65535&(l=L),p=l>>>16,g=65535&(u=S),y=u>>>16,f+=65535&(l=(N>>>14|w<<18)^(N>>>18|w<<14)^(w>>>9|N<<23)),p+=l>>>16,g+=65535&(u=(w>>>14|N<<18)^(w>>>18|N<<14)^(N>>>9|w<<23)),y+=u>>>16,f+=65535&(l=N&T^~N&x),p+=l>>>16,g+=65535&(u=w&E^~w&O),y+=u>>>16,u=o[2*A],f+=65535&(l=o[2*A+1]),p+=l>>>16,g+=65535&u,y+=u>>>16,u=e[A%16],p+=(l=t[A%16])>>>16,g+=65535&u,y+=u>>>16,g+=(p+=(f+=65535&l)>>>16)>>>16,f=65535&(l=d=65535&f|p<<16),p=l>>>16,g=65535&(u=h=65535&g|(y+=g>>>16)<<16),y=u>>>16,f+=65535&(l=(j>>>28|b<<4)^(b>>>2|j<<30)^(b>>>7|j<<25)),p+=l>>>16,g+=65535&(u=(b>>>28|j<<4)^(j>>>2|b<<30)^(j>>>7|b<<25)),y+=u>>>16,p+=(l=j&R^j&I^R&I)>>>16,g+=65535&(u=b&v^b&m^v&m),y+=u>>>16,M=65535&(g+=(p+=(f+=65535&l)>>>16)>>>16)|(y+=g>>>16)<<16,C=65535&f|p<<16,f=65535&(l=W),p=l>>>16,g=65535&(u=K),y=u>>>16,p+=(l=d)>>>16,g+=65535&(u=h),y+=u>>>16,v=D,m=z,_=k,w=K=65535&(g+=(p+=(f+=65535&l)>>>16)>>>16)|(y+=g>>>16)<<16,E=V,O=q,S=H,b=M,R=J,I=B,P=F,N=W=65535&f|p<<16,T=G,x=Y,L=$,j=C,A%16==15)for(U=0;U<16;U++)u=e[U],f=65535&(l=t[U]),p=l>>>16,g=65535&u,y=u>>>16,u=e[(U+9)%16],f+=65535&(l=t[(U+9)%16]),p+=l>>>16,g+=65535&u,y+=u>>>16,h=e[(U+1)%16],f+=65535&(l=((d=t[(U+1)%16])>>>1|h<<31)^(d>>>8|h<<24)^(d>>>7|h<<25)),p+=l>>>16,g+=65535&(u=(h>>>1|d<<31)^(h>>>8|d<<24)^h>>>7),y+=u>>>16,h=e[(U+14)%16],p+=(l=((d=t[(U+14)%16])>>>19|h<<13)^(h>>>29|d<<3)^(d>>>6|h<<26))>>>16,g+=65535&(u=(h>>>19|d<<13)^(d>>>29|h<<3)^h>>>6),y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,e[U]=65535&g|y<<16,t[U]=65535&f|p<<16;}f=65535&(l=j),p=l>>>16,g=65535&(u=b),y=u>>>16,u=r[0],p+=(l=n[0])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[0]=b=65535&g|y<<16,n[0]=j=65535&f|p<<16,f=65535&(l=R),p=l>>>16,g=65535&(u=v),y=u>>>16,u=r[1],p+=(l=n[1])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[1]=v=65535&g|y<<16,n[1]=R=65535&f|p<<16,f=65535&(l=I),p=l>>>16,g=65535&(u=m),y=u>>>16,u=r[2],p+=(l=n[2])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[2]=m=65535&g|y<<16,n[2]=I=65535&f|p<<16,f=65535&(l=P),p=l>>>16,g=65535&(u=_),y=u>>>16,u=r[3],p+=(l=n[3])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[3]=_=65535&g|y<<16,n[3]=P=65535&f|p<<16,f=65535&(l=N),p=l>>>16,g=65535&(u=w),y=u>>>16,u=r[4],p+=(l=n[4])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[4]=w=65535&g|y<<16,n[4]=N=65535&f|p<<16,f=65535&(l=T),p=l>>>16,g=65535&(u=E),y=u>>>16,u=r[5],p+=(l=n[5])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[5]=E=65535&g|y<<16,n[5]=T=65535&f|p<<16,f=65535&(l=x),p=l>>>16,g=65535&(u=O),y=u>>>16,u=r[6],p+=(l=n[6])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[6]=O=65535&g|y<<16,n[6]=x=65535&f|p<<16,f=65535&(l=L),p=l>>>16,g=65535&(u=S),y=u>>>16,u=r[7],p+=(l=n[7])>>>16,g+=65535&u,y+=u>>>16,y+=(g+=(p+=(f+=65535&l)>>>16)>>>16)>>>16,r[7]=S=65535&g|y<<16,n[7]=L=65535&f|p<<16,c+=128,a-=128;}return c}t.hash=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12),n=r(14);const s=i.from({prefix:"\0",name:"identity",encode:e=>n.toString(e),decode:e=>n.fromString(e)});t.identity=s;},function(e,t,r){var i=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=n;}var c=e.length,a=e.charAt(0),u=Math.log(c)/Math.log(256),l=Math.log(256)/Math.log(c);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var i=0,n=0;e[t]===a;)i++,t++;for(var s=(e.length-t)*u+1>>>0,o=new Uint8Array(s);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var h=0,d=s-1;(0!==l||h<n)&&-1!==d;d--,h++)l+=c*o[d]>>>0,o[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");n=h,t++;}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=o[f++];return p}}}return {encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return "";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*l+1>>>0,u=new Uint8Array(o);n!==s;){for(var h=t[n],d=0,f=o-1;(0!==h||d<i)&&-1!==f;f--,d++)h+=256*u[f]>>>0,u[f]=h%c>>>0,h=h/c>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,n++;}for(var p=o-i;p!==o&&0===u[p];)p++;for(var g=a.repeat(r);p<o;++p)g+=e.charAt(u[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error(`Non-${t} character`)}}};e.exports=i;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(12).rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});t.base2=i;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(12).rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});t.base8=i;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=r(12).baseX({prefix:"9",name:"base10",alphabet:"0123456789"});t.base10=i;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);const n=i.rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),s=i.rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});t.base16=n,t.base16upper=s;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);const n=i.baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),s=i.baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});t.base36=n,t.base36upper=s;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);const n=i.rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),s=i.rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),o=i.rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),c=i.rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});t.base64=n,t.base64pad=s,t.base64url=o,t.base64urlpad=c;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);const n=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),s=n.reduce((e,t,r)=>(e[r]=t,e),[]),o=n.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);const c=i.from({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=s[t],"")},decode:function(e){const t=[];for(const r of e){const e=o[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: "+r);t.push(e);}return new Uint8Array(t)}});t.base256emoji=c;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(36);const n=e=>t=>{return r=this,i=null,n=function*(){return new Uint8Array(yield crypto.subtle.digest(e,t))},new Promise((e,t)=>{var s=e=>{try{c(n.next(e));}catch(e){t(e);}},o=e=>{try{c(n.throw(e));}catch(e){t(e);}},c=t=>t.done?e(t.value):Promise.resolve(t.value).then(s,o);c((n=n.apply(r,i)).next());});var r,i,n;},s=i.from({name:"sha2-256",code:18,encode:n("SHA-256")}),o=i.from({name:"sha2-512",code:19,encode:n("SHA-512")});t.sha256=s,t.sha512=o;},function(e,t,r){var i=function e(t,r,i){r=r||[];var s=i=i||0;for(;t>=n;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-s+1,r},n=Math.pow(2,31);var s=function e(t,r){var i,n=0,s=0,o=r=r||0,c=t.length;do{if(o>=c)throw e.bytes=0,new RangeError("Could not decode varint");i=t[o++],n+=s<28?(127&i)<<s:(127&i)*Math.pow(2,s),s+=7;}while(i>=128);return e.bytes=o-r,n};var o=Math.pow(2,7),c=Math.pow(2,14),a=Math.pow(2,21),u=Math.pow(2,28),l=Math.pow(2,35),h=Math.pow(2,42),d=Math.pow(2,49),f=Math.pow(2,56),p=Math.pow(2,63),g={encode:i,decode:s,encodingLength:function(e){return e<o?1:e<c?2:e<a?3:e<u?4:e<l?5:e<h?6:e<d?7:e<f?8:e<p?9:10}};e.exports=g;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),n=r(24);const s=i.coerce,o={code:0,name:"identity",encode:s,digest:e=>n.create(0,s(e))};t.identity=o;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(14);t.code=85,t.decode=e=>i.coerce(e),t.encode=e=>i.coerce(e),t.name="raw";},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const i=new TextEncoder,n=new TextDecoder;t.code=512,t.decode=e=>JSON.parse(n.decode(e)),t.encode=e=>i.encode(JSON.stringify(e)),t.name="json";},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(53),n=r(30),s=r(14),o=r(36),c=r(24);t.CID=i.CID,t.varint=n,t.bytes=s,t.hasher=o,t.digest=c;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(23),n=r(10);function s(e,t,r){for(var n=1634760805,s=857760878,o=2036477234,c=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=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],y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],b=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],_=n,w=s,E=o,O=c,S=a,j=u,R=l,I=h,P=d,N=f,T=p,x=g,L=y,A=b,U=v,M=m,C=0;C<20;C+=2)S=(S^=P=P+(L=(L^=_=_+S|0)>>>16|L<<16)|0)>>>20|S<<12,j=(j^=N=N+(A=(A^=w=w+j|0)>>>16|A<<16)|0)>>>20|j<<12,R=(R^=T=T+(U=(U^=E=E+R|0)>>>16|U<<16)|0)>>>20|R<<12,I=(I^=x=x+(M=(M^=O=O+I|0)>>>16|M<<16)|0)>>>20|I<<12,R=(R^=T=T+(U=(U^=E=E+R|0)>>>24|U<<8)|0)>>>25|R<<7,I=(I^=x=x+(M=(M^=O=O+I|0)>>>24|M<<8)|0)>>>25|I<<7,j=(j^=N=N+(A=(A^=w=w+j|0)>>>24|A<<8)|0)>>>25|j<<7,S=(S^=P=P+(L=(L^=_=_+S|0)>>>24|L<<8)|0)>>>25|S<<7,j=(j^=T=T+(M=(M^=_=_+j|0)>>>16|M<<16)|0)>>>20|j<<12,R=(R^=x=x+(L=(L^=w=w+R|0)>>>16|L<<16)|0)>>>20|R<<12,I=(I^=P=P+(A=(A^=E=E+I|0)>>>16|A<<16)|0)>>>20|I<<12,S=(S^=N=N+(U=(U^=O=O+S|0)>>>16|U<<16)|0)>>>20|S<<12,I=(I^=P=P+(A=(A^=E=E+I|0)>>>24|A<<8)|0)>>>25|I<<7,S=(S^=N=N+(U=(U^=O=O+S|0)>>>24|U<<8)|0)>>>25|S<<7,R=(R^=x=x+(L=(L^=w=w+R|0)>>>24|L<<8)|0)>>>25|R<<7,j=(j^=T=T+(M=(M^=_=_+j|0)>>>24|M<<8)|0)>>>25|j<<7;i.writeUint32LE(_+n|0,e,0),i.writeUint32LE(w+s|0,e,4),i.writeUint32LE(E+o|0,e,8),i.writeUint32LE(O+c|0,e,12),i.writeUint32LE(S+a|0,e,16),i.writeUint32LE(j+u|0,e,20),i.writeUint32LE(R+l|0,e,24),i.writeUint32LE(I+h|0,e,28),i.writeUint32LE(P+d|0,e,32),i.writeUint32LE(N+f|0,e,36),i.writeUint32LE(T+p|0,e,40),i.writeUint32LE(x+g|0,e,44),i.writeUint32LE(L+y|0,e,48),i.writeUint32LE(A+b|0,e,52),i.writeUint32LE(U+v|0,e,56),i.writeUint32LE(M+m|0,e,60);}function o(e,t,r,i,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.length)throw new Error("ChaCha: destination is shorter than source");var a,u;if(0===o){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");u=(a=new Uint8Array(16)).length-t.length,a.set(t,u);}else {if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");a=t,u=o;}for(var l=new Uint8Array(64),h=0;h<r.length;h+=64){s(l,a,e);for(var d=h;d<h+64&&d<r.length;d++)i[d]=r[d]^l[d-h];c(a,0,u);}return n.wipe(l),0===o&&n.wipe(a),i}function c(e,t,r){for(var i=1;r--;)i=i+(255&e[t])|0,e[t]=255&i,i>>>=8,t++;if(i>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=o,t.stream=function(e,t,r,i){return void 0===i&&(i=0),n.wipe(r),o(e,t,r,r,i)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(38),n=r(10);t.DIGEST_LENGTH=16;var s=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 i=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|i<<3);var n=e[4]|e[5]<<8;this._r[2]=7939&(i>>>10|n<<6);var s=e[6]|e[7]<<8;this._r[3]=8191&(n>>>7|s<<9);var o=e[8]|e[9]<<8;this._r[4]=255&(s>>>4|o<<12),this._r[5]=o>>>1&8190;var c=e[10]|e[11]<<8;this._r[6]=8191&(o>>>14|c<<2);var a=e[12]|e[13]<<8;this._r[7]=8065&(c>>>11|a<<5);var u=e[14]|e[15]<<8;this._r[8]=8191&(a>>>8|u<<8),this._r[9]=u>>>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 i=this._fin?0:2048,n=this._h[0],s=this._h[1],o=this._h[2],c=this._h[3],a=this._h[4],u=this._h[5],l=this._h[6],h=this._h[7],d=this._h[8],f=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],b=this._r[3],v=this._r[4],m=this._r[5],_=this._r[6],w=this._r[7],E=this._r[8],O=this._r[9];r>=16;){var S=e[t+0]|e[t+1]<<8;n+=8191&S;var j=e[t+2]|e[t+3]<<8;s+=8191&(S>>>13|j<<3);var R=e[t+4]|e[t+5]<<8;o+=8191&(j>>>10|R<<6);var I=e[t+6]|e[t+7]<<8;c+=8191&(R>>>7|I<<9);var P=e[t+8]|e[t+9]<<8;a+=8191&(I>>>4|P<<12),u+=P>>>1&8191;var N=e[t+10]|e[t+11]<<8;l+=8191&(P>>>14|N<<2);var T=e[t+12]|e[t+13]<<8;h+=8191&(N>>>11|T<<5);var x=e[t+14]|e[t+15]<<8,L=0,A=L;A+=n*p,A+=s*(5*O),A+=o*(5*E),A+=c*(5*w),L=(A+=a*(5*_))>>>13,A&=8191,A+=u*(5*m),A+=l*(5*v),A+=h*(5*b),A+=(d+=8191&(T>>>8|x<<8))*(5*y);var U=L+=(A+=(f+=x>>>5|i)*(5*g))>>>13;U+=n*g,U+=s*p,U+=o*(5*O),U+=c*(5*E),L=(U+=a*(5*w))>>>13,U&=8191,U+=u*(5*_),U+=l*(5*m),U+=h*(5*v),U+=d*(5*b),L+=(U+=f*(5*y))>>>13,U&=8191;var M=L;M+=n*y,M+=s*g,M+=o*p,M+=c*(5*O),L=(M+=a*(5*E))>>>13,M&=8191,M+=u*(5*w),M+=l*(5*_),M+=h*(5*m),M+=d*(5*v);var C=L+=(M+=f*(5*b))>>>13;C+=n*b,C+=s*y,C+=o*g,C+=c*p,L=(C+=a*(5*O))>>>13,C&=8191,C+=u*(5*E),C+=l*(5*w),C+=h*(5*_),C+=d*(5*m);var D=L+=(C+=f*(5*v))>>>13;D+=n*v,D+=s*b,D+=o*y,D+=c*g,L=(D+=a*p)>>>13,D&=8191,D+=u*(5*O),D+=l*(5*E),D+=h*(5*w),D+=d*(5*_);var z=L+=(D+=f*(5*m))>>>13;z+=n*m,z+=s*v,z+=o*b,z+=c*y,L=(z+=a*g)>>>13,z&=8191,z+=u*p,z+=l*(5*O),z+=h*(5*E),z+=d*(5*w);var k=L+=(z+=f*(5*_))>>>13;k+=n*_,k+=s*m,k+=o*v,k+=c*b,L=(k+=a*y)>>>13,k&=8191,k+=u*g,k+=l*p,k+=h*(5*O),k+=d*(5*E);var K=L+=(k+=f*(5*w))>>>13;K+=n*w,K+=s*_,K+=o*m,K+=c*v,L=(K+=a*b)>>>13,K&=8191,K+=u*y,K+=l*g,K+=h*p,K+=d*(5*O);var V=L+=(K+=f*(5*E))>>>13;V+=n*E,V+=s*w,V+=o*_,V+=c*m,L=(V+=a*v)>>>13,V&=8191,V+=u*b,V+=l*y,V+=h*g,V+=d*p;var q=L+=(V+=f*(5*O))>>>13;q+=n*O,q+=s*E,q+=o*w,q+=c*_,L=(q+=a*m)>>>13,q&=8191,q+=u*v,q+=l*b,q+=h*y,q+=d*g,n=A=8191&(L=(L=((L+=(q+=f*p)>>>13)<<2)+L|0)+(A&=8191)|0),s=U+=L>>>=13,o=M&=8191,c=C&=8191,a=D&=8191,u=z&=8191,l=k&=8191,h=K&=8191,d=V&=8191,f=q&=8191,t+=16,r-=16;}this._h[0]=n,this._h[1]=s,this._h[2]=o,this._h[3]=c,this._h[4]=a,this._h[5]=u,this._h[6]=l,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,i,n,s,o=new Uint16Array(10);if(this._leftover){for(s=this._leftover,this._buffer[s++]=1;s<16;s++)this._buffer[s]=0;this._fin=1,this._blocks(this._buffer,0,16);}for(r=this._h[1]>>>13,this._h[1]&=8191,s=2;s<10;s++)this._h[s]+=r,r=this._h[s]>>>13,this._h[s]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,o[0]=this._h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this._h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,i=(1^r)-1,s=0;s<10;s++)o[s]&=i;for(i=~i,s=0;s<10;s++)this._h[s]=this._h[s]&i|o[s];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),n=this._h[0]+this._pad[0],this._h[0]=65535&n,s=1;s<8;s++)n=(this._h[s]+this._pad[s]|0)+(n>>>16)|0,this._h[s]=65535&n;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,i=e.length;if(this._leftover){(t=16-this._leftover)>i&&(t=i);for(var n=0;n<t;n++)this._buffer[this._leftover+n]=e[r+n];if(i-=t,r+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0;}if(i>=16&&(t=i-i%16,this._blocks(e,r,t),r+=t,i-=t),i){for(n=0;n<i;n++)this._buffer[this._leftover+n]=e[r+n];this._leftover+=i;}return this},e.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},e.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},e}();t.Poly1305=s,t.oneTimeAuth=function(e,t){var r=new s(e);r.update(t);var i=r.digest();return r.clean(),i},t.equal=function(e,r){return e.length===t.DIGEST_LENGTH&&r.length===t.DIGEST_LENGTH&&i.equal(e,r)};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(117),n=r(38),s=r(10),o=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 n=0;n<r.length;n++)r[n]^=54;this._inner.update(r);for(n=0;n<r.length;n++)r[n]^=106;this._outer.update(r),i.isSerializableHash(this._inner)&&i.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),s.wipe(r);}return e.prototype.reset=function(){if(!i.isSerializableHash(this._inner)||!i.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){i.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),i.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean();},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!i.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!i.isSerializableHash(this._inner)||!i.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!i.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e);},e}();t.HMAC=o,t.hmac=function(e,t,r){var i=new o(e,t);i.update(r);var n=i.digest();return i.clean(),n},t.equal=n.equal;},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.compare=function(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return -1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(39);t.concat=function(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));const r=i.allocUnsafe(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.equals=function(e,t){if(e===t)return !0;if(e.byteLength!==t.byteLength)return !1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return !1;return !0};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(55);t.fromString=function(e,t="utf8"){const r=i[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return "utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):globalThis.Buffer.from(e,"utf8")};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(55);t.toString=function(e,t="utf8"){const r=i[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return "utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")};},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(39);t.xor=function(e,t){if(e.length!==t.length)throw new Error("Inputs should have the same length");const r=i.allocUnsafe(e.length);for(let i=0;i<e.length;i++)r[i]=e[i]^t[i];return r};},function(e,t,r){e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase());},function(e,t,r){var i=new RegExp("%[a-f0-9]{2}","gi"),n=new RegExp("(%[a-f0-9]{2})+","gi");function s(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),i=e.slice(t);return Array.prototype.concat.call([],s(r),s(i))}function o(e){try{return decodeURIComponent(e)}catch(n){for(var t=e.match(i),r=1;r<t.length;r++)t=(e=s(t,r).join("")).match(i);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=n.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0]);}catch(e){var i=o(r[0]);i!==r[0]&&(t[r[0]]=i);}r=n.exec(e);}t["%C2"]="�";for(var s=Object.keys(t),c=0;c<s.length;c++){var a=s[c];e=e.replace(new RegExp(a,"g"),t[a]);}return e}(e)}};},function(e,t,r){e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return [e];const r=e.indexOf(t);return -1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]};},function(e,t,r){e.exports=function(e,t){for(var r={},i=Object.keys(e),n=Array.isArray(t),s=0;s<i.length;s++){var o=i[s],c=e[o];(n?-1!==t.indexOf(o):t(o,c,e))&&(r[o]=c);}return r};},function(e,t,r){(function(e){function r(){return (null==e?void 0:e.crypto)||(null==e?void 0:e.msCrypto)||{}}function i(){const e=r();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=r,t.getSubtleCrypto=i,t.isBrowserCryptoAvailable=function(){return !!r()&&!!i()};}).call(this,r(29));},function(e,t,r){(function(e){function r(){return "undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function i(){return void 0!==e&&void 0!==e.versions&&void 0!==e.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=r,t.isNode=i,t.isBrowser=function(){return !r()&&!i()};}).call(this,r(37));},function(e,t,r){e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")};},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e};},function(e,t,r){r.r(t),r.d(t,"Core",(function(){return Er})),r.d(t,"SignClient",(function(){return Jr}));var i=r(6),n=r.n(i),s=r(22),o=r.n(s),c=r(69),a=r.n(c),u=r(26),l=r(4),h=r(16);class d extends h.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2;}}class f extends h.IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map;}}class p extends h.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t;}}class g extends h.IEvents{constructor(e){super();}}class y extends h.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t;}}class b extends h.IEvents{constructor(e,t){super(),this.core=e,this.logger=t;}}n.a;i.EventEmitter;var v=r(13),m=r(27),_=r(0),w=r(1),E=r(2),O=(e,t,r)=>new Promise((i,n)=>{var s=e=>{try{c(r.next(e));}catch(e){n(e);}},o=e=>{try{c(r.throw(e));}catch(e){n(e);}},c=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);c((r=r.apply(e,t)).next());});class S extends E.IJsonRpcProvider{constructor(e){super(e),this.events=new i.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners();}connect(){return O(this,arguments,(function*(e=this.connection){yield this.open(e);}))}disconnect(){return O(this,null,(function*(){yield this.close();}))}on(e,t){this.events.on(e,t);}once(e,t){this.events.once(e,t);}off(e,t){this.events.off(e,t);}removeListener(e,t){this.events.removeListener(e,t);}request(e,t){return O(this,null,(function*(){return this.requestStrict(Object(E.formatJsonRpcRequest)(e.method,e.params||[]),t)}))}requestStrict(e,t){return O(this,null,(function*(){return new Promise((r,i)=>O(this,null,(function*(){if(!this.connection.connected)try{yield this.open();}catch(e){i(e);}this.events.on(""+e.id,e=>{Object(E.isJsonRpcError)(e)?i(e.error):r(e.result);});try{yield this.connection.send(e,t);}catch(e){i(e);}})))}))}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Object(E.isJsonRpcResponse)(e)?this.events.emit(""+e.id,e):this.events.emit("message",{type:e.method,data:e.params});}open(){return O(this,arguments,(function*(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(yield this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),yield this.connection.open(),this.registerEventListeners(),this.events.emit("connect"));}))}close(){return O(this,null,(function*(){yield this.connection.close();}))}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0);}}var j=r(32).a,R=r(75),I=r.n(R),P=Object.defineProperty,N=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,L=(e,t,r)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))T.call(t,r)&&L(e,r,t[r]);if(N)for(var r of N(t))x.call(t,r)&&L(e,r,t[r]);return e},U=(e,t,r)=>new Promise((i,n)=>{var s=e=>{try{c(r.next(e));}catch(e){n(e);}},o=e=>{try{c(r.throw(e));}catch(e){n(e);}},c=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);c((r=r.apply(e,t)).next());});var M=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=n;}var c=e.length,a=e.charAt(0),u=Math.log(c)/Math.log(256),l=Math.log(256)/Math.log(c);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var i=0,n=0;e[t]===a;)i++,t++;for(var s=(e.length-t)*u+1>>>0,o=new Uint8Array(s);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var h=0,d=s-1;(0!==l||h<n)&&-1!==d;d--,h++)l+=c*o[d]>>>0,o[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");n=h,t++;}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=o[f++];return p}}}return {encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return "";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*l+1>>>0,u=new Uint8Array(o);n!==s;){for(var h=t[n],d=0,f=o-1;(0!==h||d<i)&&-1!==f;f--,d++)h+=256*u[f]>>>0,u[f]=h%c>>>0,h=h/c>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,n++;}for(var p=o-i;p!==o&&0===u[p];)p++;for(var g=a.repeat(r);p<o;++p)g+=e.charAt(u[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error(`Non-${t} character`)}}};const C=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};class D{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r;}encode(e){if(e instanceof Uint8Array)return `${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class z{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r;}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return K(this,e)}}class k{constructor(e){this.decoders=e;}or(e){return K(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const K=(e,t)=>new k(A(A({},e.decoders||{[e.prefix]:e}),t.decoders||{[t.prefix]:t}));class V{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new D(e,t,r),this.decoder=new z(e,t,i);}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const q=({name:e,prefix:t,encode:r,decode:i})=>new V(e,t,r,i),H=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:n}=M(r,t);return q({prefix:e,name:t,encode:i,decode:e=>C(n(e))})},J=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>q({prefix:t,name:e,encode:e=>((e,t,r)=>{const i="="===t[t.length-1],n=(1<<r)-1;let s="",o=0,c=0;for(let i=0;i<e.length;++i)for(c=c<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&c>>o];if(o&&(s+=t[n&c<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{const n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;const o=new Uint8Array(s*r/8|0);let c=0,a=0,u=0;for(let t=0;t<s;++t){const s=n[e[t]];if(void 0===s)throw new SyntaxError(`Non-${i} character`);a=a<<r|s,c+=r,c>=8&&(c-=8,o[u++]=255&a>>c);}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return o})(t,i,r,e)}),B=q({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var F=Object.freeze({__proto__:null,identity:B});const W=J({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var G=Object.freeze({__proto__:null,base2:W});const Y=J({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $=Object.freeze({__proto__:null,base8:Y});const X=H({prefix:"9",name:"base10",alphabet:"0123456789"});var Z=Object.freeze({__proto__:null,base10:X});const Q=J({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ee=J({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var te=Object.freeze({__proto__:null,base16:Q,base16upper:ee});const re=J({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ie=J({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ne=J({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),se=J({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oe=J({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ce=J({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ae=J({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ue=J({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),le=J({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var he=Object.freeze({__proto__:null,base32:re,base32upper:ie,base32pad:ne,base32padupper:se,base32hex:oe,base32hexupper:ce,base32hexpad:ae,base32hexpadupper:ue,base32z:le});const de=H({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fe=H({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var pe=Object.freeze({__proto__:null,base36:de,base36upper:fe});const ge=H({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ye=H({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var be=Object.freeze({__proto__:null,base58btc:ge,base58flickr:ye});const ve=J({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),me=J({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_e=J({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),we=J({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ee=Object.freeze({__proto__:null,base64:ve,base64pad:me,base64url:_e,base64urlpad:we});const Oe=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Se=Oe.reduce((e,t,r)=>(e[r]=t,e),[]),je=Oe.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);const Re=q({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=Se[t],"")},decode:function(e){const t=[];for(const r of e){const e=je[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: "+r);t.push(e);}return new Uint8Array(t)}});var Ie=Object.freeze({__proto__:null,base256emoji:Re}),Pe=function e(t,r,i){r=r||[];for(var n=i=i||0;t>=Ne;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r},Ne=Math.pow(2,31);var Te=function e(t,r){var i,n=0,s=0,o=r=r||0,c=t.length;do{if(o>=c)throw e.bytes=0,new RangeError("Could not decode varint");i=t[o++],n+=s<28?(127&i)<<s:(127&i)*Math.pow(2,s),s+=7;}while(i>=128);return e.bytes=o-r,n};var xe=Math.pow(2,7),Le=Math.pow(2,14),Ae=Math.pow(2,21),Ue=Math.pow(2,28),Me=Math.pow(2,35),Ce=Math.pow(2,42),De=Math.pow(2,49),ze=Math.pow(2,56),ke=Math.pow(2,63),Ke={encode:Pe,decode:Te,encodingLength:function(e){return e<xe?1:e<Le?2:e<Ae?3:e<Ue?4:e<Me?5:e<Ce?6:e<De?7:e<ze?8:e<ke?9:10}};const Ve=(e,t,r=0)=>(Ke.encode(e,t,r),t),qe=e=>Ke.encodingLength(e),He=(e,t)=>{const r=t.byteLength,i=qe(e),n=i+qe(r),s=new Uint8Array(n+r);return Ve(e,s,0),Ve(r,s,i),s.set(t,n),new Je(e,r,t,s)};class Je{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i;}}const Be=({name:e,code:t,encode:r})=>new Fe(e,t,r);class Fe{constructor(e,t,r){this.name=e,this.code=t,this.encode=r;}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?He(this.code,t):t.then(e=>He(this.code,e))}throw Error("Unknown type, must be binary type")}}const We=e=>t=>U(void 0,null,(function*(){return new Uint8Array(yield crypto.subtle.digest(e,t))})),Ge=Be({name:"sha2-256",code:18,encode:We("SHA-256")}),Ye=Be({name:"sha2-512",code:19,encode:We("SHA-512")});var $e=Object.freeze({__proto__:null,sha256:Ge,sha512:Ye});const Xe=C,Ze={code:0,name:"identity",encode:Xe,digest:e=>He(0,Xe(e))};var Qe=Object.freeze({__proto__:null,identity:Ze});new TextEncoder,new TextDecoder;const et=A(A(A(A(A(A(A(A(A(A({},F),G),$),Z),te),he),pe),be),Ee),Ie);function tt(e,t,r,i){return {name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}A(A({},$e),Qe);const rt=tt("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>(new TextEncoder).encode(e.substring(1))),it=tt("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{const t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),nt=A({utf8:rt,"utf-8":rt,hex:et.base16,latin1:it,ascii:it,binary:it},et);const st="core",ot="wc@2:core:",ct="error",at={database:":memory:"},ut="client_ed25519_seed",lt=w.ONE_DAY,ht=w.SIX_HOURS,dt="relayer_message",ft="relayer_connect",pt="relayer_disconnect",gt="relayer_error",yt="relayer_connection_stalled",bt="relayer_transport_closed",vt="relayer_publish",mt="payload",_t="connect",wt="disconnect",Et="error",Ot=w.ONE_SECOND,St="subscription_created",jt="subscription_deleted",Rt="subscription_sync",It="subscription_resubscribed",Pt=(w.THIRTY_DAYS,1e3*w.FIVE_SECONDS),Nt=(w.THIRTY_DAYS,{wc_pairingDelete:{req:{ttl:w.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:w.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:w.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:w.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:w.ONE_DAY,prompt:!1,tag:0},res:{ttl:w.ONE_DAY,prompt:!1,tag:0}}}),Tt="history_created",xt="history_updated",Lt="history_deleted",At="history_sync",Ut="expirer_created",Mt="expirer_deleted",Ct="expirer_expired",Dt="expirer_sync";w.ONE_DAY;class zt{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=ot,this.init=()=>U(this,null,(function*(){if(!this.initialized){const e=yield this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0;}})),this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=(e,t)=>U(this,null,(function*(){this.isInitialized(),this.keychain.set(e,t),yield this.persist();})),this.get=e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=Object(_.r)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t},this.del=e=>U(this,null,(function*(){this.isInitialized(),this.keychain.delete(e),yield this.persist();})),this.core=e,this.logger=Object(l.generateChildLogger)(t,this.name);}get context(){return Object(l.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}setKeyChain(e){return U(this,null,(function*(){yield this.core.storage.setItem(this.storageKey,Object(_.X)(e));}))}getKeyChain(){return U(this,null,(function*(){const e=yield this.core.storage.getItem(this.storageKey);return typeof e<"u"?Object(_.Y)(e):void 0}))}persist(){return U(this,null,(function*(){yield this.setKeyChain(this.keychain);}))}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}class kt{constructor(e,t,r){this.core=e,this.logger=t,this.name="crypto",this.initialized=!1,this.init=()=>U(this,null,(function*(){this.initialized||(yield this.keychain.init(),this.initialized=!0);})),this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=()=>U(this,null,(function*(){this.isInitialized();const e=yield this.getClientSeed(),t=m.generateKeyPair(e);return m.encodeIss(t.publicKey)})),this.generateKeyPair=()=>{this.isInitialized();const e=Object(_.o)();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=e=>U(this,null,(function*(){this.isInitialized();const t=yield this.getClientSeed(),r=m.generateKeyPair(t),i=Object(_.p)(),n=lt;return yield m.signJWT(i,e,n,r)})),this.generateSharedKey=(e,t,r)=>{this.isInitialized();const i=this.getPrivateKey(e),n=Object(_.g)(i,t);return this.setSymKey(n,r)},this.setSymKey=(e,t)=>U(this,null,(function*(){this.isInitialized();const r=t||Object(_.w)(e);return yield this.keychain.set(r,e),r})),this.deleteKeyPair=e=>U(this,null,(function*(){this.isInitialized(),yield this.keychain.del(e);})),this.deleteSymKey=e=>U(this,null,(function*(){this.isInitialized(),yield this.keychain.del(e);})),this.encode=(e,t,r)=>U(this,null,(function*(){this.isInitialized();const i=Object(_.cb)(r),n=Object(v.b)(t);if(Object(_.D)(i)){const t=i.senderPublicKey,r=i.receiverPublicKey;e=yield this.generateSharedKey(t,r);}const s=this.getSymKey(e),{type:o,senderPublicKey:c}=i;return Object(_.i)({type:o,symKey:s,message:n,senderPublicKey:c})})),this.decode=(e,t,r)=>U(this,null,(function*(){this.isInitialized();const i=Object(_.bb)(t,r);if(Object(_.D)(i)){const t=i.receiverPublicKey,r=i.senderPublicKey;e=yield this.generateSharedKey(t,r);}const n=this.getSymKey(e),s=Object(_.f)({symKey:n,encoded:t});return Object(v.a)(s)})),this.core=e,this.logger=Object(l.generateChildLogger)(t,this.name),this.keychain=r||new zt(this.core,this.logger);}get context(){return Object(l.getLoggerContext)(this.logger)}getPayloadType(e){const t=Object(_.h)(e);return Object(_.e)(t.type)}setPrivateKey(e,t){return U(this,null,(function*(){return yield this.keychain.set(e,t),e}))}getPrivateKey(e){return this.keychain.get(e)}getClientSeed(){return U(this,null,(function*(){let e="";try{e=this.keychain.get(ut);}catch(t){e=Object(_.p)(),yield this.keychain.set(ut,e);}return function(e,t="utf8"){const r=nt[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return "utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):globalThis.Buffer.from(e,"utf8")}(e,"base16")}))}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Kt extends class{constructor(e,t){this.logger=e,this.core=t;}}{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=ot,this.init=()=>U(this,null,(function*(){if(!this.initialized){this.logger.trace("Initialized");try{const e=yield this.getRelayerMessages();typeof e<"u"&&(this.messages=e),this.logger.debug("Successfully Restored records for "+this.name),this.logger.trace({type:"method",method:"restore",size:this.messages.size});}catch(e){this.logger.debug("Failed to Restore records for "+this.name),this.logger.error(e);}finally{this.initialized=!0;}}})),this.set=(e,t)=>U(this,null,(function*(){this.isInitialized();const r=Object(_.x)(t);let i=this.messages.get(e);return typeof i>"u"&&(i={}),typeof i[r]<"u"||(i[r]=t,this.messages.set(e,i),yield this.persist()),r})),this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>{this.isInitialized();return typeof this.get(e)[Object(_.x)(t)]<"u"},this.del=e=>U(this,null,(function*(){this.isInitialized(),this.messages.delete(e),yield this.persist();})),this.logger=Object(l.generateChildLogger)(e,this.name),this.core=t;}get context(){return Object(l.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}setRelayerMessages(e){return U(this,null,(function*(){yield this.core.storage.setItem(this.storageKey,Object(_.X)(e));}))}getRelayerMessages(){return U(this,null,(function*(){const e=yield this.core.storage.getItem(this.storageKey);return typeof e<"u"?Object(_.Y)(e):void 0}))}persist(){return U(this,null,(function*(){yield this.setRelayerMessages(this.messages);}))}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Vt extends p{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new i.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=1e4,this.publish=(e,t,r)=>U(this,null,(function*(){this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});try{const i=(null==r?void 0:r.ttl)||ht,n=Object(_.t)(r),s=(null==r?void 0:r.prompt)||!1,o=(null==r?void 0:r.tag)||0,c={topic:e,message:t,opts:{ttl:i,relay:n,prompt:s,tag:o}},a=Object(_.x)(t);this.queue.set(a,c);try{yield yield Object(_.d)(this.rpcPublish(e,t,i,n,s,o),this.publishTimeout),this.relayer.events.emit(vt,c);}catch(e){return this.logger.debug("Publishing Payload stalled"),void this.relayer.events.emit(yt)}this.onPublish(a,c),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});}catch(e){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(e),e}})),this.on=(e,t)=>{this.events.on(e,t);},this.once=(e,t)=>{this.events.once(e,t);},this.off=(e,t)=>{this.events.off(e,t);},this.removeListener=(e,t)=>{this.events.removeListener(e,t);},this.relayer=e,this.logger=Object(l.generateChildLogger)(t,this.name),this.registerEventListeners();}get context(){return Object(l.getLoggerContext)(this.logger)}rpcPublish(e,t,r,i,n,s){var o,c,a,u;const l={method:Object(_.s)(i.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:n,tag:s}};return Object(_.E)(null==(o=l.params)?void 0:o.prompt)&&(null==(c=l.params)||delete c.prompt),Object(_.E)(null==(a=l.params)?void 0:a.tag)&&(null==(u=l.params)||delete u.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:l}),this.relayer.provider.request(l)}onPublish(e,t){this.queue.delete(e);}checkQueue(){this.queue.forEach(e=>U(this,null,(function*(){const{topic:t,message:r,opts:i}=e;yield this.publish(t,r,i);})));}registerEventListeners(){this.relayer.core.heartbeat.on(u.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue();});}}class qt{constructor(){this.map=new Map,this.set=(e,t)=>{const r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t]);},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const r=this.get(e);if(!this.exists(e,t))return;const i=r.filter(e=>e!==t);i.length?this.map.set(e,i):this.map.delete(e);},this.clear=()=>{this.map.clear();};}get topics(){return Array.from(this.map.keys())}}var Ht=Object.defineProperty,Jt=Object.defineProperties,Bt=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertySymbols,Wt=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,Yt=(e,t,r)=>t in e?Ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$t=(e,t)=>{for(var r in t||(t={}))Wt.call(t,r)&&Yt(e,r,t[r]);if(Ft)for(var r of Ft(t))Gt.call(t,r)&&Yt(e,r,t[r]);return e},Xt=(e,t)=>Jt(e,Bt(t));class Zt extends y{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new qt,this.events=new i.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=ot,this.subscribeTimeout=1e4,this.init=()=>U(this,null,(function*(){this.initialized||(this.logger.trace("Initialized"),yield this.restart(),this.registerEventListeners(),this.onEnable());})),this.subscribe=(e,t)=>U(this,null,(function*(){this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const r=Object(_.t)(t),i={topic:e,relay:r};this.pending.set(e,i);const n=yield this.rpcSubscribe(e,r);return this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}}),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}})),this.unsubscribe=(e,t)=>U(this,null,(function*(){this.isInitialized(),typeof(null==t?void 0:t.id)<"u"?yield this.unsubscribeById(e,t.id,t):yield this.unsubscribeByTopic(e,t);})),this.isSubscribed=e=>U(this,null,(function*(){return !!this.topics.includes(e)||(yield new Promise((t,r)=>{const i=new w.Watch;i.start(this.pendingSubscriptionWatchLabel);const n=setInterval(()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(n),i.stop(this.pendingSubscriptionWatchLabel),t(!0)),i.elapsed(this.pendingSubscriptionWatchLabel)>=Pt&&(clearInterval(n),i.stop(this.pendingSubscriptionWatchLabel),r(!1));},this.pendingSubInterval);}))})),this.on=(e,t)=>{this.events.on(e,t);},this.once=(e,t)=>{this.events.once(e,t);},this.off=(e,t)=>{this.events.off(e,t);},this.removeListener=(e,t)=>{this.events.removeListener(e,t);},this.restart=()=>U(this,null,(function*(){yield this.restore(),yield this.reset();})),this.relayer=e,this.logger=Object(l.generateChildLogger)(t,this.name);}get context(){return Object(l.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t;}catch(e){}return r}onEnable(){this.cached=[],this.initialized=!0;}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1;}unsubscribeByTopic(e,t){return U(this,null,(function*(){const r=this.topicMap.get(e);yield Promise.all(r.map(r=>U(this,null,(function*(){return yield this.unsubscribeById(e,r,t)}))));}))}unsubscribeById(e,t,r){return U(this,null,(function*(){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{const i=Object(_.t)(r);yield this.rpcUnsubscribe(e,t,i);const n=Object(_.v)("USER_DISCONNECTED",`${this.name}, ${e}`);yield this.onUnsubscribe(e,t,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}))}rpcSubscribe(e,t){return U(this,null,(function*(){const r={method:Object(_.s)(t.protocol).subscribe,params:{topic:e}};let i;this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{i=yield yield Object(_.d)(this.relayer.provider.request(r),this.subscribeTimeout);}catch(e){this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(yt);}return i}))}rpcUnsubscribe(e,t,r){const i={method:Object(_.s)(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.provider.request(i)}onSubscribe(e,t){this.setSubscription(e,Xt($t({},t),{id:e})),this.pending.delete(t.topic);}onResubscribe(e,t){this.addSubscription(e,Xt($t({},t),{id:e})),this.pending.delete(t.topic);}onUnsubscribe(e,t,r){return U(this,null,(function*(){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),yield this.relayer.messages.del(e);}))}setRelayerSubscriptions(e){return U(this,null,(function*(){yield this.relayer.core.storage.setItem(this.storageKey,e);}))}getRelayerSubscriptions(){return U(this,null,(function*(){return yield this.relayer.core.storage.getItem(this.storageKey)}))}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t));}addSubscription(e,t){this.subscriptions.set(e,$t({},t)),this.topicMap.set(t.topic,e),this.events.emit(St,t);}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=Object(_.r)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(jt,Xt($t({},r),{reason:t}));}persist(){return U(this,null,(function*(){yield this.setRelayerSubscriptions(this.values),this.events.emit(Rt);}))}reset(){return U(this,null,(function*(){this.cached.length&&(yield Promise.all(this.cached.map(e=>U(this,null,(function*(){return yield this.resubscribe(e)}))))),this.events.emit(It);}))}restore(){return U(this,null,(function*(){try{const e=yield this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:e}=Object(_.r)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored subscriptions for "+this.name),this.logger.trace({type:"method",method:"restore",subscriptions:this.values});}catch(e){this.logger.debug("Failed to Restore subscriptions for "+this.name),this.logger.error(e);}}))}resubscribe(e){return U(this,null,(function*(){if(!this.ids.includes(e.id)){const{topic:t,relay:r}=e,i={topic:t,relay:r};this.pending.set(i.topic,i);const n=yield this.rpcSubscribe(i.topic,i.relay);this.onResubscribe(n,i);}}))}onConnect(){return U(this,null,(function*(){yield this.restart(),this.onEnable();}))}onDisconnect(){this.onDisable();}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(e=>U(this,null,(function*(){const t=yield this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(t,e);})));}registerEventListeners(){this.relayer.core.heartbeat.on(u.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending();}),this.relayer.on(ft,()=>U(this,null,(function*(){yield this.onConnect();}))),this.relayer.on(pt,()=>{this.onDisconnect();}),this.events.on(St,e=>U(this,null,(function*(){const t=St;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,data:e}),yield this.persist();}))),this.events.on(jt,e=>U(this,null,(function*(){const t=jt;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,data:e}),yield this.persist();})));}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Qt=Object.defineProperty,er=Object.getOwnPropertySymbols,tr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,ir=(e,t,r)=>t in e?Qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;class nr extends g{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new i.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?Object(l.generateChildLogger)(e.logger,this.name):o()(Object(l.getDefaultLoggerOptions)({level:e.logger||"error"})),this.messages=new Kt(this.logger,e.core),this.subscriber=new Zt(this,this.logger),this.publisher=new Vt(this,this.logger),this.relayUrl=(null==e?void 0:e.relayUrl)||"wss://relay.walletconnect.com",this.projectId=e.projectId,this.provider={};}init(){return U(this,null,(function*(){this.logger.trace("Initialized"),this.provider=yield this.createProvider(),yield Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0;}))}get context(){return Object(l.getLoggerContext)(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}publish(e,t,r){return U(this,null,(function*(){this.isInitialized(),yield this.publisher.publish(e,t,r),yield this.recordMessageEvent({topic:e,message:t});}))}subscribe(e,t){return U(this,null,(function*(){this.isInitialized();let r="";return yield Promise.all([new Promise(t=>{this.subscriber.once(St,r=>{r.topic===e&&t();});}),new Promise(i=>U(this,null,(function*(){r=yield this.subscriber.subscribe(e,t),i();})))]),r}))}unsubscribe(e,t){return U(this,null,(function*(){this.isInitialized(),yield this.subscriber.unsubscribe(e,t);}))}on(e,t){this.events.on(e,t);}once(e,t){this.events.once(e,t);}off(e,t){this.events.off(e,t);}removeListener(e,t){this.events.removeListener(e,t);}transportClose(){return U(this,null,(function*(){this.transportExplicitlyClosed=!0,this.connected&&(yield this.provider.disconnect(),this.events.emit(bt));}))}transportOpen(e){return U(this,null,(function*(){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1;try{yield Promise.all([new Promise(e=>{this.initialized||e(),this.subscriber.once(It,()=>{e();});}),yield Promise.race([this.provider.connect(),new Promise((e,t)=>this.once(bt,()=>{t(new Error("closeTransport called before connection was established"));}))])]);}catch(e){const t=e;if(!/socket hang up/i.test(t.message))throw new Error(t.message);this.logger.error(t),this.events.emit(bt);}}))}restartTransport(e){return U(this,null,(function*(){yield this.transportClose(),yield new Promise(e=>setTimeout(e,Ot)),yield this.transportOpen(e);}))}createProvider(){return U(this,null,(function*(){const e=yield this.core.crypto.signJWT(this.relayUrl);return new S(new j(Object(_.l)({sdkVersion:"2.3.3",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}))}recordMessageEvent(e){return U(this,null,(function*(){const{topic:t,message:r}=e;yield this.messages.set(t,r);}))}shouldIgnoreMessageEvent(e){return U(this,null,(function*(){const{topic:t,message:r}=e;return !(yield this.subscriber.isSubscribed(t))||this.messages.has(t,r)}))}onProviderPayload(e){return U(this,null,(function*(){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Object(E.isJsonRpcRequest)(e)){if(!e.method.endsWith("_subscription"))return;const t=e.params,{topic:r,message:i}=t.data,n={topic:r,message:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(((e,t)=>{for(var r in t||(t={}))tr.call(t,r)&&ir(e,r,t[r]);if(er)for(var r of er(t))rr.call(t,r)&&ir(e,r,t[r]);return e})({type:"event",event:t.id},n)),this.events.emit(t.id,n),yield this.acknowledgePayload(e),yield this.onMessageEvent(n);}}))}onMessageEvent(e){return U(this,null,(function*(){(yield this.shouldIgnoreMessageEvent(e))||(this.events.emit(dt,e),yield this.recordMessageEvent(e));}))}acknowledgePayload(e){return U(this,null,(function*(){const t=Object(E.formatJsonRpcResult)(e.id,!0);yield this.provider.connection.send(t);}))}registerEventListeners(){this.provider.on(mt,e=>this.onProviderPayload(e)),this.provider.on(_t,()=>{this.events.emit(ft);}),this.provider.on(wt,()=>{this.events.emit(pt),this.attemptToReconnect();}),this.provider.on(Et,e=>this.events.emit(gt,e)),this.events.on(yt,()=>U(this,null,(function*(){yield this.restartTransport();})));}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(()=>U(this,null,(function*(){yield this.transportOpen();})),Object(w.toMiliseconds)(Ot));}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}var sr=Object.defineProperty,or=Object.getOwnPropertySymbols,cr=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable,ur=(e,t,r)=>t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lr=(e,t)=>{for(var r in t||(t={}))cr.call(t,r)&&ur(e,r,t[r]);if(or)for(var r of or(t))ar.call(t,r)&&ur(e,r,t[r]);return e};class hr extends class{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r;}}{constructor(e,t,r,i=ot,n){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ot,this.init=()=>U(this,null,(function*(){this.initialized||(this.logger.trace("Initialized"),yield this.restore(),this.cached.forEach(e=>{Object(_.A)(e)?this.map.set(e.id,e):Object(_.C)(e)?this.map.set(e.topic,e):this.getKey&&null!==e&&!Object(_.E)(e)&&this.map.set(this.getKey(e),e);}),this.cached=[],this.initialized=!0);})),this.set=(e,t)=>U(this,null,(function*(){this.isInitialized(),this.map.has(e)?yield this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),yield this.persist());})),this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>I()(t[r],e[r]))):this.values),this.update=(e,t)=>U(this,null,(function*(){this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const r=lr(lr({},this.getData(e)),t);this.map.set(e,r),yield this.persist();})),this.delete=(e,t)=>U(this,null,(function*(){this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),yield this.persist());})),this.logger=Object(l.generateChildLogger)(t,this.name),this.storagePrefix=i,this.getKey=n;}get context(){return Object(l.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}setDataStore(e){return U(this,null,(function*(){yield this.core.storage.setItem(this.storageKey,e);}))}getDataStore(){return U(this,null,(function*(){return yield this.core.storage.getItem(this.storageKey)}))}getData(e){const t=this.map.get(e);if(!t){const{message:t}=Object(_.r)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}persist(){return U(this,null,(function*(){yield this.setDataStore(this.values);}))}restore(){return U(this,null,(function*(){try{const e=yield this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=Object(_.r)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored value for "+this.name),this.logger.trace({type:"method",method:"restore",value:this.values});}catch(e){this.logger.debug("Failed to Restore value for "+this.name),this.logger.error(e);}}))}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}class dr{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new n.a,this.initialized=!1,this.storagePrefix=ot,this.ignoredPayloadTypes=[_.a],this.registeredMethods=[],this.init=()=>U(this,null,(function*(){this.initialized||(yield this.pairings.init(),yield this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"));})),this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])];},this.create=()=>U(this,null,(function*(){this.isInitialized();const e=Object(_.p)(),t=yield this.core.crypto.setSymKey(e),r=Object(_.b)(w.FIVE_MINUTES),i={protocol:"irn"},n={topic:t,expiry:r,relay:i,active:!1},s=Object(_.n)({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:e,relay:i});return yield this.pairings.set(t,n),yield this.core.relayer.subscribe(t),this.core.expirer.set(t,r),{topic:t,uri:s}})),this.pair=e=>U(this,null,(function*(){this.isInitialized(),this.isValidPair(e);const{topic:t,symKey:r,relay:i}=Object(_.ab)(e.uri),n=Object(_.b)(w.FIVE_MINUTES),s={topic:t,relay:i,expiry:n,active:!1};return yield this.pairings.set(t,s),yield this.core.crypto.setSymKey(r,t),yield this.core.relayer.subscribe(t,{relay:i}),this.core.expirer.set(t,n),e.activatePairing&&(yield this.activate({topic:t})),s})),this.activate=e=>U(this,[e],(function*({topic:e}){this.isInitialized();const t=Object(_.b)(w.THIRTY_DAYS);yield this.pairings.update(e,{active:!0,expiry:t}),this.core.expirer.set(e,t);})),this.ping=e=>U(this,null,(function*(){this.isInitialized(),yield this.isValidPing(e);const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=yield this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=Object(_.c)();this.events.once(Object(_.j)("pairing_ping",e),({error:e})=>{e?n(e):i();}),yield r();}})),this.updateExpiry=e=>U(this,[e],(function*({topic:e,expiry:t}){this.isInitialized(),yield this.pairings.update(e,{expiry:t});})),this.updateMetadata=e=>U(this,[e],(function*({topic:e,metadata:t}){this.isInitialized(),yield this.pairings.update(e,{peerMetadata:t});})),this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=e=>U(this,null,(function*(){this.isInitialized(),yield this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(yield this.sendRequest(t,"wc_pairingDelete",Object(_.v)("USER_DISCONNECTED")),yield this.deletePairing(t));})),this.sendRequest=(e,t,r)=>U(this,null,(function*(){const i=Object(E.formatJsonRpcRequest)(t,r),n=yield this.core.crypto.encode(e,i),s=Nt[t].req;return this.core.history.set(e,i),yield this.core.relayer.publish(e,n,s),i.id})),this.sendResult=(e,t,r)=>U(this,null,(function*(){const i=Object(E.formatJsonRpcResult)(e,r),n=yield this.core.crypto.encode(t,i),s=yield this.core.history.get(t,e),o=Nt[s.request.method].res;yield this.core.relayer.publish(t,n,o),yield this.core.history.resolve(i);})),this.sendError=(e,t,r)=>U(this,null,(function*(){const i=Object(E.formatJsonRpcError)(e,r),n=yield this.core.crypto.encode(t,i),s=yield this.core.history.get(t,e),o=Nt[s.request.method]?Nt[s.request.method].res:Nt.unregistered_method.res;yield this.core.relayer.publish(t,n,o),yield this.core.history.resolve(i);})),this.deletePairing=(e,t)=>U(this,null,(function*(){yield this.core.relayer.unsubscribe(e),yield Promise.all([this.pairings.delete(e,Object(_.v)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)]);})),this.cleanup=()=>U(this,null,(function*(){const e=this.pairings.getAll().filter(e=>Object(_.z)(e.expiry));yield Promise.all(e.map(e=>this.deletePairing(e.topic)));})),this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e,i=r.method;if(this.pairings.keys.includes(t))switch(i){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}},this.onRelayEventResponse=e=>U(this,null,(function*(){const{topic:t,payload:r}=e,i=(yield this.core.history.get(t,r.id)).request.method;if(this.pairings.keys.includes(t))switch(i){case"wc_pairingPing":return this.onPairingPingResponse(t,r);default:return this.onUnknownRpcMethodResponse(i)}})),this.onPairingPingRequest=(e,t)=>U(this,null,(function*(){const{id:r}=t;try{this.isValidPing({topic:e}),yield this.sendResult(r,e,!0),this.events.emit("pairing_ping",{id:r,topic:e});}catch(t){yield this.sendError(r,e,t),this.logger.error(t);}})),this.onPairingPingResponse=(e,t)=>{const{id:r}=t;setTimeout(()=>{Object(E.isJsonRpcResult)(t)?this.events.emit(Object(_.j)("pairing_ping",r),{}):Object(E.isJsonRpcError)(t)&&this.events.emit(Object(_.j)("pairing_ping",r),{error:t.error});},500);},this.onPairingDeleteRequest=(e,t)=>U(this,null,(function*(){const{id:r}=t;try{this.isValidDisconnect({topic:e}),yield this.sendResult(r,e,!0),yield this.deletePairing(e),this.events.emit("pairing_delete",{id:r,topic:e});}catch(t){yield this.sendError(r,e,t),this.logger.error(t);}})),this.onUnknownRpcMethodRequest=(e,t)=>U(this,null,(function*(){const{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;const t=Object(_.v)("WC_METHOD_UNSUPPORTED",i);yield this.sendError(r,e,t),this.logger.error(t);}catch(t){yield this.sendError(r,e,t),this.logger.error(t);}})),this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error(Object(_.v)("WC_METHOD_UNSUPPORTED",e));},this.isValidPair=e=>{if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","pair() params: "+e);throw new Error(t)}if(!Object(_.W)(e.uri)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","pair() uri: "+e.uri);throw new Error(t)}},this.isValidPing=e=>U(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","ping() params: "+e);throw new Error(t)}const{topic:t}=e;yield this.isValidPairingTopic(t);})),this.isValidDisconnect=e=>U(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","disconnect() params: "+e);throw new Error(t)}const{topic:t}=e;yield this.isValidPairingTopic(t);})),this.isValidPairingTopic=e=>U(this,null,(function*(){if(!Object(_.V)(e,!1)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","pairing topic should be a string: "+e);throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=Object(_.r)("NO_MATCHING_KEY","pairing topic doesn't exist: "+e);throw new Error(t)}if(Object(_.z)(this.pairings.get(e).expiry)){yield this.deletePairing(e);const{message:t}=Object(_.r)("EXPIRED","pairing topic: "+e);throw new Error(t)}})),this.core=e,this.logger=Object(l.generateChildLogger)(t,this.name),this.pairings=new hr(this.core,this.logger,this.name,this.storagePrefix);}get context(){return Object(l.getLoggerContext)(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(dt,e=>U(this,null,(function*(){const{topic:t,message:r}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;const i=yield this.core.crypto.decode(t,r);Object(E.isJsonRpcRequest)(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):Object(E.isJsonRpcResponse)(i)&&(yield this.core.history.resolve(i),this.onRelayEventResponse({topic:t,payload:i}));})));}registerExpirerEvents(){this.core.expirer.on(Ct,e=>U(this,null,(function*(){const{topic:t}=Object(_.Z)(e.target);t&&this.pairings.keys.includes(t)&&(yield this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}));})));}}class fr extends f{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new i.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ot,this.init=()=>U(this,null,(function*(){this.initialized||(this.logger.trace("Initialized"),yield this.restore(),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0);})),this.set=(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;const i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r};this.records.set(i.id,i),this.events.emit(Tt,i);},this.resolve=e=>U(this,null,(function*(){if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=yield this.getRecord(e.id);typeof t.response>"u"&&(t.response=Object(E.isJsonRpcError)(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.events.emit(xt,t));})),this.get=(e,t)=>U(this,null,(function*(){return this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),yield this.getRecord(t)})),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach(r=>{if(r.topic===e){if(typeof t<"u"&&r.id!==t)return;this.records.delete(r.id),this.events.emit(Lt,r);}});},this.exists=(e,t)=>U(this,null,(function*(){return this.isInitialized(),!!this.records.has(t)&&(yield this.getRecord(t)).topic===e})),this.on=(e,t)=>{this.events.on(e,t);},this.once=(e,t)=>{this.events.once(e,t);},this.off=(e,t)=>{this.events.off(e,t);},this.removeListener=(e,t)=>{this.events.removeListener(e,t);},this.logger=Object(l.generateChildLogger)(t,this.name);}get context(){return Object(l.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const r={topic:t.topic,request:Object(E.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)}),e}setJsonRpcRecords(e){return U(this,null,(function*(){yield this.core.storage.setItem(this.storageKey,e);}))}getJsonRpcRecords(){return U(this,null,(function*(){return yield this.core.storage.getItem(this.storageKey)}))}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=Object(_.r)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(t)}return t}persist(){return U(this,null,(function*(){yield this.setJsonRpcRecords(this.values),this.events.emit(At);}))}restore(){return U(this,null,(function*(){try{const e=yield this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=Object(_.r)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored records for "+this.name),this.logger.trace({type:"method",method:"restore",records:this.values});}catch(e){this.logger.debug("Failed to Restore records for "+this.name),this.logger.error(e);}}))}registerEventListeners(){this.events.on(Tt,e=>{const t=Tt;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,record:e}),this.persist();}),this.events.on(xt,e=>{const t=xt;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,record:e}),this.persist();}),this.events.on(Lt,e=>{const t=Lt;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,record:e}),this.persist();});}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}class pr extends b{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new i.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=ot,this.init=()=>U(this,null,(function*(){this.initialized||(this.logger.trace("Initialized"),yield this.restore(),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0);})),this.has=e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch(e){return !1}},this.set=(e,t)=>{this.isInitialized();const r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(Ut,{target:r,expiration:i});},this.get=e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(Mt,{target:t,expiration:r});}},this.on=(e,t)=>{this.events.on(e,t);},this.once=(e,t)=>{this.events.once(e,t);},this.off=(e,t)=>{this.events.off(e,t);},this.removeListener=(e,t)=>{this.events.removeListener(e,t);},this.logger=Object(l.generateChildLogger)(t,this.name);}get context(){return Object(l.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return Object(_.m)(e);if("number"==typeof e)return Object(_.k)(e);const{message:t}=Object(_.r)("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(t)}setExpirations(e){return U(this,null,(function*(){yield this.core.storage.setItem(this.storageKey,e);}))}getExpirations(){return U(this,null,(function*(){return yield this.core.storage.getItem(this.storageKey)}))}persist(){return U(this,null,(function*(){yield this.setExpirations(this.values),this.events.emit(Dt);}))}restore(){return U(this,null,(function*(){try{const e=yield this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=Object(_.r)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored expirations for "+this.name),this.logger.trace({type:"method",method:"restore",expirations:this.values});}catch(e){this.logger.debug("Failed to Restore expirations for "+this.name),this.logger.error(e);}}))}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=Object(_.r)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:r}=t;Object(w.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t);}expire(e,t){this.expirations.delete(e),this.events.emit(Ct,{target:e,expiration:t});}checkExpirations(){this.expirations.forEach((e,t)=>this.checkExpiry(t,e));}registerEventListeners(){this.core.heartbeat.on(u.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Ut,e=>{const t=Ut;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,data:e}),this.persist();}),this.events.on(Ct,e=>{const t=Ct;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,data:e}),this.persist();}),this.events.on(Mt,e=>{const t=Mt;this.logger.info("Emitting "+t),this.logger.debug({type:"event",event:t,data:e}),this.persist();});}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}}var gr=Object.defineProperty,yr=Object.getOwnPropertySymbols,br=Object.prototype.hasOwnProperty,vr=Object.prototype.propertyIsEnumerable,mr=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_r=(e,t)=>{for(var r in t||(t={}))br.call(t,r)&&mr(e,r,t[r]);if(yr)for(var r of yr(t))vr.call(t,r)&&mr(e,r,t[r]);return e};class wr extends d{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=st,this.events=new i.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.projectId=null==e?void 0:e.projectId;const t=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:o()(Object(l.getDefaultLoggerOptions)({level:(null==e?void 0:e.logger)||ct}));this.logger=Object(l.generateChildLogger)(t,this.name),this.heartbeat=new u.HeartBeat,this.crypto=new kt(this,this.logger,null==e?void 0:e.keychain),this.history=new fr(this,this.logger),this.expirer=new pr(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new a.a(_r(_r({},at),null==e?void 0:e.storageOptions)),this.relayer=new nr({core:this,logger:this.logger,relayUrl:null==e?void 0:e.relayUrl,projectId:this.projectId}),this.pairing=new dr(this,this.logger);}static init(e){return U(this,null,(function*(){const t=new wr(e);return yield t.initialize(),t}))}get context(){return Object(l.getLoggerContext)(this.logger)}start(){return U(this,null,(function*(){this.initialized||(yield this.initialize());}))}initialize(){return U(this,null,(function*(){this.logger.trace("Initialized");try{yield this.crypto.init(),yield this.history.init(),yield this.expirer.init(),yield this.relayer.init(),yield this.heartbeat.init(),yield this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success");}catch(e){throw this.logger.warn("Core Initialization Failure at epoch "+Date.now(),e),this.logger.error(e.message),e}}))}}const Er=wr;var Or=(e,t,r)=>new Promise((i,n)=>{var s=e=>{try{c(r.next(e));}catch(e){n(e);}},o=e=>{try{c(r.throw(e));}catch(e){n(e);}},c=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);c((r=r.apply(e,t)).next());});const Sr="client",jr=`wc@2:${Sr}:`,Rr=Sr,Ir="error",Pr=(w.THIRTY_DAYS,w.SEVEN_DAYS),Nr={wc_sessionPropose:{req:{ttl:w.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:w.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:w.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:w.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:w.ONE_DAY,prompt:!1,tag:1104},res:{ttl:w.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:w.ONE_DAY,prompt:!1,tag:1106},res:{ttl:w.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:w.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:w.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:w.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:w.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:w.ONE_DAY,prompt:!1,tag:1112},res:{ttl:w.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:w.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:w.THIRTY_SECONDS,prompt:!1,tag:1115}}},Tr={min:w.FIVE_MINUTES,max:w.SEVEN_DAYS};var xr=Object.defineProperty,Lr=Object.defineProperties,Ar=Object.getOwnPropertyDescriptors,Ur=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,Dr=(e,t,r)=>t in e?xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zr=(e,t)=>{for(var r in t||(t={}))Mr.call(t,r)&&Dr(e,r,t[r]);if(Ur)for(var r of Ur(t))Cr.call(t,r)&&Dr(e,r,t[r]);return e},kr=(e,t)=>Lr(e,Ar(t));class Kr extends class{constructor(e){this.client=e;}}{constructor(e){super(e),this.name="engine",this.events=new n.a,this.initialized=!1,this.ignoredPayloadTypes=[_.a],this.init=()=>Or(this,null,(function*(){this.initialized||(yield this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Nr)}),this.initialized=!0);})),this.connect=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidConnect(e);const{pairingTopic:t,requiredNamespaces:r,relays:i}=e;let n,s=t,o=!1;if(s&&(o=this.client.core.pairing.pairings.get(s).active),!s||!o){const{topic:e,uri:t}=yield this.client.core.pairing.create();s=e,n=t;}const c=yield this.client.core.crypto.generateKeyPair(),a={requiredNamespaces:r,relays:null!=i?i:[{protocol:"irn"}],proposer:{publicKey:c,metadata:this.client.metadata}},{reject:u,resolve:l,done:h}=Object(_.c)();if(this.events.once(Object(_.j)("session_connect"),e=>Or(this,[e],(function*({error:e,session:t}){if(e)u(e);else if(t){t.self.publicKey=c;const e=kr(zr({},t),{requiredNamespaces:t.requiredNamespaces});yield this.client.session.set(t.topic,e),yield this.setExpiry(t.topic,t.expiry),s&&(yield this.client.core.pairing.updateMetadata({topic:s,metadata:t.peer.metadata})),l(e);}}))),!s){const{message:e}=Object(_.r)("NO_MATCHING_KEY","connect() pairing topic: "+s);throw new Error(e)}const d=yield this.sendRequest(s,"wc_sessionPropose",a),f=Object(_.b)(w.FIVE_MINUTES);return yield this.setProposal(d,zr({id:d,expiry:f},a)),{uri:n,approval:h}})),this.pair=e=>Or(this,null,(function*(){return this.isInitialized(),yield this.client.core.pairing.pair(e)})),this.approve=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidApprove(e);const{id:t,relayProtocol:r,namespaces:i}=e,n=this.client.proposal.get(t);let{pairingTopic:s,proposer:o,requiredNamespaces:c}=n;Object(_.N)(c)||(c=Object(_.u)(i,"approve()"),this.client.proposal.set(t,kr(zr({},n),{requiredNamespaces:c})));const a=yield this.client.core.crypto.generateKeyPair(),u=o.publicKey,l=yield this.client.core.crypto.generateSharedKey(a,u),h={relay:{protocol:null!=r?r:"irn"},namespaces:i,requiredNamespaces:c,controller:{publicKey:a,metadata:this.client.metadata},expiry:Object(_.b)(Pr)};yield this.client.core.relayer.subscribe(l);const d=yield this.sendRequest(l,"wc_sessionSettle",h),{done:f,resolve:p,reject:g}=Object(_.c)();this.events.once(Object(_.j)("session_approve",d),({error:e})=>{e?g(e):p(this.client.session.get(l));});const y=kr(zr({},h),{topic:l,acknowledged:!1,self:h.controller,peer:{publicKey:o.publicKey,metadata:o.metadata},controller:a});return yield this.client.session.set(l,y),yield this.setExpiry(l,Object(_.b)(Pr)),s&&(yield this.client.core.pairing.updateMetadata({topic:s,metadata:y.peer.metadata})),s&&t&&(yield this.sendResult(t,s,{relay:{protocol:null!=r?r:"irn"},responderPublicKey:a}),yield this.client.proposal.delete(t,Object(_.v)("USER_DISCONNECTED")),yield this.client.core.pairing.activate({topic:s})),{topic:l,acknowledged:f}})),this.reject=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidReject(e);const{id:t,reason:r}=e,{pairingTopic:i}=this.client.proposal.get(t);i&&(yield this.sendError(t,i,r),yield this.client.proposal.delete(t,Object(_.v)("USER_DISCONNECTED")));})),this.update=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidUpdate(e);const{topic:t,namespaces:r}=e,i=yield this.sendRequest(t,"wc_sessionUpdate",{namespaces:r}),{done:n,resolve:s,reject:o}=Object(_.c)();return this.events.once(Object(_.j)("session_update",i),({error:e})=>{e?o(e):s();}),yield this.client.session.update(t,{namespaces:r}),{acknowledged:n}})),this.extend=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidExtend(e);const{topic:t}=e,r=yield this.sendRequest(t,"wc_sessionExtend",{}),{done:i,resolve:n,reject:s}=Object(_.c)();return this.events.once(Object(_.j)("session_extend",r),({error:e})=>{e?s(e):n();}),yield this.setExpiry(t,Object(_.b)(Pr)),{acknowledged:i}})),this.request=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidRequest(e);const{chainId:t,request:r,topic:i,expiry:n}=e,s=yield this.sendRequest(i,"wc_sessionRequest",{request:r,chainId:t},n),{done:o,resolve:c,reject:a}=Object(_.c)(n);return this.events.once(Object(_.j)("session_request",s),({error:e,result:t})=>{e?a(e):c(t);}),yield o()})),this.respond=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidRespond(e);const{topic:t,response:r}=e,{id:i}=r;Object(E.isJsonRpcResult)(r)?yield this.sendResult(i,t,r.result):Object(E.isJsonRpcError)(r)&&(yield this.sendError(i,t,r.error)),this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0});})),this.ping=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidPing(e);const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=yield this.sendRequest(t,"wc_sessionPing",{}),{done:r,resolve:i,reject:n}=Object(_.c)();this.events.once(Object(_.j)("session_ping",e),({error:e})=>{e?n(e):i();}),yield r();}else this.client.core.pairing.pairings.keys.includes(t)&&(yield this.client.core.pairing.ping({topic:t}));})),this.emit=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidEmit(e);const{topic:t,event:r,chainId:i}=e;yield this.sendRequest(t,"wc_sessionEvent",{event:r,chainId:i});})),this.disconnect=e=>Or(this,null,(function*(){this.isInitialized(),yield this.isValidDisconnect(e);const{topic:t}=e;this.client.session.keys.includes(t)?(yield this.sendRequest(t,"wc_sessionDelete",Object(_.v)("USER_DISCONNECTED")),yield this.deleteSession(t)):yield this.client.core.pairing.disconnect({topic:t});})),this.find=e=>(this.isInitialized(),this.client.session.getAll().filter(t=>Object(_.B)(t,e))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=(e,t)=>Or(this,null,(function*(){const{self:r}=this.client.session.get(e);yield this.client.core.relayer.unsubscribe(e),yield Promise.all([this.client.session.delete(e,Object(_.v)("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(r.publicKey),this.client.core.crypto.deleteSymKey(e),t?Promise.resolve():this.client.core.expirer.del(e)]);})),this.deleteProposal=(e,t)=>Or(this,null,(function*(){yield Promise.all([this.client.proposal.delete(e,Object(_.v)("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]);})),this.deletePendingSessionRequest=(e,t,r=!1)=>Or(this,null,(function*(){yield Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]);})),this.setExpiry=(e,t)=>Or(this,null,(function*(){this.client.session.keys.includes(e)&&(yield this.client.session.update(e,{expiry:t})),this.client.core.expirer.set(e,t);})),this.setProposal=(e,t)=>Or(this,null,(function*(){yield this.client.proposal.set(e,t),this.client.core.expirer.set(e,t.expiry);})),this.setPendingSessionRequest=e=>Or(this,null,(function*(){const t=Nr.wc_sessionRequest.req.ttl,{id:r,topic:i,params:n}=e;yield this.client.pendingRequest.set(r,{id:r,topic:i,params:n}),t&&this.client.core.expirer.set(r,Object(_.b)(t));})),this.sendRequest=(e,t,r,i)=>Or(this,null,(function*(){const n=Object(E.formatJsonRpcRequest)(t,r),s=yield this.client.core.crypto.encode(e,n),o=Nr[t].req;return i&&(o.ttl=i),this.client.core.history.set(e,n),this.client.core.relayer.publish(e,s,o),n.id})),this.sendResult=(e,t,r)=>Or(this,null,(function*(){const i=Object(E.formatJsonRpcResult)(e,r),n=yield this.client.core.crypto.encode(t,i),s=yield this.client.core.history.get(t,e),o=Nr[s.request.method].res;this.client.core.relayer.publish(t,n,o),yield this.client.core.history.resolve(i);})),this.sendError=(e,t,r)=>Or(this,null,(function*(){const i=Object(E.formatJsonRpcError)(e,r),n=yield this.client.core.crypto.encode(t,i),s=yield this.client.core.history.get(t,e),o=Nr[s.request.method].res;this.client.core.relayer.publish(t,n,o),yield this.client.core.history.resolve(i);})),this.cleanup=()=>Or(this,null,(function*(){const e=[],t=[];this.client.session.getAll().forEach(t=>{Object(_.z)(t.expiry)&&e.push(t.topic);}),this.client.proposal.getAll().forEach(e=>{Object(_.z)(e.expiry)&&t.push(e.id);}),yield Promise.all([...e.map(e=>this.deleteSession(e)),...t.map(e=>this.deleteProposal(e))]);})),this.onRelayEventRequest=e=>{const{topic:t,payload:r}=e,i=r.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeRequest(t,r);case"wc_sessionSettle":return this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return this.onSessionExtendRequest(t,r);case"wc_sessionPing":return this.onSessionPingRequest(t,r);case"wc_sessionDelete":return this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return this.onSessionRequest(t,r);case"wc_sessionEvent":return this.onSessionEventRequest(t,r);default:return this.client.logger.info("Unsupported request method "+i)}},this.onRelayEventResponse=e=>Or(this,null,(function*(){const{topic:t,payload:r}=e,i=(yield this.client.core.history.get(t,r.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);default:return this.client.logger.info("Unsupported response method "+i)}})),this.onSessionProposeRequest=(e,t)=>Or(this,null,(function*(){const{params:r,id:i}=t;try{this.isValidConnect(zr({},t.params));const n=Object(_.b)(w.FIVE_MINUTES),s=zr({id:i,pairingTopic:e,expiry:n},r);yield this.setProposal(i,s),this.client.events.emit("session_proposal",{id:i,params:s});}catch(t){yield this.sendError(i,e,t),this.client.logger.error(t);}})),this.onSessionProposeResponse=(e,t)=>Or(this,null,(function*(){const{id:r}=t;if(Object(E.isJsonRpcResult)(t)){const{result:i}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});const n=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:n});const s=n.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s});const o=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:o});const c=yield this.client.core.crypto.generateSharedKey(s,o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});const a=yield this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:a}),yield this.client.core.pairing.activate({topic:e});}else Object(E.isJsonRpcError)(t)&&(yield this.client.proposal.delete(r,Object(_.v)("USER_DISCONNECTED")),this.events.emit(Object(_.j)("session_connect"),{error:t.error}));})),this.onSessionSettleRequest=(e,t)=>Or(this,null,(function*(){const{id:r,params:i}=t;try{this.isValidSessionSettleRequest(i);const{relay:r,controller:n,expiry:s,namespaces:o,requiredNamespaces:c}=t.params,a={topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,requiredNamespaces:c,controller:n.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}};yield this.sendResult(t.id,e,!0),this.events.emit(Object(_.j)("session_connect"),{session:a});}catch(t){yield this.sendError(r,e,t),this.client.logger.error(t);}})),this.onSessionSettleResponse=(e,t)=>Or(this,null,(function*(){const{id:r}=t;Object(E.isJsonRpcResult)(t)?(yield this.client.session.update(e,{acknowledged:!0}),this.events.emit(Object(_.j)("session_approve",r),{})):Object(E.isJsonRpcError)(t)&&(yield this.client.session.delete(e,Object(_.v)("USER_DISCONNECTED")),this.events.emit(Object(_.j)("session_approve",r),{error:t.error}));})),this.onSessionUpdateRequest=(e,t)=>Or(this,null,(function*(){const{params:r,id:i}=t;try{this.isValidUpdate(zr({topic:e},r)),yield this.client.session.update(e,{namespaces:r.namespaces}),yield this.sendResult(i,e,!0),this.client.events.emit("session_update",{id:i,topic:e,params:r});}catch(t){yield this.sendError(i,e,t),this.client.logger.error(t);}})),this.onSessionUpdateResponse=(e,t)=>{const{id:r}=t;Object(E.isJsonRpcResult)(t)?this.events.emit(Object(_.j)("session_update",r),{}):Object(E.isJsonRpcError)(t)&&this.events.emit(Object(_.j)("session_update",r),{error:t.error});},this.onSessionExtendRequest=(e,t)=>Or(this,null,(function*(){const{id:r}=t;try{this.isValidExtend({topic:e}),yield this.setExpiry(e,Object(_.b)(Pr)),yield this.sendResult(r,e,!0),this.client.events.emit("session_extend",{id:r,topic:e});}catch(t){yield this.sendError(r,e,t),this.client.logger.error(t);}})),this.onSessionExtendResponse=(e,t)=>{const{id:r}=t;Object(E.isJsonRpcResult)(t)?this.events.emit(Object(_.j)("session_extend",r),{}):Object(E.isJsonRpcError)(t)&&this.events.emit(Object(_.j)("session_extend",r),{error:t.error});},this.onSessionPingRequest=(e,t)=>Or(this,null,(function*(){const{id:r}=t;try{this.isValidPing({topic:e}),yield this.sendResult(r,e,!0),this.client.events.emit("session_ping",{id:r,topic:e});}catch(t){yield this.sendError(r,e,t),this.client.logger.error(t);}})),this.onSessionPingResponse=(e,t)=>{const{id:r}=t;setTimeout(()=>{Object(E.isJsonRpcResult)(t)?this.events.emit(Object(_.j)("session_ping",r),{}):Object(E.isJsonRpcError)(t)&&this.events.emit(Object(_.j)("session_ping",r),{error:t.error});},500);},this.onSessionDeleteRequest=(e,t)=>Or(this,null,(function*(){const{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),this.client.core.relayer.once(vt,()=>Or(this,null,(function*(){yield this.deleteSession(e);}))),yield this.sendResult(r,e,!0),this.client.events.emit("session_delete",{id:r,topic:e});}catch(t){yield this.sendError(r,e,t),this.client.logger.error(t);}})),this.onSessionRequest=(e,t)=>Or(this,null,(function*(){const{id:r,params:i}=t;try{this.isValidRequest(zr({topic:e},i)),yield this.setPendingSessionRequest({id:r,topic:e,params:i}),this.client.events.emit("session_request",{id:r,topic:e,params:i});}catch(t){yield this.sendError(r,e,t),this.client.logger.error(t);}})),this.onSessionRequestResponse=(e,t)=>{const{id:r}=t;Object(E.isJsonRpcResult)(t)?this.events.emit(Object(_.j)("session_request",r),{result:t.result}):Object(E.isJsonRpcError)(t)&&this.events.emit(Object(_.j)("session_request",r),{error:t.error});},this.onSessionEventRequest=(e,t)=>Or(this,null,(function*(){const{id:r,params:i}=t;try{this.isValidEmit(zr({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i});}catch(t){yield this.sendError(r,e,t),this.client.logger.error(t);}})),this.isValidConnect=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","connect() params: "+JSON.stringify(e));throw new Error(t)}const{pairingTopic:t,requiredNamespaces:r,relays:i}=e;if(Object(_.E)(t)||(yield this.isValidPairingTopic(t)),!Object(_.E)(r)&&0===Object(_.N)(r))return;const n=Object(_.T)(r,"connect()");if(n)throw new Error(n.message);if(!Object(_.Q)(i,!0)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","connect() relays: "+i);throw new Error(e)}})),this.isValidApprove=e=>Or(this,null,(function*(){if(!Object(_.O)(e))throw new Error(Object(_.r)("MISSING_OR_INVALID","approve() params: "+e).message);const{id:t,namespaces:r,relayProtocol:i}=e;yield this.isValidProposalId(t);const n=this.client.proposal.get(t),s=Object(_.J)(r,"approve()");if(s)throw new Error(s.message);const o=Object(_.y)(n.requiredNamespaces,r,"update()");if(o)throw new Error(o.message);if(!Object(_.V)(i,!0)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","approve() relayProtocol: "+i);throw new Error(e)}})),this.isValidReject=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","reject() params: "+e);throw new Error(t)}const{id:t,reason:r}=e;if(yield this.isValidProposalId(t),!Object(_.G)(r)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","reject() reason: "+JSON.stringify(r));throw new Error(e)}})),this.isValidSessionSettleRequest=e=>{if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","onSessionSettleRequest() params: "+e);throw new Error(t)}const{relay:t,controller:r,namespaces:i,expiry:n}=e;if(!Object(_.P)(t)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const s=Object(_.F)(r,"onSessionSettleRequest()");if(s)throw new Error(s.message);const o=Object(_.J)(i,"onSessionSettleRequest()");if(o)throw new Error(o.message);if(Object(_.z)(n)){const{message:e}=Object(_.r)("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","update() params: "+e);throw new Error(t)}const{topic:t,namespaces:r}=e;yield this.isValidSessionTopic(t);const i=this.client.session.get(t),n=Object(_.J)(r,"update()");if(n)throw new Error(n.message);const s=Object(_.y)(i.requiredNamespaces,r,"update()");if(s)throw new Error(s.message)})),this.isValidExtend=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","extend() params: "+e);throw new Error(t)}const{topic:t}=e;yield this.isValidSessionTopic(t);})),this.isValidRequest=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","request() params: "+e);throw new Error(t)}const{topic:t,request:r,chainId:i,expiry:n}=e;yield this.isValidSessionTopic(t);const{namespaces:s}=this.client.session.get(t);if(!Object(_.K)(s,i)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","request() chainId: "+i);throw new Error(e)}if(!Object(_.R)(r)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","request() "+JSON.stringify(r));throw new Error(e)}if(!Object(_.M)(s,i,r.method)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","request() method: "+r.method);throw new Error(e)}if(n&&!Object(_.S)(n,Tr)){const{message:e}=Object(_.r)("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${Tr.min} and ${Tr.max}`);throw new Error(e)}})),this.isValidRespond=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","respond() params: "+e);throw new Error(t)}const{topic:t,response:r}=e;if(yield this.isValidSessionTopic(t),!Object(_.U)(r)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","respond() response: "+JSON.stringify(r));throw new Error(e)}})),this.isValidPing=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","ping() params: "+e);throw new Error(t)}const{topic:t}=e;yield this.isValidSessionOrPairingTopic(t);})),this.isValidEmit=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","emit() params: "+e);throw new Error(t)}const{topic:t,event:r,chainId:i}=e;yield this.isValidSessionTopic(t);const{namespaces:n}=this.client.session.get(t);if(!Object(_.K)(n,i)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","emit() chainId: "+i);throw new Error(e)}if(!Object(_.H)(r)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","emit() event: "+JSON.stringify(r));throw new Error(e)}if(!Object(_.L)(n,i,r.name)){const{message:e}=Object(_.r)("MISSING_OR_INVALID","emit() event: "+JSON.stringify(r));throw new Error(e)}})),this.isValidDisconnect=e=>Or(this,null,(function*(){if(!Object(_.O)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","disconnect() params: "+e);throw new Error(t)}const{topic:t}=e;yield this.isValidSessionOrPairingTopic(t);}));}isInitialized(){if(!this.initialized){const{message:e}=Object(_.r)("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(dt,e=>Or(this,null,(function*(){const{topic:t,message:r}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(r)))return;const i=yield this.client.core.crypto.decode(t,r);Object(E.isJsonRpcRequest)(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):Object(E.isJsonRpcResponse)(i)&&(yield this.client.core.history.resolve(i),this.onRelayEventResponse({topic:t,payload:i}));})));}registerExpirerEvents(){this.client.core.expirer.on(Ct,e=>Or(this,null,(function*(){const{topic:t,id:r}=Object(_.Z)(e.target);if(r&&this.client.pendingRequest.keys.includes(r))return yield this.deletePendingSessionRequest(r,Object(_.r)("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(yield this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):r&&(yield this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}));})));}isValidPairingTopic(e){if(!Object(_.V)(e,!1)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","pairing topic should be a string: "+e);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=Object(_.r)("NO_MATCHING_KEY","pairing topic doesn't exist: "+e);throw new Error(t)}if(Object(_.z)(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=Object(_.r)("EXPIRED","pairing topic: "+e);throw new Error(t)}}isValidSessionTopic(e){return Or(this,null,(function*(){if(!Object(_.V)(e,!1)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","session topic should be a string: "+e);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=Object(_.r)("NO_MATCHING_KEY","session topic doesn't exist: "+e);throw new Error(t)}if(Object(_.z)(this.client.session.get(e).expiry)){yield this.deleteSession(e);const{message:t}=Object(_.r)("EXPIRED","session topic: "+e);throw new Error(t)}}))}isValidSessionOrPairingTopic(e){return Or(this,null,(function*(){if(this.client.session.keys.includes(e))yield this.isValidSessionTopic(e);else {if(!this.client.core.pairing.pairings.keys.includes(e)){if(Object(_.V)(e,!1)){const{message:t}=Object(_.r)("NO_MATCHING_KEY","session or pairing topic doesn't exist: "+e);throw new Error(t)}{const{message:t}=Object(_.r)("MISSING_OR_INVALID","session or pairing topic should be a string: "+e);throw new Error(t)}}this.isValidPairingTopic(e);}}))}isValidProposalId(e){return Or(this,null,(function*(){if(!Object(_.I)(e)){const{message:t}=Object(_.r)("MISSING_OR_INVALID","proposal id should be a number: "+e);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=Object(_.r)("NO_MATCHING_KEY","proposal id doesn't exist: "+e);throw new Error(t)}if(Object(_.z)(this.client.proposal.get(e).expiry)){yield this.deleteProposal(e);const{message:t}=Object(_.r)("EXPIRED","proposal id: "+e);throw new Error(t)}}))}}class Vr extends hr{constructor(e,t){super(e,t,"proposal",jr),this.core=e,this.logger=t;}}class qr extends hr{constructor(e,t){super(e,t,"session",jr),this.core=e,this.logger=t;}}class Hr extends hr{constructor(e,t){super(e,t,"request",jr),this.core=e,this.logger=t;}}class Jr extends class{constructor(e){this.opts=e,this.protocol="wc",this.version=2;}}{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=Rr,this.events=new i.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=e=>Or(this,null,(function*(){try{return yield this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}})),this.pair=e=>Or(this,null,(function*(){try{return yield this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}})),this.approve=e=>Or(this,null,(function*(){try{return yield this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}})),this.reject=e=>Or(this,null,(function*(){try{return yield this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}})),this.update=e=>Or(this,null,(function*(){try{return yield this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}})),this.extend=e=>Or(this,null,(function*(){try{return yield this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}})),this.request=e=>Or(this,null,(function*(){try{return yield this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}})),this.respond=e=>Or(this,null,(function*(){try{return yield this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}})),this.ping=e=>Or(this,null,(function*(){try{return yield this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}})),this.emit=e=>Or(this,null,(function*(){try{return yield this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}})),this.disconnect=e=>Or(this,null,(function*(){try{return yield this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}})),this.find=e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.name=(null==e?void 0:e.name)||Rr,this.metadata=(null==e?void 0:e.metadata)||Object(_.q)();const t=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:o()(Object(l.getDefaultLoggerOptions)({level:(null==e?void 0:e.logger)||Ir}));this.core=(null==e?void 0:e.core)||new Er(e),this.logger=Object(l.generateChildLogger)(t,this.name),this.session=new qr(this.core,this.logger),this.proposal=new Vr(this.core,this.logger),this.pendingRequest=new Hr(this.core,this.logger),this.engine=new Kr(this);}static init(e){return Or(this,null,(function*(){const t=new Jr(e);return yield t.initialize(),t}))}get context(){return Object(l.getLoggerContext)(this.logger)}get pairing(){return this.core.pairing.pairings}initialize(){return Or(this,null,(function*(){this.logger.trace("Initialized");try{yield this.core.start(),yield this.session.init(),yield this.proposal.init(),yield this.pendingRequest.init(),yield this.engine.init(),this.logger.info("SignClient Initialization Success");}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}))}}}]);void 0===WalletConnectV2$1&&console.error("esm-webpack-plugin: nothing exported!");const _WalletConnectV2$Core=WalletConnectV2$1.Core,_WalletConnectV2$SignClient=WalletConnectV2$1.SignClient;
|
|
60215
|
-
|
|
60216
60200
|
function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
60217
60201
|
const sendTransaction$2 = async ({ transaction, wallet })=> {
|
|
60218
60202
|
transaction = new Transaction$1(transaction);
|
|
@@ -60366,7 +60350,7 @@ class WalletConnectV2 {
|
|
|
60366
60350
|
}
|
|
60367
60351
|
|
|
60368
60352
|
newWalletConnectInstance() {
|
|
60369
|
-
return new
|
|
60353
|
+
return new Core({ projectId: window._walletConnectProjectId })
|
|
60370
60354
|
}
|
|
60371
60355
|
|
|
60372
60356
|
async account() {
|
|
@@ -60381,7 +60365,7 @@ class WalletConnectV2 {
|
|
|
60381
60365
|
try {
|
|
60382
60366
|
|
|
60383
60367
|
delete localStorage[`wc@2:core:${this.connector.pairing.version}//subscription`]; // DO NOT RECOVER AN OTHER SUBSCRIPTION!!!
|
|
60384
|
-
this.signClient = await
|
|
60368
|
+
this.signClient = await SignClient.init({ core: this.connector });
|
|
60385
60369
|
|
|
60386
60370
|
this.signClient.on("session_delete", () => {
|
|
60387
60371
|
console.log('WALLETCONNECT DISCONNECT');
|