@walletconnect/ethereum-provider 2.2.0 → 2.2.1
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/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(St,ke){typeof exports=="object"&&typeof module<"u"?ke(exports):typeof define=="function"&&define.amd?define(["exports"],ke):(St=typeof globalThis<"u"?globalThis:St||self,ke(St["@walletconnect/ethereum-provider"]={}))})(this,function(St){"use strict";var ke=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Zt(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Wn={exports:{}},hr=typeof Reflect=="object"?Reflect:null,gs=hr&&typeof hr.apply=="function"?hr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},rn;hr&&typeof hr.ownKeys=="function"?rn=hr.ownKeys:Object.getOwnPropertySymbols?rn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:rn=function(e){return Object.getOwnPropertyNames(e)};function Uu(t){console&&console.warn&&console.warn(t)}var ys=Number.isNaN||function(e){return e!==e};function xe(){xe.init.call(this)}Wn.exports=xe,Wn.exports.once=Ku,xe.EventEmitter=xe,xe.prototype._events=void 0,xe.prototype._eventsCount=0,xe.prototype._maxListeners=void 0;var vs=10;function nn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(xe,"defaultMaxListeners",{enumerable:!0,get:function(){return vs},set:function(t){if(typeof t!="number"||t<0||ys(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");vs=t}}),xe.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},xe.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ys(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};function _s(t){return t._maxListeners===void 0?xe.defaultMaxListeners:t._maxListeners}xe.prototype.getMaxListeners=function(){return _s(this)},xe.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")gs(h,this,r);else for(var f=h.length,l=Ds(h,f),n=0;n<f;++n)gs(l[n],this,r);return!0};function bs(t,e,r,n){var i,s,o;if(nn(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=_s(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Uu(a)}return t}xe.prototype.addListener=function(e,r){return bs(this,e,r,!1)},xe.prototype.on=xe.prototype.addListener,xe.prototype.prependListener=function(e,r){return bs(this,e,r,!0)};function ju(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ms(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ju.bind(n);return i.listener=r,n.wrapFn=i,i}xe.prototype.once=function(e,r){return nn(r),this.on(e,ms(this,e,r)),this},xe.prototype.prependOnceListener=function(e,r){return nn(r),this.prependListener(e,ms(this,e,r)),this},xe.prototype.removeListener=function(e,r){var n,i,s,o,a;if(nn(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Bu(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},xe.prototype.off=xe.prototype.removeListener,xe.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ws(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?zu(i):Ds(i,i.length)}xe.prototype.listeners=function(e){return ws(this,e,!0)},xe.prototype.rawListeners=function(e){return ws(this,e,!1)},xe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Es.call(t,e)},xe.prototype.listenerCount=Es;function Es(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}xe.prototype.eventNames=function(){return this._eventsCount>0?rn(this._events):[]};function Ds(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Bu(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function zu(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Ku(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}xs(t,e,s,{once:!0}),e!=="error"&&qu(t,i,{once:!0})})}function qu(t,e,r){typeof t.on=="function"&&xs(t,"error",e,r)}function xs(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}function Ye(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var kn=Ye;Ye.EventEmitter=Ye,Ye.prototype._events=void 0,Ye.prototype._maxListeners=void 0,Ye.defaultMaxListeners=10,Ye.prototype.setMaxListeners=function(t){if(!Hu(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},Ye.prototype.emit=function(t){var e,r,n,i,s,o;if(this._events||(this._events={}),t==="error"&&(!this._events.error||xr(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(r=this._events[t],Ss(r))return!1;if(Ft(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(xr(r))for(i=Array.prototype.slice.call(arguments,1),o=r.slice(),n=o.length,s=0;s<n;s++)o[s].apply(this,i);return!0},Ye.prototype.addListener=function(t,e){var r;if(!Ft(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,Ft(e.listener)?e.listener:e),this._events[t]?xr(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,xr(this._events[t])&&!this._events[t].warned&&(Ss(this._maxListeners)?r=Ye.defaultMaxListeners:r=this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),typeof console.trace=="function"&&console.trace())),this},Ye.prototype.on=Ye.prototype.addListener,Ye.prototype.once=function(t,e){if(!Ft(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},Ye.prototype.removeListener=function(t,e){var r,n,i,s;if(!Ft(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=r.length,n=-1,r===e||Ft(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(xr(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;r.length===1?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},Ye.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[t]&&delete this._events[t],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],Ft(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},Ye.prototype.listeners=function(t){var e;return!this._events||!this._events[t]?e=[]:Ft(this._events[t])?e=[this._events[t]]:e=this._events[t].slice(),e},Ye.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(Ft(e))return 1;if(e)return e.length}return 0},Ye.listenerCount=function(t,e){return t.listenerCount(e)};function Ft(t){return typeof t=="function"}function Hu(t){return typeof t=="number"}function xr(t){return typeof t=="object"&&t!==null}function Ss(t){return t===void 0}const Vu="PARSE_ERROR",Gu="INVALID_REQUEST",Wu="METHOD_NOT_FOUND",ku="INVALID_PARAMS",Os="INTERNAL_ERROR",Yn="SERVER_ERROR",Yu=[-32700,-32600,-32601,-32602,-32603],Sr={[Vu]:{code:-32700,message:"Parse error"},[Gu]:{code:-32600,message:"Invalid Request"},[Wu]:{code:-32601,message:"Method not found"},[ku]:{code:-32602,message:"Invalid params"},[Os]:{code:-32603,message:"Internal error"},[Yn]:{code:-32e3,message:"Server error"}},Ls=Yn;function Ju(t){return Yu.includes(t)}function Is(t){return Object.keys(Sr).includes(t)?Sr[t]:Sr[Ls]}function Xu(t){const e=Object.values(Sr).find(r=>r.code===t);return e||Sr[Ls]}function As(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Ts={};/*! *****************************************************************************
|
|
1
|
+
(function(St,ke){typeof exports=="object"&&typeof module<"u"?ke(exports):typeof define=="function"&&define.amd?define(["exports"],ke):(St=typeof globalThis<"u"?globalThis:St||self,ke(St["@walletconnect/ethereum-provider"]={}))})(this,function(St){"use strict";var ke=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Zt(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Wn={exports:{}},hr=typeof Reflect=="object"?Reflect:null,vs=hr&&typeof hr.apply=="function"?hr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},rn;hr&&typeof hr.ownKeys=="function"?rn=hr.ownKeys:Object.getOwnPropertySymbols?rn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:rn=function(e){return Object.getOwnPropertyNames(e)};function ju(t){console&&console.warn&&console.warn(t)}var _s=Number.isNaN||function(e){return e!==e};function xe(){xe.init.call(this)}Wn.exports=xe,Wn.exports.once=qu,xe.EventEmitter=xe,xe.prototype._events=void 0,xe.prototype._eventsCount=0,xe.prototype._maxListeners=void 0;var bs=10;function nn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(xe,"defaultMaxListeners",{enumerable:!0,get:function(){return bs},set:function(t){if(typeof t!="number"||t<0||_s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");bs=t}}),xe.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},xe.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||_s(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};function ms(t){return t._maxListeners===void 0?xe.defaultMaxListeners:t._maxListeners}xe.prototype.getMaxListeners=function(){return ms(this)},xe.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")vs(f,this,r);else for(var h=f.length,l=Ss(f,h),n=0;n<h;++n)vs(l[n],this,r);return!0};function ws(t,e,r,n){var i,s,o;if(nn(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=ms(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,ju(a)}return t}xe.prototype.addListener=function(e,r){return ws(this,e,r,!1)},xe.prototype.on=xe.prototype.addListener,xe.prototype.prependListener=function(e,r){return ws(this,e,r,!0)};function Bu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Es(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Bu.bind(n);return i.listener=r,n.wrapFn=i,i}xe.prototype.once=function(e,r){return nn(r),this.on(e,Es(this,e,r)),this},xe.prototype.prependOnceListener=function(e,r){return nn(r),this.prependListener(e,Es(this,e,r)),this},xe.prototype.removeListener=function(e,r){var n,i,s,o,a;if(nn(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():zu(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},xe.prototype.off=xe.prototype.removeListener,xe.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Ds(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Ku(i):Ss(i,i.length)}xe.prototype.listeners=function(e){return Ds(this,e,!0)},xe.prototype.rawListeners=function(e){return Ds(this,e,!1)},xe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):xs.call(t,e)},xe.prototype.listenerCount=xs;function xs(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}xe.prototype.eventNames=function(){return this._eventsCount>0?rn(this._events):[]};function Ss(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function zu(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Ku(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function qu(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Os(t,e,s,{once:!0}),e!=="error"&&Hu(t,i,{once:!0})})}function Hu(t,e,r){typeof t.on=="function"&&Os(t,"error",e,r)}function Os(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}function Ye(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var kn=Ye;Ye.EventEmitter=Ye,Ye.prototype._events=void 0,Ye.prototype._maxListeners=void 0,Ye.defaultMaxListeners=10,Ye.prototype.setMaxListeners=function(t){if(!Vu(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},Ye.prototype.emit=function(t){var e,r,n,i,s,o;if(this._events||(this._events={}),t==="error"&&(!this._events.error||xr(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(r=this._events[t],Ls(r))return!1;if(Mt(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(xr(r))for(i=Array.prototype.slice.call(arguments,1),o=r.slice(),n=o.length,s=0;s<n;s++)o[s].apply(this,i);return!0},Ye.prototype.addListener=function(t,e){var r;if(!Mt(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,Mt(e.listener)?e.listener:e),this._events[t]?xr(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,xr(this._events[t])&&!this._events[t].warned&&(Ls(this._maxListeners)?r=Ye.defaultMaxListeners:r=this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),typeof console.trace=="function"&&console.trace())),this},Ye.prototype.on=Ye.prototype.addListener,Ye.prototype.once=function(t,e){if(!Mt(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},Ye.prototype.removeListener=function(t,e){var r,n,i,s;if(!Mt(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=r.length,n=-1,r===e||Mt(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(xr(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;r.length===1?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},Ye.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[t]&&delete this._events[t],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],Mt(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},Ye.prototype.listeners=function(t){var e;return!this._events||!this._events[t]?e=[]:Mt(this._events[t])?e=[this._events[t]]:e=this._events[t].slice(),e},Ye.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(Mt(e))return 1;if(e)return e.length}return 0},Ye.listenerCount=function(t,e){return t.listenerCount(e)};function Mt(t){return typeof t=="function"}function Vu(t){return typeof t=="number"}function xr(t){return typeof t=="object"&&t!==null}function Ls(t){return t===void 0}const Gu="PARSE_ERROR",Wu="INVALID_REQUEST",ku="METHOD_NOT_FOUND",Yu="INVALID_PARAMS",Is="INTERNAL_ERROR",Yn="SERVER_ERROR",Ju=[-32700,-32600,-32601,-32602,-32603],Sr={[Gu]:{code:-32700,message:"Parse error"},[Wu]:{code:-32600,message:"Invalid Request"},[ku]:{code:-32601,message:"Method not found"},[Yu]:{code:-32602,message:"Invalid params"},[Is]:{code:-32603,message:"Internal error"},[Yn]:{code:-32e3,message:"Server error"}},As=Yn;function Xu(t){return Ju.includes(t)}function Ts(t){return Object.keys(Sr).includes(t)?Sr[t]:Sr[As]}function Zu(t){const e=Object.values(Sr).find(r=>r.code===t);return e||Sr[As]}function Cs(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Rs={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */var Jn=function(t,e){return Jn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jn(t,e)};function Zu(t,e){Jn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xn=function(){return Xn=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Xn.apply(this,arguments)};function Qu(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function ef(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function tf(t,e){return function(r,n){e(r,n,t)}}function rf(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function nf(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function sf(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function of(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function af(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Zn(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Cs(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function cf(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Cs(arguments[e]));return t}function uf(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Or(t){return this instanceof Or?(this.v=t,this):new Or(t)}function ff(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Or?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function hf(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Or(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function lf(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zn=="function"?Zn(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function df(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function pf(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function gf(t){return t&&t.__esModule?t:{default:t}}function yf(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function vf(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var _f=Object.freeze({__proto__:null,__extends:Zu,get __assign(){return Xn},__rest:Qu,__decorate:ef,__param:tf,__metadata:rf,__awaiter:nf,__generator:sf,__createBinding:of,__exportStar:af,__values:Zn,__read:Cs,__spread:cf,__spreadArrays:uf,__await:Or,__asyncGenerator:ff,__asyncDelegator:hf,__asyncValues:lf,__makeTemplateObject:df,__importStar:pf,__importDefault:gf,__classPrivateFieldGet:yf,__classPrivateFieldSet:vf}),bf=Zt(_f),Mt={},Rs;function mf(){if(Rs)return Mt;Rs=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.isBrowserCryptoAvailable=Mt.getSubtleCrypto=Mt.getBrowerCrypto=void 0;function t(){return ke?.crypto||ke?.msCrypto||{}}Mt.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Mt.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Mt.isBrowserCryptoAvailable=r,Mt}var Ut={},Ps;function wf(){if(Ps)return Ut;Ps=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.isBrowser=Ut.isNode=Ut.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ut.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ut.isNode=e;function r(){return!t()&&!e()}return Ut.isBrowser=r,Ut}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=bf;e.__exportStar(mf(),t),e.__exportStar(wf(),t)})(Ts);function Ef(){const t=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return t+e}function sn(t,e,r){return{id:r||Ef(),jsonrpc:"2.0",method:t,params:e}}function on(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Lr(t,e,r){return{id:t,jsonrpc:"2.0",error:Df(e,r)}}function Df(t,e){return typeof t>"u"?Is(Os):(typeof t=="string"&&(t=Object.assign(Object.assign({},Is(Yn)),{message:t})),typeof e<"u"&&(t.data=e),Ju(t.code)&&(t=Xu(t.code)),t)}class Ns{}class xf extends Ns{constructor(e){super()}}class Sf extends Ns{constructor(){super()}}class Of extends Sf{constructor(e){super()}}const Lf="^https?:",If="^wss?:";function Af(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function $s(t,e){const r=Af(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Fs(t){return $s(t,Lf)}function Ms(t){return $s(t,If)}function Tf(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Us(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Qn(t){return Us(t)&&"method"in t}function ei(t){return Us(t)&&(jt(t)||Ot(t))}function jt(t){return"result"in t}function Ot(t){return"error"in t}class ti extends Of{constructor(e){super(e),this.events=new kn.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(sn(e.method,e.params||[]),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Ot(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ei(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await 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 ri={exports:{}};(function(t,e){var r=typeof self<"u"?self:ke,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function h(g){return g&&DataView.prototype.isPrototypeOf(g)}if(a.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(g){return g&&f.indexOf(Object.prototype.toString.call(g))>-1};function D(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(g))throw new TypeError("Invalid character in header field name");return g.toLowerCase()}function b(g){return typeof g!="string"&&(g=String(g)),g}function m(g){var v={next:function(){var F=g.shift();return{done:F===void 0,value:F}}};return a.iterable&&(v[Symbol.iterator]=function(){return v}),v}function w(g){this.map={},g instanceof w?g.forEach(function(v,F){this.append(F,v)},this):Array.isArray(g)?g.forEach(function(v){this.append(v[0],v[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(v){this.append(v,g[v])},this)}w.prototype.append=function(g,v){g=D(g),v=b(v);var F=this.map[g];this.map[g]=F?F+", "+v:v},w.prototype.delete=function(g){delete this.map[D(g)]},w.prototype.get=function(g){return g=D(g),this.has(g)?this.map[g]:null},w.prototype.has=function(g){return this.map.hasOwnProperty(D(g))},w.prototype.set=function(g,v){this.map[D(g)]=b(v)},w.prototype.forEach=function(g,v){for(var F in this.map)this.map.hasOwnProperty(F)&&g.call(v,this.map[F],F,this)},w.prototype.keys=function(){var g=[];return this.forEach(function(v,F){g.push(F)}),m(g)},w.prototype.values=function(){var g=[];return this.forEach(function(v){g.push(v)}),m(g)},w.prototype.entries=function(){var g=[];return this.forEach(function(v,F){g.push([F,v])}),m(g)},a.iterable&&(w.prototype[Symbol.iterator]=w.prototype.entries);function N(g){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}function R(g){return new Promise(function(v,F){g.onload=function(){v(g.result)},g.onerror=function(){F(g.error)}})}function B(g){var v=new FileReader,F=R(v);return v.readAsArrayBuffer(g),F}function S(g){var v=new FileReader,F=R(v);return v.readAsText(g),F}function I(g){for(var v=new Uint8Array(g),F=new Array(v.length),M=0;M<v.length;M++)F[M]=String.fromCharCode(v[M]);return F.join("")}function y(g){if(g.slice)return g.slice(0);var v=new Uint8Array(g.byteLength);return v.set(new Uint8Array(g)),v.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(g){this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:a.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:a.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():a.arrayBuffer&&a.blob&&h(g)?(this._bodyArrayBuffer=y(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||l(g))?this._bodyArrayBuffer=y(g):this._bodyText=g=Object.prototype.toString.call(g):this._bodyText="",this.headers.get("content-type")||(typeof g=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var g=N(this);if(g)return g;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?N(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(B)}),this.text=function(){var g=N(this);if(g)return g;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(I(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function c(g){var v=g.toUpperCase();return E.indexOf(v)>-1?v:g}function d(g,v){v=v||{};var F=v.body;if(g instanceof d){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,v.headers||(this.headers=new w(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!F&&g._bodyInit!=null&&(F=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new w(v.headers)),this.method=c(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&F)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(F)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})};function U(g){var v=new FormData;return g.trim().split("&").forEach(function(F){if(F){var M=F.split("="),P=M.shift().replace(/\+/g," "),C=M.join("=").replace(/\+/g," ");v.append(decodeURIComponent(P),decodeURIComponent(C))}}),v}function K(g){var v=new w,F=g.replace(/\r?\n[\t ]+/g," ");return F.split(/\r?\n/).forEach(function(M){var P=M.split(":"),C=P.shift().trim();if(C){var j=P.join(":").trim();v.append(C,j)}}),v}x.call(d.prototype);function G(g,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new w(v.headers),this.url=v.url||"",this._initBody(g)}x.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new w(this.headers),url:this.url})},G.error=function(){var g=new G(null,{status:0,statusText:""});return g.type="error",g};var J=[301,302,303,307,308];G.redirect=function(g,v){if(J.indexOf(v)===-1)throw new RangeError("Invalid status code");return new G(null,{status:v,headers:{location:g}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(v,F){this.message=v,this.name=F;var M=Error(v);this.stack=M.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function X(g,v){return new Promise(function(F,M){var P=new d(g,v);if(P.signal&&P.signal.aborted)return M(new o.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function j(){C.abort()}C.onload=function(){var z={status:C.status,statusText:C.statusText,headers:K(C.getAllResponseHeaders()||"")};z.url="responseURL"in C?C.responseURL:z.headers.get("X-Request-URL");var Q="response"in C?C.response:C.responseText;F(new G(Q,z))},C.onerror=function(){M(new TypeError("Network request failed"))},C.ontimeout=function(){M(new TypeError("Network request failed"))},C.onabort=function(){M(new o.DOMException("Aborted","AbortError"))},C.open(P.method,P.url,!0),P.credentials==="include"?C.withCredentials=!0:P.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&a.blob&&(C.responseType="blob"),P.headers.forEach(function(z,Q){C.setRequestHeader(Q,z)}),P.signal&&(P.signal.addEventListener("abort",j),C.onreadystatechange=function(){C.readyState===4&&P.signal.removeEventListener("abort",j)}),C.send(typeof P._bodyInit>"u"?null:P._bodyInit)})}return X.polyfill=!0,s.fetch||(s.fetch=X,s.Headers=w,s.Request=d,s.Response=G),o.Headers=w,o.Request=d,o.Response=G,o.fetch=X,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(ri,ri.exports);var js=Mu(ri.exports);function ni(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ir(t){return typeof t=="string"?t:JSON.stringify(t)}const Bs={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},zs=10;class Cf{constructor(e){if(this.url=e,this.events=new kn.EventEmitter,this.isAvailable=!1,this.registering=!1,!Fs(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,r){this.isAvailable||await this.register();try{const n=Ir(e),s=await(await js(this.url,Object.assign(Object.assign({},Bs),{body:n}))).json();this.onPayload({data:s})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!Fs(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{const r=Ir({id:1,jsonrpc:"2.0",method:"test",params:[]});await js(e,Object.assign(Object.assign({},Bs),{body:r})),this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?ni(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Lr(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return As(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>zs&&this.events.setMaxListeners(zs)}}var ii={},an={},re={},Ks={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,h){var f=a>>>16&65535,l=a&65535,D=h>>>16&65535,b=h&65535;return l*b+(f*b+l*D<<16>>>0)|0}t.mul=Math.imul||e;function r(a,h){return a+h|0}t.add=r;function n(a,h){return a-h|0}t.sub=n;function i(a,h){return a<<h|a>>>32-h}t.rotl=i;function s(a,h){return a<<32-h|a>>>h}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Ks),Object.defineProperty(re,"__esModule",{value:!0});var qs=Ks;function Rf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}re.readInt16BE=Rf;function Pf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}re.readUint16BE=Pf;function Nf(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}re.readInt16LE=Nf;function $f(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}re.readUint16LE=$f;function Hs(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}re.writeUint16BE=Hs,re.writeInt16BE=Hs;function Vs(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}re.writeUint16LE=Vs,re.writeInt16LE=Vs;function si(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}re.readInt32BE=si;function oi(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}re.readUint32BE=oi;function ai(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}re.readInt32LE=ai;function ci(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}re.readUint32LE=ci;function cn(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}re.writeUint32BE=cn,re.writeInt32BE=cn;function un(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}re.writeUint32LE=un,re.writeInt32LE=un;function Ff(t,e){e===void 0&&(e=0);var r=si(t,e),n=si(t,e+4);return r*4294967296+n-(n>>31)*4294967296}re.readInt64BE=Ff;function Mf(t,e){e===void 0&&(e=0);var r=oi(t,e),n=oi(t,e+4);return r*4294967296+n}re.readUint64BE=Mf;function Uf(t,e){e===void 0&&(e=0);var r=ai(t,e),n=ai(t,e+4);return n*4294967296+r-(r>>31)*4294967296}re.readInt64LE=Uf;function jf(t,e){e===void 0&&(e=0);var r=ci(t,e),n=ci(t,e+4);return n*4294967296+r}re.readUint64LE=jf;function Gs(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),cn(t/4294967296>>>0,e,r),cn(t>>>0,e,r+4),e}re.writeUint64BE=Gs,re.writeInt64BE=Gs;function Ws(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),un(t>>>0,e,r),un(t/4294967296>>>0,e,r+4),e}re.writeUint64LE=Ws,re.writeInt64LE=Ws;function Bf(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}re.readUintBE=Bf;function zf(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+t/8;s++)n+=e[s]*i,i*=256;return n}re.readUintLE=zf;function Kf(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!qs.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=t/8+n-1;s>=n;s--)r[s]=e/i&255,i*=256;return r}re.writeUintBE=Kf;function qf(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!qs.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+t/8;s++)r[s]=e/i&255,i*=256;return r}re.writeUintLE=qf;function Hf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}re.readFloat32BE=Hf;function Vf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}re.readFloat32LE=Vf;function Gf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}re.readFloat64BE=Gf;function Wf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}re.readFloat64LE=Wf;function kf(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t),e}re.writeFloat32BE=kf;function Yf(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t,!0),e}re.writeFloat32LE=Yf;function Jf(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t),e}re.writeFloat64BE=Jf;function Xf(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t,!0),e}re.writeFloat64LE=Xf;var _t={};Object.defineProperty(_t,"__esModule",{value:!0});function Zf(t){for(var e=0;e<t.length;e++)t[e]=0;return t}_t.wipe=Zf,Object.defineProperty(an,"__esModule",{value:!0});var ct=re,ui=_t,Qf=20;function eh(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],h=r[7]<<24|r[6]<<16|r[5]<<8|r[4],f=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],D=r[19]<<24|r[18]<<16|r[17]<<8|r[16],b=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],w=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],S=e[15]<<24|e[14]<<16|e[13]<<8|e[12],I=n,y=i,x=s,E=o,c=a,d=h,U=f,K=l,G=D,J=b,X=m,g=w,v=N,F=R,M=B,P=S,C=0;C<Qf;C+=2)I=I+c|0,v^=I,v=v>>>32-16|v<<16,G=G+v|0,c^=G,c=c>>>32-12|c<<12,y=y+d|0,F^=y,F=F>>>32-16|F<<16,J=J+F|0,d^=J,d=d>>>32-12|d<<12,x=x+U|0,M^=x,M=M>>>32-16|M<<16,X=X+M|0,U^=X,U=U>>>32-12|U<<12,E=E+K|0,P^=E,P=P>>>32-16|P<<16,g=g+P|0,K^=g,K=K>>>32-12|K<<12,x=x+U|0,M^=x,M=M>>>32-8|M<<8,X=X+M|0,U^=X,U=U>>>32-7|U<<7,E=E+K|0,P^=E,P=P>>>32-8|P<<8,g=g+P|0,K^=g,K=K>>>32-7|K<<7,y=y+d|0,F^=y,F=F>>>32-8|F<<8,J=J+F|0,d^=J,d=d>>>32-7|d<<7,I=I+c|0,v^=I,v=v>>>32-8|v<<8,G=G+v|0,c^=G,c=c>>>32-7|c<<7,I=I+d|0,P^=I,P=P>>>32-16|P<<16,X=X+P|0,d^=X,d=d>>>32-12|d<<12,y=y+U|0,v^=y,v=v>>>32-16|v<<16,g=g+v|0,U^=g,U=U>>>32-12|U<<12,x=x+K|0,F^=x,F=F>>>32-16|F<<16,G=G+F|0,K^=G,K=K>>>32-12|K<<12,E=E+c|0,M^=E,M=M>>>32-16|M<<16,J=J+M|0,c^=J,c=c>>>32-12|c<<12,x=x+K|0,F^=x,F=F>>>32-8|F<<8,G=G+F|0,K^=G,K=K>>>32-7|K<<7,E=E+c|0,M^=E,M=M>>>32-8|M<<8,J=J+M|0,c^=J,c=c>>>32-7|c<<7,y=y+U|0,v^=y,v=v>>>32-8|v<<8,g=g+v|0,U^=g,U=U>>>32-7|U<<7,I=I+d|0,P^=I,P=P>>>32-8|P<<8,X=X+P|0,d^=X,d=d>>>32-7|d<<7;ct.writeUint32LE(I+n|0,t,0),ct.writeUint32LE(y+i|0,t,4),ct.writeUint32LE(x+s|0,t,8),ct.writeUint32LE(E+o|0,t,12),ct.writeUint32LE(c+a|0,t,16),ct.writeUint32LE(d+h|0,t,20),ct.writeUint32LE(U+f|0,t,24),ct.writeUint32LE(K+l|0,t,28),ct.writeUint32LE(G+D|0,t,32),ct.writeUint32LE(J+b|0,t,36),ct.writeUint32LE(X+m|0,t,40),ct.writeUint32LE(g+w|0,t,44),ct.writeUint32LE(v+N|0,t,48),ct.writeUint32LE(F+R|0,t,52),ct.writeUint32LE(M+B|0,t,56),ct.writeUint32LE(P+S|0,t,60)}function ks(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,o;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=i}for(var a=new Uint8Array(64),h=0;h<r.length;h+=64){eh(a,s,t);for(var f=h;f<h+64&&f<r.length;f++)n[f]=r[f]^a[f-h];rh(s,0,o)}return ui.wipe(a),i===0&&ui.wipe(s),n}an.streamXOR=ks;function th(t,e,r,n){return n===void 0&&(n=0),ui.wipe(r),ks(t,e,r,r,n)}an.stream=th;function rh(t,e,r){for(var n=1;r--;)n=n+(t[e]&255)|0,t[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Ys={},Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});function nh(t,e,r){return~(t-1)&e|t-1&r}Vt.select=nh;function ih(t,e){return(t|0)-(e|0)-1>>>31&1}Vt.lessOrEqual=ih;function Js(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 1&r-1>>>8}Vt.compare=Js;function sh(t,e){return t.length===0||e.length===0?!1:Js(t,e)!==0}Vt.equal=sh,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Vt,r=_t;t.DIGEST_LENGTH=16;var n=function(){function o(a){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 h=a[0]|a[1]<<8;this._r[0]=h&8191;var f=a[2]|a[3]<<8;this._r[1]=(h>>>13|f<<3)&8191;var l=a[4]|a[5]<<8;this._r[2]=(f>>>10|l<<6)&7939;var D=a[6]|a[7]<<8;this._r[3]=(l>>>7|D<<9)&8191;var b=a[8]|a[9]<<8;this._r[4]=(D>>>4|b<<12)&255,this._r[5]=b>>>1&8190;var m=a[10]|a[11]<<8;this._r[6]=(b>>>14|m<<2)&8191;var w=a[12]|a[13]<<8;this._r[7]=(m>>>11|w<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(w>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,h,f){for(var l=this._fin?0:2048,D=this._h[0],b=this._h[1],m=this._h[2],w=this._h[3],N=this._h[4],R=this._h[5],B=this._h[6],S=this._h[7],I=this._h[8],y=this._h[9],x=this._r[0],E=this._r[1],c=this._r[2],d=this._r[3],U=this._r[4],K=this._r[5],G=this._r[6],J=this._r[7],X=this._r[8],g=this._r[9];f>=16;){var v=a[h+0]|a[h+1]<<8;D+=v&8191;var F=a[h+2]|a[h+3]<<8;b+=(v>>>13|F<<3)&8191;var M=a[h+4]|a[h+5]<<8;m+=(F>>>10|M<<6)&8191;var P=a[h+6]|a[h+7]<<8;w+=(M>>>7|P<<9)&8191;var C=a[h+8]|a[h+9]<<8;N+=(P>>>4|C<<12)&8191,R+=C>>>1&8191;var j=a[h+10]|a[h+11]<<8;B+=(C>>>14|j<<2)&8191;var z=a[h+12]|a[h+13]<<8;S+=(j>>>11|z<<5)&8191;var Q=a[h+14]|a[h+15]<<8;I+=(z>>>8|Q<<8)&8191,y+=Q>>>5|l;var q=0,ee=q;ee+=D*x,ee+=b*(5*g),ee+=m*(5*X),ee+=w*(5*J),ee+=N*(5*G),q=ee>>>13,ee&=8191,ee+=R*(5*K),ee+=B*(5*U),ee+=S*(5*d),ee+=I*(5*c),ee+=y*(5*E),q+=ee>>>13,ee&=8191;var Y=q;Y+=D*E,Y+=b*x,Y+=m*(5*g),Y+=w*(5*X),Y+=N*(5*J),q=Y>>>13,Y&=8191,Y+=R*(5*G),Y+=B*(5*K),Y+=S*(5*U),Y+=I*(5*d),Y+=y*(5*c),q+=Y>>>13,Y&=8191;var ae=q;ae+=D*c,ae+=b*E,ae+=m*x,ae+=w*(5*g),ae+=N*(5*X),q=ae>>>13,ae&=8191,ae+=R*(5*J),ae+=B*(5*G),ae+=S*(5*K),ae+=I*(5*U),ae+=y*(5*d),q+=ae>>>13,ae&=8191;var T=q;T+=D*d,T+=b*c,T+=m*E,T+=w*x,T+=N*(5*g),q=T>>>13,T&=8191,T+=R*(5*X),T+=B*(5*J),T+=S*(5*G),T+=I*(5*K),T+=y*(5*U),q+=T>>>13,T&=8191;var A=q;A+=D*U,A+=b*d,A+=m*c,A+=w*E,A+=N*x,q=A>>>13,A&=8191,A+=R*(5*g),A+=B*(5*X),A+=S*(5*J),A+=I*(5*G),A+=y*(5*K),q+=A>>>13,A&=8191;var O=q;O+=D*K,O+=b*U,O+=m*d,O+=w*c,O+=N*E,q=O>>>13,O&=8191,O+=R*x,O+=B*(5*g),O+=S*(5*X),O+=I*(5*J),O+=y*(5*G),q+=O>>>13,O&=8191;var u=q;u+=D*G,u+=b*K,u+=m*U,u+=w*d,u+=N*c,q=u>>>13,u&=8191,u+=R*E,u+=B*x,u+=S*(5*g),u+=I*(5*X),u+=y*(5*J),q+=u>>>13,u&=8191;var _=q;_+=D*J,_+=b*G,_+=m*K,_+=w*U,_+=N*d,q=_>>>13,_&=8191,_+=R*c,_+=B*E,_+=S*x,_+=I*(5*g),_+=y*(5*X),q+=_>>>13,_&=8191;var H=q;H+=D*X,H+=b*J,H+=m*G,H+=w*K,H+=N*U,q=H>>>13,H&=8191,H+=R*d,H+=B*c,H+=S*E,H+=I*x,H+=y*(5*g),q+=H>>>13,H&=8191;var W=q;W+=D*g,W+=b*X,W+=m*J,W+=w*G,W+=N*K,q=W>>>13,W&=8191,W+=R*U,W+=B*d,W+=S*c,W+=I*E,W+=y*x,q+=W>>>13,W&=8191,q=(q<<2)+q|0,q=q+ee|0,ee=q&8191,q=q>>>13,Y+=q,D=ee,b=Y,m=ae,w=T,N=A,R=O,B=u,S=_,I=H,y=W,h+=16,f-=16}this._h[0]=D,this._h[1]=b,this._h[2]=m,this._h[3]=w,this._h[4]=N,this._h[5]=R,this._h[6]=B,this._h[7]=S,this._h[8]=I,this._h[9]=y},o.prototype.finish=function(a,h){h===void 0&&(h=0);var f=new Uint16Array(10),l,D,b,m;if(this._leftover){for(m=this._leftover,this._buffer[m++]=1;m<16;m++)this._buffer[m]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(l=this._h[1]>>>13,this._h[1]&=8191,m=2;m<10;m++)this._h[m]+=l,l=this._h[m]>>>13,this._h[m]&=8191;for(this._h[0]+=l*5,l=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=l,l=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=l,f[0]=this._h[0]+5,l=f[0]>>>13,f[0]&=8191,m=1;m<10;m++)f[m]=this._h[m]+l,l=f[m]>>>13,f[m]&=8191;for(f[9]-=1<<13,D=(l^1)-1,m=0;m<10;m++)f[m]&=D;for(D=~D,m=0;m<10;m++)this._h[m]=this._h[m]&D|f[m];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,b=this._h[0]+this._pad[0],this._h[0]=b&65535,m=1;m<8;m++)b=(this._h[m]+this._pad[m]|0)+(b>>>16)|0,this._h[m]=b&65535;return a[h+0]=this._h[0]>>>0,a[h+1]=this._h[0]>>>8,a[h+2]=this._h[1]>>>0,a[h+3]=this._h[1]>>>8,a[h+4]=this._h[2]>>>0,a[h+5]=this._h[2]>>>8,a[h+6]=this._h[3]>>>0,a[h+7]=this._h[3]>>>8,a[h+8]=this._h[4]>>>0,a[h+9]=this._h[4]>>>8,a[h+10]=this._h[5]>>>0,a[h+11]=this._h[5]>>>8,a[h+12]=this._h[6]>>>0,a[h+13]=this._h[6]>>>8,a[h+14]=this._h[7]>>>0,a[h+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var h=0,f=a.length,l;if(this._leftover){l=16-this._leftover,l>f&&(l=f);for(var D=0;D<l;D++)this._buffer[this._leftover+D]=a[h+D];if(f-=l,h+=l,this._leftover+=l,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(l=f-f%16,this._blocks(a,h,l),h+=l,f-=l),f){for(var D=0;D<f;D++)this._buffer[this._leftover+D]=a[h+D];this._leftover+=f}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var a=new Uint8Array(16);return this.finish(a),a},o.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},o}();t.Poly1305=n;function i(o,a){var h=new n(o);h.update(a);var f=h.digest();return h.clean(),f}t.oneTimeAuth=i;function s(o,a){return o.length!==t.DIGEST_LENGTH||a.length!==t.DIGEST_LENGTH?!1:e.equal(o,a)}t.equal=s}(Ys),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=an,r=Ys,n=_t,i=re,s=Vt;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var o=new Uint8Array(16),a=function(){function h(f){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,f.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return h.prototype.seal=function(f,l,D,b){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var m=new Uint8Array(16);m.set(f,m.length-f.length);var w=new Uint8Array(32);e.stream(this._key,m,w,4);var N=l.length+this.tagLength,R;if(b){if(b.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");R=b}else R=new Uint8Array(N);return e.streamXOR(this._key,m,l,R,4),this._authenticate(R.subarray(R.length-this.tagLength,R.length),w,R.subarray(0,R.length-this.tagLength),D),n.wipe(m),R},h.prototype.open=function(f,l,D,b){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(l.length<this.tagLength)return null;var m=new Uint8Array(16);m.set(f,m.length-f.length);var w=new Uint8Array(32);e.stream(this._key,m,w,4);var N=new Uint8Array(this.tagLength);if(this._authenticate(N,w,l.subarray(0,l.length-this.tagLength),D),!s.equal(N,l.subarray(l.length-this.tagLength,l.length)))return null;var R=l.length-this.tagLength,B;if(b){if(b.length!==R)throw new Error("ChaCha20Poly1305: incorrect destination length");B=b}else B=new Uint8Array(R);return e.streamXOR(this._key,m,l.subarray(0,l.length-this.tagLength),B,4),n.wipe(m),B},h.prototype.clean=function(){return n.wipe(this._key),this},h.prototype._authenticate=function(f,l,D,b){var m=new r.Poly1305(l);b&&(m.update(b),b.length%16>0&&m.update(o.subarray(b.length%16))),m.update(D),D.length%16>0&&m.update(o.subarray(D.length%16));var w=new Uint8Array(8);b&&i.writeUint64LE(b.length,w),m.update(w),i.writeUint64LE(D.length,w),m.update(w);for(var N=m.digest(),R=0;R<N.length;R++)f[R]=N[R];m.clean(),n.wipe(N),n.wipe(w)},h}();t.ChaCha20Poly1305=a}(ii);var Xs={},Ar={},fi={};Object.defineProperty(fi,"__esModule",{value:!0});function oh(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}fi.isSerializableHash=oh,Object.defineProperty(Ar,"__esModule",{value:!0});var At=fi,ah=Vt,ch=_t,Zs=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),At.isSerializableHash(this._inner)&&At.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),ch.wipe(n)}return t.prototype.reset=function(){if(!At.isSerializableHash(this._inner)||!At.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},t.prototype.clean=function(){At.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),At.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.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)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!At.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!At.isSerializableHash(this._inner)||!At.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},t.prototype.cleanSavedState=function(e){if(!At.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Ar.HMAC=Zs;function uh(t,e,r){var n=new Zs(t,e);n.update(r);var i=n.digest();return n.clean(),i}Ar.hmac=uh,Ar.equal=ah.equal,Object.defineProperty(Xs,"__esModule",{value:!0});var Qs=Ar,eo=_t,fh=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=Qs.hmac(this._hash,n,r);this._hmac=new Qs.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)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},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n<r.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[n]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),eo.wipe(this._buffer),eo.wipe(this._counter),this._bufpos=0},t}(),hh=Xs.HKDF=fh,lr={},fn={},hn={};Object.defineProperty(hn,"__esModule",{value:!0}),hn.BrowserRandomSource=void 0;const to=65536;class lh{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(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 r=new Uint8Array(e);for(let n=0;n<r.length;n+=to)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,to)));return r}}hn.BrowserRandomSource=lh;function dh(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ln={},ph={},gh=Object.freeze({__proto__:null,default:ph}),yh=Zt(gh);Object.defineProperty(ln,"__esModule",{value:!0}),ln.NodeRandomSource=void 0;const vh=_t;class _h{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof dh<"u"){const e=yh;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 r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=r[i];return(0,vh.wipe)(r),n}}ln.NodeRandomSource=_h,Object.defineProperty(fn,"__esModule",{value:!0}),fn.SystemRandomSource=void 0;const bh=hn,mh=ln;class wh{constructor(){if(this.isAvailable=!1,this.name="",this._source=new bh.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new mh.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}fn.SystemRandomSource=wh,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=fn,r=re,n=_t;t.defaultRandomSource=new e.SystemRandomSource;function i(f,l=t.defaultRandomSource){return l.randomBytes(f)}t.randomBytes=i;function s(f=t.defaultRandomSource){const l=i(4,f),D=(0,r.readUint32LE)(l);return(0,n.wipe)(l),D}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(f,l=o,D=t.defaultRandomSource){if(l.length<2)throw new Error("randomString charset is too short");if(l.length>256)throw new Error("randomString charset is too long");let b="";const m=l.length,w=256-256%m;for(;f>0;){const N=i(Math.ceil(f*256/w),D);for(let R=0;R<N.length&&f>0;R++){const B=N[R];B<w&&(b+=l.charAt(B%m),f--)}(0,n.wipe)(N)}return b}t.randomString=a;function h(f,l=o,D=t.defaultRandomSource){const b=Math.ceil(f/(Math.log(l.length)/Math.LN2));return a(b,l,D)}t.randomStringForEntropy=h}(lr);var dn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=_t;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var l=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=h[l++],f--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(l=s(this._temp,this._state,h,l,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[l++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,l=this._bufferLength,D=f/536870912|0,b=f<<3,m=f%64<56?64:128;this._buffer[l]=128;for(var w=l+1;w<m-8;w++)this._buffer[w]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(b,this._buffer,m-4),s(this._temp,this._state,this._buffer,0,m),this._finished=!0}for(var w=0;w<this.digestLength/4;w++)e.writeUint32BE(this._state[w],h,w*4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.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}},a.prototype.restoreState=function(h){return this._state.set(h.state),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.state),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();t.SHA256=n;var i=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 s(a,h,f,l,D){for(;D>=64;){for(var b=h[0],m=h[1],w=h[2],N=h[3],R=h[4],B=h[5],S=h[6],I=h[7],y=0;y<16;y++){var x=l+y*4;a[y]=e.readUint32BE(f,x)}for(var y=16;y<64;y++){var E=a[y-2],c=(E>>>17|E<<32-17)^(E>>>19|E<<32-19)^E>>>10;E=a[y-15];var d=(E>>>7|E<<32-7)^(E>>>18|E<<32-18)^E>>>3;a[y]=(c+a[y-7]|0)+(d+a[y-16]|0)}for(var y=0;y<64;y++){var c=(((R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&B^~R&S)|0)+(I+(i[y]+a[y]|0)|0)|0,d=((b>>>2|b<<32-2)^(b>>>13|b<<32-13)^(b>>>22|b<<32-22))+(b&m^b&w^m&w)|0;I=S,S=B,B=R,R=N+c|0,N=w,w=m,m=b,b=c+d|0}h[0]+=b,h[1]+=m,h[2]+=w,h[3]+=N,h[4]+=R,h[5]+=B,h[6]+=S,h[7]+=I,l+=64,D-=64}return l}function o(a){var h=new n;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(dn);var hi={};(function(t){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 e=lr,r=_t;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(y){const x=new Float64Array(16);if(y)for(let E=0;E<y.length;E++)x[E]=y[E];return x}const i=new Uint8Array(32);i[0]=9;const s=n([56129,1]);function o(y){let x=1;for(let E=0;E<16;E++){let c=y[E]+x+65535;x=Math.floor(c/65536),y[E]=c-x*65536}y[0]+=x-1+37*(x-1)}function a(y,x,E){const c=~(E-1);for(let d=0;d<16;d++){const U=c&(y[d]^x[d]);y[d]^=U,x[d]^=U}}function h(y,x){const E=n(),c=n();for(let d=0;d<16;d++)c[d]=x[d];o(c),o(c),o(c);for(let d=0;d<2;d++){E[0]=c[0]-65517;for(let K=1;K<15;K++)E[K]=c[K]-65535-(E[K-1]>>16&1),E[K-1]&=65535;E[15]=c[15]-32767-(E[14]>>16&1);const U=E[15]>>16&1;E[14]&=65535,a(c,E,1-U)}for(let d=0;d<16;d++)y[2*d]=c[d]&255,y[2*d+1]=c[d]>>8}function f(y,x){for(let E=0;E<16;E++)y[E]=x[2*E]+(x[2*E+1]<<8);y[15]&=32767}function l(y,x,E){for(let c=0;c<16;c++)y[c]=x[c]+E[c]}function D(y,x,E){for(let c=0;c<16;c++)y[c]=x[c]-E[c]}function b(y,x,E){let c,d,U=0,K=0,G=0,J=0,X=0,g=0,v=0,F=0,M=0,P=0,C=0,j=0,z=0,Q=0,q=0,ee=0,Y=0,ae=0,T=0,A=0,O=0,u=0,_=0,H=0,W=0,he=0,ve=0,de=0,me=0,Be=0,$e=0,ye=E[0],pe=E[1],le=E[2],ue=E[3],ce=E[4],oe=E[5],se=E[6],te=E[7],fe=E[8],ge=E[9],ne=E[10],_e=E[11],be=E[12],Ee=E[13],De=E[14],we=E[15];c=x[0],U+=c*ye,K+=c*pe,G+=c*le,J+=c*ue,X+=c*ce,g+=c*oe,v+=c*se,F+=c*te,M+=c*fe,P+=c*ge,C+=c*ne,j+=c*_e,z+=c*be,Q+=c*Ee,q+=c*De,ee+=c*we,c=x[1],K+=c*ye,G+=c*pe,J+=c*le,X+=c*ue,g+=c*ce,v+=c*oe,F+=c*se,M+=c*te,P+=c*fe,C+=c*ge,j+=c*ne,z+=c*_e,Q+=c*be,q+=c*Ee,ee+=c*De,Y+=c*we,c=x[2],G+=c*ye,J+=c*pe,X+=c*le,g+=c*ue,v+=c*ce,F+=c*oe,M+=c*se,P+=c*te,C+=c*fe,j+=c*ge,z+=c*ne,Q+=c*_e,q+=c*be,ee+=c*Ee,Y+=c*De,ae+=c*we,c=x[3],J+=c*ye,X+=c*pe,g+=c*le,v+=c*ue,F+=c*ce,M+=c*oe,P+=c*se,C+=c*te,j+=c*fe,z+=c*ge,Q+=c*ne,q+=c*_e,ee+=c*be,Y+=c*Ee,ae+=c*De,T+=c*we,c=x[4],X+=c*ye,g+=c*pe,v+=c*le,F+=c*ue,M+=c*ce,P+=c*oe,C+=c*se,j+=c*te,z+=c*fe,Q+=c*ge,q+=c*ne,ee+=c*_e,Y+=c*be,ae+=c*Ee,T+=c*De,A+=c*we,c=x[5],g+=c*ye,v+=c*pe,F+=c*le,M+=c*ue,P+=c*ce,C+=c*oe,j+=c*se,z+=c*te,Q+=c*fe,q+=c*ge,ee+=c*ne,Y+=c*_e,ae+=c*be,T+=c*Ee,A+=c*De,O+=c*we,c=x[6],v+=c*ye,F+=c*pe,M+=c*le,P+=c*ue,C+=c*ce,j+=c*oe,z+=c*se,Q+=c*te,q+=c*fe,ee+=c*ge,Y+=c*ne,ae+=c*_e,T+=c*be,A+=c*Ee,O+=c*De,u+=c*we,c=x[7],F+=c*ye,M+=c*pe,P+=c*le,C+=c*ue,j+=c*ce,z+=c*oe,Q+=c*se,q+=c*te,ee+=c*fe,Y+=c*ge,ae+=c*ne,T+=c*_e,A+=c*be,O+=c*Ee,u+=c*De,_+=c*we,c=x[8],M+=c*ye,P+=c*pe,C+=c*le,j+=c*ue,z+=c*ce,Q+=c*oe,q+=c*se,ee+=c*te,Y+=c*fe,ae+=c*ge,T+=c*ne,A+=c*_e,O+=c*be,u+=c*Ee,_+=c*De,H+=c*we,c=x[9],P+=c*ye,C+=c*pe,j+=c*le,z+=c*ue,Q+=c*ce,q+=c*oe,ee+=c*se,Y+=c*te,ae+=c*fe,T+=c*ge,A+=c*ne,O+=c*_e,u+=c*be,_+=c*Ee,H+=c*De,W+=c*we,c=x[10],C+=c*ye,j+=c*pe,z+=c*le,Q+=c*ue,q+=c*ce,ee+=c*oe,Y+=c*se,ae+=c*te,T+=c*fe,A+=c*ge,O+=c*ne,u+=c*_e,_+=c*be,H+=c*Ee,W+=c*De,he+=c*we,c=x[11],j+=c*ye,z+=c*pe,Q+=c*le,q+=c*ue,ee+=c*ce,Y+=c*oe,ae+=c*se,T+=c*te,A+=c*fe,O+=c*ge,u+=c*ne,_+=c*_e,H+=c*be,W+=c*Ee,he+=c*De,ve+=c*we,c=x[12],z+=c*ye,Q+=c*pe,q+=c*le,ee+=c*ue,Y+=c*ce,ae+=c*oe,T+=c*se,A+=c*te,O+=c*fe,u+=c*ge,_+=c*ne,H+=c*_e,W+=c*be,he+=c*Ee,ve+=c*De,de+=c*we,c=x[13],Q+=c*ye,q+=c*pe,ee+=c*le,Y+=c*ue,ae+=c*ce,T+=c*oe,A+=c*se,O+=c*te,u+=c*fe,_+=c*ge,H+=c*ne,W+=c*_e,he+=c*be,ve+=c*Ee,de+=c*De,me+=c*we,c=x[14],q+=c*ye,ee+=c*pe,Y+=c*le,ae+=c*ue,T+=c*ce,A+=c*oe,O+=c*se,u+=c*te,_+=c*fe,H+=c*ge,W+=c*ne,he+=c*_e,ve+=c*be,de+=c*Ee,me+=c*De,Be+=c*we,c=x[15],ee+=c*ye,Y+=c*pe,ae+=c*le,T+=c*ue,A+=c*ce,O+=c*oe,u+=c*se,_+=c*te,H+=c*fe,W+=c*ge,he+=c*ne,ve+=c*_e,de+=c*be,me+=c*Ee,Be+=c*De,$e+=c*we,U+=38*Y,K+=38*ae,G+=38*T,J+=38*A,X+=38*O,g+=38*u,v+=38*_,F+=38*H,M+=38*W,P+=38*he,C+=38*ve,j+=38*de,z+=38*me,Q+=38*Be,q+=38*$e,d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=v+d+65535,d=Math.floor(c/65536),v=c-d*65536,c=F+d+65535,d=Math.floor(c/65536),F=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=P+d+65535,d=Math.floor(c/65536),P=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=q+d+65535,d=Math.floor(c/65536),q=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=v+d+65535,d=Math.floor(c/65536),v=c-d*65536,c=F+d+65535,d=Math.floor(c/65536),F=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=P+d+65535,d=Math.floor(c/65536),P=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=q+d+65535,d=Math.floor(c/65536),q=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),y[0]=U,y[1]=K,y[2]=G,y[3]=J,y[4]=X,y[5]=g,y[6]=v,y[7]=F,y[8]=M,y[9]=P,y[10]=C,y[11]=j,y[12]=z,y[13]=Q,y[14]=q,y[15]=ee}function m(y,x){b(y,x,x)}function w(y,x){const E=n();for(let c=0;c<16;c++)E[c]=x[c];for(let c=253;c>=0;c--)m(E,E),c!==2&&c!==4&&b(E,E,x);for(let c=0;c<16;c++)y[c]=E[c]}function N(y,x){const E=new Uint8Array(32),c=new Float64Array(80),d=n(),U=n(),K=n(),G=n(),J=n(),X=n();for(let M=0;M<31;M++)E[M]=y[M];E[31]=y[31]&127|64,E[0]&=248,f(c,x);for(let M=0;M<16;M++)U[M]=c[M];d[0]=G[0]=1;for(let M=254;M>=0;--M){const P=E[M>>>3]>>>(M&7)&1;a(d,U,P),a(K,G,P),l(J,d,K),D(d,d,K),l(K,U,G),D(U,U,G),m(G,J),m(X,d),b(d,K,d),b(K,U,J),l(J,d,K),D(d,d,K),m(U,d),D(K,G,X),b(d,K,s),l(d,d,G),b(K,K,d),b(d,G,X),b(G,U,c),m(U,J),a(d,U,P),a(K,G,P)}for(let M=0;M<16;M++)c[M+16]=d[M],c[M+32]=K[M],c[M+48]=U[M],c[M+64]=G[M];const g=c.subarray(32),v=c.subarray(16);w(g,g),b(v,v,g);const F=new Uint8Array(32);return h(F,v),F}t.scalarMult=N;function R(y){return N(y,i)}t.scalarMultBase=R;function B(y){if(y.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const x=new Uint8Array(y);return{publicKey:R(x),secretKey:x}}t.generateKeyPairFromSeed=B;function S(y){const x=(0,e.randomBytes)(32,y),E=B(x);return(0,r.wipe)(x),E}t.generateKeyPair=S;function I(y,x,E=!1){if(y.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(x.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const c=N(y,x);if(E){let d=0;for(let U=0;U<c.length;U++)d|=c[U];if(d===0)throw new Error("X25519: invalid shared key")}return c}t.sharedKey=I})(hi);function ro(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function li(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=ro(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Eh(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var N=0,R=0,B=0,S=w.length;B!==S&&w[B]===0;)B++,N++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=w[B],E=0,c=I-1;(x!==0||E<R)&&c!==-1;c--,E++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=E,B++}for(var d=I-R;d!==I&&y[d]===0;)d++;for(var U=h.repeat(N);d<I;++d)U+=t.charAt(y[d]);return U}function b(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var N=0;if(w[N]!==" "){for(var R=0,B=0;w[N]===h;)R++,N++;for(var S=(w.length-N)*f+1>>>0,I=new Uint8Array(S);w[N];){var y=r[w.charCodeAt(N)];if(y===255)return;for(var x=0,E=S-1;(y!==0||x<B)&&E!==-1;E--,x++)y+=a*I[E]>>>0,I[E]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,N++}if(w[N]!==" "){for(var c=S-B;c!==S&&I[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=I[c++];return d}}}function m(w){var N=b(w);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:b,decode:m}}var Dh=Eh,xh=Dh;const no=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Sh=t=>new TextEncoder().encode(t),Oh=t=>new TextDecoder().decode(t);class Lh{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ih{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return io(this,e)}}class Ah{constructor(e){this.decoders=e}or(e){return io(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const io=(t,e)=>new Ah({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Th{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Lh(e,r,n),this.decoder=new Ih(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pn=({name:t,prefix:e,encode:r,decode:n})=>new Th(t,e,r,n),Tr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=xh(r,e);return pn({prefix:t,name:e,encode:n,decode:s=>no(i(s))})},Ch=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<r|D,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},Rh=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},it=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>pn({prefix:e,name:t,encode(i){return Rh(i,n,r)},decode(i){return Ch(i,n,r,t)}}),Ph=pn({prefix:"\0",name:"identity",encode:t=>Oh(t),decode:t=>Sh(t)});var Nh=Object.freeze({__proto__:null,identity:Ph});const $h=it({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fh=Object.freeze({__proto__:null,base2:$h});const Mh=it({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Uh=Object.freeze({__proto__:null,base8:Mh});const jh=Tr({prefix:"9",name:"base10",alphabet:"0123456789"});var Bh=Object.freeze({__proto__:null,base10:jh});const zh=it({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Kh=it({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var qh=Object.freeze({__proto__:null,base16:zh,base16upper:Kh});const Hh=it({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vh=it({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Gh=it({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wh=it({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),kh=it({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yh=it({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Jh=it({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xh=it({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Zh=it({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Qh=Object.freeze({__proto__:null,base32:Hh,base32upper:Vh,base32pad:Gh,base32padupper:Wh,base32hex:kh,base32hexupper:Yh,base32hexpad:Jh,base32hexpadupper:Xh,base32z:Zh});const el=Tr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tl=Tr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var rl=Object.freeze({__proto__:null,base36:el,base36upper:tl});const nl=Tr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),il=Tr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var sl=Object.freeze({__proto__:null,base58btc:nl,base58flickr:il});const ol=it({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),al=it({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cl=it({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ul=it({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var fl=Object.freeze({__proto__:null,base64:ol,base64pad:al,base64url:cl,base64urlpad:ul});const so=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),hl=so.reduce((t,e,r)=>(t[r]=e,t),[]),ll=so.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function dl(t){return t.reduce((e,r)=>(e+=hl[r],e),"")}function pl(t){const e=[];for(const r of t){const n=ll[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const gl=pn({prefix:"\u{1F680}",name:"base256emoji",encode:dl,decode:pl});var yl=Object.freeze({__proto__:null,base256emoji:gl}),vl=ao,oo=128,_l=127,bl=~_l,ml=Math.pow(2,31);function ao(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ml;)e[r++]=t&255|oo,t/=128;for(;t&bl;)e[r++]=t&255|oo,t>>>=7;return e[r]=t|0,ao.bytes=r-n+1,e}var wl=di,El=128,co=127;function di(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw di.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&co)<<i:(o&co)*Math.pow(2,i),i+=7}while(o>=El);return di.bytes=s-n,r}var Dl=Math.pow(2,7),xl=Math.pow(2,14),Sl=Math.pow(2,21),Ol=Math.pow(2,28),Ll=Math.pow(2,35),Il=Math.pow(2,42),Al=Math.pow(2,49),Tl=Math.pow(2,56),Cl=Math.pow(2,63),Rl=function(t){return t<Dl?1:t<xl?2:t<Sl?3:t<Ol?4:t<Ll?5:t<Il?6:t<Al?7:t<Tl?8:t<Cl?9:10},Pl={encode:vl,decode:wl,encodingLength:Rl},uo=Pl;const fo=(t,e,r=0)=>(uo.encode(t,e,r),e),ho=t=>uo.encodingLength(t),pi=(t,e)=>{const r=e.byteLength,n=ho(t),i=n+ho(r),s=new Uint8Array(i+r);return fo(t,s,0),fo(r,s,n),s.set(e,i),new Nl(t,r,e,s)};class Nl{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const lo=({name:t,code:e,encode:r})=>new $l(t,e,r);class $l{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?pi(this.code,r):r.then(n=>pi(this.code,n))}else throw Error("Unknown type, must be binary type")}}const po=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Fl=lo({name:"sha2-256",code:18,encode:po("SHA-256")}),Ml=lo({name:"sha2-512",code:19,encode:po("SHA-512")});var Ul=Object.freeze({__proto__:null,sha256:Fl,sha512:Ml});const go=0,jl="identity",yo=no;var Bl=Object.freeze({__proto__:null,identity:{code:go,name:jl,encode:yo,digest:t=>pi(go,yo(t))}});new TextEncoder,new TextDecoder;const vo={...Nh,...Fh,...Uh,...Bh,...qh,...Qh,...rl,...sl,...fl,...yl};({...Ul,...Bl});function _o(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const bo=_o("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),gi=_o("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=ro(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),mo={utf8:bo,"utf-8":bo,hex:vo.base16,latin1:gi,ascii:gi,binary:gi,...vo};function lt(t,e="utf8"){const r=mo[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function dt(t,e="utf8"){const r=mo[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var wo=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},zl=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),Kl=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),ql=function(){function t(e,r,n,i){this.name=e,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return t}(),Hl=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Vl=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Gl=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Wl=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Eo=3,kl=[["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",Gl]],Do=[["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 Yl(t){return t?xo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Vl:typeof navigator<"u"?xo(navigator.userAgent):Zl()}function Jl(t){return t!==""&&kl.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function xo(t){var e=Jl(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Hl;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<Eo&&(i=wo(wo([],i,!0),Ql(Eo-i.length),!0)):i=[];var s=i.join("."),o=Xl(t),a=Wl.exec(t);return a&&a[1]?new ql(r,s,o,a[1]):new zl(r,s,o)}function Xl(t){for(var e=0,r=Do.length;e<r;e++){var n=Do[e],i=n[0],s=n[1],o=s.exec(t);if(o)return i}return null}function Zl(){var t=typeof process<"u"&&process.version;return t?new Kl(process.version.slice(1)):null}function Ql(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var Z={};/*! *****************************************************************************
|
|
14
|
+
***************************************************************************** */var Jn=function(t,e){return Jn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Jn(t,e)};function Qu(t,e){Jn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xn=function(){return Xn=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Xn.apply(this,arguments)};function ef(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function tf(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function rf(t,e){return function(r,n){e(r,n,t)}}function nf(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function sf(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{h(n.next(l))}catch(D){o(D)}}function f(l){try{h(n.throw(l))}catch(D){o(D)}}function h(l){l.done?s(l.value):i(l.value).then(a,f)}h((n=n.apply(t,e||[])).next())})}function of(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(l){return f([h,l])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(l){h=[6,l],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function af(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function cf(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Zn(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ns(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function uf(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ns(arguments[e]));return t}function ff(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Or(t){return this instanceof Or?(this.v=t,this):new Or(t)}function hf(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(v){n[v]&&(i[v]=function(m){return new Promise(function(w,P){s.push([v,m,w,P])>1||a(v,m)})})}function a(v,m){try{f(n[v](m))}catch(w){D(s[0][3],w)}}function f(v){v.value instanceof Or?Promise.resolve(v.value.v).then(h,l):D(s[0][2],v)}function h(v){a("next",v)}function l(v){a("throw",v)}function D(v,m){v(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function lf(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Or(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function df(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zn=="function"?Zn(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),i(a,f,o.done,o.value)})}}function i(s,o,a,f){Promise.resolve(f).then(function(h){s({value:h,done:a})},o)}}function pf(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gf(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function yf(t){return t&&t.__esModule?t:{default:t}}function vf(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function _f(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var bf=Object.freeze({__proto__:null,__extends:Qu,get __assign(){return Xn},__rest:ef,__decorate:tf,__param:rf,__metadata:nf,__awaiter:sf,__generator:of,__createBinding:af,__exportStar:cf,__values:Zn,__read:Ns,__spread:uf,__spreadArrays:ff,__await:Or,__asyncGenerator:hf,__asyncDelegator:lf,__asyncValues:df,__makeTemplateObject:pf,__importStar:gf,__importDefault:yf,__classPrivateFieldGet:vf,__classPrivateFieldSet:_f}),mf=Zt(bf),Ut={},Ps;function wf(){if(Ps)return Ut;Ps=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.isBrowserCryptoAvailable=Ut.getSubtleCrypto=Ut.getBrowerCrypto=void 0;function t(){return ke?.crypto||ke?.msCrypto||{}}Ut.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Ut.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ut.isBrowserCryptoAvailable=r,Ut}var jt={},$s;function Ef(){if($s)return jt;$s=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.isBrowser=jt.isNode=jt.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}jt.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}jt.isNode=e;function r(){return!t()&&!e()}return jt.isBrowser=r,jt}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=mf;e.__exportStar(wf(),t),e.__exportStar(Ef(),t)})(Rs);function Df(){const t=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return t+e}function sn(t,e,r){return{id:r||Df(),jsonrpc:"2.0",method:t,params:e}}function on(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Lr(t,e,r){return{id:t,jsonrpc:"2.0",error:xf(e,r)}}function xf(t,e){return typeof t>"u"?Ts(Is):(typeof t=="string"&&(t=Object.assign(Object.assign({},Ts(Yn)),{message:t})),typeof e<"u"&&(t.data=e),Xu(t.code)&&(t=Zu(t.code)),t)}class Fs{}class Sf extends Fs{constructor(e){super()}}class Of extends Fs{constructor(){super()}}class Lf extends Of{constructor(e){super()}}const If="^https?:",Af="^wss?:";function Tf(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Ms(t,e){const r=Tf(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Us(t){return Ms(t,If)}function js(t){return Ms(t,Af)}function Cf(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Bs(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Qn(t){return Bs(t)&&"method"in t}function ei(t){return Bs(t)&&(Bt(t)||Ot(t))}function Bt(t){return"result"in t}function Ot(t){return"error"in t}class ti extends Lf{constructor(e){super(e),this.events=new kn.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(sn(e.method,e.params||[]),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Ot(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ei(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await 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 ri={exports:{}};(function(t,e){var r=typeof self<"u"?self:ke,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function f(g){return g&&DataView.prototype.isPrototypeOf(g)}if(a.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(g){return g&&h.indexOf(Object.prototype.toString.call(g))>-1};function D(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(g))throw new TypeError("Invalid character in header field name");return g.toLowerCase()}function v(g){return typeof g!="string"&&(g=String(g)),g}function m(g){var _={next:function(){var F=g.shift();return{done:F===void 0,value:F}}};return a.iterable&&(_[Symbol.iterator]=function(){return _}),_}function w(g){this.map={},g instanceof w?g.forEach(function(_,F){this.append(F,_)},this):Array.isArray(g)?g.forEach(function(_){this.append(_[0],_[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(_){this.append(_,g[_])},this)}w.prototype.append=function(g,_){g=D(g),_=v(_);var F=this.map[g];this.map[g]=F?F+", "+_:_},w.prototype.delete=function(g){delete this.map[D(g)]},w.prototype.get=function(g){return g=D(g),this.has(g)?this.map[g]:null},w.prototype.has=function(g){return this.map.hasOwnProperty(D(g))},w.prototype.set=function(g,_){this.map[D(g)]=v(_)},w.prototype.forEach=function(g,_){for(var F in this.map)this.map.hasOwnProperty(F)&&g.call(_,this.map[F],F,this)},w.prototype.keys=function(){var g=[];return this.forEach(function(_,F){g.push(F)}),m(g)},w.prototype.values=function(){var g=[];return this.forEach(function(_){g.push(_)}),m(g)},w.prototype.entries=function(){var g=[];return this.forEach(function(_,F){g.push([F,_])}),m(g)},a.iterable&&(w.prototype[Symbol.iterator]=w.prototype.entries);function P(g){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}function R(g){return new Promise(function(_,F){g.onload=function(){_(g.result)},g.onerror=function(){F(g.error)}})}function B(g){var _=new FileReader,F=R(_);return _.readAsArrayBuffer(g),F}function S(g){var _=new FileReader,F=R(_);return _.readAsText(g),F}function I(g){for(var _=new Uint8Array(g),F=new Array(_.length),M=0;M<_.length;M++)F[M]=String.fromCharCode(_[M]);return F.join("")}function y(g){if(g.slice)return g.slice(0);var _=new Uint8Array(g.byteLength);return _.set(new Uint8Array(g)),_.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(g){this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:a.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:a.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():a.arrayBuffer&&a.blob&&f(g)?(this._bodyArrayBuffer=y(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||l(g))?this._bodyArrayBuffer=y(g):this._bodyText=g=Object.prototype.toString.call(g):this._bodyText="",this.headers.get("content-type")||(typeof g=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var g=P(this);if(g)return g;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?P(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(B)}),this.text=function(){var g=P(this);if(g)return g;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(I(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function c(g){var _=g.toUpperCase();return E.indexOf(_)>-1?_:g}function d(g,_){_=_||{};var F=_.body;if(g instanceof d){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,_.headers||(this.headers=new w(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!F&&g._bodyInit!=null&&(F=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);if(this.credentials=_.credentials||this.credentials||"same-origin",(_.headers||!this.headers)&&(this.headers=new w(_.headers)),this.method=c(_.method||this.method||"GET"),this.mode=_.mode||this.mode||null,this.signal=_.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&F)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(F)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})};function U(g){var _=new FormData;return g.trim().split("&").forEach(function(F){if(F){var M=F.split("="),N=M.shift().replace(/\+/g," "),C=M.join("=").replace(/\+/g," ");_.append(decodeURIComponent(N),decodeURIComponent(C))}}),_}function K(g){var _=new w,F=g.replace(/\r?\n[\t ]+/g," ");return F.split(/\r?\n/).forEach(function(M){var N=M.split(":"),C=N.shift().trim();if(C){var j=N.join(":").trim();_.append(C,j)}}),_}x.call(d.prototype);function G(g,_){_||(_={}),this.type="default",this.status=_.status===void 0?200:_.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in _?_.statusText:"OK",this.headers=new w(_.headers),this.url=_.url||"",this._initBody(g)}x.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new w(this.headers),url:this.url})},G.error=function(){var g=new G(null,{status:0,statusText:""});return g.type="error",g};var J=[301,302,303,307,308];G.redirect=function(g,_){if(J.indexOf(_)===-1)throw new RangeError("Invalid status code");return new G(null,{status:_,headers:{location:g}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(_,F){this.message=_,this.name=F;var M=Error(_);this.stack=M.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function X(g,_){return new Promise(function(F,M){var N=new d(g,_);if(N.signal&&N.signal.aborted)return M(new o.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function j(){C.abort()}C.onload=function(){var z={status:C.status,statusText:C.statusText,headers:K(C.getAllResponseHeaders()||"")};z.url="responseURL"in C?C.responseURL:z.headers.get("X-Request-URL");var Q="response"in C?C.response:C.responseText;F(new G(Q,z))},C.onerror=function(){M(new TypeError("Network request failed"))},C.ontimeout=function(){M(new TypeError("Network request failed"))},C.onabort=function(){M(new o.DOMException("Aborted","AbortError"))},C.open(N.method,N.url,!0),N.credentials==="include"?C.withCredentials=!0:N.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&a.blob&&(C.responseType="blob"),N.headers.forEach(function(z,Q){C.setRequestHeader(Q,z)}),N.signal&&(N.signal.addEventListener("abort",j),C.onreadystatechange=function(){C.readyState===4&&N.signal.removeEventListener("abort",j)}),C.send(typeof N._bodyInit>"u"?null:N._bodyInit)})}return X.polyfill=!0,s.fetch||(s.fetch=X,s.Headers=w,s.Request=d,s.Response=G),o.Headers=w,o.Request=d,o.Response=G,o.fetch=X,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(ri,ri.exports);var zs=Uu(ri.exports);function ni(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ir(t){return typeof t=="string"?t:JSON.stringify(t)}const Ks={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},qs=10;class Rf{constructor(e){if(this.url=e,this.events=new kn.EventEmitter,this.isAvailable=!1,this.registering=!1,!Us(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,r){this.isAvailable||await this.register();try{const n=Ir(e),s=await(await zs(this.url,Object.assign(Object.assign({},Ks),{body:n}))).json();this.onPayload({data:s})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!Us(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{const r=Ir({id:1,jsonrpc:"2.0",method:"test",params:[]});await zs(e,Object.assign(Object.assign({},Ks),{body:r})),this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?ni(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Lr(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Cs(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>qs&&this.events.setMaxListeners(qs)}}var ii={},an={},re={},Hs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,f){var h=a>>>16&65535,l=a&65535,D=f>>>16&65535,v=f&65535;return l*v+(h*v+l*D<<16>>>0)|0}t.mul=Math.imul||e;function r(a,f){return a+f|0}t.add=r;function n(a,f){return a-f|0}t.sub=n;function i(a,f){return a<<f|a>>>32-f}t.rotl=i;function s(a,f){return a<<32-f|a>>>f}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Hs),Object.defineProperty(re,"__esModule",{value:!0});var Vs=Hs;function Nf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}re.readInt16BE=Nf;function Pf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}re.readUint16BE=Pf;function $f(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}re.readInt16LE=$f;function Ff(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}re.readUint16LE=Ff;function Gs(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}re.writeUint16BE=Gs,re.writeInt16BE=Gs;function Ws(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}re.writeUint16LE=Ws,re.writeInt16LE=Ws;function si(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}re.readInt32BE=si;function oi(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}re.readUint32BE=oi;function ai(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}re.readInt32LE=ai;function ci(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}re.readUint32LE=ci;function cn(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}re.writeUint32BE=cn,re.writeInt32BE=cn;function un(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}re.writeUint32LE=un,re.writeInt32LE=un;function Mf(t,e){e===void 0&&(e=0);var r=si(t,e),n=si(t,e+4);return r*4294967296+n-(n>>31)*4294967296}re.readInt64BE=Mf;function Uf(t,e){e===void 0&&(e=0);var r=oi(t,e),n=oi(t,e+4);return r*4294967296+n}re.readUint64BE=Uf;function jf(t,e){e===void 0&&(e=0);var r=ai(t,e),n=ai(t,e+4);return n*4294967296+r-(r>>31)*4294967296}re.readInt64LE=jf;function Bf(t,e){e===void 0&&(e=0);var r=ci(t,e),n=ci(t,e+4);return n*4294967296+r}re.readUint64LE=Bf;function ks(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),cn(t/4294967296>>>0,e,r),cn(t>>>0,e,r+4),e}re.writeUint64BE=ks,re.writeInt64BE=ks;function Ys(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),un(t>>>0,e,r),un(t/4294967296>>>0,e,r+4),e}re.writeUint64LE=Ys,re.writeInt64LE=Ys;function zf(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}re.readUintBE=zf;function Kf(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+t/8;s++)n+=e[s]*i,i*=256;return n}re.readUintLE=Kf;function qf(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Vs.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=t/8+n-1;s>=n;s--)r[s]=e/i&255,i*=256;return r}re.writeUintBE=qf;function Hf(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Vs.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+t/8;s++)r[s]=e/i&255,i*=256;return r}re.writeUintLE=Hf;function Vf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}re.readFloat32BE=Vf;function Gf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}re.readFloat32LE=Gf;function Wf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}re.readFloat64BE=Wf;function kf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}re.readFloat64LE=kf;function Yf(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t),e}re.writeFloat32BE=Yf;function Jf(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t,!0),e}re.writeFloat32LE=Jf;function Xf(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t),e}re.writeFloat64BE=Xf;function Zf(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t,!0),e}re.writeFloat64LE=Zf;var _t={};Object.defineProperty(_t,"__esModule",{value:!0});function Qf(t){for(var e=0;e<t.length;e++)t[e]=0;return t}_t.wipe=Qf,Object.defineProperty(an,"__esModule",{value:!0});var ct=re,ui=_t,eh=20;function th(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],f=r[7]<<24|r[6]<<16|r[5]<<8|r[4],h=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],D=r[19]<<24|r[18]<<16|r[17]<<8|r[16],v=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],w=r[31]<<24|r[30]<<16|r[29]<<8|r[28],P=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],S=e[15]<<24|e[14]<<16|e[13]<<8|e[12],I=n,y=i,x=s,E=o,c=a,d=f,U=h,K=l,G=D,J=v,X=m,g=w,_=P,F=R,M=B,N=S,C=0;C<eh;C+=2)I=I+c|0,_^=I,_=_>>>32-16|_<<16,G=G+_|0,c^=G,c=c>>>32-12|c<<12,y=y+d|0,F^=y,F=F>>>32-16|F<<16,J=J+F|0,d^=J,d=d>>>32-12|d<<12,x=x+U|0,M^=x,M=M>>>32-16|M<<16,X=X+M|0,U^=X,U=U>>>32-12|U<<12,E=E+K|0,N^=E,N=N>>>32-16|N<<16,g=g+N|0,K^=g,K=K>>>32-12|K<<12,x=x+U|0,M^=x,M=M>>>32-8|M<<8,X=X+M|0,U^=X,U=U>>>32-7|U<<7,E=E+K|0,N^=E,N=N>>>32-8|N<<8,g=g+N|0,K^=g,K=K>>>32-7|K<<7,y=y+d|0,F^=y,F=F>>>32-8|F<<8,J=J+F|0,d^=J,d=d>>>32-7|d<<7,I=I+c|0,_^=I,_=_>>>32-8|_<<8,G=G+_|0,c^=G,c=c>>>32-7|c<<7,I=I+d|0,N^=I,N=N>>>32-16|N<<16,X=X+N|0,d^=X,d=d>>>32-12|d<<12,y=y+U|0,_^=y,_=_>>>32-16|_<<16,g=g+_|0,U^=g,U=U>>>32-12|U<<12,x=x+K|0,F^=x,F=F>>>32-16|F<<16,G=G+F|0,K^=G,K=K>>>32-12|K<<12,E=E+c|0,M^=E,M=M>>>32-16|M<<16,J=J+M|0,c^=J,c=c>>>32-12|c<<12,x=x+K|0,F^=x,F=F>>>32-8|F<<8,G=G+F|0,K^=G,K=K>>>32-7|K<<7,E=E+c|0,M^=E,M=M>>>32-8|M<<8,J=J+M|0,c^=J,c=c>>>32-7|c<<7,y=y+U|0,_^=y,_=_>>>32-8|_<<8,g=g+_|0,U^=g,U=U>>>32-7|U<<7,I=I+d|0,N^=I,N=N>>>32-8|N<<8,X=X+N|0,d^=X,d=d>>>32-7|d<<7;ct.writeUint32LE(I+n|0,t,0),ct.writeUint32LE(y+i|0,t,4),ct.writeUint32LE(x+s|0,t,8),ct.writeUint32LE(E+o|0,t,12),ct.writeUint32LE(c+a|0,t,16),ct.writeUint32LE(d+f|0,t,20),ct.writeUint32LE(U+h|0,t,24),ct.writeUint32LE(K+l|0,t,28),ct.writeUint32LE(G+D|0,t,32),ct.writeUint32LE(J+v|0,t,36),ct.writeUint32LE(X+m|0,t,40),ct.writeUint32LE(g+w|0,t,44),ct.writeUint32LE(_+P|0,t,48),ct.writeUint32LE(F+R|0,t,52),ct.writeUint32LE(M+B|0,t,56),ct.writeUint32LE(N+S|0,t,60)}function Js(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,o;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=i}for(var a=new Uint8Array(64),f=0;f<r.length;f+=64){th(a,s,t);for(var h=f;h<f+64&&h<r.length;h++)n[h]=r[h]^a[h-f];nh(s,0,o)}return ui.wipe(a),i===0&&ui.wipe(s),n}an.streamXOR=Js;function rh(t,e,r,n){return n===void 0&&(n=0),ui.wipe(r),Js(t,e,r,r,n)}an.stream=rh;function nh(t,e,r){for(var n=1;r--;)n=n+(t[e]&255)|0,t[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Xs={},Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});function ih(t,e,r){return~(t-1)&e|t-1&r}Vt.select=ih;function sh(t,e){return(t|0)-(e|0)-1>>>31&1}Vt.lessOrEqual=sh;function Zs(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 1&r-1>>>8}Vt.compare=Zs;function oh(t,e){return t.length===0||e.length===0?!1:Zs(t,e)!==0}Vt.equal=oh,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Vt,r=_t;t.DIGEST_LENGTH=16;var n=function(){function o(a){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 f=a[0]|a[1]<<8;this._r[0]=f&8191;var h=a[2]|a[3]<<8;this._r[1]=(f>>>13|h<<3)&8191;var l=a[4]|a[5]<<8;this._r[2]=(h>>>10|l<<6)&7939;var D=a[6]|a[7]<<8;this._r[3]=(l>>>7|D<<9)&8191;var v=a[8]|a[9]<<8;this._r[4]=(D>>>4|v<<12)&255,this._r[5]=v>>>1&8190;var m=a[10]|a[11]<<8;this._r[6]=(v>>>14|m<<2)&8191;var w=a[12]|a[13]<<8;this._r[7]=(m>>>11|w<<5)&8065;var P=a[14]|a[15]<<8;this._r[8]=(w>>>8|P<<8)&8191,this._r[9]=P>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,f,h){for(var l=this._fin?0:2048,D=this._h[0],v=this._h[1],m=this._h[2],w=this._h[3],P=this._h[4],R=this._h[5],B=this._h[6],S=this._h[7],I=this._h[8],y=this._h[9],x=this._r[0],E=this._r[1],c=this._r[2],d=this._r[3],U=this._r[4],K=this._r[5],G=this._r[6],J=this._r[7],X=this._r[8],g=this._r[9];h>=16;){var _=a[f+0]|a[f+1]<<8;D+=_&8191;var F=a[f+2]|a[f+3]<<8;v+=(_>>>13|F<<3)&8191;var M=a[f+4]|a[f+5]<<8;m+=(F>>>10|M<<6)&8191;var N=a[f+6]|a[f+7]<<8;w+=(M>>>7|N<<9)&8191;var C=a[f+8]|a[f+9]<<8;P+=(N>>>4|C<<12)&8191,R+=C>>>1&8191;var j=a[f+10]|a[f+11]<<8;B+=(C>>>14|j<<2)&8191;var z=a[f+12]|a[f+13]<<8;S+=(j>>>11|z<<5)&8191;var Q=a[f+14]|a[f+15]<<8;I+=(z>>>8|Q<<8)&8191,y+=Q>>>5|l;var q=0,ee=q;ee+=D*x,ee+=v*(5*g),ee+=m*(5*X),ee+=w*(5*J),ee+=P*(5*G),q=ee>>>13,ee&=8191,ee+=R*(5*K),ee+=B*(5*U),ee+=S*(5*d),ee+=I*(5*c),ee+=y*(5*E),q+=ee>>>13,ee&=8191;var Y=q;Y+=D*E,Y+=v*x,Y+=m*(5*g),Y+=w*(5*X),Y+=P*(5*J),q=Y>>>13,Y&=8191,Y+=R*(5*G),Y+=B*(5*K),Y+=S*(5*U),Y+=I*(5*d),Y+=y*(5*c),q+=Y>>>13,Y&=8191;var ae=q;ae+=D*c,ae+=v*E,ae+=m*x,ae+=w*(5*g),ae+=P*(5*X),q=ae>>>13,ae&=8191,ae+=R*(5*J),ae+=B*(5*G),ae+=S*(5*K),ae+=I*(5*U),ae+=y*(5*d),q+=ae>>>13,ae&=8191;var T=q;T+=D*d,T+=v*c,T+=m*E,T+=w*x,T+=P*(5*g),q=T>>>13,T&=8191,T+=R*(5*X),T+=B*(5*J),T+=S*(5*G),T+=I*(5*K),T+=y*(5*U),q+=T>>>13,T&=8191;var A=q;A+=D*U,A+=v*d,A+=m*c,A+=w*E,A+=P*x,q=A>>>13,A&=8191,A+=R*(5*g),A+=B*(5*X),A+=S*(5*J),A+=I*(5*G),A+=y*(5*K),q+=A>>>13,A&=8191;var O=q;O+=D*K,O+=v*U,O+=m*d,O+=w*c,O+=P*E,q=O>>>13,O&=8191,O+=R*x,O+=B*(5*g),O+=S*(5*X),O+=I*(5*J),O+=y*(5*G),q+=O>>>13,O&=8191;var u=q;u+=D*G,u+=v*K,u+=m*U,u+=w*d,u+=P*c,q=u>>>13,u&=8191,u+=R*E,u+=B*x,u+=S*(5*g),u+=I*(5*X),u+=y*(5*J),q+=u>>>13,u&=8191;var b=q;b+=D*J,b+=v*G,b+=m*K,b+=w*U,b+=P*d,q=b>>>13,b&=8191,b+=R*c,b+=B*E,b+=S*x,b+=I*(5*g),b+=y*(5*X),q+=b>>>13,b&=8191;var H=q;H+=D*X,H+=v*J,H+=m*G,H+=w*K,H+=P*U,q=H>>>13,H&=8191,H+=R*d,H+=B*c,H+=S*E,H+=I*x,H+=y*(5*g),q+=H>>>13,H&=8191;var W=q;W+=D*g,W+=v*X,W+=m*J,W+=w*G,W+=P*K,q=W>>>13,W&=8191,W+=R*U,W+=B*d,W+=S*c,W+=I*E,W+=y*x,q+=W>>>13,W&=8191,q=(q<<2)+q|0,q=q+ee|0,ee=q&8191,q=q>>>13,Y+=q,D=ee,v=Y,m=ae,w=T,P=A,R=O,B=u,S=b,I=H,y=W,f+=16,h-=16}this._h[0]=D,this._h[1]=v,this._h[2]=m,this._h[3]=w,this._h[4]=P,this._h[5]=R,this._h[6]=B,this._h[7]=S,this._h[8]=I,this._h[9]=y},o.prototype.finish=function(a,f){f===void 0&&(f=0);var h=new Uint16Array(10),l,D,v,m;if(this._leftover){for(m=this._leftover,this._buffer[m++]=1;m<16;m++)this._buffer[m]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(l=this._h[1]>>>13,this._h[1]&=8191,m=2;m<10;m++)this._h[m]+=l,l=this._h[m]>>>13,this._h[m]&=8191;for(this._h[0]+=l*5,l=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=l,l=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=l,h[0]=this._h[0]+5,l=h[0]>>>13,h[0]&=8191,m=1;m<10;m++)h[m]=this._h[m]+l,l=h[m]>>>13,h[m]&=8191;for(h[9]-=1<<13,D=(l^1)-1,m=0;m<10;m++)h[m]&=D;for(D=~D,m=0;m<10;m++)this._h[m]=this._h[m]&D|h[m];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,v=this._h[0]+this._pad[0],this._h[0]=v&65535,m=1;m<8;m++)v=(this._h[m]+this._pad[m]|0)+(v>>>16)|0,this._h[m]=v&65535;return a[f+0]=this._h[0]>>>0,a[f+1]=this._h[0]>>>8,a[f+2]=this._h[1]>>>0,a[f+3]=this._h[1]>>>8,a[f+4]=this._h[2]>>>0,a[f+5]=this._h[2]>>>8,a[f+6]=this._h[3]>>>0,a[f+7]=this._h[3]>>>8,a[f+8]=this._h[4]>>>0,a[f+9]=this._h[4]>>>8,a[f+10]=this._h[5]>>>0,a[f+11]=this._h[5]>>>8,a[f+12]=this._h[6]>>>0,a[f+13]=this._h[6]>>>8,a[f+14]=this._h[7]>>>0,a[f+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var f=0,h=a.length,l;if(this._leftover){l=16-this._leftover,l>h&&(l=h);for(var D=0;D<l;D++)this._buffer[this._leftover+D]=a[f+D];if(h-=l,f+=l,this._leftover+=l,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(l=h-h%16,this._blocks(a,f,l),f+=l,h-=l),h){for(var D=0;D<h;D++)this._buffer[this._leftover+D]=a[f+D];this._leftover+=h}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var a=new Uint8Array(16);return this.finish(a),a},o.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},o}();t.Poly1305=n;function i(o,a){var f=new n(o);f.update(a);var h=f.digest();return f.clean(),h}t.oneTimeAuth=i;function s(o,a){return o.length!==t.DIGEST_LENGTH||a.length!==t.DIGEST_LENGTH?!1:e.equal(o,a)}t.equal=s}(Xs),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=an,r=Xs,n=_t,i=re,s=Vt;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var o=new Uint8Array(16),a=function(){function f(h){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,h.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return f.prototype.seal=function(h,l,D,v){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var m=new Uint8Array(16);m.set(h,m.length-h.length);var w=new Uint8Array(32);e.stream(this._key,m,w,4);var P=l.length+this.tagLength,R;if(v){if(v.length!==P)throw new Error("ChaCha20Poly1305: incorrect destination length");R=v}else R=new Uint8Array(P);return e.streamXOR(this._key,m,l,R,4),this._authenticate(R.subarray(R.length-this.tagLength,R.length),w,R.subarray(0,R.length-this.tagLength),D),n.wipe(m),R},f.prototype.open=function(h,l,D,v){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(l.length<this.tagLength)return null;var m=new Uint8Array(16);m.set(h,m.length-h.length);var w=new Uint8Array(32);e.stream(this._key,m,w,4);var P=new Uint8Array(this.tagLength);if(this._authenticate(P,w,l.subarray(0,l.length-this.tagLength),D),!s.equal(P,l.subarray(l.length-this.tagLength,l.length)))return null;var R=l.length-this.tagLength,B;if(v){if(v.length!==R)throw new Error("ChaCha20Poly1305: incorrect destination length");B=v}else B=new Uint8Array(R);return e.streamXOR(this._key,m,l.subarray(0,l.length-this.tagLength),B,4),n.wipe(m),B},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,l,D,v){var m=new r.Poly1305(l);v&&(m.update(v),v.length%16>0&&m.update(o.subarray(v.length%16))),m.update(D),D.length%16>0&&m.update(o.subarray(D.length%16));var w=new Uint8Array(8);v&&i.writeUint64LE(v.length,w),m.update(w),i.writeUint64LE(D.length,w),m.update(w);for(var P=m.digest(),R=0;R<P.length;R++)h[R]=P[R];m.clean(),n.wipe(P),n.wipe(w)},f}();t.ChaCha20Poly1305=a}(ii);var Qs={},Ar={},fi={};Object.defineProperty(fi,"__esModule",{value:!0});function ah(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}fi.isSerializableHash=ah,Object.defineProperty(Ar,"__esModule",{value:!0});var At=fi,ch=Vt,uh=_t,eo=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),At.isSerializableHash(this._inner)&&At.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),uh.wipe(n)}return t.prototype.reset=function(){if(!At.isSerializableHash(this._inner)||!At.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},t.prototype.clean=function(){At.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),At.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.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)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!At.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!At.isSerializableHash(this._inner)||!At.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},t.prototype.cleanSavedState=function(e){if(!At.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Ar.HMAC=eo;function fh(t,e,r){var n=new eo(t,e);n.update(r);var i=n.digest();return n.clean(),i}Ar.hmac=fh,Ar.equal=ch.equal,Object.defineProperty(Qs,"__esModule",{value:!0});var to=Ar,ro=_t,hh=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=to.hmac(this._hash,n,r);this._hmac=new to.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)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},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n<r.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[n]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),ro.wipe(this._buffer),ro.wipe(this._counter),this._bufpos=0},t}(),lh=Qs.HKDF=hh,lr={},fn={},hn={};Object.defineProperty(hn,"__esModule",{value:!0}),hn.BrowserRandomSource=void 0;const no=65536;class dh{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(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 r=new Uint8Array(e);for(let n=0;n<r.length;n+=no)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,no)));return r}}hn.BrowserRandomSource=dh;function ph(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ln={},gh={},yh=Object.freeze({__proto__:null,default:gh}),vh=Zt(yh);Object.defineProperty(ln,"__esModule",{value:!0}),ln.NodeRandomSource=void 0;const _h=_t;class bh{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof ph<"u"){const e=vh;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 r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=r[i];return(0,_h.wipe)(r),n}}ln.NodeRandomSource=bh,Object.defineProperty(fn,"__esModule",{value:!0}),fn.SystemRandomSource=void 0;const mh=hn,wh=ln;class Eh{constructor(){if(this.isAvailable=!1,this.name="",this._source=new mh.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new wh.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}fn.SystemRandomSource=Eh,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=fn,r=re,n=_t;t.defaultRandomSource=new e.SystemRandomSource;function i(h,l=t.defaultRandomSource){return l.randomBytes(h)}t.randomBytes=i;function s(h=t.defaultRandomSource){const l=i(4,h),D=(0,r.readUint32LE)(l);return(0,n.wipe)(l),D}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(h,l=o,D=t.defaultRandomSource){if(l.length<2)throw new Error("randomString charset is too short");if(l.length>256)throw new Error("randomString charset is too long");let v="";const m=l.length,w=256-256%m;for(;h>0;){const P=i(Math.ceil(h*256/w),D);for(let R=0;R<P.length&&h>0;R++){const B=P[R];B<w&&(v+=l.charAt(B%m),h--)}(0,n.wipe)(P)}return v}t.randomString=a;function f(h,l=o,D=t.defaultRandomSource){const v=Math.ceil(h/(Math.log(l.length)/Math.LN2));return a(v,l,D)}t.randomStringForEntropy=f}(lr);var dn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=_t;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},a.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var l=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=f[l++],h--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(l=s(this._temp,this._state,f,l,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[l++],h--;return this},a.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,l=this._bufferLength,D=h/536870912|0,v=h<<3,m=h%64<56?64:128;this._buffer[l]=128;for(var w=l+1;w<m-8;w++)this._buffer[w]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(v,this._buffer,m-4),s(this._temp,this._state,this._buffer,0,m),this._finished=!0}for(var w=0;w<this.digestLength/4;w++)e.writeUint32BE(this._state[w],f,w*4);return this},a.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},a.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}},a.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(f){r.wipe(f.state),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},a}();t.SHA256=n;var i=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 s(a,f,h,l,D){for(;D>=64;){for(var v=f[0],m=f[1],w=f[2],P=f[3],R=f[4],B=f[5],S=f[6],I=f[7],y=0;y<16;y++){var x=l+y*4;a[y]=e.readUint32BE(h,x)}for(var y=16;y<64;y++){var E=a[y-2],c=(E>>>17|E<<32-17)^(E>>>19|E<<32-19)^E>>>10;E=a[y-15];var d=(E>>>7|E<<32-7)^(E>>>18|E<<32-18)^E>>>3;a[y]=(c+a[y-7]|0)+(d+a[y-16]|0)}for(var y=0;y<64;y++){var c=(((R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&B^~R&S)|0)+(I+(i[y]+a[y]|0)|0)|0,d=((v>>>2|v<<32-2)^(v>>>13|v<<32-13)^(v>>>22|v<<32-22))+(v&m^v&w^m&w)|0;I=S,S=B,B=R,R=P+c|0,P=w,w=m,m=v,v=c+d|0}f[0]+=v,f[1]+=m,f[2]+=w,f[3]+=P,f[4]+=R,f[5]+=B,f[6]+=S,f[7]+=I,l+=64,D-=64}return l}function o(a){var f=new n;f.update(a);var h=f.digest();return f.clean(),h}t.hash=o})(dn);var hi={};(function(t){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 e=lr,r=_t;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(y){const x=new Float64Array(16);if(y)for(let E=0;E<y.length;E++)x[E]=y[E];return x}const i=new Uint8Array(32);i[0]=9;const s=n([56129,1]);function o(y){let x=1;for(let E=0;E<16;E++){let c=y[E]+x+65535;x=Math.floor(c/65536),y[E]=c-x*65536}y[0]+=x-1+37*(x-1)}function a(y,x,E){const c=~(E-1);for(let d=0;d<16;d++){const U=c&(y[d]^x[d]);y[d]^=U,x[d]^=U}}function f(y,x){const E=n(),c=n();for(let d=0;d<16;d++)c[d]=x[d];o(c),o(c),o(c);for(let d=0;d<2;d++){E[0]=c[0]-65517;for(let K=1;K<15;K++)E[K]=c[K]-65535-(E[K-1]>>16&1),E[K-1]&=65535;E[15]=c[15]-32767-(E[14]>>16&1);const U=E[15]>>16&1;E[14]&=65535,a(c,E,1-U)}for(let d=0;d<16;d++)y[2*d]=c[d]&255,y[2*d+1]=c[d]>>8}function h(y,x){for(let E=0;E<16;E++)y[E]=x[2*E]+(x[2*E+1]<<8);y[15]&=32767}function l(y,x,E){for(let c=0;c<16;c++)y[c]=x[c]+E[c]}function D(y,x,E){for(let c=0;c<16;c++)y[c]=x[c]-E[c]}function v(y,x,E){let c,d,U=0,K=0,G=0,J=0,X=0,g=0,_=0,F=0,M=0,N=0,C=0,j=0,z=0,Q=0,q=0,ee=0,Y=0,ae=0,T=0,A=0,O=0,u=0,b=0,H=0,W=0,he=0,ve=0,de=0,me=0,Be=0,$e=0,ye=E[0],pe=E[1],le=E[2],ue=E[3],ce=E[4],oe=E[5],se=E[6],te=E[7],fe=E[8],ge=E[9],ne=E[10],_e=E[11],be=E[12],Ee=E[13],De=E[14],we=E[15];c=x[0],U+=c*ye,K+=c*pe,G+=c*le,J+=c*ue,X+=c*ce,g+=c*oe,_+=c*se,F+=c*te,M+=c*fe,N+=c*ge,C+=c*ne,j+=c*_e,z+=c*be,Q+=c*Ee,q+=c*De,ee+=c*we,c=x[1],K+=c*ye,G+=c*pe,J+=c*le,X+=c*ue,g+=c*ce,_+=c*oe,F+=c*se,M+=c*te,N+=c*fe,C+=c*ge,j+=c*ne,z+=c*_e,Q+=c*be,q+=c*Ee,ee+=c*De,Y+=c*we,c=x[2],G+=c*ye,J+=c*pe,X+=c*le,g+=c*ue,_+=c*ce,F+=c*oe,M+=c*se,N+=c*te,C+=c*fe,j+=c*ge,z+=c*ne,Q+=c*_e,q+=c*be,ee+=c*Ee,Y+=c*De,ae+=c*we,c=x[3],J+=c*ye,X+=c*pe,g+=c*le,_+=c*ue,F+=c*ce,M+=c*oe,N+=c*se,C+=c*te,j+=c*fe,z+=c*ge,Q+=c*ne,q+=c*_e,ee+=c*be,Y+=c*Ee,ae+=c*De,T+=c*we,c=x[4],X+=c*ye,g+=c*pe,_+=c*le,F+=c*ue,M+=c*ce,N+=c*oe,C+=c*se,j+=c*te,z+=c*fe,Q+=c*ge,q+=c*ne,ee+=c*_e,Y+=c*be,ae+=c*Ee,T+=c*De,A+=c*we,c=x[5],g+=c*ye,_+=c*pe,F+=c*le,M+=c*ue,N+=c*ce,C+=c*oe,j+=c*se,z+=c*te,Q+=c*fe,q+=c*ge,ee+=c*ne,Y+=c*_e,ae+=c*be,T+=c*Ee,A+=c*De,O+=c*we,c=x[6],_+=c*ye,F+=c*pe,M+=c*le,N+=c*ue,C+=c*ce,j+=c*oe,z+=c*se,Q+=c*te,q+=c*fe,ee+=c*ge,Y+=c*ne,ae+=c*_e,T+=c*be,A+=c*Ee,O+=c*De,u+=c*we,c=x[7],F+=c*ye,M+=c*pe,N+=c*le,C+=c*ue,j+=c*ce,z+=c*oe,Q+=c*se,q+=c*te,ee+=c*fe,Y+=c*ge,ae+=c*ne,T+=c*_e,A+=c*be,O+=c*Ee,u+=c*De,b+=c*we,c=x[8],M+=c*ye,N+=c*pe,C+=c*le,j+=c*ue,z+=c*ce,Q+=c*oe,q+=c*se,ee+=c*te,Y+=c*fe,ae+=c*ge,T+=c*ne,A+=c*_e,O+=c*be,u+=c*Ee,b+=c*De,H+=c*we,c=x[9],N+=c*ye,C+=c*pe,j+=c*le,z+=c*ue,Q+=c*ce,q+=c*oe,ee+=c*se,Y+=c*te,ae+=c*fe,T+=c*ge,A+=c*ne,O+=c*_e,u+=c*be,b+=c*Ee,H+=c*De,W+=c*we,c=x[10],C+=c*ye,j+=c*pe,z+=c*le,Q+=c*ue,q+=c*ce,ee+=c*oe,Y+=c*se,ae+=c*te,T+=c*fe,A+=c*ge,O+=c*ne,u+=c*_e,b+=c*be,H+=c*Ee,W+=c*De,he+=c*we,c=x[11],j+=c*ye,z+=c*pe,Q+=c*le,q+=c*ue,ee+=c*ce,Y+=c*oe,ae+=c*se,T+=c*te,A+=c*fe,O+=c*ge,u+=c*ne,b+=c*_e,H+=c*be,W+=c*Ee,he+=c*De,ve+=c*we,c=x[12],z+=c*ye,Q+=c*pe,q+=c*le,ee+=c*ue,Y+=c*ce,ae+=c*oe,T+=c*se,A+=c*te,O+=c*fe,u+=c*ge,b+=c*ne,H+=c*_e,W+=c*be,he+=c*Ee,ve+=c*De,de+=c*we,c=x[13],Q+=c*ye,q+=c*pe,ee+=c*le,Y+=c*ue,ae+=c*ce,T+=c*oe,A+=c*se,O+=c*te,u+=c*fe,b+=c*ge,H+=c*ne,W+=c*_e,he+=c*be,ve+=c*Ee,de+=c*De,me+=c*we,c=x[14],q+=c*ye,ee+=c*pe,Y+=c*le,ae+=c*ue,T+=c*ce,A+=c*oe,O+=c*se,u+=c*te,b+=c*fe,H+=c*ge,W+=c*ne,he+=c*_e,ve+=c*be,de+=c*Ee,me+=c*De,Be+=c*we,c=x[15],ee+=c*ye,Y+=c*pe,ae+=c*le,T+=c*ue,A+=c*ce,O+=c*oe,u+=c*se,b+=c*te,H+=c*fe,W+=c*ge,he+=c*ne,ve+=c*_e,de+=c*be,me+=c*Ee,Be+=c*De,$e+=c*we,U+=38*Y,K+=38*ae,G+=38*T,J+=38*A,X+=38*O,g+=38*u,_+=38*b,F+=38*H,M+=38*W,N+=38*he,C+=38*ve,j+=38*de,z+=38*me,Q+=38*Be,q+=38*$e,d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=_+d+65535,d=Math.floor(c/65536),_=c-d*65536,c=F+d+65535,d=Math.floor(c/65536),F=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=N+d+65535,d=Math.floor(c/65536),N=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=q+d+65535,d=Math.floor(c/65536),q=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=_+d+65535,d=Math.floor(c/65536),_=c-d*65536,c=F+d+65535,d=Math.floor(c/65536),F=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=N+d+65535,d=Math.floor(c/65536),N=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=q+d+65535,d=Math.floor(c/65536),q=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),y[0]=U,y[1]=K,y[2]=G,y[3]=J,y[4]=X,y[5]=g,y[6]=_,y[7]=F,y[8]=M,y[9]=N,y[10]=C,y[11]=j,y[12]=z,y[13]=Q,y[14]=q,y[15]=ee}function m(y,x){v(y,x,x)}function w(y,x){const E=n();for(let c=0;c<16;c++)E[c]=x[c];for(let c=253;c>=0;c--)m(E,E),c!==2&&c!==4&&v(E,E,x);for(let c=0;c<16;c++)y[c]=E[c]}function P(y,x){const E=new Uint8Array(32),c=new Float64Array(80),d=n(),U=n(),K=n(),G=n(),J=n(),X=n();for(let M=0;M<31;M++)E[M]=y[M];E[31]=y[31]&127|64,E[0]&=248,h(c,x);for(let M=0;M<16;M++)U[M]=c[M];d[0]=G[0]=1;for(let M=254;M>=0;--M){const N=E[M>>>3]>>>(M&7)&1;a(d,U,N),a(K,G,N),l(J,d,K),D(d,d,K),l(K,U,G),D(U,U,G),m(G,J),m(X,d),v(d,K,d),v(K,U,J),l(J,d,K),D(d,d,K),m(U,d),D(K,G,X),v(d,K,s),l(d,d,G),v(K,K,d),v(d,G,X),v(G,U,c),m(U,J),a(d,U,N),a(K,G,N)}for(let M=0;M<16;M++)c[M+16]=d[M],c[M+32]=K[M],c[M+48]=U[M],c[M+64]=G[M];const g=c.subarray(32),_=c.subarray(16);w(g,g),v(_,_,g);const F=new Uint8Array(32);return f(F,_),F}t.scalarMult=P;function R(y){return P(y,i)}t.scalarMultBase=R;function B(y){if(y.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const x=new Uint8Array(y);return{publicKey:R(x),secretKey:x}}t.generateKeyPairFromSeed=B;function S(y){const x=(0,e.randomBytes)(32,y),E=B(x);return(0,r.wipe)(x),E}t.generateKeyPair=S;function I(y,x,E=!1){if(y.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(x.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const c=P(y,x);if(E){let d=0;for(let U=0;U<c.length;U++)d|=c[U];if(d===0)throw new Error("X25519: invalid shared key")}return c}t.sharedKey=I})(hi);function io(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function li(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=io(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Dh(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,f=t.charAt(0),h=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var P=0,R=0,B=0,S=w.length;B!==S&&w[B]===0;)B++,P++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=w[B],E=0,c=I-1;(x!==0||E<R)&&c!==-1;c--,E++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=E,B++}for(var d=I-R;d!==I&&y[d]===0;)d++;for(var U=f.repeat(P);d<I;++d)U+=t.charAt(y[d]);return U}function v(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var P=0;if(w[P]!==" "){for(var R=0,B=0;w[P]===f;)R++,P++;for(var S=(w.length-P)*h+1>>>0,I=new Uint8Array(S);w[P];){var y=r[w.charCodeAt(P)];if(y===255)return;for(var x=0,E=S-1;(y!==0||x<B)&&E!==-1;E--,x++)y+=a*I[E]>>>0,I[E]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,P++}if(w[P]!==" "){for(var c=S-B;c!==S&&I[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=I[c++];return d}}}function m(w){var P=v(w);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:v,decode:m}}var xh=Dh,Sh=xh;const so=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Oh=t=>new TextEncoder().encode(t),Lh=t=>new TextDecoder().decode(t);class Ih{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ah{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return oo(this,e)}}class Th{constructor(e){this.decoders=e}or(e){return oo(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const oo=(t,e)=>new Th({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Ch{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Ih(e,r,n),this.decoder=new Ah(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pn=({name:t,prefix:e,encode:r,decode:n})=>new Ch(t,e,r,n),Tr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Sh(r,e);return pn({prefix:t,name:e,encode:n,decode:s=>so(i(s))})},Rh=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,f=0,h=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|D,a+=r,a>=8&&(a-=8,o[h++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return o},Nh=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},it=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>pn({prefix:e,name:t,encode(i){return Nh(i,n,r)},decode(i){return Rh(i,n,r,t)}}),Ph=pn({prefix:"\0",name:"identity",encode:t=>Lh(t),decode:t=>Oh(t)});var $h=Object.freeze({__proto__:null,identity:Ph});const Fh=it({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Mh=Object.freeze({__proto__:null,base2:Fh});const Uh=it({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var jh=Object.freeze({__proto__:null,base8:Uh});const Bh=Tr({prefix:"9",name:"base10",alphabet:"0123456789"});var zh=Object.freeze({__proto__:null,base10:Bh});const Kh=it({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qh=it({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Hh=Object.freeze({__proto__:null,base16:Kh,base16upper:qh});const Vh=it({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Gh=it({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wh=it({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),kh=it({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Yh=it({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Jh=it({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xh=it({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Zh=it({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qh=it({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var el=Object.freeze({__proto__:null,base32:Vh,base32upper:Gh,base32pad:Wh,base32padupper:kh,base32hex:Yh,base32hexupper:Jh,base32hexpad:Xh,base32hexpadupper:Zh,base32z:Qh});const tl=Tr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),rl=Tr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nl=Object.freeze({__proto__:null,base36:tl,base36upper:rl});const il=Tr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),sl=Tr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ol=Object.freeze({__proto__:null,base58btc:il,base58flickr:sl});const al=it({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),cl=it({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ul=it({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),fl=it({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var hl=Object.freeze({__proto__:null,base64:al,base64pad:cl,base64url:ul,base64urlpad:fl});const ao=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),ll=ao.reduce((t,e,r)=>(t[r]=e,t),[]),dl=ao.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function pl(t){return t.reduce((e,r)=>(e+=ll[r],e),"")}function gl(t){const e=[];for(const r of t){const n=dl[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const yl=pn({prefix:"\u{1F680}",name:"base256emoji",encode:pl,decode:gl});var vl=Object.freeze({__proto__:null,base256emoji:yl}),_l=uo,co=128,bl=127,ml=~bl,wl=Math.pow(2,31);function uo(t,e,r){e=e||[],r=r||0;for(var n=r;t>=wl;)e[r++]=t&255|co,t/=128;for(;t&ml;)e[r++]=t&255|co,t>>>=7;return e[r]=t|0,uo.bytes=r-n+1,e}var El=di,Dl=128,fo=127;function di(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw di.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&fo)<<i:(o&fo)*Math.pow(2,i),i+=7}while(o>=Dl);return di.bytes=s-n,r}var xl=Math.pow(2,7),Sl=Math.pow(2,14),Ol=Math.pow(2,21),Ll=Math.pow(2,28),Il=Math.pow(2,35),Al=Math.pow(2,42),Tl=Math.pow(2,49),Cl=Math.pow(2,56),Rl=Math.pow(2,63),Nl=function(t){return t<xl?1:t<Sl?2:t<Ol?3:t<Ll?4:t<Il?5:t<Al?6:t<Tl?7:t<Cl?8:t<Rl?9:10},Pl={encode:_l,decode:El,encodingLength:Nl},ho=Pl;const lo=(t,e,r=0)=>(ho.encode(t,e,r),e),po=t=>ho.encodingLength(t),pi=(t,e)=>{const r=e.byteLength,n=po(t),i=n+po(r),s=new Uint8Array(i+r);return lo(t,s,0),lo(r,s,n),s.set(e,i),new $l(t,r,e,s)};class $l{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const go=({name:t,code:e,encode:r})=>new Fl(t,e,r);class Fl{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?pi(this.code,r):r.then(n=>pi(this.code,n))}else throw Error("Unknown type, must be binary type")}}const yo=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Ml=go({name:"sha2-256",code:18,encode:yo("SHA-256")}),Ul=go({name:"sha2-512",code:19,encode:yo("SHA-512")});var jl=Object.freeze({__proto__:null,sha256:Ml,sha512:Ul});const vo=0,Bl="identity",_o=so;var zl=Object.freeze({__proto__:null,identity:{code:vo,name:Bl,encode:_o,digest:t=>pi(vo,_o(t))}});new TextEncoder,new TextDecoder;const bo={...$h,...Mh,...jh,...zh,...Hh,...el,...nl,...ol,...hl,...vl};({...jl,...zl});function mo(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const wo=mo("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),gi=mo("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=io(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Eo={utf8:wo,"utf-8":wo,hex:bo.base16,latin1:gi,ascii:gi,binary:gi,...bo};function dt(t,e="utf8"){const r=Eo[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function pt(t,e="utf8"){const r=Eo[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var Do=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},Kl=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),ql=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),Hl=function(){function t(e,r,n,i){this.name=e,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return t}(),Vl=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Gl=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Wl=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,kl=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,xo=3,Yl=[["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",Wl]],So=[["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 Jl(t){return t?Oo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Gl:typeof navigator<"u"?Oo(navigator.userAgent):Ql()}function Xl(t){return t!==""&&Yl.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Oo(t){var e=Xl(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Vl;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<xo&&(i=Do(Do([],i,!0),ed(xo-i.length),!0)):i=[];var s=i.join("."),o=Zl(t),a=kl.exec(t);return a&&a[1]?new Hl(r,s,o,a[1]):new Kl(r,s,o)}function Zl(t){for(var e=0,r=So.length;e<r;e++){var n=So[e],i=n[0],s=n[1],o=s.exec(t);if(o)return i}return null}function Ql(){var t=typeof process<"u"&&process.version;return t?new ql(process.version.slice(1)):null}function ed(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var Z={};/*! *****************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
25
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
-
***************************************************************************** */var yi=function(t,e){return yi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},yi(t,e)};function ed(t,e){yi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var vi=function(){return vi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},vi.apply(this,arguments)};function td(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function rd(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function nd(t,e){return function(r,n){e(r,n,t)}}function id(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function sd(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function od(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function ad(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function cd(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function _i(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function So(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function ud(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(So(arguments[e]));return t}function fd(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Cr(t){return this instanceof Cr?(this.v=t,this):new Cr(t)}function hd(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Cr?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function ld(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Cr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function dd(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof _i=="function"?_i(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function pd(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gd(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function yd(t){return t&&t.__esModule?t:{default:t}}function vd(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function _d(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var bd=Object.freeze({__proto__:null,__extends:ed,get __assign(){return vi},__rest:td,__decorate:rd,__param:nd,__metadata:id,__awaiter:sd,__generator:od,__createBinding:ad,__exportStar:cd,__values:_i,__read:So,__spread:ud,__spreadArrays:fd,__await:Cr,__asyncGenerator:hd,__asyncDelegator:ld,__asyncValues:dd,__makeTemplateObject:pd,__importStar:gd,__importDefault:yd,__classPrivateFieldGet:vd,__classPrivateFieldSet:_d}),gn=Zt(bd),bi={},Rr={},Oo;function md(){if(Oo)return Rr;Oo=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Rr.delay=t,Rr}var Qt={},mi={},er={},Lo;function wd(){return Lo||(Lo=1,Object.defineProperty(er,"__esModule",{value:!0}),er.ONE_THOUSAND=er.ONE_HUNDRED=void 0,er.ONE_HUNDRED=100,er.ONE_THOUSAND=1e3),er}var wi={},Io;function Ed(){return Io||(Io=1,function(t){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=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(wi)),wi}var Ao;function To(){return Ao||(Ao=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(wd(),t),e.__exportStar(Ed(),t)}(mi)),mi}var Co;function Dd(){if(Co)return Qt;Co=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.fromMiliseconds=Qt.toMiliseconds=void 0;const t=To();function e(n){return n*t.ONE_THOUSAND}Qt.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Qt.fromMiliseconds=r,Qt}var Ro;function xd(){return Ro||(Ro=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(md(),t),e.__exportStar(Dd(),t)}(bi)),bi}var dr={},Po;function Sd(){if(Po)return dr;Po=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return dr.Watch=t,dr.default=t,dr}var Ei={},Pr={},No;function Od(){if(No)return Pr;No=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.IWatch=void 0;class t{}return Pr.IWatch=t,Pr}var $o;function Ld(){return $o||($o=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),gn.__exportStar(Od(),t)}(Ei)),Ei}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(xd(),t),e.__exportStar(Sd(),t),e.__exportStar(Ld(),t),e.__exportStar(To(),t)})(Z);var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.getLocalStorage=Ce.getLocalStorageOrThrow=Ce.getCrypto=Ce.getCryptoOrThrow=Mo=Ce.getLocation=Ce.getLocationOrThrow=Di=Ce.getNavigator=Ce.getNavigatorOrThrow=Fo=Ce.getDocument=Ce.getDocumentOrThrow=Ce.getFromWindowOrThrow=Ce.getFromWindow=void 0;function tr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ce.getFromWindow=tr;function pr(t){const e=tr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ce.getFromWindowOrThrow=pr;function Id(){return pr("document")}Ce.getDocumentOrThrow=Id;function Ad(){return tr("document")}var Fo=Ce.getDocument=Ad;function Td(){return pr("navigator")}Ce.getNavigatorOrThrow=Td;function Cd(){return tr("navigator")}var Di=Ce.getNavigator=Cd;function Rd(){return pr("location")}Ce.getLocationOrThrow=Rd;function Pd(){return tr("location")}var Mo=Ce.getLocation=Pd;function Nd(){return pr("crypto")}Ce.getCryptoOrThrow=Nd;function $d(){return tr("crypto")}Ce.getCrypto=$d;function Fd(){return pr("localStorage")}Ce.getLocalStorageOrThrow=Fd;function Md(){return tr("localStorage")}Ce.getLocalStorage=Md;var xi={};Object.defineProperty(xi,"__esModule",{value:!0});var Uo=xi.getWindowMetadata=void 0;const jo=Ce;function Ud(){let t,e;try{t=jo.getDocumentOrThrow(),e=jo.getLocationOrThrow()}catch{return null}function r(){const D=t.getElementsByTagName("link"),b=[];for(let m=0;m<D.length;m++){const w=D[m],N=w.getAttribute("rel");if(N&&N.toLowerCase().indexOf("icon")>-1){const R=w.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(R.indexOf("/")===0)B+=R;else{const S=e.pathname.split("/");S.pop();const I=S.join("/");B+=I+"/"+R}b.push(B)}else if(R.indexOf("//")===0){const B=e.protocol+R;b.push(B)}else b.push(R)}}return b}function n(...D){const b=t.getElementsByTagName("meta");for(let m=0;m<b.length;m++){const w=b[m],N=["itemprop","property","name"].map(R=>w.getAttribute(R)).filter(R=>R?D.includes(R):!1);if(N.length&&N){const R=w.getAttribute("content");if(R)return R}}return""}function i(){let D=n("name","og:site_name","og:title","twitter:title");return D||(D=t.title),D}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),h=e.origin,f=r();return{description:a,url:h,icons:f,name:o}}Uo=xi.getWindowMetadata=Ud;var Nr={},jd=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Bo="%[a-f0-9]{2}",zo=new RegExp(Bo,"gi"),Ko=new RegExp("("+Bo+")+","gi");function Si(t,e){try{return decodeURIComponent(t.join(""))}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Si(r),Si(n))}function Bd(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(zo),r=1;r<e.length;r++)t=Si(e,r).join(""),e=t.match(zo);return t}}function zd(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Ko.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=Bd(r[0]);n!==r[0]&&(e[r[0]]=n)}r=Ko.exec(t)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var o=i[s];t=t.replace(new RegExp(o,"g"),e[o])}return t}var Kd=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return zd(t)}},qd=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},Hd=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s<n.length;s++){var o=n[s],a=t[o];(i?e.indexOf(o)!==-1:e(o,a,t))&&(r[o]=a)}return r};(function(t){const e=jd,r=Kd,n=qd,i=Hd,s=S=>S==null,o=Symbol("encodeFragmentIdentifier");function a(S){switch(S.arrayFormat){case"index":return I=>(y,x)=>{const E=y.length;return x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),"[",E,"]"].join("")]:[...y,[l(I,S),"[",l(E,S),"]=",l(x,S)].join("")]};case"bracket":return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),"[]"].join("")]:[...y,[l(I,S),"[]=",l(x,S)].join("")];case"colon-list-separator":return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),":list="].join("")]:[...y,[l(I,S),":list=",l(x,S)].join("")];case"comma":case"separator":case"bracket-separator":{const I=S.arrayFormat==="bracket-separator"?"[]=":"=";return y=>(x,E)=>E===void 0||S.skipNull&&E===null||S.skipEmptyString&&E===""?x:(E=E===null?"":E,x.length===0?[[l(y,S),I,l(E,S)].join("")]:[[x,l(E,S)].join(S.arrayFormatSeparator)])}default:return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,l(I,S)]:[...y,[l(I,S),"=",l(x,S)].join("")]}}function h(S){let I;switch(S.arrayFormat){case"index":return(y,x,E)=>{if(I=/\[(\d*)\]$/.exec(y),y=y.replace(/\[\d*\]$/,""),!I){E[y]=x;return}E[y]===void 0&&(E[y]={}),E[y][I[1]]=x};case"bracket":return(y,x,E)=>{if(I=/(\[\])$/.exec(y),y=y.replace(/\[\]$/,""),!I){E[y]=x;return}if(E[y]===void 0){E[y]=[x];return}E[y]=[].concat(E[y],x)};case"colon-list-separator":return(y,x,E)=>{if(I=/(:list)$/.exec(y),y=y.replace(/:list$/,""),!I){E[y]=x;return}if(E[y]===void 0){E[y]=[x];return}E[y]=[].concat(E[y],x)};case"comma":case"separator":return(y,x,E)=>{const c=typeof x=="string"&&x.includes(S.arrayFormatSeparator),d=typeof x=="string"&&!c&&D(x,S).includes(S.arrayFormatSeparator);x=d?D(x,S):x;const U=c||d?x.split(S.arrayFormatSeparator).map(K=>D(K,S)):x===null?x:D(x,S);E[y]=U};case"bracket-separator":return(y,x,E)=>{const c=/(\[\])$/.test(y);if(y=y.replace(/\[\]$/,""),!c){E[y]=x&&D(x,S);return}const d=x===null?[]:x.split(S.arrayFormatSeparator).map(U=>D(U,S));if(E[y]===void 0){E[y]=d;return}E[y]=[].concat(E[y],d)};default:return(y,x,E)=>{if(E[y]===void 0){E[y]=x;return}E[y]=[].concat(E[y],x)}}}function f(S){if(typeof S!="string"||S.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function l(S,I){return I.encode?I.strict?e(S):encodeURIComponent(S):S}function D(S,I){return I.decode?r(S):S}function b(S){return Array.isArray(S)?S.sort():typeof S=="object"?b(Object.keys(S)).sort((I,y)=>Number(I)-Number(y)).map(I=>S[I]):S}function m(S){const I=S.indexOf("#");return I!==-1&&(S=S.slice(0,I)),S}function w(S){let I="";const y=S.indexOf("#");return y!==-1&&(I=S.slice(y)),I}function N(S){S=m(S);const I=S.indexOf("?");return I===-1?"":S.slice(I+1)}function R(S,I){return I.parseNumbers&&!Number.isNaN(Number(S))&&typeof S=="string"&&S.trim()!==""?S=Number(S):I.parseBooleans&&S!==null&&(S.toLowerCase()==="true"||S.toLowerCase()==="false")&&(S=S.toLowerCase()==="true"),S}function B(S,I){I=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},I),f(I.arrayFormatSeparator);const y=h(I),x=Object.create(null);if(typeof S!="string"||(S=S.trim().replace(/^[?#&]/,""),!S))return x;for(const E of S.split("&")){if(E==="")continue;let[c,d]=n(I.decode?E.replace(/\+/g," "):E,"=");d=d===void 0?null:["comma","separator","bracket-separator"].includes(I.arrayFormat)?d:D(d,I),y(D(c,I),d,x)}for(const E of Object.keys(x)){const c=x[E];if(typeof c=="object"&&c!==null)for(const d of Object.keys(c))c[d]=R(c[d],I);else x[E]=R(c,I)}return I.sort===!1?x:(I.sort===!0?Object.keys(x).sort():Object.keys(x).sort(I.sort)).reduce((E,c)=>{const d=x[c];return Boolean(d)&&typeof d=="object"&&!Array.isArray(d)?E[c]=b(d):E[c]=d,E},Object.create(null))}t.extract=N,t.parse=B,t.stringify=(S,I)=>{if(!S)return"";I=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},I),f(I.arrayFormatSeparator);const y=d=>I.skipNull&&s(S[d])||I.skipEmptyString&&S[d]==="",x=a(I),E={};for(const d of Object.keys(S))y(d)||(E[d]=S[d]);const c=Object.keys(E);return I.sort!==!1&&c.sort(I.sort),c.map(d=>{const U=S[d];return U===void 0?"":U===null?l(d,I):Array.isArray(U)?U.length===0&&I.arrayFormat==="bracket-separator"?l(d,I)+"[]":U.reduce(x(d),[]).join("&"):l(d,I)+"="+l(U,I)}).filter(d=>d.length>0).join("&")},t.parseUrl=(S,I)=>{I=Object.assign({decode:!0},I);const[y,x]=n(S,"#");return Object.assign({url:y.split("?")[0]||"",query:B(N(S),I)},I&&I.parseFragmentIdentifier&&x?{fragmentIdentifier:D(x,I)}:{})},t.stringifyUrl=(S,I)=>{I=Object.assign({encode:!0,strict:!0,[o]:!0},I);const y=m(S.url).split("?")[0]||"",x=t.extract(S.url),E=t.parse(x,{sort:!1}),c=Object.assign(E,S.query);let d=t.stringify(c,I);d&&(d=`?${d}`);let U=w(S.url);return S.fragmentIdentifier&&(U=`#${I[o]?l(S.fragmentIdentifier,I):S.fragmentIdentifier}`),`${y}${d}${U}`},t.pick=(S,I,y)=>{y=Object.assign({parseFragmentIdentifier:!0,[o]:!1},y);const{url:x,query:E,fragmentIdentifier:c}=t.parseUrl(S,y);return t.stringifyUrl({url:x,query:i(E,I),fragmentIdentifier:c},y)},t.exclude=(S,I,y)=>{const x=Array.isArray(I)?E=>!I.includes(E):(E,c)=>!I(E,c);return t.pick(S,x,y)}})(Nr);const Vd={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"}},qo=":";function Gd(t){const{namespace:e,reference:r}=t;return[e,r].join(qo)}function Wd(t){const[e,r,n]=t.split(qo);return{namespace:e,reference:r,address:n}}function kd(t,e){const r=[];return t.forEach(n=>{const i=e(n);r.includes(i)||r.push(i)}),r}function Yd(t){const{namespace:e,reference:r}=Wd(t);return Gd({namespace:e,reference:r})}function Jd(t){return kd(t,Yd)}function Oi(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function Li(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...Jd(i.accounts))}),r}function Xd(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.chains)}),r}const Ho="base10",pt="base16",Ii="base64pad",Ai="utf8",Vo=0,rr=1,Zd=0,Go=1,Ti=12,Ci=32;function Qd(){const t=hi.generateKeyPair();return{privateKey:dt(t.secretKey,pt),publicKey:dt(t.publicKey,pt)}}function Ri(){const t=lr.randomBytes(Ci);return dt(t,pt)}function ep(t,e){const r=hi.sharedKey(lt(t,pt),lt(e,pt)),n=new hh(dn.SHA256,r).expand(Ci);return dt(n,pt)}function tp(t){const e=dn.hash(lt(t,pt));return dt(e,pt)}function Pi(t){const e=dn.hash(lt(t,Ai));return dt(e,pt)}function rp(t){return lt(`${t}`,Ho)}function $r(t){return Number(dt(t,Ho))}function np(t){const e=rp(typeof t.type<"u"?t.type:Vo);if($r(e)===rr&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?lt(t.senderPublicKey,pt):void 0,n=typeof t.iv<"u"?lt(t.iv,pt):lr.randomBytes(Ti),i=new ii.ChaCha20Poly1305(lt(t.symKey,pt)).seal(n,lt(t.message,Ai));return sp({type:e,sealed:i,iv:n,senderPublicKey:r})}function ip(t){const e=new ii.ChaCha20Poly1305(lt(t.symKey,pt)),{sealed:r,iv:n}=Ni(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return dt(i,Ai)}function sp(t){if($r(t.type)===rr){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return dt(li([t.type,t.senderPublicKey,t.iv,t.sealed]),Ii)}return dt(li([t.type,t.iv,t.sealed]),Ii)}function Ni(t){const e=lt(t,Ii),r=e.slice(Zd,Go),n=Go;if($r(r)===rr){const a=n+Ci,h=a+Ti,f=e.slice(n,a),l=e.slice(a,h),D=e.slice(h);return{type:r,sealed:D,iv:l,senderPublicKey:f}}const i=n+Ti,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function op(t,e){const r=Ni(t);return Wo({type:$r(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?dt(r.senderPublicKey,pt):void 0,receiverPublicKey:e?.receiverPublicKey})}function Wo(t){const e=t?.type||Vo;if(e===rr){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function ko(t){return t.type===rr&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var ap=Object.defineProperty,Yo=Object.getOwnPropertySymbols,cp=Object.prototype.hasOwnProperty,up=Object.prototype.propertyIsEnumerable,Jo=(t,e,r)=>e in t?ap(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xo=(t,e)=>{for(var r in e||(e={}))cp.call(e,r)&&Jo(t,r,e[r]);if(Yo)for(var r of Yo(e))up.call(e,r)&&Jo(t,r,e[r]);return t};const fp="ReactNative",Fr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},hp="js";function Zo(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function lp(){return!Fo()&&!!Di()&&navigator.product===fp}function dp(){return!Zo()&&!!Di()}function pp(){return lp()?Fr.reactNative:Zo()?Fr.node:dp()?Fr.browser:Fr.unknown}function gp(t,e){let r=Nr.parse(t);return r=Xo(Xo({},r),e),t=Nr.stringify(r),t}function yp(){return Uo()||{name:"",description:"",url:"",icons:[""]}}function vp(){const t=Yl();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function _p(){var t;const e=pp();return e===Fr.browser?[e,((t=Mo())==null?void 0:t.host)||"unknown"].join(":"):e}function bp(t,e,r){const n=vp(),i=_p();return[[t,e].join("-"),[hp,r].join("-"),n,i].join("/")}function mp({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s}){const o=r.split("?"),a=bp(t,e,n),h={auth:i,ua:a,projectId:s},f=gp(o[1]||"",h);return o[0]+"?"+f}function gt(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Qo(t){return Object.fromEntries(t.entries())}function ea(t){return new Map(Object.entries(t))}function Bt(t,e){return Z.fromMiliseconds((e||Date.now())+Z.toMiliseconds(t))}function Gt(t){return Z.fromMiliseconds(Date.now())>=Z.toMiliseconds(t)}function nr(){const t=Z.toMiliseconds(Z.FIVE_MINUTES);let e,r,n;return{resolve:i=>{n&&e&&(clearTimeout(n),e(i))},reject:i=>{n&&r&&(clearTimeout(n),r(i))},done:()=>new Promise((i,s)=>{n=setTimeout(s,t),e=i,r=s})}}function ta(t,e){return new Promise(async(r,n)=>{const i=setTimeout(()=>n(),e),s=await t;clearTimeout(i),r(s)})}function ra(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function wp(t){return ra("topic",t)}function Ep(t){return ra("id",t)}function na(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function je(t,e){return`${t}${e?`:${e}`:""}`}const Dp="irn";function $i(t){return t?.relay||{protocol:Dp}}function Fi(t){const e=Vd[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var xp=Object.defineProperty,ia=Object.getOwnPropertySymbols,Sp=Object.prototype.hasOwnProperty,Op=Object.prototype.propertyIsEnumerable,sa=(t,e,r)=>e in t?xp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Lp=(t,e)=>{for(var r in e||(e={}))Sp.call(e,r)&&sa(t,r,e[r]);if(ia)for(var r of ia(e))Op.call(e,r)&&sa(t,r,e[r]);return t};function Ip(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function Ap(t){const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Nr.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:Ip(o)}}function Tp(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Cp(t){return`${t.protocol}:${t.topic}@${t.version}?`+Nr.stringify(Lp({symKey:t.symKey},Tp(t.relay)))}function Tt(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function Rp(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Tt(r.accounts)),r.extension&&r.extension.forEach(n=>{e.push(...Tt(n.accounts))})}),e}function Pp(t,e){const r=[];return Object.values(t).forEach(n=>{Tt(n.accounts).includes(e)&&r.push(...n.methods),n.extension&&n.extension.forEach(i=>{Tt(i.accounts).includes(e)&&r.push(...i.methods)})}),r}function Np(t,e){const r=[];return Object.values(t).forEach(n=>{Tt(n.accounts).includes(e)&&r.push(...n.events),n.extension&&n.extension.forEach(i=>{Tt(i.accounts).includes(e)&&r.push(...i.events)})}),r}function $p(t,e){const r=vn(t,e);if(r)throw new Error(r.message);const n={};for(const[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}const Fp={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}},Mp={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 V(t,e){const{message:r,code:n}=Mp[t];return{message:e?`${r} ${e}`:r,code:n}}function Ge(t,e){const{message:r,code:n}=Fp[t];return{message:e?`${r} ${e}`:r,code:n}}function Mr(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function yn(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bt(t){return typeof t>"u"}function st(t,e){return e&&bt(t)?!0:typeof t=="string"&&Boolean(t.trim().length)}function oa(t,e){return e&&bt(t)?!0:typeof t=="number"&&!isNaN(t)}function Up(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return gt(i,n)?(n.forEach(o=>{const{accounts:a,methods:h,events:f,extension:l}=t.namespaces[o],D=Tt(a),b=r[o];(!gt(b.chains,D)||!gt(b.methods,h)||!gt(b.events,f))&&(s=!1),s&&l&&l.forEach(m=>{var w;const{accounts:N,methods:R,events:B}=m,S=Tt(N);(w=b.extension)!=null&&w.find(I=>gt(I.chains,S)&>(I.methods,R)&>(I.events,B))||(s=!1)})}),s):!1}function Mi(t){return st(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function jp(t){if(st(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Mi(r)}}return!1}function Bp(t){if(st(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function zp(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Kp(t){return t?.topic}function qp(t,e){let r=null;return st(t?.publicKey,!1)||(r=V("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Ui(t,e){let r=null;return bt(t?.extension)||(!Mr(t.extension)||!t.extension.length)&&(r=V("MISSING_OR_INVALID",`${e} extension should be an array of namespaces, or omitted`)),r}function aa(t){let e=!0;return Mr(t)?t.length&&(e=t.every(r=>st(r,!1))):e=!1,e}function ca(t,e,r){let n=null;return Mr(e)?e.forEach(i=>{n||(!Mi(i)||!i.includes(t))&&(n=Ge("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=Ge("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function Hp(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;const s=ca(n,i?.chains,`${e} requiredNamespace`),o=Ui(i,e);s?r=s:o?r=o:i.extension&&i.extension.forEach(a=>{if(r)return;const h=ca(n,a.chains,`${e} extension`);h&&(r=h)})}),r}function ua(t,e){let r=null;return Mr(t)?t.forEach(n=>{r||jp(n)||(r=Ge("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ge("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Vp(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=ua(n?.accounts,`${e} namespace`),s=Ui(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=ua(o.accounts,`${e} extension`);a&&(r=a)})}),r}function fa(t,e){let r=null;return aa(t?.methods)?aa(t?.events)||(r=Ge("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ge("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function ha(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=fa(n,`${e}, namespace`),s=Ui(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=fa(o,`${e}, extension`);a&&(r=a)})}),r}function Gp(t,e){let r=null;if(t&&yn(t)){const n=ha(t,e);n&&(r=n);const i=Hp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, requiredNamespaces should be an object with data`);return r}function vn(t,e){let r=null;if(t&&yn(t)){const n=ha(t,e);n&&(r=n);const i=Vp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function la(t){return st(t.protocol,!0)}function Wp(t,e){let r=!1;return e&&!t?r=!0:t&&Mr(t)&&t.length&&t.forEach(n=>{r=la(n)}),r}function kp(t){return typeof t=="number"}function yt(t){return typeof t<"u"&&typeof t!==null}function Yp(t){return!(!t||typeof t!="object"||!t.code||!oa(t.code,!1)||!t.message||!st(t.message,!1))}function Jp(t){return!(bt(t)||!st(t.method,!1))}function Xp(t){return!(bt(t)||bt(t.result)&&bt(t.error)||!oa(t.id,!1)||!st(t.jsonrpc,!1))}function Zp(t){return!(bt(t)||!st(t.name,!1))}function da(t,e){return!(!Mi(e)||!Rp(t).includes(e))}function Qp(t,e,r){return st(r,!1)?Pp(t,e).includes(r):!1}function eg(t,e,r){return st(r,!1)?Np(t,e).includes(r):!1}function pa(t,e,r){let n=null;const i=Object.keys(t),s=Object.keys(e);return gt(i,s)?i.forEach(o=>{var a;if(n)return;const h=t[o].chains,f=Tt(e[o].accounts);gt(h,f)?gt(t[o].methods,e[o].methods)?gt(t[o].events,e[o].events)?t[o].extension&&!e[o].extension?n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`):t[o].extension&&e[o].extension&&((a=t[o].extension)==null||a.forEach(({methods:l,events:D,chains:b})=>{var m;n||(m=e[o].extension)!=null&&m.find(w=>{const N=Tt(w.accounts);return gt(b,N)&>(D,w.events)&>(l,w.methods)})||(n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`))})):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy requiredNamespaces events for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy requiredNamespaces methods for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy requiredNamespaces chains for ${o}`)}):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces`),n}function tg(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var rg=ng;function ng(t,e,r){var n=r&&r.stringify||tg,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a<s;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var h=e.length;if(h===0)return t;for(var f="",l=1-i,D=-1,b=t&&t.length||0,m=0;m<b;){if(t.charCodeAt(m)===37&&m+1<b){switch(D=D>-1?D:0,t.charCodeAt(m+1)){case 100:case 102:if(l>=h||e[l]==null)break;D<m&&(f+=t.slice(D,m)),f+=Number(e[l]),D=m+2,m++;break;case 105:if(l>=h||e[l]==null)break;D<m&&(f+=t.slice(D,m)),f+=Math.floor(Number(e[l])),D=m+2,m++;break;case 79:case 111:case 106:if(l>=h||e[l]===void 0)break;D<m&&(f+=t.slice(D,m));var w=typeof e[l];if(w==="string"){f+="'"+e[l]+"'",D=m+2,m++;break}if(w==="function"){f+=e[l].name||"<anonymous>",D=m+2,m++;break}f+=n(e[l]),D=m+2,m++;break;case 115:if(l>=h)break;D<m&&(f+=t.slice(D,m)),f+=String(e[l]),D=m+2,m++;break;case 37:D<m&&(f+=t.slice(D,m)),f+="%",D=m+2,m++,l--;break}++l}++m}return D===-1?t:(D<b&&(f+=t.slice(D)),f)}const ga=rg;var _n=Ct;const Ur=dg().console||{},ig={mapHttpRequest:mn,mapHttpResponse:mn,wrapRequestSerializer:Bi,wrapResponseSerializer:Bi,wrapErrorSerializer:Bi,req:mn,res:mn,err:ug};function sg(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Ct(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Ur;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=sg(t.browser.serialize,n);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",h=Object.create(r);h.log||(h.log=jr),Object.defineProperty(h,"levelVal",{get:l}),Object.defineProperty(h,"level",{get:D,set:b});const f={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:fg(t)};h.levels=Ct.levels,h.level=a,h.setMaxListeners=h.getMaxListeners=h.emit=h.addListener=h.on=h.prependListener=h.once=h.prependOnceListener=h.removeListener=h.removeAllListeners=h.listeners=h.listenerCount=h.eventNames=h.write=h.flush=jr,h.serializers=n,h._serialize=i,h._stdErrSerialize=s,h.child=m,e&&(h._logEvent=ji());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function D(){return this._level}function b(w){if(w!=="silent"&&!this.levels.values[w])throw Error("unknown level "+w);this._level=w,gr(f,h,"error","log"),gr(f,h,"fatal","error"),gr(f,h,"warn","error"),gr(f,h,"info","log"),gr(f,h,"debug","log"),gr(f,h,"trace","log")}function m(w,N){if(!w)throw new Error("missing bindings for child Pino");N=N||{},i&&w.serializers&&(N.serializers=w.serializers);const R=N.serializers;if(i&&R){var B=Object.assign({},n,R),S=t.browser.serialize===!0?Object.keys(B):i;delete w.serializers,bn([w],S,B,this._stdErrSerialize)}function I(y){this._childLevel=(y._childLevel|0)+1,this.error=yr(y,w,"error"),this.fatal=yr(y,w,"fatal"),this.warn=yr(y,w,"warn"),this.info=yr(y,w,"info"),this.debug=yr(y,w,"debug"),this.trace=yr(y,w,"trace"),B&&(this.serializers=B,this._serialize=S),e&&(this._logEvent=ji([].concat(y._logEvent.bindings,w)))}return I.prototype=this,new I(this)}return h}Ct.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"}},Ct.stdSerializers=ig,Ct.stdTimeFunctions=Object.assign({},{nullTime:ya,epochTime:va,unixTime:hg,isoTime:lg});function gr(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?jr:i[r]?i[r]:Ur[r]||Ur[n]||jr,og(t,e,r)}function og(t,e,r){!t.transmit&&e[r]===jr||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ur?Ur:this;for(var h=0;h<o.length;h++)o[h]=arguments[h];if(t.serialize&&!t.asObject&&bn(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,ag(this,r,o,s)):n.apply(a,o),t.transmit){const f=t.transmit.level||e.level,l=Ct.levels.values[f],D=Ct.levels.values[r];if(D<l)return;cg(this,{ts:s,methodLevel:r,methodValue:D,transmitLevel:f,transmitValue:Ct.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function ag(t,e,r,n){t._serialize&&bn(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let s=i[0];const o={};n&&(o.time=n),o.level=Ct.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof i[0]=="object";)Object.assign(o,i.shift());s=i.length?ga(i.shift(),i):void 0}else typeof s=="string"&&(s=ga(i.shift(),i));return s!==void 0&&(o.msg=s),o}function bn(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=Ct.stdSerializers.err(t[i]);else if(typeof t[i]=="object"&&!Array.isArray(t[i]))for(const s in t[i])e&&e.indexOf(s)>-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function yr(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return t[r].apply(this,n)}}function cg(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,h=t._logEvent.bindings;bn(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(f){return h.indexOf(f)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,n(s,t._logEvent,a),t._logEvent=ji(h)}function ji(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function ug(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function fg(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?ya:va}function mn(){return{}}function Bi(t){return t}function jr(){}function ya(){return!1}function va(){return Date.now()}function hg(){return Math.round(Date.now()/1e3)}function lg(){return new Date(Date.now()).toISOString()}function dg(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}var zt={exports:{}},vr=typeof Reflect=="object"?Reflect:null,_a=vr&&typeof vr.apply=="function"?vr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},wn;vr&&typeof vr.ownKeys=="function"?wn=vr.ownKeys:Object.getOwnPropertySymbols?wn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:wn=function(e){return Object.getOwnPropertyNames(e)};function pg(t){console&&console.warn&&console.warn(t)}var ba=Number.isNaN||function(e){return e!==e};function Se(){Se.init.call(this)}zt.exports=Se,zt.exports.once=_g,Se.EventEmitter=Se,Se.prototype._events=void 0,Se.prototype._eventsCount=0,Se.prototype._maxListeners=void 0;var ma=10;function En(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Se,"defaultMaxListeners",{enumerable:!0,get:function(){return ma},set:function(t){if(typeof t!="number"||t<0||ba(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ma=t}}),Se.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Se.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ba(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};function wa(t){return t._maxListeners===void 0?Se.defaultMaxListeners:t._maxListeners}Se.prototype.getMaxListeners=function(){return wa(this)},Se.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")_a(h,this,r);else for(var f=h.length,l=Oa(h,f),n=0;n<f;++n)_a(l[n],this,r);return!0};function Ea(t,e,r,n){var i,s,o;if(En(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=wa(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,pg(a)}return t}Se.prototype.addListener=function(e,r){return Ea(this,e,r,!1)},Se.prototype.on=Se.prototype.addListener,Se.prototype.prependListener=function(e,r){return Ea(this,e,r,!0)};function gg(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Da(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=gg.bind(n);return i.listener=r,n.wrapFn=i,i}Se.prototype.once=function(e,r){return En(r),this.on(e,Da(this,e,r)),this},Se.prototype.prependOnceListener=function(e,r){return En(r),this.prependListener(e,Da(this,e,r)),this},Se.prototype.removeListener=function(e,r){var n,i,s,o,a;if(En(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():yg(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Se.prototype.off=Se.prototype.removeListener,Se.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function xa(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?vg(i):Oa(i,i.length)}Se.prototype.listeners=function(e){return xa(this,e,!0)},Se.prototype.rawListeners=function(e){return xa(this,e,!1)},Se.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Sa.call(t,e)},Se.prototype.listenerCount=Sa;function Sa(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Se.prototype.eventNames=function(){return this._eventsCount>0?wn(this._events):[]};function Oa(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function yg(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function vg(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function _g(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}La(t,e,s,{once:!0}),e!=="error"&&bg(t,i,{once:!0})})}function bg(t,e,r){typeof t.on=="function"&&La(t,"error",e,r)}function La(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Dn={};/*! *****************************************************************************
|
|
27
|
+
***************************************************************************** */var yi=function(t,e){return yi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},yi(t,e)};function td(t,e){yi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var vi=function(){return vi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},vi.apply(this,arguments)};function rd(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function nd(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function id(t,e){return function(r,n){e(r,n,t)}}function sd(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function od(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{h(n.next(l))}catch(D){o(D)}}function f(l){try{h(n.throw(l))}catch(D){o(D)}}function h(l){l.done?s(l.value):i(l.value).then(a,f)}h((n=n.apply(t,e||[])).next())})}function ad(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(l){return f([h,l])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(l){h=[6,l],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function cd(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function ud(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function _i(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lo(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function fd(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Lo(arguments[e]));return t}function hd(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Cr(t){return this instanceof Cr?(this.v=t,this):new Cr(t)}function ld(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(v){n[v]&&(i[v]=function(m){return new Promise(function(w,P){s.push([v,m,w,P])>1||a(v,m)})})}function a(v,m){try{f(n[v](m))}catch(w){D(s[0][3],w)}}function f(v){v.value instanceof Cr?Promise.resolve(v.value.v).then(h,l):D(s[0][2],v)}function h(v){a("next",v)}function l(v){a("throw",v)}function D(v,m){v(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function dd(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Cr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function pd(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof _i=="function"?_i(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),i(a,f,o.done,o.value)})}}function i(s,o,a,f){Promise.resolve(f).then(function(h){s({value:h,done:a})},o)}}function gd(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function yd(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function vd(t){return t&&t.__esModule?t:{default:t}}function _d(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function bd(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var md=Object.freeze({__proto__:null,__extends:td,get __assign(){return vi},__rest:rd,__decorate:nd,__param:id,__metadata:sd,__awaiter:od,__generator:ad,__createBinding:cd,__exportStar:ud,__values:_i,__read:Lo,__spread:fd,__spreadArrays:hd,__await:Cr,__asyncGenerator:ld,__asyncDelegator:dd,__asyncValues:pd,__makeTemplateObject:gd,__importStar:yd,__importDefault:vd,__classPrivateFieldGet:_d,__classPrivateFieldSet:bd}),gn=Zt(md),bi={},Rr={},Io;function wd(){if(Io)return Rr;Io=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Rr.delay=t,Rr}var Qt={},mi={},er={},Ao;function Ed(){return Ao||(Ao=1,Object.defineProperty(er,"__esModule",{value:!0}),er.ONE_THOUSAND=er.ONE_HUNDRED=void 0,er.ONE_HUNDRED=100,er.ONE_THOUSAND=1e3),er}var wi={},To;function Dd(){return To||(To=1,function(t){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=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(wi)),wi}var Co;function Ro(){return Co||(Co=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(Ed(),t),e.__exportStar(Dd(),t)}(mi)),mi}var No;function xd(){if(No)return Qt;No=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.fromMiliseconds=Qt.toMiliseconds=void 0;const t=Ro();function e(n){return n*t.ONE_THOUSAND}Qt.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Qt.fromMiliseconds=r,Qt}var Po;function Sd(){return Po||(Po=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(wd(),t),e.__exportStar(xd(),t)}(bi)),bi}var dr={},$o;function Od(){if($o)return dr;$o=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return dr.Watch=t,dr.default=t,dr}var Ei={},Nr={},Fo;function Ld(){if(Fo)return Nr;Fo=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.IWatch=void 0;class t{}return Nr.IWatch=t,Nr}var Mo;function Id(){return Mo||(Mo=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),gn.__exportStar(Ld(),t)}(Ei)),Ei}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(Sd(),t),e.__exportStar(Od(),t),e.__exportStar(Id(),t),e.__exportStar(Ro(),t)})(Z);var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.getLocalStorage=Ce.getLocalStorageOrThrow=Ce.getCrypto=Ce.getCryptoOrThrow=jo=Ce.getLocation=Ce.getLocationOrThrow=Di=Ce.getNavigator=Ce.getNavigatorOrThrow=Uo=Ce.getDocument=Ce.getDocumentOrThrow=Ce.getFromWindowOrThrow=Ce.getFromWindow=void 0;function tr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ce.getFromWindow=tr;function pr(t){const e=tr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ce.getFromWindowOrThrow=pr;function Ad(){return pr("document")}Ce.getDocumentOrThrow=Ad;function Td(){return tr("document")}var Uo=Ce.getDocument=Td;function Cd(){return pr("navigator")}Ce.getNavigatorOrThrow=Cd;function Rd(){return tr("navigator")}var Di=Ce.getNavigator=Rd;function Nd(){return pr("location")}Ce.getLocationOrThrow=Nd;function Pd(){return tr("location")}var jo=Ce.getLocation=Pd;function $d(){return pr("crypto")}Ce.getCryptoOrThrow=$d;function Fd(){return tr("crypto")}Ce.getCrypto=Fd;function Md(){return pr("localStorage")}Ce.getLocalStorageOrThrow=Md;function Ud(){return tr("localStorage")}Ce.getLocalStorage=Ud;var xi={};Object.defineProperty(xi,"__esModule",{value:!0});var Bo=xi.getWindowMetadata=void 0;const zo=Ce;function jd(){let t,e;try{t=zo.getDocumentOrThrow(),e=zo.getLocationOrThrow()}catch{return null}function r(){const D=t.getElementsByTagName("link"),v=[];for(let m=0;m<D.length;m++){const w=D[m],P=w.getAttribute("rel");if(P&&P.toLowerCase().indexOf("icon")>-1){const R=w.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(R.indexOf("/")===0)B+=R;else{const S=e.pathname.split("/");S.pop();const I=S.join("/");B+=I+"/"+R}v.push(B)}else if(R.indexOf("//")===0){const B=e.protocol+R;v.push(B)}else v.push(R)}}return v}function n(...D){const v=t.getElementsByTagName("meta");for(let m=0;m<v.length;m++){const w=v[m],P=["itemprop","property","name"].map(R=>w.getAttribute(R)).filter(R=>R?D.includes(R):!1);if(P.length&&P){const R=w.getAttribute("content");if(R)return R}}return""}function i(){let D=n("name","og:site_name","og:title","twitter:title");return D||(D=t.title),D}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),f=e.origin,h=r();return{description:a,url:f,icons:h,name:o}}Bo=xi.getWindowMetadata=jd;var Pr={},Bd=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Ko="%[a-f0-9]{2}",qo=new RegExp(Ko,"gi"),Ho=new RegExp("("+Ko+")+","gi");function Si(t,e){try{return decodeURIComponent(t.join(""))}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Si(r),Si(n))}function zd(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(qo),r=1;r<e.length;r++)t=Si(e,r).join(""),e=t.match(qo);return t}}function Kd(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Ho.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=zd(r[0]);n!==r[0]&&(e[r[0]]=n)}r=Ho.exec(t)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var o=i[s];t=t.replace(new RegExp(o,"g"),e[o])}return t}var qd=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return Kd(t)}},Hd=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},Vd=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s<n.length;s++){var o=n[s],a=t[o];(i?e.indexOf(o)!==-1:e(o,a,t))&&(r[o]=a)}return r};(function(t){const e=Bd,r=qd,n=Hd,i=Vd,s=S=>S==null,o=Symbol("encodeFragmentIdentifier");function a(S){switch(S.arrayFormat){case"index":return I=>(y,x)=>{const E=y.length;return x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),"[",E,"]"].join("")]:[...y,[l(I,S),"[",l(E,S),"]=",l(x,S)].join("")]};case"bracket":return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),"[]"].join("")]:[...y,[l(I,S),"[]=",l(x,S)].join("")];case"colon-list-separator":return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),":list="].join("")]:[...y,[l(I,S),":list=",l(x,S)].join("")];case"comma":case"separator":case"bracket-separator":{const I=S.arrayFormat==="bracket-separator"?"[]=":"=";return y=>(x,E)=>E===void 0||S.skipNull&&E===null||S.skipEmptyString&&E===""?x:(E=E===null?"":E,x.length===0?[[l(y,S),I,l(E,S)].join("")]:[[x,l(E,S)].join(S.arrayFormatSeparator)])}default:return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,l(I,S)]:[...y,[l(I,S),"=",l(x,S)].join("")]}}function f(S){let I;switch(S.arrayFormat){case"index":return(y,x,E)=>{if(I=/\[(\d*)\]$/.exec(y),y=y.replace(/\[\d*\]$/,""),!I){E[y]=x;return}E[y]===void 0&&(E[y]={}),E[y][I[1]]=x};case"bracket":return(y,x,E)=>{if(I=/(\[\])$/.exec(y),y=y.replace(/\[\]$/,""),!I){E[y]=x;return}if(E[y]===void 0){E[y]=[x];return}E[y]=[].concat(E[y],x)};case"colon-list-separator":return(y,x,E)=>{if(I=/(:list)$/.exec(y),y=y.replace(/:list$/,""),!I){E[y]=x;return}if(E[y]===void 0){E[y]=[x];return}E[y]=[].concat(E[y],x)};case"comma":case"separator":return(y,x,E)=>{const c=typeof x=="string"&&x.includes(S.arrayFormatSeparator),d=typeof x=="string"&&!c&&D(x,S).includes(S.arrayFormatSeparator);x=d?D(x,S):x;const U=c||d?x.split(S.arrayFormatSeparator).map(K=>D(K,S)):x===null?x:D(x,S);E[y]=U};case"bracket-separator":return(y,x,E)=>{const c=/(\[\])$/.test(y);if(y=y.replace(/\[\]$/,""),!c){E[y]=x&&D(x,S);return}const d=x===null?[]:x.split(S.arrayFormatSeparator).map(U=>D(U,S));if(E[y]===void 0){E[y]=d;return}E[y]=[].concat(E[y],d)};default:return(y,x,E)=>{if(E[y]===void 0){E[y]=x;return}E[y]=[].concat(E[y],x)}}}function h(S){if(typeof S!="string"||S.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function l(S,I){return I.encode?I.strict?e(S):encodeURIComponent(S):S}function D(S,I){return I.decode?r(S):S}function v(S){return Array.isArray(S)?S.sort():typeof S=="object"?v(Object.keys(S)).sort((I,y)=>Number(I)-Number(y)).map(I=>S[I]):S}function m(S){const I=S.indexOf("#");return I!==-1&&(S=S.slice(0,I)),S}function w(S){let I="";const y=S.indexOf("#");return y!==-1&&(I=S.slice(y)),I}function P(S){S=m(S);const I=S.indexOf("?");return I===-1?"":S.slice(I+1)}function R(S,I){return I.parseNumbers&&!Number.isNaN(Number(S))&&typeof S=="string"&&S.trim()!==""?S=Number(S):I.parseBooleans&&S!==null&&(S.toLowerCase()==="true"||S.toLowerCase()==="false")&&(S=S.toLowerCase()==="true"),S}function B(S,I){I=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},I),h(I.arrayFormatSeparator);const y=f(I),x=Object.create(null);if(typeof S!="string"||(S=S.trim().replace(/^[?#&]/,""),!S))return x;for(const E of S.split("&")){if(E==="")continue;let[c,d]=n(I.decode?E.replace(/\+/g," "):E,"=");d=d===void 0?null:["comma","separator","bracket-separator"].includes(I.arrayFormat)?d:D(d,I),y(D(c,I),d,x)}for(const E of Object.keys(x)){const c=x[E];if(typeof c=="object"&&c!==null)for(const d of Object.keys(c))c[d]=R(c[d],I);else x[E]=R(c,I)}return I.sort===!1?x:(I.sort===!0?Object.keys(x).sort():Object.keys(x).sort(I.sort)).reduce((E,c)=>{const d=x[c];return Boolean(d)&&typeof d=="object"&&!Array.isArray(d)?E[c]=v(d):E[c]=d,E},Object.create(null))}t.extract=P,t.parse=B,t.stringify=(S,I)=>{if(!S)return"";I=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},I),h(I.arrayFormatSeparator);const y=d=>I.skipNull&&s(S[d])||I.skipEmptyString&&S[d]==="",x=a(I),E={};for(const d of Object.keys(S))y(d)||(E[d]=S[d]);const c=Object.keys(E);return I.sort!==!1&&c.sort(I.sort),c.map(d=>{const U=S[d];return U===void 0?"":U===null?l(d,I):Array.isArray(U)?U.length===0&&I.arrayFormat==="bracket-separator"?l(d,I)+"[]":U.reduce(x(d),[]).join("&"):l(d,I)+"="+l(U,I)}).filter(d=>d.length>0).join("&")},t.parseUrl=(S,I)=>{I=Object.assign({decode:!0},I);const[y,x]=n(S,"#");return Object.assign({url:y.split("?")[0]||"",query:B(P(S),I)},I&&I.parseFragmentIdentifier&&x?{fragmentIdentifier:D(x,I)}:{})},t.stringifyUrl=(S,I)=>{I=Object.assign({encode:!0,strict:!0,[o]:!0},I);const y=m(S.url).split("?")[0]||"",x=t.extract(S.url),E=t.parse(x,{sort:!1}),c=Object.assign(E,S.query);let d=t.stringify(c,I);d&&(d=`?${d}`);let U=w(S.url);return S.fragmentIdentifier&&(U=`#${I[o]?l(S.fragmentIdentifier,I):S.fragmentIdentifier}`),`${y}${d}${U}`},t.pick=(S,I,y)=>{y=Object.assign({parseFragmentIdentifier:!0,[o]:!1},y);const{url:x,query:E,fragmentIdentifier:c}=t.parseUrl(S,y);return t.stringifyUrl({url:x,query:i(E,I),fragmentIdentifier:c},y)},t.exclude=(S,I,y)=>{const x=Array.isArray(I)?E=>!I.includes(E):(E,c)=>!I(E,c);return t.pick(S,x,y)}})(Pr);const Gd={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"}},Vo=":";function Wd(t){const{namespace:e,reference:r}=t;return[e,r].join(Vo)}function kd(t){const[e,r,n]=t.split(Vo);return{namespace:e,reference:r,address:n}}function Yd(t,e){const r=[];return t.forEach(n=>{const i=e(n);r.includes(i)||r.push(i)}),r}function Jd(t){const{namespace:e,reference:r}=kd(t);return Wd({namespace:e,reference:r})}function Xd(t){return Yd(t,Jd)}function Oi(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function Li(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...Xd(i.accounts))}),r}function Zd(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.chains)}),r}const Go="base10",gt="base16",Ii="base64pad",Ai="utf8",Wo=0,rr=1,Qd=0,ko=1,Ti=12,Ci=32;function ep(){const t=hi.generateKeyPair();return{privateKey:pt(t.secretKey,gt),publicKey:pt(t.publicKey,gt)}}function Ri(){const t=lr.randomBytes(Ci);return pt(t,gt)}function tp(t,e){const r=hi.sharedKey(dt(t,gt),dt(e,gt)),n=new lh(dn.SHA256,r).expand(Ci);return pt(n,gt)}function rp(t){const e=dn.hash(dt(t,gt));return pt(e,gt)}function Ni(t){const e=dn.hash(dt(t,Ai));return pt(e,gt)}function np(t){return dt(`${t}`,Go)}function $r(t){return Number(pt(t,Go))}function ip(t){const e=np(typeof t.type<"u"?t.type:Wo);if($r(e)===rr&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?dt(t.senderPublicKey,gt):void 0,n=typeof t.iv<"u"?dt(t.iv,gt):lr.randomBytes(Ti),i=new ii.ChaCha20Poly1305(dt(t.symKey,gt)).seal(n,dt(t.message,Ai));return op({type:e,sealed:i,iv:n,senderPublicKey:r})}function sp(t){const e=new ii.ChaCha20Poly1305(dt(t.symKey,gt)),{sealed:r,iv:n}=Pi(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return pt(i,Ai)}function op(t){if($r(t.type)===rr){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return pt(li([t.type,t.senderPublicKey,t.iv,t.sealed]),Ii)}return pt(li([t.type,t.iv,t.sealed]),Ii)}function Pi(t){const e=dt(t,Ii),r=e.slice(Qd,ko),n=ko;if($r(r)===rr){const a=n+Ci,f=a+Ti,h=e.slice(n,a),l=e.slice(a,f),D=e.slice(f);return{type:r,sealed:D,iv:l,senderPublicKey:h}}const i=n+Ti,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function ap(t,e){const r=Pi(t);return Yo({type:$r(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?pt(r.senderPublicKey,gt):void 0,receiverPublicKey:e?.receiverPublicKey})}function Yo(t){const e=t?.type||Wo;if(e===rr){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Jo(t){return t.type===rr&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var cp=Object.defineProperty,Xo=Object.getOwnPropertySymbols,up=Object.prototype.hasOwnProperty,fp=Object.prototype.propertyIsEnumerable,Zo=(t,e,r)=>e in t?cp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qo=(t,e)=>{for(var r in e||(e={}))up.call(e,r)&&Zo(t,r,e[r]);if(Xo)for(var r of Xo(e))fp.call(e,r)&&Zo(t,r,e[r]);return t};const hp="ReactNative",Fr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},lp="js";function ea(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function dp(){return!Uo()&&!!Di()&&navigator.product===hp}function pp(){return!ea()&&!!Di()}function gp(){return dp()?Fr.reactNative:ea()?Fr.node:pp()?Fr.browser:Fr.unknown}function yp(t,e){let r=Pr.parse(t);return r=Qo(Qo({},r),e),t=Pr.stringify(r),t}function vp(){return Bo()||{name:"",description:"",url:"",icons:[""]}}function _p(){const t=Jl();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function bp(){var t;const e=gp();return e===Fr.browser?[e,((t=jo())==null?void 0:t.host)||"unknown"].join(":"):e}function mp(t,e,r){const n=_p(),i=bp();return[[t,e].join("-"),[lp,r].join("-"),n,i].join("/")}function wp({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s}){const o=r.split("?"),a=mp(t,e,n),f={auth:i,ua:a,projectId:s},h=yp(o[1]||"",f);return o[0]+"?"+h}function yt(t,e){return t.filter(r=>e.includes(r)).length===t.length}function ta(t){return Object.fromEntries(t.entries())}function ra(t){return new Map(Object.entries(t))}function Tt(t,e){return Z.fromMiliseconds((e||Date.now())+Z.toMiliseconds(t))}function Gt(t){return Z.fromMiliseconds(Date.now())>=Z.toMiliseconds(t)}function nr(t){const e=Z.toMiliseconds(t||Z.FIVE_MINUTES);let r,n,i;return{resolve:s=>{i&&r&&(clearTimeout(i),r(s))},reject:s=>{i&&n&&(clearTimeout(i),n(s))},done:()=>new Promise((s,o)=>{i=setTimeout(o,e),r=s,n=o})}}function na(t,e){return new Promise(async(r,n)=>{const i=setTimeout(()=>n(),e),s=await t;clearTimeout(i),r(s)})}function ia(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Ep(t){return ia("topic",t)}function Dp(t){return ia("id",t)}function sa(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function je(t,e){return`${t}${e?`:${e}`:""}`}const xp="irn";function $i(t){return t?.relay||{protocol:xp}}function Fi(t){const e=Gd[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Sp=Object.defineProperty,oa=Object.getOwnPropertySymbols,Op=Object.prototype.hasOwnProperty,Lp=Object.prototype.propertyIsEnumerable,aa=(t,e,r)=>e in t?Sp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ip=(t,e)=>{for(var r in e||(e={}))Op.call(e,r)&&aa(t,r,e[r]);if(oa)for(var r of oa(e))Lp.call(e,r)&&aa(t,r,e[r]);return t};function Ap(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function Tp(t){const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Pr.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:Ap(o)}}function Cp(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Rp(t){return`${t.protocol}:${t.topic}@${t.version}?`+Pr.stringify(Ip({symKey:t.symKey},Cp(t.relay)))}function Ct(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function Np(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Ct(r.accounts)),r.extension&&r.extension.forEach(n=>{e.push(...Ct(n.accounts))})}),e}function Pp(t,e){const r=[];return Object.values(t).forEach(n=>{Ct(n.accounts).includes(e)&&r.push(...n.methods),n.extension&&n.extension.forEach(i=>{Ct(i.accounts).includes(e)&&r.push(...i.methods)})}),r}function $p(t,e){const r=[];return Object.values(t).forEach(n=>{Ct(n.accounts).includes(e)&&r.push(...n.events),n.extension&&n.extension.forEach(i=>{Ct(i.accounts).includes(e)&&r.push(...i.events)})}),r}function Fp(t,e){const r=vn(t,e);if(r)throw new Error(r.message);const n={};for(const[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}const Mp={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}},Up={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 V(t,e){const{message:r,code:n}=Up[t];return{message:e?`${r} ${e}`:r,code:n}}function Ge(t,e){const{message:r,code:n}=Mp[t];return{message:e?`${r} ${e}`:r,code:n}}function Mr(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function yn(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bt(t){return typeof t>"u"}function st(t,e){return e&&bt(t)?!0:typeof t=="string"&&Boolean(t.trim().length)}function Mi(t,e){return e&&bt(t)?!0:typeof t=="number"&&!isNaN(t)}function jp(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return yt(i,n)?(n.forEach(o=>{const{accounts:a,methods:f,events:h,extension:l}=t.namespaces[o],D=Ct(a),v=r[o];(!yt(v.chains,D)||!yt(v.methods,f)||!yt(v.events,h))&&(s=!1),s&&l&&l.forEach(m=>{var w;const{accounts:P,methods:R,events:B}=m,S=Ct(P);(w=v.extension)!=null&&w.find(I=>yt(I.chains,S)&&yt(I.methods,R)&&yt(I.events,B))||(s=!1)})}),s):!1}function Ui(t){return st(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function Bp(t){if(st(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Ui(r)}}return!1}function zp(t){if(st(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Kp(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function qp(t){return t?.topic}function Hp(t,e){let r=null;return st(t?.publicKey,!1)||(r=V("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function ji(t,e){let r=null;return bt(t?.extension)||(!Mr(t.extension)||!t.extension.length)&&(r=V("MISSING_OR_INVALID",`${e} extension should be an array of namespaces, or omitted`)),r}function ca(t){let e=!0;return Mr(t)?t.length&&(e=t.every(r=>st(r,!1))):e=!1,e}function ua(t,e,r){let n=null;return Mr(e)?e.forEach(i=>{n||(!Ui(i)||!i.includes(t))&&(n=Ge("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=Ge("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function Vp(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;const s=ua(n,i?.chains,`${e} requiredNamespace`),o=ji(i,e);s?r=s:o?r=o:i.extension&&i.extension.forEach(a=>{if(r)return;const f=ua(n,a.chains,`${e} extension`);f&&(r=f)})}),r}function fa(t,e){let r=null;return Mr(t)?t.forEach(n=>{r||Bp(n)||(r=Ge("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ge("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Gp(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=fa(n?.accounts,`${e} namespace`),s=ji(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=fa(o.accounts,`${e} extension`);a&&(r=a)})}),r}function ha(t,e){let r=null;return ca(t?.methods)?ca(t?.events)||(r=Ge("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ge("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function la(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=ha(n,`${e}, namespace`),s=ji(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=ha(o,`${e}, extension`);a&&(r=a)})}),r}function Wp(t,e){let r=null;if(t&&yn(t)){const n=la(t,e);n&&(r=n);const i=Vp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, requiredNamespaces should be an object with data`);return r}function vn(t,e){let r=null;if(t&&yn(t)){const n=la(t,e);n&&(r=n);const i=Gp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function da(t){return st(t.protocol,!0)}function kp(t,e){let r=!1;return e&&!t?r=!0:t&&Mr(t)&&t.length&&t.forEach(n=>{r=da(n)}),r}function Yp(t){return typeof t=="number"}function vt(t){return typeof t<"u"&&typeof t!==null}function Jp(t){return!(!t||typeof t!="object"||!t.code||!Mi(t.code,!1)||!t.message||!st(t.message,!1))}function Xp(t){return!(bt(t)||!st(t.method,!1))}function Zp(t){return!(bt(t)||bt(t.result)&&bt(t.error)||!Mi(t.id,!1)||!st(t.jsonrpc,!1))}function Qp(t){return!(bt(t)||!st(t.name,!1))}function pa(t,e){return!(!Ui(e)||!Np(t).includes(e))}function eg(t,e,r){return st(r,!1)?Pp(t,e).includes(r):!1}function tg(t,e,r){return st(r,!1)?$p(t,e).includes(r):!1}function ga(t,e,r){let n=null;const i=Object.keys(t),s=Object.keys(e);return yt(i,s)?i.forEach(o=>{var a;if(n)return;const f=t[o].chains,h=Ct(e[o].accounts);yt(f,h)?yt(t[o].methods,e[o].methods)?yt(t[o].events,e[o].events)?t[o].extension&&!e[o].extension?n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`):t[o].extension&&e[o].extension&&((a=t[o].extension)==null||a.forEach(({methods:l,events:D,chains:v})=>{var m;n||(m=e[o].extension)!=null&&m.find(w=>{const P=Ct(w.accounts);return yt(v,P)&&yt(D,w.events)&&yt(l,w.methods)})||(n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`))})):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy requiredNamespaces events for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy requiredNamespaces methods for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy requiredNamespaces chains for ${o}`)}):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces`),n}function rg(t,e){return Mi(t,!1)&&t<=e.max&&t>=e.min}function ng(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var ig=sg;function sg(t,e,r){var n=r&&r.stringify||ng,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a<s;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var f=e.length;if(f===0)return t;for(var h="",l=1-i,D=-1,v=t&&t.length||0,m=0;m<v;){if(t.charCodeAt(m)===37&&m+1<v){switch(D=D>-1?D:0,t.charCodeAt(m+1)){case 100:case 102:if(l>=f||e[l]==null)break;D<m&&(h+=t.slice(D,m)),h+=Number(e[l]),D=m+2,m++;break;case 105:if(l>=f||e[l]==null)break;D<m&&(h+=t.slice(D,m)),h+=Math.floor(Number(e[l])),D=m+2,m++;break;case 79:case 111:case 106:if(l>=f||e[l]===void 0)break;D<m&&(h+=t.slice(D,m));var w=typeof e[l];if(w==="string"){h+="'"+e[l]+"'",D=m+2,m++;break}if(w==="function"){h+=e[l].name||"<anonymous>",D=m+2,m++;break}h+=n(e[l]),D=m+2,m++;break;case 115:if(l>=f)break;D<m&&(h+=t.slice(D,m)),h+=String(e[l]),D=m+2,m++;break;case 37:D<m&&(h+=t.slice(D,m)),h+="%",D=m+2,m++,l--;break}++l}++m}return D===-1?t:(D<v&&(h+=t.slice(D)),h)}const ya=ig;var _n=Rt;const Ur=gg().console||{},og={mapHttpRequest:mn,mapHttpResponse:mn,wrapRequestSerializer:zi,wrapResponseSerializer:zi,wrapErrorSerializer:zi,req:mn,res:mn,err:hg};function ag(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Rt(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Ur;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=ag(t.browser.serialize,n);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",f=Object.create(r);f.log||(f.log=jr),Object.defineProperty(f,"levelVal",{get:l}),Object.defineProperty(f,"level",{get:D,set:v});const h={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:lg(t)};f.levels=Rt.levels,f.level=a,f.setMaxListeners=f.getMaxListeners=f.emit=f.addListener=f.on=f.prependListener=f.once=f.prependOnceListener=f.removeListener=f.removeAllListeners=f.listeners=f.listenerCount=f.eventNames=f.write=f.flush=jr,f.serializers=n,f._serialize=i,f._stdErrSerialize=s,f.child=m,e&&(f._logEvent=Bi());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function D(){return this._level}function v(w){if(w!=="silent"&&!this.levels.values[w])throw Error("unknown level "+w);this._level=w,gr(h,f,"error","log"),gr(h,f,"fatal","error"),gr(h,f,"warn","error"),gr(h,f,"info","log"),gr(h,f,"debug","log"),gr(h,f,"trace","log")}function m(w,P){if(!w)throw new Error("missing bindings for child Pino");P=P||{},i&&w.serializers&&(P.serializers=w.serializers);const R=P.serializers;if(i&&R){var B=Object.assign({},n,R),S=t.browser.serialize===!0?Object.keys(B):i;delete w.serializers,bn([w],S,B,this._stdErrSerialize)}function I(y){this._childLevel=(y._childLevel|0)+1,this.error=yr(y,w,"error"),this.fatal=yr(y,w,"fatal"),this.warn=yr(y,w,"warn"),this.info=yr(y,w,"info"),this.debug=yr(y,w,"debug"),this.trace=yr(y,w,"trace"),B&&(this.serializers=B,this._serialize=S),e&&(this._logEvent=Bi([].concat(y._logEvent.bindings,w)))}return I.prototype=this,new I(this)}return f}Rt.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"}},Rt.stdSerializers=og,Rt.stdTimeFunctions=Object.assign({},{nullTime:va,epochTime:_a,unixTime:dg,isoTime:pg});function gr(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?jr:i[r]?i[r]:Ur[r]||Ur[n]||jr,cg(t,e,r)}function cg(t,e,r){!t.transmit&&e[r]===jr||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ur?Ur:this;for(var f=0;f<o.length;f++)o[f]=arguments[f];if(t.serialize&&!t.asObject&&bn(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,ug(this,r,o,s)):n.apply(a,o),t.transmit){const h=t.transmit.level||e.level,l=Rt.levels.values[h],D=Rt.levels.values[r];if(D<l)return;fg(this,{ts:s,methodLevel:r,methodValue:D,transmitLevel:h,transmitValue:Rt.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function ug(t,e,r,n){t._serialize&&bn(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let s=i[0];const o={};n&&(o.time=n),o.level=Rt.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof i[0]=="object";)Object.assign(o,i.shift());s=i.length?ya(i.shift(),i):void 0}else typeof s=="string"&&(s=ya(i.shift(),i));return s!==void 0&&(o.msg=s),o}function bn(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=Rt.stdSerializers.err(t[i]);else if(typeof t[i]=="object"&&!Array.isArray(t[i]))for(const s in t[i])e&&e.indexOf(s)>-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function yr(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return t[r].apply(this,n)}}function fg(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,f=t._logEvent.bindings;bn(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(h){return f.indexOf(h)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,n(s,t._logEvent,a),t._logEvent=Bi(f)}function Bi(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function hg(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function lg(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?va:_a}function mn(){return{}}function zi(t){return t}function jr(){}function va(){return!1}function _a(){return Date.now()}function dg(){return Math.round(Date.now()/1e3)}function pg(){return new Date(Date.now()).toISOString()}function gg(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}var zt={exports:{}},vr=typeof Reflect=="object"?Reflect:null,ba=vr&&typeof vr.apply=="function"?vr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},wn;vr&&typeof vr.ownKeys=="function"?wn=vr.ownKeys:Object.getOwnPropertySymbols?wn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:wn=function(e){return Object.getOwnPropertyNames(e)};function yg(t){console&&console.warn&&console.warn(t)}var ma=Number.isNaN||function(e){return e!==e};function Se(){Se.init.call(this)}zt.exports=Se,zt.exports.once=mg,Se.EventEmitter=Se,Se.prototype._events=void 0,Se.prototype._eventsCount=0,Se.prototype._maxListeners=void 0;var wa=10;function En(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Se,"defaultMaxListeners",{enumerable:!0,get:function(){return wa},set:function(t){if(typeof t!="number"||t<0||ma(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");wa=t}}),Se.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Se.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ma(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};function Ea(t){return t._maxListeners===void 0?Se.defaultMaxListeners:t._maxListeners}Se.prototype.getMaxListeners=function(){return Ea(this)},Se.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")ba(f,this,r);else for(var h=f.length,l=La(f,h),n=0;n<h;++n)ba(l[n],this,r);return!0};function Da(t,e,r,n){var i,s,o;if(En(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Ea(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,yg(a)}return t}Se.prototype.addListener=function(e,r){return Da(this,e,r,!1)},Se.prototype.on=Se.prototype.addListener,Se.prototype.prependListener=function(e,r){return Da(this,e,r,!0)};function vg(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function xa(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=vg.bind(n);return i.listener=r,n.wrapFn=i,i}Se.prototype.once=function(e,r){return En(r),this.on(e,xa(this,e,r)),this},Se.prototype.prependOnceListener=function(e,r){return En(r),this.prependListener(e,xa(this,e,r)),this},Se.prototype.removeListener=function(e,r){var n,i,s,o,a;if(En(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():_g(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Se.prototype.off=Se.prototype.removeListener,Se.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Sa(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?bg(i):La(i,i.length)}Se.prototype.listeners=function(e){return Sa(this,e,!0)},Se.prototype.rawListeners=function(e){return Sa(this,e,!1)},Se.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Oa.call(t,e)},Se.prototype.listenerCount=Oa;function Oa(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Se.prototype.eventNames=function(){return this._eventsCount>0?wn(this._events):[]};function La(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function _g(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function bg(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function mg(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Ia(t,e,s,{once:!0}),e!=="error"&&wg(t,i,{once:!0})})}function wg(t,e,r){typeof t.on=="function"&&Ia(t,"error",e,r)}function Ia(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Dn={};/*! *****************************************************************************
|
|
28
28
|
Copyright (c) Microsoft Corporation.
|
|
29
29
|
|
|
30
30
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
38
38
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
39
|
PERFORMANCE OF THIS SOFTWARE.
|
|
40
|
-
***************************************************************************** */var
|
|
40
|
+
***************************************************************************** */var Ki=function(t,e){return Ki=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Ki(t,e)};function Eg(t,e){Ki(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var qi=function(){return qi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},qi.apply(this,arguments)};function Dg(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function xg(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Sg(t,e){return function(r,n){e(r,n,t)}}function Og(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Lg(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{h(n.next(l))}catch(D){o(D)}}function f(l){try{h(n.throw(l))}catch(D){o(D)}}function h(l){l.done?s(l.value):i(l.value).then(a,f)}h((n=n.apply(t,e||[])).next())})}function Ig(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(l){return f([h,l])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(l){h=[6,l],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Ag(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Tg(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Hi(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Aa(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Cg(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Aa(arguments[e]));return t}function Rg(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Br(t){return this instanceof Br?(this.v=t,this):new Br(t)}function Ng(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(v){n[v]&&(i[v]=function(m){return new Promise(function(w,P){s.push([v,m,w,P])>1||a(v,m)})})}function a(v,m){try{f(n[v](m))}catch(w){D(s[0][3],w)}}function f(v){v.value instanceof Br?Promise.resolve(v.value.v).then(h,l):D(s[0][2],v)}function h(v){a("next",v)}function l(v){a("throw",v)}function D(v,m){v(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Pg(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Br(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function $g(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Hi=="function"?Hi(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),i(a,f,o.done,o.value)})}}function i(s,o,a,f){Promise.resolve(f).then(function(h){s({value:h,done:a})},o)}}function Fg(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Mg(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function Ug(t){return t&&t.__esModule?t:{default:t}}function jg(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Bg(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var zg=Object.freeze({__proto__:null,__extends:Eg,get __assign(){return qi},__rest:Dg,__decorate:xg,__param:Sg,__metadata:Og,__awaiter:Lg,__generator:Ig,__createBinding:Ag,__exportStar:Tg,__values:Hi,__read:Aa,__spread:Cg,__spreadArrays:Rg,__await:Br,__asyncGenerator:Ng,__asyncDelegator:Pg,__asyncValues:$g,__makeTemplateObject:Fg,__importStar:Mg,__importDefault:Ug,__classPrivateFieldGet:jg,__classPrivateFieldSet:Bg}),Ta=Zt(zg),zr={};Object.defineProperty(zr,"__esModule",{value:!0});function Kg(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}zr.safeJsonParse=Kg;function qg(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}zr.safeJsonStringify=qg;var Kr={exports:{}},Ca;function Hg(){return Ca||(Ca=1,function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof ke<"u"&&ke.localStorage?Kr.exports=ke.localStorage:typeof window<"u"&&window.localStorage?Kr.exports=window.localStorage:Kr.exports=new e}()),Kr.exports}var Vi={},qr={},Ra;function Vg(){if(Ra)return qr;Ra=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.IKeyValueStorage=void 0;class t{}return qr.IKeyValueStorage=t,qr}var Hr={},Na;function Gg(){if(Na)return Hr;Na=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.parseEntry=void 0;const t=zr;function e(r){var n;return[r[0],t.safeJsonParse((n=r[1])!==null&&n!==void 0?n:"")]}return Hr.parseEntry=e,Hr}var Pa;function Wg(){return Pa||(Pa=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Ta;e.__exportStar(Vg(),t),e.__exportStar(Gg(),t)}(Vi)),Vi}Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.KeyValueStorage=void 0;const _r=Ta,$a=zr,kg=_r.__importDefault(Hg()),Yg=Wg();class Fa{constructor(){this.localStorage=kg.default}getKeys(){return _r.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return _r.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(Yg.parseEntry)})}getItem(e){return _r.__awaiter(this,void 0,void 0,function*(){const r=this.localStorage.getItem(e);if(r!==null)return $a.safeJsonParse(r)})}setItem(e,r){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,$a.safeJsonStringify(r))})}removeItem(e){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}}Dn.KeyValueStorage=Fa;var Jg=Dn.default=Fa,Vr={};/*! *****************************************************************************
|
|
41
41
|
Copyright (c) Microsoft Corporation.
|
|
42
42
|
|
|
43
43
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
51
51
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
52
52
|
PERFORMANCE OF THIS SOFTWARE.
|
|
53
|
-
***************************************************************************** */var
|
|
53
|
+
***************************************************************************** */var Gi=function(t,e){return Gi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Gi(t,e)};function Xg(t,e){Gi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Wi=function(){return Wi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Wi.apply(this,arguments)};function Zg(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Qg(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function ey(t,e){return function(r,n){e(r,n,t)}}function ty(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ry(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{h(n.next(l))}catch(D){o(D)}}function f(l){try{h(n.throw(l))}catch(D){o(D)}}function h(l){l.done?s(l.value):i(l.value).then(a,f)}h((n=n.apply(t,e||[])).next())})}function ny(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(l){return f([h,l])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(l){h=[6,l],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function iy(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function sy(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function ki(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ma(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function oy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ma(arguments[e]));return t}function ay(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Gr(t){return this instanceof Gr?(this.v=t,this):new Gr(t)}function cy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(v){n[v]&&(i[v]=function(m){return new Promise(function(w,P){s.push([v,m,w,P])>1||a(v,m)})})}function a(v,m){try{f(n[v](m))}catch(w){D(s[0][3],w)}}function f(v){v.value instanceof Gr?Promise.resolve(v.value.v).then(h,l):D(s[0][2],v)}function h(v){a("next",v)}function l(v){a("throw",v)}function D(v,m){v(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function uy(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Gr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function fy(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ki=="function"?ki(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),i(a,f,o.done,o.value)})}}function i(s,o,a,f){Promise.resolve(f).then(function(h){s({value:h,done:a})},o)}}function hy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ly(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function dy(t){return t&&t.__esModule?t:{default:t}}function py(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function gy(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var yy=Object.freeze({__proto__:null,__extends:Xg,get __assign(){return Wi},__rest:Zg,__decorate:Qg,__param:ey,__metadata:ty,__awaiter:ry,__generator:ny,__createBinding:iy,__exportStar:sy,__values:ki,__read:Ma,__spread:oy,__spreadArrays:ay,__await:Gr,__asyncGenerator:cy,__asyncDelegator:uy,__asyncValues:fy,__makeTemplateObject:hy,__importStar:ly,__importDefault:dy,__classPrivateFieldGet:py,__classPrivateFieldSet:gy}),xn=Zt(yy),Wr={},Yi={},kr={};class ir{}var vy=Object.freeze({__proto__:null,IEvents:ir}),_y=Zt(vy),Ua;function by(){if(Ua)return kr;Ua=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.IHeartBeat=void 0;const t=_y;class e extends t.IEvents{constructor(n){super()}}return kr.IHeartBeat=e,kr}var ja;function Ba(){return ja||(ja=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),xn.__exportStar(by(),t)}(Yi)),Yi}var Ji={},sr={},za;function my(){if(za)return sr;za=1,Object.defineProperty(sr,"__esModule",{value:!0}),sr.HEARTBEAT_EVENTS=sr.HEARTBEAT_INTERVAL=void 0;const t=Z;return sr.HEARTBEAT_INTERVAL=t.FIVE_SECONDS,sr.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},sr}var Ka;function qa(){return Ka||(Ka=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),xn.__exportStar(my(),t)}(Ji)),Ji}var Ha;function wy(){if(Ha)return Wr;Ha=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.HeartBeat=void 0;const t=xn,e=kn,r=Z,n=Ba(),i=qa();class s extends n.IHeartBeat{constructor(a){super(a),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=a?.interval||i.HEARTBEAT_INTERVAL}static init(a){return t.__awaiter(this,void 0,void 0,function*(){const f=new s(a);return yield f.init(),f})}init(){return t.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}on(a,f){this.events.on(a,f)}once(a,f){this.events.once(a,f)}off(a,f){this.events.off(a,f)}removeListener(a,f){this.events.removeListener(a,f)}initialize(){return t.__awaiter(this,void 0,void 0,function*(){setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return Wr.HeartBeat=s,Wr}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=xn;e.__exportStar(wy(),t),e.__exportStar(Ba(),t),e.__exportStar(qa(),t)})(Vr);var Oe={};/*! *****************************************************************************
|
|
54
54
|
Copyright (c) Microsoft Corporation.
|
|
55
55
|
|
|
56
56
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
64
64
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
65
65
|
PERFORMANCE OF THIS SOFTWARE.
|
|
66
|
-
***************************************************************************** */var Ji=function(t,e){return Ji=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Ji(t,e)};function my(t,e){Ji(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xi=function(){return Xi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Xi.apply(this,arguments)};function wy(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Ey(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Dy(t,e){return function(r,n){e(r,n,t)}}function xy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Sy(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function Oy(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Ly(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Iy(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Zi(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ha(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Ay(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ha(arguments[e]));return t}function Ty(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Yr(t){return this instanceof Yr?(this.v=t,this):new Yr(t)}function Cy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Yr?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Ry(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Yr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Py(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Zi=="function"?Zi(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function Ny(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function $y(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function Fy(t){return t&&t.__esModule?t:{default:t}}function My(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Uy(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var jy=Object.freeze({__proto__:null,__extends:my,get __assign(){return Xi},__rest:wy,__decorate:Ey,__param:Dy,__metadata:xy,__awaiter:Sy,__generator:Oy,__createBinding:Ly,__exportStar:Iy,__values:Zi,__read:Ha,__spread:Ay,__spreadArrays:Ty,__await:Yr,__asyncGenerator:Cy,__asyncDelegator:Ry,__asyncValues:Py,__makeTemplateObject:Ny,__importStar:$y,__importDefault:Fy,__classPrivateFieldGet:My,__classPrivateFieldSet:Uy}),By=Zt(jy),or={},Va;function Ga(){return Va||(Va=1,Object.defineProperty(or,"__esModule",{value:!0}),or.PINO_CUSTOM_CONTEXT_KEY=or.PINO_LOGGER_DEFAULTS=void 0,or.PINO_LOGGER_DEFAULTS={level:"info"},or.PINO_CUSTOM_CONTEXT_KEY="custom_context"),or}var ft={},Wa;function zy(){if(Wa)return ft;Wa=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.generateChildLogger=ft.formatChildLoggerContext=ft.getLoggerContext=ft.setBrowserLoggerContext=ft.getBrowserLoggerContext=ft.getDefaultLoggerOptions=void 0;const t=Ga();function e(a){return Object.assign(Object.assign({},a),{level:a?.level||t.PINO_LOGGER_DEFAULTS.level})}ft.getDefaultLoggerOptions=e;function r(a,h=t.PINO_CUSTOM_CONTEXT_KEY){return a[h]||""}ft.getBrowserLoggerContext=r;function n(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){return a[f]=h,a}ft.setBrowserLoggerContext=n;function i(a,h=t.PINO_CUSTOM_CONTEXT_KEY){let f="";return typeof a.bindings>"u"?f=r(a,h):f=a.bindings().context||"",f}ft.getLoggerContext=i;function s(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){const l=i(a,f);return l.trim()?`${l}/${h}`:h}ft.formatChildLoggerContext=s;function o(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){const l=s(a,h,f),D=a.child({context:l});return n(D,l,f)}return ft.generateChildLogger=o,ft}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const e=By,r=e.__importDefault(_n);Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return r.default}}),e.__exportStar(Ga(),t),e.__exportStar(zy(),t)})(Oe);var ka={exports:{}},br=typeof Reflect=="object"?Reflect:null,Ya=br&&typeof br.apply=="function"?br.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Sn;br&&typeof br.ownKeys=="function"?Sn=br.ownKeys:Object.getOwnPropertySymbols?Sn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sn=function(e){return Object.getOwnPropertyNames(e)};function Ky(t){console&&console.warn&&console.warn(t)}var Ja=Number.isNaN||function(e){return e!==e};function Le(){Le.init.call(this)}ka.exports=Le,ka.exports.once=Gy,Le.EventEmitter=Le,Le.prototype._events=void 0,Le.prototype._eventsCount=0,Le.prototype._maxListeners=void 0;var Xa=10;function On(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Le,"defaultMaxListeners",{enumerable:!0,get:function(){return Xa},set:function(t){if(typeof t!="number"||t<0||Ja(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Xa=t}}),Le.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Le.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ja(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};function Za(t){return t._maxListeners===void 0?Le.defaultMaxListeners:t._maxListeners}Le.prototype.getMaxListeners=function(){return Za(this)},Le.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")Ya(h,this,r);else for(var f=h.length,l=nc(h,f),n=0;n<f;++n)Ya(l[n],this,r);return!0};function Qa(t,e,r,n){var i,s,o;if(On(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Za(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Ky(a)}return t}Le.prototype.addListener=function(e,r){return Qa(this,e,r,!1)},Le.prototype.on=Le.prototype.addListener,Le.prototype.prependListener=function(e,r){return Qa(this,e,r,!0)};function qy(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ec(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=qy.bind(n);return i.listener=r,n.wrapFn=i,i}Le.prototype.once=function(e,r){return On(r),this.on(e,ec(this,e,r)),this},Le.prototype.prependOnceListener=function(e,r){return On(r),this.prependListener(e,ec(this,e,r)),this},Le.prototype.removeListener=function(e,r){var n,i,s,o,a;if(On(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Hy(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Le.prototype.off=Le.prototype.removeListener,Le.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function tc(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Vy(i):nc(i,i.length)}Le.prototype.listeners=function(e){return tc(this,e,!0)},Le.prototype.rawListeners=function(e){return tc(this,e,!1)},Le.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):rc.call(t,e)},Le.prototype.listenerCount=rc;function rc(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Le.prototype.eventNames=function(){return this._eventsCount>0?Sn(this._events):[]};function nc(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Hy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Vy(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Gy(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}ic(t,e,s,{once:!0}),e!=="error"&&Wy(t,i,{once:!0})})}function Wy(t,e,r){typeof t.on=="function"&&ic(t,"error",e,r)}function ic(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}class ky extends ir{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Yy extends ir{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class Jy{constructor(e,r){this.logger=e,this.core=r}}class Xy extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Zy extends ir{constructor(e){super()}}class Qy{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class ev extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class tv extends ir{constructor(e,r){super(),this.core=e,this.logger=r}}class rv{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class nv{constructor(e){this.client=e}}var Qi={},sc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=_t;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var l=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&f>0;)this._buffer[this._bufferLength++]=h[l++],f--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(l=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,l,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[l++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,l=this._bufferLength,D=f/536870912|0,b=f<<3,m=f%128<112?128:256;this._buffer[l]=128;for(var w=l+1;w<m-8;w++)this._buffer[w]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(b,this._buffer,m-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,m),this._finished=!0}for(var w=0;w<this.digestLength/8;w++)e.writeUint32BE(this._stateHi[w],h,w*8),e.writeUint32BE(this._stateLo[w],h,w*8+4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.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}},a.prototype.restoreState=function(h){return this._stateHi.set(h.stateHi),this._stateLo.set(h.stateLo),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.stateHi),r.wipe(h.stateLo),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();t.SHA512=n;var i=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 s(a,h,f,l,D,b,m){for(var w=f[0],N=f[1],R=f[2],B=f[3],S=f[4],I=f[5],y=f[6],x=f[7],E=l[0],c=l[1],d=l[2],U=l[3],K=l[4],G=l[5],J=l[6],X=l[7],g,v,F,M,P,C,j,z;m>=128;){for(var Q=0;Q<16;Q++){var q=8*Q+b;a[Q]=e.readUint32BE(D,q),h[Q]=e.readUint32BE(D,q+4)}for(var Q=0;Q<80;Q++){var ee=w,Y=N,ae=R,T=B,A=S,O=I,u=y,_=x,H=E,W=c,he=d,ve=U,de=K,me=G,Be=J,$e=X;if(g=x,v=X,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=(S>>>14|K<<32-14)^(S>>>18|K<<32-18)^(K>>>41-32|S<<32-(41-32)),v=(K>>>14|S<<32-14)^(K>>>18|S<<32-18)^(S>>>41-32|K<<32-(41-32)),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=S&I^~S&y,v=K&G^~K&J,P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=i[Q*2],v=i[Q*2+1],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=a[Q%16],v=h[Q%16],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,F=j&65535|z<<16,M=P&65535|C<<16,g=F,v=M,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=(w>>>28|E<<32-28)^(E>>>34-32|w<<32-(34-32))^(E>>>39-32|w<<32-(39-32)),v=(E>>>28|w<<32-28)^(w>>>34-32|E<<32-(34-32))^(w>>>39-32|E<<32-(39-32)),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=w&N^w&R^N&R,v=E&c^E&d^c&d,P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,_=j&65535|z<<16,$e=P&65535|C<<16,g=T,v=ve,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=F,v=M,P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,T=j&65535|z<<16,ve=P&65535|C<<16,N=ee,R=Y,B=ae,S=T,I=A,y=O,x=u,w=_,c=H,d=W,U=he,K=ve,G=de,J=me,X=Be,E=$e,Q%16===15)for(var q=0;q<16;q++)g=a[q],v=h[q],P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=a[(q+9)%16],v=h[(q+9)%16],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,F=a[(q+1)%16],M=h[(q+1)%16],g=(F>>>1|M<<32-1)^(F>>>8|M<<32-8)^F>>>7,v=(M>>>1|F<<32-1)^(M>>>8|F<<32-8)^(M>>>7|F<<32-7),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,F=a[(q+14)%16],M=h[(q+14)%16],g=(F>>>19|M<<32-19)^(M>>>61-32|F<<32-(61-32))^F>>>6,v=(M>>>19|F<<32-19)^(F>>>61-32|M<<32-(61-32))^(M>>>6|F<<32-6),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,a[q]=j&65535|z<<16,h[q]=P&65535|C<<16}g=w,v=E,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[0],v=l[0],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[0]=w=j&65535|z<<16,l[0]=E=P&65535|C<<16,g=N,v=c,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[1],v=l[1],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[1]=N=j&65535|z<<16,l[1]=c=P&65535|C<<16,g=R,v=d,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[2],v=l[2],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[2]=R=j&65535|z<<16,l[2]=d=P&65535|C<<16,g=B,v=U,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[3],v=l[3],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[3]=B=j&65535|z<<16,l[3]=U=P&65535|C<<16,g=S,v=K,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[4],v=l[4],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[4]=S=j&65535|z<<16,l[4]=K=P&65535|C<<16,g=I,v=G,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[5],v=l[5],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[5]=I=j&65535|z<<16,l[5]=G=P&65535|C<<16,g=y,v=J,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[6],v=l[6],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[6]=y=j&65535|z<<16,l[6]=J=P&65535|C<<16,g=x,v=X,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[7],v=l[7],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[7]=x=j&65535|z<<16,l[7]=X=P&65535|C<<16,b+=128,m-=128}return b}function o(a){var h=new n;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(sc),function(t){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 e=lr,r=sc,n=_t;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(T){const A=new Float64Array(16);if(T)for(let O=0;O<T.length;O++)A[O]=T[O];return A}const s=new Uint8Array(32);s[0]=9;const o=i(),a=i([1]),h=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),D=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),b=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(T,A){for(let O=0;O<16;O++)T[O]=A[O]|0}function w(T){let A=1;for(let O=0;O<16;O++){let u=T[O]+A+65535;A=Math.floor(u/65536),T[O]=u-A*65536}T[0]+=A-1+37*(A-1)}function N(T,A,O){const u=~(O-1);for(let _=0;_<16;_++){const H=u&(T[_]^A[_]);T[_]^=H,A[_]^=H}}function R(T,A){const O=i(),u=i();for(let _=0;_<16;_++)u[_]=A[_];w(u),w(u),w(u);for(let _=0;_<2;_++){O[0]=u[0]-65517;for(let W=1;W<15;W++)O[W]=u[W]-65535-(O[W-1]>>16&1),O[W-1]&=65535;O[15]=u[15]-32767-(O[14]>>16&1);const H=O[15]>>16&1;O[14]&=65535,N(u,O,1-H)}for(let _=0;_<16;_++)T[2*_]=u[_]&255,T[2*_+1]=u[_]>>8}function B(T,A){let O=0;for(let u=0;u<32;u++)O|=T[u]^A[u];return(1&O-1>>>8)-1}function S(T,A){const O=new Uint8Array(32),u=new Uint8Array(32);return R(O,T),R(u,A),B(O,u)}function I(T){const A=new Uint8Array(32);return R(A,T),A[0]&1}function y(T,A){for(let O=0;O<16;O++)T[O]=A[2*O]+(A[2*O+1]<<8);T[15]&=32767}function x(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]+O[u]}function E(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]-O[u]}function c(T,A,O){let u,_,H=0,W=0,he=0,ve=0,de=0,me=0,Be=0,$e=0,ye=0,pe=0,le=0,ue=0,ce=0,oe=0,se=0,te=0,fe=0,ge=0,ne=0,_e=0,be=0,Ee=0,De=0,we=0,Lt=0,$t=0,kt=0,mt=0,ar=0,Qr=0,Bn=0,ze=O[0],Fe=O[1],Ke=O[2],qe=O[3],He=O[4],Me=O[5],Je=O[6],Xe=O[7],Ze=O[8],Qe=O[9],et=O[10],We=O[11],Ve=O[12],Pe=O[13],tt=O[14],rt=O[15];u=A[0],H+=u*ze,W+=u*Fe,he+=u*Ke,ve+=u*qe,de+=u*He,me+=u*Me,Be+=u*Je,$e+=u*Xe,ye+=u*Ze,pe+=u*Qe,le+=u*et,ue+=u*We,ce+=u*Ve,oe+=u*Pe,se+=u*tt,te+=u*rt,u=A[1],W+=u*ze,he+=u*Fe,ve+=u*Ke,de+=u*qe,me+=u*He,Be+=u*Me,$e+=u*Je,ye+=u*Xe,pe+=u*Ze,le+=u*Qe,ue+=u*et,ce+=u*We,oe+=u*Ve,se+=u*Pe,te+=u*tt,fe+=u*rt,u=A[2],he+=u*ze,ve+=u*Fe,de+=u*Ke,me+=u*qe,Be+=u*He,$e+=u*Me,ye+=u*Je,pe+=u*Xe,le+=u*Ze,ue+=u*Qe,ce+=u*et,oe+=u*We,se+=u*Ve,te+=u*Pe,fe+=u*tt,ge+=u*rt,u=A[3],ve+=u*ze,de+=u*Fe,me+=u*Ke,Be+=u*qe,$e+=u*He,ye+=u*Me,pe+=u*Je,le+=u*Xe,ue+=u*Ze,ce+=u*Qe,oe+=u*et,se+=u*We,te+=u*Ve,fe+=u*Pe,ge+=u*tt,ne+=u*rt,u=A[4],de+=u*ze,me+=u*Fe,Be+=u*Ke,$e+=u*qe,ye+=u*He,pe+=u*Me,le+=u*Je,ue+=u*Xe,ce+=u*Ze,oe+=u*Qe,se+=u*et,te+=u*We,fe+=u*Ve,ge+=u*Pe,ne+=u*tt,_e+=u*rt,u=A[5],me+=u*ze,Be+=u*Fe,$e+=u*Ke,ye+=u*qe,pe+=u*He,le+=u*Me,ue+=u*Je,ce+=u*Xe,oe+=u*Ze,se+=u*Qe,te+=u*et,fe+=u*We,ge+=u*Ve,ne+=u*Pe,_e+=u*tt,be+=u*rt,u=A[6],Be+=u*ze,$e+=u*Fe,ye+=u*Ke,pe+=u*qe,le+=u*He,ue+=u*Me,ce+=u*Je,oe+=u*Xe,se+=u*Ze,te+=u*Qe,fe+=u*et,ge+=u*We,ne+=u*Ve,_e+=u*Pe,be+=u*tt,Ee+=u*rt,u=A[7],$e+=u*ze,ye+=u*Fe,pe+=u*Ke,le+=u*qe,ue+=u*He,ce+=u*Me,oe+=u*Je,se+=u*Xe,te+=u*Ze,fe+=u*Qe,ge+=u*et,ne+=u*We,_e+=u*Ve,be+=u*Pe,Ee+=u*tt,De+=u*rt,u=A[8],ye+=u*ze,pe+=u*Fe,le+=u*Ke,ue+=u*qe,ce+=u*He,oe+=u*Me,se+=u*Je,te+=u*Xe,fe+=u*Ze,ge+=u*Qe,ne+=u*et,_e+=u*We,be+=u*Ve,Ee+=u*Pe,De+=u*tt,we+=u*rt,u=A[9],pe+=u*ze,le+=u*Fe,ue+=u*Ke,ce+=u*qe,oe+=u*He,se+=u*Me,te+=u*Je,fe+=u*Xe,ge+=u*Ze,ne+=u*Qe,_e+=u*et,be+=u*We,Ee+=u*Ve,De+=u*Pe,we+=u*tt,Lt+=u*rt,u=A[10],le+=u*ze,ue+=u*Fe,ce+=u*Ke,oe+=u*qe,se+=u*He,te+=u*Me,fe+=u*Je,ge+=u*Xe,ne+=u*Ze,_e+=u*Qe,be+=u*et,Ee+=u*We,De+=u*Ve,we+=u*Pe,Lt+=u*tt,$t+=u*rt,u=A[11],ue+=u*ze,ce+=u*Fe,oe+=u*Ke,se+=u*qe,te+=u*He,fe+=u*Me,ge+=u*Je,ne+=u*Xe,_e+=u*Ze,be+=u*Qe,Ee+=u*et,De+=u*We,we+=u*Ve,Lt+=u*Pe,$t+=u*tt,kt+=u*rt,u=A[12],ce+=u*ze,oe+=u*Fe,se+=u*Ke,te+=u*qe,fe+=u*He,ge+=u*Me,ne+=u*Je,_e+=u*Xe,be+=u*Ze,Ee+=u*Qe,De+=u*et,we+=u*We,Lt+=u*Ve,$t+=u*Pe,kt+=u*tt,mt+=u*rt,u=A[13],oe+=u*ze,se+=u*Fe,te+=u*Ke,fe+=u*qe,ge+=u*He,ne+=u*Me,_e+=u*Je,be+=u*Xe,Ee+=u*Ze,De+=u*Qe,we+=u*et,Lt+=u*We,$t+=u*Ve,kt+=u*Pe,mt+=u*tt,ar+=u*rt,u=A[14],se+=u*ze,te+=u*Fe,fe+=u*Ke,ge+=u*qe,ne+=u*He,_e+=u*Me,be+=u*Je,Ee+=u*Xe,De+=u*Ze,we+=u*Qe,Lt+=u*et,$t+=u*We,kt+=u*Ve,mt+=u*Pe,ar+=u*tt,Qr+=u*rt,u=A[15],te+=u*ze,fe+=u*Fe,ge+=u*Ke,ne+=u*qe,_e+=u*He,be+=u*Me,Ee+=u*Je,De+=u*Xe,we+=u*Ze,Lt+=u*Qe,$t+=u*et,kt+=u*We,mt+=u*Ve,ar+=u*Pe,Qr+=u*tt,Bn+=u*rt,H+=38*fe,W+=38*ge,he+=38*ne,ve+=38*_e,de+=38*be,me+=38*Ee,Be+=38*De,$e+=38*we,ye+=38*Lt,pe+=38*$t,le+=38*kt,ue+=38*mt,ce+=38*ar,oe+=38*Qr,se+=38*Bn,_=1,u=H+_+65535,_=Math.floor(u/65536),H=u-_*65536,u=W+_+65535,_=Math.floor(u/65536),W=u-_*65536,u=he+_+65535,_=Math.floor(u/65536),he=u-_*65536,u=ve+_+65535,_=Math.floor(u/65536),ve=u-_*65536,u=de+_+65535,_=Math.floor(u/65536),de=u-_*65536,u=me+_+65535,_=Math.floor(u/65536),me=u-_*65536,u=Be+_+65535,_=Math.floor(u/65536),Be=u-_*65536,u=$e+_+65535,_=Math.floor(u/65536),$e=u-_*65536,u=ye+_+65535,_=Math.floor(u/65536),ye=u-_*65536,u=pe+_+65535,_=Math.floor(u/65536),pe=u-_*65536,u=le+_+65535,_=Math.floor(u/65536),le=u-_*65536,u=ue+_+65535,_=Math.floor(u/65536),ue=u-_*65536,u=ce+_+65535,_=Math.floor(u/65536),ce=u-_*65536,u=oe+_+65535,_=Math.floor(u/65536),oe=u-_*65536,u=se+_+65535,_=Math.floor(u/65536),se=u-_*65536,u=te+_+65535,_=Math.floor(u/65536),te=u-_*65536,H+=_-1+37*(_-1),_=1,u=H+_+65535,_=Math.floor(u/65536),H=u-_*65536,u=W+_+65535,_=Math.floor(u/65536),W=u-_*65536,u=he+_+65535,_=Math.floor(u/65536),he=u-_*65536,u=ve+_+65535,_=Math.floor(u/65536),ve=u-_*65536,u=de+_+65535,_=Math.floor(u/65536),de=u-_*65536,u=me+_+65535,_=Math.floor(u/65536),me=u-_*65536,u=Be+_+65535,_=Math.floor(u/65536),Be=u-_*65536,u=$e+_+65535,_=Math.floor(u/65536),$e=u-_*65536,u=ye+_+65535,_=Math.floor(u/65536),ye=u-_*65536,u=pe+_+65535,_=Math.floor(u/65536),pe=u-_*65536,u=le+_+65535,_=Math.floor(u/65536),le=u-_*65536,u=ue+_+65535,_=Math.floor(u/65536),ue=u-_*65536,u=ce+_+65535,_=Math.floor(u/65536),ce=u-_*65536,u=oe+_+65535,_=Math.floor(u/65536),oe=u-_*65536,u=se+_+65535,_=Math.floor(u/65536),se=u-_*65536,u=te+_+65535,_=Math.floor(u/65536),te=u-_*65536,H+=_-1+37*(_-1),T[0]=H,T[1]=W,T[2]=he,T[3]=ve,T[4]=de,T[5]=me,T[6]=Be,T[7]=$e,T[8]=ye,T[9]=pe,T[10]=le,T[11]=ue,T[12]=ce,T[13]=oe,T[14]=se,T[15]=te}function d(T,A){c(T,A,A)}function U(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=253;u>=0;u--)d(O,O),u!==2&&u!==4&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function K(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=250;u>=0;u--)d(O,O),u!==1&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function G(T,A){const O=i(),u=i(),_=i(),H=i(),W=i(),he=i(),ve=i(),de=i(),me=i();E(O,T[1],T[0]),E(me,A[1],A[0]),c(O,O,me),x(u,T[0],T[1]),x(me,A[0],A[1]),c(u,u,me),c(_,T[3],A[3]),c(_,_,f),c(H,T[2],A[2]),x(H,H,H),E(W,u,O),E(he,H,_),x(ve,H,_),x(de,u,O),c(T[0],W,he),c(T[1],de,ve),c(T[2],ve,he),c(T[3],W,de)}function J(T,A,O){for(let u=0;u<4;u++)N(T[u],A[u],O)}function X(T,A){const O=i(),u=i(),_=i();U(_,A[2]),c(O,A[0],_),c(u,A[1],_),R(T,u),T[31]^=I(O)<<7}function g(T,A,O){m(T[0],o),m(T[1],a),m(T[2],a),m(T[3],o);for(let u=255;u>=0;--u){const _=O[u/8|0]>>(u&7)&1;J(T,A,_),G(A,T),G(T,T),J(T,A,_)}}function v(T,A){const O=[i(),i(),i(),i()];m(O[0],l),m(O[1],D),m(O[2],a),c(O[3],l,D),g(T,O,A)}function F(T){if(T.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const A=(0,r.hash)(T);A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(32),u=[i(),i(),i(),i()];v(u,A),X(O,u);const _=new Uint8Array(64);return _.set(T),_.set(O,32),{publicKey:O,secretKey:_}}t.generateKeyPairFromSeed=F;function M(T){const A=(0,e.randomBytes)(32,T),O=F(A);return(0,n.wipe)(A),O}t.generateKeyPair=M;function P(T){if(T.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(T.subarray(32))}t.extractPublicKeyFromSecretKey=P;const C=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 j(T,A){let O,u,_,H;for(u=63;u>=32;--u){for(O=0,_=u-32,H=u-12;_<H;++_)A[_]+=O-16*A[u]*C[_-(u-32)],O=Math.floor((A[_]+128)/256),A[_]-=O*256;A[_]+=O,A[u]=0}for(O=0,_=0;_<32;_++)A[_]+=O-(A[31]>>4)*C[_],O=A[_]>>8,A[_]&=255;for(_=0;_<32;_++)A[_]-=O*C[_];for(u=0;u<32;u++)A[u+1]+=A[u]>>8,T[u]=A[u]&255}function z(T){const A=new Float64Array(64);for(let O=0;O<64;O++)A[O]=T[O];for(let O=0;O<64;O++)T[O]=0;j(T,A)}function Q(T,A){const O=new Float64Array(64),u=[i(),i(),i(),i()],_=(0,r.hash)(T.subarray(0,32));_[0]&=248,_[31]&=127,_[31]|=64;const H=new Uint8Array(64);H.set(_.subarray(32),32);const W=new r.SHA512;W.update(H.subarray(32)),W.update(A);const he=W.digest();W.clean(),z(he),v(u,he),X(H,u),W.reset(),W.update(H.subarray(0,32)),W.update(T.subarray(32)),W.update(A);const ve=W.digest();z(ve);for(let de=0;de<32;de++)O[de]=he[de];for(let de=0;de<32;de++)for(let me=0;me<32;me++)O[de+me]+=ve[de]*_[me];return j(H.subarray(32),O),H}t.sign=Q;function q(T,A){const O=i(),u=i(),_=i(),H=i(),W=i(),he=i(),ve=i();return m(T[2],a),y(T[1],A),d(_,T[1]),c(H,_,h),E(_,_,T[2]),x(H,T[2],H),d(W,H),d(he,W),c(ve,he,W),c(O,ve,_),c(O,O,H),K(O,O),c(O,O,_),c(O,O,H),c(O,O,H),c(T[0],O,H),d(u,T[0]),c(u,u,H),S(u,_)&&c(T[0],T[0],b),d(u,T[0]),c(u,u,H),S(u,_)?-1:(I(T[0])===A[31]>>7&&E(T[0],o,T[0]),c(T[3],T[0],T[1]),0)}function ee(T,A,O){const u=new Uint8Array(32),_=[i(),i(),i(),i()],H=[i(),i(),i(),i()];if(O.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(q(H,T))return!1;const W=new r.SHA512;W.update(O.subarray(0,32)),W.update(T),W.update(A);const he=W.digest();return z(he),g(_,H,he),v(H,O.subarray(32)),G(_,H),X(u,_),!B(O,u)}t.verify=ee;function Y(T){let A=[i(),i(),i(),i()];if(q(A,T))throw new Error("Ed25519: invalid public key");let O=i(),u=i(),_=A[1];x(O,a,_),E(u,a,_),U(u,u),c(O,O,u);let H=new Uint8Array(32);return R(H,O),H}t.convertPublicKeyToX25519=Y;function ae(T){const A=(0,r.hash)(T.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(A.subarray(0,32));return(0,n.wipe)(A),O}t.convertSecretKeyToX25519=ae}(Qi);const iv="EdDSA",sv="JWT",oc=".",ac="base64url",ov="utf8",av="utf8",cv=":",uv="did",fv="key",cc="base58btc",hv="z",lv="K36",dv=32;function Ln(t){return dt(lt(Ir(t),ov),ac)}function uc(t){const e=lt(lv,cc),r=hv+dt(li([e,t]),cc);return[uv,fv,r].join(cv)}function pv(t){return dt(t,ac)}function gv(t){return lt([Ln(t.header),Ln(t.payload)].join(oc),av)}function yv(t){return[Ln(t.header),Ln(t.payload),pv(t.signature)].join(oc)}function fc(t=lr.randomBytes(dv)){return Qi.generateKeyPairFromSeed(t)}async function vv(t,e,r,n,i=Z.fromMiliseconds(Date.now())){const s={alg:iv,typ:sv},o=uc(n.publicKey),a=i+r,h={iss:o,sub:t,aud:e,iat:i,exp:a},f=gv({header:s,payload:h}),l=Qi.sign(n.secretKey,f);return yv({header:s,payload:h,signature:l})}var es={exports:{}},mr=typeof Reflect=="object"?Reflect:null,hc=mr&&typeof mr.apply=="function"?mr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},In;mr&&typeof mr.ownKeys=="function"?In=mr.ownKeys:Object.getOwnPropertySymbols?In=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:In=function(e){return Object.getOwnPropertyNames(e)};function _v(t){console&&console.warn&&console.warn(t)}var lc=Number.isNaN||function(e){return e!==e};function Ie(){Ie.init.call(this)}es.exports=Ie,es.exports.once=Ev,Ie.EventEmitter=Ie,Ie.prototype._events=void 0,Ie.prototype._eventsCount=0,Ie.prototype._maxListeners=void 0;var dc=10;function An(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ie,"defaultMaxListeners",{enumerable:!0,get:function(){return dc},set:function(t){if(typeof t!="number"||t<0||lc(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");dc=t}}),Ie.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ie.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||lc(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};function pc(t){return t._maxListeners===void 0?Ie.defaultMaxListeners:t._maxListeners}Ie.prototype.getMaxListeners=function(){return pc(this)},Ie.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")hc(h,this,r);else for(var f=h.length,l=bc(h,f),n=0;n<f;++n)hc(l[n],this,r);return!0};function gc(t,e,r,n){var i,s,o;if(An(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=pc(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,_v(a)}return t}Ie.prototype.addListener=function(e,r){return gc(this,e,r,!1)},Ie.prototype.on=Ie.prototype.addListener,Ie.prototype.prependListener=function(e,r){return gc(this,e,r,!0)};function bv(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function yc(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=bv.bind(n);return i.listener=r,n.wrapFn=i,i}Ie.prototype.once=function(e,r){return An(r),this.on(e,yc(this,e,r)),this},Ie.prototype.prependOnceListener=function(e,r){return An(r),this.prependListener(e,yc(this,e,r)),this},Ie.prototype.removeListener=function(e,r){var n,i,s,o,a;if(An(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():mv(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ie.prototype.off=Ie.prototype.removeListener,Ie.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function vc(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?wv(i):bc(i,i.length)}Ie.prototype.listeners=function(e){return vc(this,e,!0)},Ie.prototype.rawListeners=function(e){return vc(this,e,!1)},Ie.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):_c.call(t,e)},Ie.prototype.listenerCount=_c;function _c(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ie.prototype.eventNames=function(){return this._eventsCount>0?In(this._events):[]};function bc(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function mv(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function wv(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Ev(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}mc(t,e,s,{once:!0}),e!=="error"&&Dv(t,i,{once:!0})})}function Dv(t,e,r){typeof t.on=="function"&&mc(t,"error",e,r)}function mc(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}const wc=10,xv=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:require("ws"),Sv=()=>typeof window<"u",Ov=xv();class Lv{constructor(e){if(this.url=e,this.events=new es.exports.EventEmitter,this.registering=!1,!Ms(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(typeof this.socket>"u")throw new Error("Connection already closed");this.socket.close(),this.onClose()}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ir(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Ms(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=Ts.isReactNative()?void 0:{rejectUnauthorized:!Tf(e)},s=new Ov(e,[],i);Sv()?s.onerror=o=>{const a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),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(typeof e.data>"u")return;const r=typeof e.data=="string"?ni(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Lr(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return As(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>wc&&this.events.setMaxListeners(wc)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}}var ts={exports:{}};(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",D="[object Date]",b="[object Error]",m="[object Function]",w="[object GeneratorFunction]",N="[object Map]",R="[object Number]",B="[object Null]",S="[object Object]",I="[object Promise]",y="[object Proxy]",x="[object RegExp]",E="[object Set]",c="[object String]",d="[object Symbol]",U="[object Undefined]",K="[object WeakMap]",G="[object ArrayBuffer]",J="[object DataView]",X="[object Float32Array]",g="[object Float64Array]",v="[object Int8Array]",F="[object Int16Array]",M="[object Int32Array]",P="[object Uint8Array]",C="[object Uint8ClampedArray]",j="[object Uint16Array]",z="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,q=/^\[object .+?Constructor\]$/,ee=/^(?:0|[1-9]\d*)$/,Y={};Y[X]=Y[g]=Y[v]=Y[F]=Y[M]=Y[P]=Y[C]=Y[j]=Y[z]=!0,Y[a]=Y[h]=Y[G]=Y[l]=Y[J]=Y[D]=Y[b]=Y[m]=Y[N]=Y[R]=Y[S]=Y[x]=Y[E]=Y[c]=Y[K]=!1;var ae=typeof ke=="object"&&ke&&ke.Object===Object&&ke,T=typeof self=="object"&&self&&self.Object===Object&&self,A=ae||T||Function("return this")(),O=e&&!e.nodeType&&e,u=O&&!0&&t&&!t.nodeType&&t,_=u&&u.exports===O,H=_&&ae.process,W=function(){try{return H&&H.binding&&H.binding("util")}catch{}}(),he=W&&W.isTypedArray;function ve(p,L){for(var $=-1,k=p==null?0:p.length,Re=0,ie=[];++$<k;){var Ue=p[$];L(Ue,$,p)&&(ie[Re++]=Ue)}return ie}function de(p,L){for(var $=-1,k=L.length,Re=p.length;++$<k;)p[Re+$]=L[$];return p}function me(p,L){for(var $=-1,k=p==null?0:p.length;++$<k;)if(L(p[$],$,p))return!0;return!1}function Be(p,L){for(var $=-1,k=Array(p);++$<p;)k[$]=L($);return k}function $e(p){return function(L){return p(L)}}function ye(p,L){return p.has(L)}function pe(p,L){return p?.[L]}function le(p){var L=-1,$=Array(p.size);return p.forEach(function(k,Re){$[++L]=[Re,k]}),$}function ue(p,L){return function($){return p(L($))}}function ce(p){var L=-1,$=Array(p.size);return p.forEach(function(k){$[++L]=k}),$}var oe=Array.prototype,se=Function.prototype,te=Object.prototype,fe=A["__core-js_shared__"],ge=se.toString,ne=te.hasOwnProperty,_e=function(){var p=/[^.]+$/.exec(fe&&fe.keys&&fe.keys.IE_PROTO||"");return p?"Symbol(src)_1."+p:""}(),be=te.toString,Ee=RegExp("^"+ge.call(ne).replace(Q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=_?A.Buffer:void 0,we=A.Symbol,Lt=A.Uint8Array,$t=te.propertyIsEnumerable,kt=oe.splice,mt=we?we.toStringTag:void 0,ar=Object.getOwnPropertySymbols,Qr=De?De.isBuffer:void 0,Bn=ue(Object.keys,Object),ze=Dr(A,"DataView"),Fe=Dr(A,"Map"),Ke=Dr(A,"Promise"),qe=Dr(A,"Set"),He=Dr(A,"WeakMap"),Me=Dr(Object,"create"),Je=ur(ze),Xe=ur(Fe),Ze=ur(Ke),Qe=ur(qe),et=ur(He),We=we?we.prototype:void 0,Ve=We?We.valueOf:void 0;function Pe(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function tt(){this.__data__=Me?Me(null):{},this.size=0}function rt(p){var L=this.has(p)&&delete this.__data__[p];return this.size-=L?1:0,L}function Ib(p){var L=this.__data__;if(Me){var $=L[p];return $===n?void 0:$}return ne.call(L,p)?L[p]:void 0}function Ab(p){var L=this.__data__;return Me?L[p]!==void 0:ne.call(L,p)}function Tb(p,L){var $=this.__data__;return this.size+=this.has(p)?0:1,$[p]=Me&&L===void 0?n:L,this}Pe.prototype.clear=tt,Pe.prototype.delete=rt,Pe.prototype.get=Ib,Pe.prototype.has=Ab,Pe.prototype.set=Tb;function qt(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function Cb(){this.__data__=[],this.size=0}function Rb(p){var L=this.__data__,$=Kn(L,p);if($<0)return!1;var k=L.length-1;return $==k?L.pop():kt.call(L,$,1),--this.size,!0}function Pb(p){var L=this.__data__,$=Kn(L,p);return $<0?void 0:L[$][1]}function Nb(p){return Kn(this.__data__,p)>-1}function $b(p,L){var $=this.__data__,k=Kn($,p);return k<0?(++this.size,$.push([p,L])):$[k][1]=L,this}qt.prototype.clear=Cb,qt.prototype.delete=Rb,qt.prototype.get=Pb,qt.prototype.has=Nb,qt.prototype.set=$b;function cr(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function Fb(){this.size=0,this.__data__={hash:new Pe,map:new(Fe||qt),string:new Pe}}function Mb(p){var L=qn(this,p).delete(p);return this.size-=L?1:0,L}function Ub(p){return qn(this,p).get(p)}function jb(p){return qn(this,p).has(p)}function Bb(p,L){var $=qn(this,p),k=$.size;return $.set(p,L),this.size+=$.size==k?0:1,this}cr.prototype.clear=Fb,cr.prototype.delete=Mb,cr.prototype.get=Ub,cr.prototype.has=jb,cr.prototype.set=Bb;function zn(p){var L=-1,$=p==null?0:p.length;for(this.__data__=new cr;++L<$;)this.add(p[L])}function zb(p){return this.__data__.set(p,n),this}function Kb(p){return this.__data__.has(p)}zn.prototype.add=zn.prototype.push=zb,zn.prototype.has=Kb;function Yt(p){var L=this.__data__=new qt(p);this.size=L.size}function qb(){this.__data__=new qt,this.size=0}function Hb(p){var L=this.__data__,$=L.delete(p);return this.size=L.size,$}function Vb(p){return this.__data__.get(p)}function Gb(p){return this.__data__.has(p)}function Wb(p,L){var $=this.__data__;if($ instanceof qt){var k=$.__data__;if(!Fe||k.length<r-1)return k.push([p,L]),this.size=++$.size,this;$=this.__data__=new cr(k)}return $.set(p,L),this.size=$.size,this}Yt.prototype.clear=qb,Yt.prototype.delete=Hb,Yt.prototype.get=Vb,Yt.prototype.has=Gb,Yt.prototype.set=Wb;function kb(p,L){var $=Hn(p),k=!$&&u1(p),Re=!$&&!k&&ps(p),ie=!$&&!k&&!Re&&$u(p),Ue=$||k||Re||ie,nt=Ue?Be(p.length,String):[],at=nt.length;for(var Ne in p)(L||ne.call(p,Ne))&&!(Ue&&(Ne=="length"||Re&&(Ne=="offset"||Ne=="parent")||ie&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||i1(Ne,at)))&&nt.push(Ne);return nt}function Kn(p,L){for(var $=p.length;$--;)if(Cu(p[$][0],L))return $;return-1}function Yb(p,L,$){var k=L(p);return Hn(p)?k:de(k,$(p))}function en(p){return p==null?p===void 0?U:B:mt&&mt in Object(p)?r1(p):c1(p)}function Lu(p){return tn(p)&&en(p)==a}function Iu(p,L,$,k,Re){return p===L?!0:p==null||L==null||!tn(p)&&!tn(L)?p!==p&&L!==L:Jb(p,L,$,k,Iu,Re)}function Jb(p,L,$,k,Re,ie){var Ue=Hn(p),nt=Hn(L),at=Ue?h:Jt(p),Ne=nt?h:Jt(L);at=at==a?S:at,Ne=Ne==a?S:Ne;var wt=at==S,It=Ne==S,ut=at==Ne;if(ut&&ps(p)){if(!ps(L))return!1;Ue=!0,wt=!1}if(ut&&!wt)return ie||(ie=new Yt),Ue||$u(p)?Au(p,L,$,k,Re,ie):e1(p,L,at,$,k,Re,ie);if(!($&i)){var Dt=wt&&ne.call(p,"__wrapped__"),xt=It&&ne.call(L,"__wrapped__");if(Dt||xt){var Xt=Dt?p.value():p,Ht=xt?L.value():L;return ie||(ie=new Yt),Re(Xt,Ht,$,k,ie)}}return ut?(ie||(ie=new Yt),t1(p,L,$,k,Re,ie)):!1}function Xb(p){if(!Nu(p)||o1(p))return!1;var L=Ru(p)?Ee:q;return L.test(ur(p))}function Zb(p){return tn(p)&&Pu(p.length)&&!!Y[en(p)]}function Qb(p){if(!a1(p))return Bn(p);var L=[];for(var $ in Object(p))ne.call(p,$)&&$!="constructor"&&L.push($);return L}function Au(p,L,$,k,Re,ie){var Ue=$&i,nt=p.length,at=L.length;if(nt!=at&&!(Ue&&at>nt))return!1;var Ne=ie.get(p);if(Ne&&ie.get(L))return Ne==L;var wt=-1,It=!0,ut=$&s?new zn:void 0;for(ie.set(p,L),ie.set(L,p);++wt<nt;){var Dt=p[wt],xt=L[wt];if(k)var Xt=Ue?k(xt,Dt,wt,L,p,ie):k(Dt,xt,wt,p,L,ie);if(Xt!==void 0){if(Xt)continue;It=!1;break}if(ut){if(!me(L,function(Ht,fr){if(!ye(ut,fr)&&(Dt===Ht||Re(Dt,Ht,$,k,ie)))return ut.push(fr)})){It=!1;break}}else if(!(Dt===xt||Re(Dt,xt,$,k,ie))){It=!1;break}}return ie.delete(p),ie.delete(L),It}function e1(p,L,$,k,Re,ie,Ue){switch($){case J:if(p.byteLength!=L.byteLength||p.byteOffset!=L.byteOffset)return!1;p=p.buffer,L=L.buffer;case G:return!(p.byteLength!=L.byteLength||!ie(new Lt(p),new Lt(L)));case l:case D:case R:return Cu(+p,+L);case b:return p.name==L.name&&p.message==L.message;case x:case c:return p==L+"";case N:var nt=le;case E:var at=k&i;if(nt||(nt=ce),p.size!=L.size&&!at)return!1;var Ne=Ue.get(p);if(Ne)return Ne==L;k|=s,Ue.set(p,L);var wt=Au(nt(p),nt(L),k,Re,ie,Ue);return Ue.delete(p),wt;case d:if(Ve)return Ve.call(p)==Ve.call(L)}return!1}function t1(p,L,$,k,Re,ie){var Ue=$&i,nt=Tu(p),at=nt.length,Ne=Tu(L),wt=Ne.length;if(at!=wt&&!Ue)return!1;for(var It=at;It--;){var ut=nt[It];if(!(Ue?ut in L:ne.call(L,ut)))return!1}var Dt=ie.get(p);if(Dt&&ie.get(L))return Dt==L;var xt=!0;ie.set(p,L),ie.set(L,p);for(var Xt=Ue;++It<at;){ut=nt[It];var Ht=p[ut],fr=L[ut];if(k)var Fu=Ue?k(fr,Ht,ut,L,p,ie):k(Ht,fr,ut,p,L,ie);if(!(Fu===void 0?Ht===fr||Re(Ht,fr,$,k,ie):Fu)){xt=!1;break}Xt||(Xt=ut=="constructor")}if(xt&&!Xt){var Vn=p.constructor,Gn=L.constructor;Vn!=Gn&&"constructor"in p&&"constructor"in L&&!(typeof Vn=="function"&&Vn instanceof Vn&&typeof Gn=="function"&&Gn instanceof Gn)&&(xt=!1)}return ie.delete(p),ie.delete(L),xt}function Tu(p){return Yb(p,l1,n1)}function qn(p,L){var $=p.__data__;return s1(L)?$[typeof L=="string"?"string":"hash"]:$.map}function Dr(p,L){var $=pe(p,L);return Xb($)?$:void 0}function r1(p){var L=ne.call(p,mt),$=p[mt];try{p[mt]=void 0;var k=!0}catch{}var Re=be.call(p);return k&&(L?p[mt]=$:delete p[mt]),Re}var n1=ar?function(p){return p==null?[]:(p=Object(p),ve(ar(p),function(L){return $t.call(p,L)}))}:d1,Jt=en;(ze&&Jt(new ze(new ArrayBuffer(1)))!=J||Fe&&Jt(new Fe)!=N||Ke&&Jt(Ke.resolve())!=I||qe&&Jt(new qe)!=E||He&&Jt(new He)!=K)&&(Jt=function(p){var L=en(p),$=L==S?p.constructor:void 0,k=$?ur($):"";if(k)switch(k){case Je:return J;case Xe:return N;case Ze:return I;case Qe:return E;case et:return K}return L});function i1(p,L){return L=L??o,!!L&&(typeof p=="number"||ee.test(p))&&p>-1&&p%1==0&&p<L}function s1(p){var L=typeof p;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?p!=="__proto__":p===null}function o1(p){return!!_e&&_e in p}function a1(p){var L=p&&p.constructor,$=typeof L=="function"&&L.prototype||te;return p===$}function c1(p){return be.call(p)}function ur(p){if(p!=null){try{return ge.call(p)}catch{}try{return p+""}catch{}}return""}function Cu(p,L){return p===L||p!==p&&L!==L}var u1=Lu(function(){return arguments}())?Lu:function(p){return tn(p)&&ne.call(p,"callee")&&!$t.call(p,"callee")},Hn=Array.isArray;function f1(p){return p!=null&&Pu(p.length)&&!Ru(p)}var ps=Qr||p1;function h1(p,L){return Iu(p,L)}function Ru(p){if(!Nu(p))return!1;var L=en(p);return L==m||L==w||L==f||L==y}function Pu(p){return typeof p=="number"&&p>-1&&p%1==0&&p<=o}function Nu(p){var L=typeof p;return p!=null&&(L=="object"||L=="function")}function tn(p){return p!=null&&typeof p=="object"}var $u=he?$e(he):Zb;function l1(p){return f1(p)?kb(p):Qb(p)}function d1(){return[]}function p1(){return!1}t.exports=h1})(ts,ts.exports);var Iv=ts.exports,Av=Object.defineProperty,Ec=Object.getOwnPropertySymbols,Tv=Object.prototype.hasOwnProperty,Cv=Object.prototype.propertyIsEnumerable,Dc=(t,e,r)=>e in t?Av(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ht=(t,e)=>{for(var r in e||(e={}))Tv.call(e,r)&&Dc(t,r,e[r]);if(Ec)for(var r of Ec(e))Cv.call(e,r)&&Dc(t,r,e[r]);return t};function Rv(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var N=0,R=0,B=0,S=w.length;B!==S&&w[B]===0;)B++,N++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=w[B],E=0,c=I-1;(x!==0||E<R)&&c!==-1;c--,E++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=E,B++}for(var d=I-R;d!==I&&y[d]===0;)d++;for(var U=h.repeat(N);d<I;++d)U+=t.charAt(y[d]);return U}function b(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var N=0;if(w[N]!==" "){for(var R=0,B=0;w[N]===h;)R++,N++;for(var S=(w.length-N)*f+1>>>0,I=new Uint8Array(S);w[N];){var y=r[w.charCodeAt(N)];if(y===255)return;for(var x=0,E=S-1;(y!==0||x<B)&&E!==-1;E--,x++)y+=a*I[E]>>>0,I[E]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,N++}if(w[N]!==" "){for(var c=S-B;c!==S&&I[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=I[c++];return d}}}function m(w){var N=b(w);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:b,decode:m}}var Pv=Rv,Nv=Pv;const xc=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},$v=t=>new TextEncoder().encode(t),Fv=t=>new TextDecoder().decode(t);class Mv{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Uv{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return Sc(this,e)}}class jv{constructor(e){this.decoders=e}or(e){return Sc(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Sc=(t,e)=>new jv(ht(ht({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class Bv{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Mv(e,r,n),this.decoder=new Uv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Tn=({name:t,prefix:e,encode:r,decode:n})=>new Bv(t,e,r,n),Jr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Nv(r,e);return Tn({prefix:t,name:e,encode:n,decode:s=>xc(i(s))})},zv=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<r|D,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},Kv=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},ot=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Tn({prefix:e,name:t,encode(i){return Kv(i,n,r)},decode(i){return zv(i,n,r,t)}}),qv=Tn({prefix:"\0",name:"identity",encode:t=>Fv(t),decode:t=>$v(t)});var Hv=Object.freeze({__proto__:null,identity:qv});const Vv=ot({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gv=Object.freeze({__proto__:null,base2:Vv});const Wv=ot({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var kv=Object.freeze({__proto__:null,base8:Wv});const Yv=Jr({prefix:"9",name:"base10",alphabet:"0123456789"});var Jv=Object.freeze({__proto__:null,base10:Yv});const Xv=ot({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Zv=ot({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qv=Object.freeze({__proto__:null,base16:Xv,base16upper:Zv});const e0=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),t0=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),r0=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),n0=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),i0=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),s0=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),o0=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),a0=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),c0=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var u0=Object.freeze({__proto__:null,base32:e0,base32upper:t0,base32pad:r0,base32padupper:n0,base32hex:i0,base32hexupper:s0,base32hexpad:o0,base32hexpadupper:a0,base32z:c0});const f0=Jr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),h0=Jr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var l0=Object.freeze({__proto__:null,base36:f0,base36upper:h0});const d0=Jr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),p0=Jr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var g0=Object.freeze({__proto__:null,base58btc:d0,base58flickr:p0});const y0=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),v0=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_0=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b0=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var m0=Object.freeze({__proto__:null,base64:y0,base64pad:v0,base64url:_0,base64urlpad:b0});const Oc=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),w0=Oc.reduce((t,e,r)=>(t[r]=e,t),[]),E0=Oc.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function D0(t){return t.reduce((e,r)=>(e+=w0[r],e),"")}function x0(t){const e=[];for(const r of t){const n=E0[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const S0=Tn({prefix:"\u{1F680}",name:"base256emoji",encode:D0,decode:x0});var O0=Object.freeze({__proto__:null,base256emoji:S0}),L0=Ic,Lc=128,I0=127,A0=~I0,T0=Math.pow(2,31);function Ic(t,e,r){e=e||[],r=r||0;for(var n=r;t>=T0;)e[r++]=t&255|Lc,t/=128;for(;t&A0;)e[r++]=t&255|Lc,t>>>=7;return e[r]=t|0,Ic.bytes=r-n+1,e}var C0=rs,R0=128,Ac=127;function rs(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw rs.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Ac)<<i:(o&Ac)*Math.pow(2,i),i+=7}while(o>=R0);return rs.bytes=s-n,r}var P0=Math.pow(2,7),N0=Math.pow(2,14),$0=Math.pow(2,21),F0=Math.pow(2,28),M0=Math.pow(2,35),U0=Math.pow(2,42),j0=Math.pow(2,49),B0=Math.pow(2,56),z0=Math.pow(2,63),K0=function(t){return t<P0?1:t<N0?2:t<$0?3:t<F0?4:t<M0?5:t<U0?6:t<j0?7:t<B0?8:t<z0?9:10},q0={encode:L0,decode:C0,encodingLength:K0},Tc=q0;const Cc=(t,e,r=0)=>(Tc.encode(t,e,r),e),Rc=t=>Tc.encodingLength(t),ns=(t,e)=>{const r=e.byteLength,n=Rc(t),i=n+Rc(r),s=new Uint8Array(i+r);return Cc(t,s,0),Cc(r,s,n),s.set(e,i),new H0(t,r,e,s)};class H0{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Pc=({name:t,code:e,encode:r})=>new V0(t,e,r);class V0{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?ns(this.code,r):r.then(n=>ns(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Nc=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),G0=Pc({name:"sha2-256",code:18,encode:Nc("SHA-256")}),W0=Pc({name:"sha2-512",code:19,encode:Nc("SHA-512")});var k0=Object.freeze({__proto__:null,sha256:G0,sha512:W0});const $c=0,Y0="identity",Fc=xc;var J0=Object.freeze({__proto__:null,identity:{code:$c,name:Y0,encode:Fc,digest:t=>ns($c,Fc(t))}});new TextEncoder,new TextDecoder;const Mc=ht(ht(ht(ht(ht(ht(ht(ht(ht(ht({},Hv),Gv),kv),Jv),Qv),u0),l0),g0),m0),O0);ht(ht({},k0),J0);function X0(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Uc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const jc=Uc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),is=Uc("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=X0(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Z0=ht({utf8:jc,"utf-8":jc,hex:Mc.base16,latin1:is,ascii:is,binary:is},Mc);function Q0(t,e="utf8"){const r=Z0[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}const Bc="wc",e_=2,ss="core",Wt=`${Bc}@${2}:${ss}:`,t_={name:ss,logger:"error"},r_={database:":memory:"},n_="crypto",zc="client_ed25519_seed",i_=Z.ONE_DAY,s_="keychain",o_="0.3",a_="messages",c_="0.3",u_=Z.SIX_HOURS,f_="publisher",Kc="irn",h_="error",l_="wss://relay.walletconnect.com",d_="relayer",vt={message:"relayer_message",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed"},p_="_subscription",Cn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},qc=Z.ONE_SECOND,g_="2.2.0",y_="0.3",Rt={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},v_="subscription",__="0.3",b_=Z.FIVE_SECONDS*1e3,m_="pairing",w_="0.3",Xr={wc_pairingDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:0},res:{ttl:Z.ONE_DAY,prompt:!1,tag:0}}},Pt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},E_="history",D_="0.3",x_="expirer",Et={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},S_="0.3";class O_{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=s_,this.version=o_,this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=V("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Qo(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ea(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class L_{constructor(e,r,n){this.core=e,this.logger=r,this.name=n_,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=fc(i);return uc(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=Qd();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=fc(s),a=Ri();return await vv(a,i,i_,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),h=ep(a,s);return this.setSymKey(h,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||tp(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=Wo(o),h=Ir(s);if(ko(a)){const b=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(b,m)}const f=this.getSymKey(i),{type:l,senderPublicKey:D}=a;return np({type:l,symKey:f,message:h,senderPublicKey:D})},this.decode=async(i,s,o)=>{this.isInitialized();const a=op(s,o);if(ko(a)){const l=a.receiverPublicKey,D=a.senderPublicKey;i=await this.generateSharedKey(l,D)}const h=this.getSymKey(i),f=ip({symKey:h,encoded:s});return ni(f)},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.keychain=n||new O_(this.core,this.logger)}get context(){return Oe.getLoggerContext(this.logger)}getPayloadType(e){const r=Ni(e);return $r(r.type)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(zc)}catch{e=Ri(),await this.keychain.set(zc,e)}return Q0(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class I_ extends Jy{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=a_,this.version=c_,this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Pi(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Pi(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Oe.generateChildLogger(e,this.name),this.core=r}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Qo(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ea(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class A_ extends Xy{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new zt.exports.EventEmitter,this.name=f_,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{const o=s?.ttl||u_,a=$i(s),h=s?.prompt||!1,f=s?.tag||0,l={topic:n,message:i,opts:{ttl:o,relay:a,prompt:h,tag:f}},D=Pi(i);this.queue.set(D,l);try{await await ta(this.rpcPublish(n,i,o,a,h,f),this.publishTimeout)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(vt.connection_stalled);return}this.onPublish(D,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Oe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Oe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,h,f,l;const D={method:Fi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return bt((a=D.params)==null?void 0:a.prompt)&&((h=D.params)==null||delete h.prompt),bt((f=D.params)==null?void 0:f.tag)&&((l=D.params)==null||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:D}),this.relayer.provider.request(D)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}}class T_{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var C_=Object.defineProperty,R_=Object.defineProperties,P_=Object.getOwnPropertyDescriptors,Hc=Object.getOwnPropertySymbols,N_=Object.prototype.hasOwnProperty,$_=Object.prototype.propertyIsEnumerable,Vc=(t,e,r)=>e in t?C_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rn=(t,e)=>{for(var r in e||(e={}))N_.call(e,r)&&Vc(t,r,e[r]);if(Hc)for(var r of Hc(e))$_.call(e,r)&&Vc(t,r,e[r]);return t},os=(t,e)=>R_(t,P_(e));class F_ extends ev{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new T_,this.events=new zt.exports.EventEmitter,this.name=v_,this.version=__,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=Wt,this.subscribeTimeout=1e4,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable())},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=$i(i),o={topic:n,relay:s};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{const o=new Z.Watch;o.start(this.pendingSubscriptionWatchLabel);const a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=b_&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pendingSubInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{await this.restore(),await this.reset()},this.relayer=e,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.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,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=$i(n);await this.rpcUnsubscribe(e,r,i);const s=Ge("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){const n={method:Fi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ta(this.relayer.provider.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(vt.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:Fi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.provider.request(i)}onSubscribe(e,r){this.setSubscription(e,os(Rn({},r),{id:e})),this.pending.delete(r.topic)}onResubscribe(e,r){this.addSubscription(e,os(Rn({},r),{id:e})),this.pending.delete(r.topic)}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,Rn({},r)),this.topicMap.set(r.topic,e),this.events.emit(Rt.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Rt.deleted,os(Rn({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Rt.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(Rt.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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)}}async resubscribe(e){if(!this.ids.includes(e.id)){const{topic:r,relay:n}=e,i={topic:r,relay:n};this.pending.set(i.topic,i);const s=await this.rpcSubscribe(i.topic,i.relay);this.onResubscribe(s,i)}}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{const r=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(r,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.on(vt.connect,async()=>{await this.onConnect()}),this.relayer.on(vt.disconnect,()=>{this.onDisconnect()}),this.events.on(Rt.created,async e=>{const r=Rt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Rt.deleted,async e=>{const r=Rt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var M_=Object.defineProperty,Gc=Object.getOwnPropertySymbols,U_=Object.prototype.hasOwnProperty,j_=Object.prototype.propertyIsEnumerable,Wc=(t,e,r)=>e in t?M_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,B_=(t,e)=>{for(var r in e||(e={}))U_.call(e,r)&&Wc(t,r,e[r]);if(Gc)for(var r of Gc(e))j_.call(e,r)&&Wc(t,r,e[r]);return t};class z_ extends Zy{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zt.exports.EventEmitter,this.name=d_,this.transportExplicitlyClosed=!1,this.initialized=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Oe.generateChildLogger(e.logger,this.name):_n(Oe.getDefaultLoggerOptions({level:e.logger||h_})),this.messages=new I_(this.logger,e.core),this.subscriber=new F_(this,this.logger),this.publisher=new A_(this,this.logger),this.relayUrl=e?.relayUrl||l_,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return Oe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Rt.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&await this.provider.disconnect(),this.events.emit(vt.transport_closed)}async transportOpen(e){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Rt.resubscribed,()=>{r()})}),await Promise.race([this.provider.connect(),new Promise((r,n)=>this.once(vt.transport_closed,()=>{n()}))])])}catch(r){const n=r;if(!/socket hang up/i.test(n.message))throw new Error(n.message);this.logger.error(n),this.events.emit(vt.transport_closed)}}async restartTransport(e){await this.transportClose(),await new Promise(r=>setTimeout(r,qc)),await this.transportOpen(e)}async createProvider(){const e=await this.core.crypto.signJWT(this.relayUrl);return new ti(new Lv(mp({sdkVersion:g_,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Qn(e)){if(!e.method.endsWith(p_))return;const r=e.params,{topic:n,message:i}=r.data,s={topic:n,message:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(B_({type:"event",event:r.id},s)),this.events.emit(r.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(vt.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=on(e.id,!0);await this.provider.connection.send(r)}registerEventListeners(){this.provider.on(Cn.payload,e=>this.onProviderPayload(e)),this.provider.on(Cn.connect,()=>{this.events.emit(vt.connect)}),this.provider.on(Cn.disconnect,()=>{this.events.emit(vt.disconnect),this.attemptToReconnect()}),this.provider.on(Cn.error,e=>this.events.emit(vt.error,e)),this.events.on(vt.connection_stalled,async()=>{await this.restartTransport()})}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.transportOpen()},Z.toMiliseconds(qc))}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var K_=Object.defineProperty,kc=Object.getOwnPropertySymbols,q_=Object.prototype.hasOwnProperty,H_=Object.prototype.propertyIsEnumerable,Yc=(t,e,r)=>e in t?K_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jc=(t,e)=>{for(var r in e||(e={}))q_.call(e,r)&&Yc(t,r,e[r]);if(kc)for(var r of kc(e))H_.call(e,r)&&Yc(t,r,e[r]);return t};class Pn extends Qy{constructor(e,r,n,i=Wt,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=y_,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{zp(o)?this.map.set(o.id,o):Kp(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!bt(o)&&this.map.set(this.getKey(o),o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(h=>Iv(a[h],o[h]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const h=Jc(Jc({},this.getData(o)),a);this.map.set(o,h),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Oe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Oe.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())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class V_{constructor(e,r){this.core=e,this.logger=r,this.name=m_,this.version=w_,this.events=new zt.exports,this.initialized=!1,this.storagePrefix=Wt,this.ignoredPayloadTypes=[rr],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=Ri(),i=await this.core.crypto.setSymKey(n),s=Bt(Z.FIVE_MINUTES),o={protocol:Kc},a={topic:i,expiry:s,relay:o,active:!1},h=Cp({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:s,relay:o}=Ap(n.uri),a=Bt(Z.FIVE_MINUTES),h={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,h),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),h},this.activate=async({topic:n})=>{this.isInitialized();const i=Bt(Z.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:h}=nr();this.events.once(je("pairing_ping",s),({error:f})=>{f?h(f):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Ge("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{const o=sn(i,s),a=await this.core.crypto.encode(n,o),h=Xr[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,h),o.id},this.sendResult=async(n,i,s)=>{const o=on(n,s),a=await this.core.crypto.encode(i,o),h=await this.core.history.get(i,n),f=Xr[h.request.method].res;await this.core.relayer.publish(i,a,f),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Lr(n,s),a=await this.core.crypto.encode(i,o),h=await this.core.history.get(i,n),f=Xr[h.request.method]?Xr[h.request.method].res:Xr.unregistered_method.res;await this.core.relayer.publish(i,a,f),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Ge("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>Gt(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{jt(i)?this.events.emit(je("pairing_ping",s),{}):Ot(i)&&this.events.emit(je("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.sendResult(s,n,!0),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Ge("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Ge("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!yt(n)){const{message:i}=V("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!Bp(n.uri)){const{message:i}=V("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!yt(n)){const{message:s}=V("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yt(n)){const{message:s}=V("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!st(n,!1)){const{message:i}=V("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Gt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=V("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.pairings=new Pn(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Oe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(vt.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(r,n);Qn(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):ei(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Et.expired,async e=>{const{topic:r}=na(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}}class G_ extends Yy{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new zt.exports.EventEmitter,this.name=E_,this.version=D_,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Pt.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ot(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Pt.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Pt.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.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(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:sn(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Pt.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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(Pt.created,e=>{const r=Pt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Pt.updated,e=>{const r=Pt.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Pt.deleted,e=>{const r=Pt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class W_ extends tv{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new zt.exports.EventEmitter,this.name=x_,this.version=S_,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Et.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{this.isInitialized();const i=this.formatTarget(n);if(this.has(i)){const s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Et.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.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(typeof e=="string")return wp(e);if(typeof e=="number")return Ep(e);const{message:r}=V("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Et.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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 r=this.expirations.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;Z.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Et.expired,{target:e,expiration:r})}checkExpirations(){this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Et.created,e=>{const r=Et.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Et.expired,e=>{const r=Et.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Et.deleted,e=>{const r=Et.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var k_=Object.defineProperty,Xc=Object.getOwnPropertySymbols,Y_=Object.prototype.hasOwnProperty,J_=Object.prototype.propertyIsEnumerable,Zc=(t,e,r)=>e in t?k_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qc=(t,e)=>{for(var r in e||(e={}))Y_.call(e,r)&&Zc(t,r,e[r]);if(Xc)for(var r of Xc(e))J_.call(e,r)&&Zc(t,r,e[r]);return t};class as extends ky{constructor(e){super(e),this.protocol=Bc,this.version=e_,this.name=ss,this.events=new zt.exports.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:_n(Oe.getDefaultLoggerOptions({level:e?.logger||t_.logger}));this.logger=Oe.generateChildLogger(r,this.name),this.heartbeat=new Vr.HeartBeat,this.crypto=new L_(this,this.logger,e?.keychain),this.history=new G_(this,this.logger),this.expirer=new W_(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new kg(Qc(Qc({},r_),e?.storageOptions)),this.relayer=new z_({core:this,logger:this.logger,relayUrl:e?.relayUrl,projectId:this.projectId}),this.pairing=new V_(this,this.logger)}static async init(e){const r=new as(e);return await r.initialize(),r}get context(){return Oe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initilization Success")}catch(e){throw this.logger.warn(`Core Initilization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const X_=as;var Nn={exports:{}},wr=typeof Reflect=="object"?Reflect:null,eu=wr&&typeof wr.apply=="function"?wr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},$n;wr&&typeof wr.ownKeys=="function"?$n=wr.ownKeys:Object.getOwnPropertySymbols?$n=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:$n=function(e){return Object.getOwnPropertyNames(e)};function Z_(t){console&&console.warn&&console.warn(t)}var tu=Number.isNaN||function(e){return e!==e};function Ae(){Ae.init.call(this)}Nn.exports=Ae,Nn.exports.once=rb,Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;var ru=10;function Fn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return ru},set:function(t){if(typeof t!="number"||t<0||tu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ru=t}}),Ae.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ae.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||tu(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};function nu(t){return t._maxListeners===void 0?Ae.defaultMaxListeners:t._maxListeners}Ae.prototype.getMaxListeners=function(){return nu(this)},Ae.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")eu(h,this,r);else for(var f=h.length,l=cu(h,f),n=0;n<f;++n)eu(l[n],this,r);return!0};function iu(t,e,r,n){var i,s,o;if(Fn(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=nu(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Z_(a)}return t}Ae.prototype.addListener=function(e,r){return iu(this,e,r,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(e,r){return iu(this,e,r,!0)};function Q_(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function su(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Q_.bind(n);return i.listener=r,n.wrapFn=i,i}Ae.prototype.once=function(e,r){return Fn(r),this.on(e,su(this,e,r)),this},Ae.prototype.prependOnceListener=function(e,r){return Fn(r),this.prependListener(e,su(this,e,r)),this},Ae.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Fn(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():eb(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ae.prototype.off=Ae.prototype.removeListener,Ae.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ou(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?tb(i):cu(i,i.length)}Ae.prototype.listeners=function(e){return ou(this,e,!0)},Ae.prototype.rawListeners=function(e){return ou(this,e,!1)},Ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):au.call(t,e)},Ae.prototype.listenerCount=au;function au(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ae.prototype.eventNames=function(){return this._eventsCount>0?$n(this._events):[]};function cu(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function eb(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function tb(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function rb(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}uu(t,e,s,{once:!0}),e!=="error"&&nb(t,i,{once:!0})})}function nb(t,e,r){typeof t.on=="function"&&uu(t,"error",e,r)}function uu(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}const fu="wc",hu=2,lu="client",cs=`${fu}@${hu}:${lu}:`,us={name:lu,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},ib="proposal",sb="session",Mn=Z.SEVEN_DAYS,ob="engine",Zr={wc_sessionPropose:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1115}}},ab="request";var cb=Object.defineProperty,ub=Object.defineProperties,fb=Object.getOwnPropertyDescriptors,du=Object.getOwnPropertySymbols,hb=Object.prototype.hasOwnProperty,lb=Object.prototype.propertyIsEnumerable,pu=(t,e,r)=>e in t?cb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kt=(t,e)=>{for(var r in e||(e={}))hb.call(e,r)&&pu(t,r,e[r]);if(du)for(var r of du(e))lb.call(e,r)&&pu(t,r,e[r]);return t},fs=(t,e)=>ub(t,fb(e));class db extends nv{constructor(e){super(e),this.name=ob,this.events=new Nn.exports,this.initialized=!1,this.ignoredPayloadTypes=[rr],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Zr)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized(),await this.isValidConnect(r);const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;let o=n,a,h=!1;if(o&&(h=this.client.core.pairing.pairings.get(o).active),!o||!h){const{topic:R,uri:B}=await this.client.core.pairing.create();o=R,a=B}const f=await this.client.core.crypto.generateKeyPair(),l={requiredNamespaces:i,relays:s??[{protocol:Kc}],proposer:{publicKey:f,metadata:this.client.metadata}},{reject:D,resolve:b,done:m}=nr();if(this.events.once(je("session_connect"),async({error:R,session:B})=>{if(R)D(R);else if(B){B.self.publicKey=f;const S=fs(Kt({},B),{requiredNamespaces:B.requiredNamespaces});await this.client.session.set(B.topic,S),await this.setExpiry(B.topic,B.expiry),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:B.peer.metadata}),b(S)}}),!o){const{message:R}=V("NO_MATCHING_KEY",`connect() pairing topic: ${o}`);throw new Error(R)}const w=await this.sendRequest(o,"wc_sessionPropose",l),N=Bt(Z.FIVE_MINUTES);return await this.setProposal(w,Kt({id:w,expiry:N},l)),{uri:a,approval:m}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);const{id:n,relayProtocol:i,namespaces:s}=r,o=this.client.proposal.get(n);let{pairingTopic:a,proposer:h,requiredNamespaces:f}=o;yn(f)||(f=$p(s,"approve()"),this.client.proposal.set(n,fs(Kt({},o),{requiredNamespaces:f})));const l=await this.client.core.crypto.generateKeyPair(),D=h.publicKey,b=await this.client.core.crypto.generateSharedKey(l,D),m={relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,controller:{publicKey:l,metadata:this.client.metadata},expiry:Bt(Mn)};await this.client.core.relayer.subscribe(b);const w=await this.sendRequest(b,"wc_sessionSettle",m),{done:N,resolve:R,reject:B}=nr();this.events.once(je("session_approve",w),({error:I})=>{I?B(I):R(this.client.session.get(b))});const S=fs(Kt({},m),{topic:b,acknowledged:!1,self:m.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:l});return await this.client.session.set(b,S),await this.setExpiry(b,Bt(Mn)),a&&await this.client.core.pairing.updateMetadata({topic:a,metadata:S.peer.metadata}),a&&n&&(await this.sendResult(n,a,{relay:{protocol:i??"irn"},responderPublicKey:l}),await this.client.proposal.delete(n,Ge("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:a})),{topic:b,acknowledged:N}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);const{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,Ge("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);const{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:h}=nr();return this.events.once(je("session_update",s),({error:f})=>{f?h(f):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);const{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=nr();return this.events.once(je("session_extend",i),({error:h})=>{h?a(h):o()}),await this.setExpiry(n,Bt(Mn)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);const{chainId:n,request:i,topic:s}=r,o=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n}),{done:a,resolve:h,reject:f}=nr();return this.events.once(je("session_request",o),({error:l,result:D})=>{l?f(l):h(D)}),await a()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i;jt(i)?await this.sendResult(s,n,i.result):Ot(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=nr();this.events.once(je("session_ping",i),({error:h})=>{h?a(h):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",Ge("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>Up(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{const{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,Ge("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ge("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{const n=Zr.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,n)},this.sendRequest=async(r,n,i)=>{const s=sn(n,i),o=await this.client.core.crypto.encode(r,s),a=Zr[n].req;return this.client.core.history.set(r,s),this.client.core.relayer.publish(r,o,a),s.id},this.sendResult=async(r,n,i)=>{const s=on(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),h=Zr[a.request.method].res;this.client.core.relayer.publish(n,o,h),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{const s=Lr(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),h=Zr[a.request.method].res;this.client.core.relayer.publish(n,o,h),await this.client.core.history.resolve(s)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{Gt(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Gt(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{const{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidConnect(Kt({},n.params));const o=Bt(Z.FIVE_MINUTES),a=Kt({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{const{id:i}=n;if(jt(n)){const{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});const o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});const h=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:h});const f=await this.client.core.crypto.generateSharedKey(a,h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const l=await this.client.core.relayer.subscribe(f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:r})}else Ot(n)&&(await this.client.proposal.delete(i,Ge("USER_DISCONNECTED")),this.events.emit(je("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:h,namespaces:f,requiredNamespaces:l}=n.params,D={topic:r,relay:o,expiry:h,namespaces:f,acknowledged:!0,requiredNamespaces:l,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}};await this.sendResult(n.id,r,!0),this.events.emit(je("session_connect"),{session:D})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;jt(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(je("session_approve",i),{})):Ot(n)&&(await this.client.session.delete(r,Ge("USER_DISCONNECTED")),this.events.emit(je("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidUpdate(Kt({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n;jt(n)?this.events.emit(je("session_update",i),{}):Ot(n)&&this.events.emit(je("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Bt(Mn)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n;jt(n)?this.events.emit(je("session_extend",i),{}):Ot(n)&&this.events.emit(je("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n;setTimeout(()=>{jt(n)?this.events.emit(je("session_ping",i),{}):Ot(n)&&this.events.emit(je("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await this.sendResult(i,r,!0),await this.deleteSession(r),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidRequest(Kt({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n;jt(n)?this.events.emit(je("session_request",i),{result:n.result}):Ot(n)&&this.events.emit(je("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidEmit(Kt({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!yt(r)){const{message:a}=V("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;if(bt(n)||await this.isValidPairingTopic(n),!bt(i)&&yn(i)===0)return;const o=Gp(i,"connect()");if(o)throw new Error(o.message);if(!Wp(s,!0)){const{message:a}=V("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(a)}},this.isValidApprove=async r=>{if(!yt(r))throw new Error(V("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s}=r;await this.isValidProposalId(n);const o=this.client.proposal.get(n),a=vn(i,"approve()");if(a)throw new Error(a.message);const h=pa(o.requiredNamespaces,i,"update()");if(h)throw new Error(h.message);if(!st(s,!0)){const{message:f}=V("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}},this.isValidReject=async r=>{if(!yt(r)){const{message:s}=V("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(await this.isValidProposalId(n),!Yp(i)){const{message:s}=V("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yt(r)){const{message:f}=V("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(f)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!la(n)){const{message:f}=V("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(f)}const a=qp(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const h=vn(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Gt(o)){const{message:f}=V("EXPIRED","onSessionSettleRequest()");throw new Error(f)}},this.isValidUpdate=async r=>{if(!yt(r)){const{message:h}=V("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(h)}const{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=vn(i,"update()");if(o)throw new Error(o.message);const a=pa(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yt(r)){const{message:i}=V("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yt(r)){const{message:a}=V("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(a)}const{topic:n,request:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!da(o,s)){const{message:a}=V("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!Jp(i)){const{message:a}=V("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!Qp(o,s,i.method)){const{message:a}=V("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(a)}},this.isValidRespond=async r=>{if(!yt(r)){const{message:s}=V("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}const{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!Xp(i)){const{message:s}=V("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!yt(r)){const{message:i}=V("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yt(r)){const{message:a}=V("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!da(o,s)){const{message:a}=V("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!Zp(i)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!eg(o,s,i.name)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yt(r)){const{message:i}=V("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(vt.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const i=await this.client.core.crypto.decode(r,n);Qn(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):ei(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(Et.expired,async e=>{const{topic:r,id:n}=na(e.target);if(n&&this.getPendingSessionRequests()[n])return await this.deletePendingSessionRequest(n,V("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&await this.deleteProposal(n,!0)})}isValidPairingTopic(e){if(!st(e,!1)){const{message:r}=V("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=V("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!st(e,!1)){const{message:r}=V("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:r}=V("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(st(e,!1)){const{message:r}=V("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=V("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!kp(e)){const{message:r}=V("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:r}=V("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class pb extends Pn{constructor(e,r){super(e,r,ib,cs),this.core=e,this.logger=r}}class gb extends Pn{constructor(e,r){super(e,r,sb,cs),this.core=e,this.logger=r}}class yb extends Pn{constructor(e,r){super(e,r,ab,cs),this.core=e,this.logger=r}}class hs extends rv{constructor(e){super(e),this.protocol=fu,this.version=hu,this.name=us.name,this.events=new Nn.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||us.name,this.metadata=e?.metadata||yp();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:_n(Oe.getDefaultLoggerOptions({level:e?.logger||us.logger}));this.core=e?.core||new X_(e),this.logger=Oe.generateChildLogger(r,this.name),this.session=new gb(this.core,this.logger),this.proposal=new pb(this.core,this.logger),this.pendingRequest=new yb(this.core,this.logger),this.engine=new db(this)}static async init(e){const r=new hs(e);return await r.initialize(),r}get context(){return Oe.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initilization Success")}catch(e){throw this.logger.info("SignClient Initilization Failure"),this.logger.error(e.message),e}}}var ls={exports:{}},Er=typeof Reflect=="object"?Reflect:null,gu=Er&&typeof Er.apply=="function"?Er.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Un;Er&&typeof Er.ownKeys=="function"?Un=Er.ownKeys:Object.getOwnPropertySymbols?Un=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Un=function(e){return Object.getOwnPropertyNames(e)};function vb(t){console&&console.warn&&console.warn(t)}var yu=Number.isNaN||function(e){return e!==e};function Te(){Te.init.call(this)}ls.exports=Te,ls.exports.once=wb,Te.EventEmitter=Te,Te.prototype._events=void 0,Te.prototype._eventsCount=0,Te.prototype._maxListeners=void 0;var vu=10;function jn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Te,"defaultMaxListeners",{enumerable:!0,get:function(){return vu},set:function(t){if(typeof t!="number"||t<0||yu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");vu=t}}),Te.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||yu(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};function _u(t){return t._maxListeners===void 0?Te.defaultMaxListeners:t._maxListeners}Te.prototype.getMaxListeners=function(){return _u(this)},Te.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")gu(h,this,r);else for(var f=h.length,l=Du(h,f),n=0;n<f;++n)gu(l[n],this,r);return!0};function bu(t,e,r,n){var i,s,o;if(jn(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=_u(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,vb(a)}return t}Te.prototype.addListener=function(e,r){return bu(this,e,r,!1)},Te.prototype.on=Te.prototype.addListener,Te.prototype.prependListener=function(e,r){return bu(this,e,r,!0)};function _b(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function mu(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=_b.bind(n);return i.listener=r,n.wrapFn=i,i}Te.prototype.once=function(e,r){return jn(r),this.on(e,mu(this,e,r)),this},Te.prototype.prependOnceListener=function(e,r){return jn(r),this.prependListener(e,mu(this,e,r)),this},Te.prototype.removeListener=function(e,r){var n,i,s,o,a;if(jn(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():bb(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Te.prototype.off=Te.prototype.removeListener,Te.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function wu(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?mb(i):Du(i,i.length)}Te.prototype.listeners=function(e){return wu(this,e,!0)},Te.prototype.rawListeners=function(e){return wu(this,e,!1)},Te.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Eu.call(t,e)},Te.prototype.listenerCount=Eu;function Eu(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Te.prototype.eventNames=function(){return this._eventsCount>0?Un(this._events):[]};function Du(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function bb(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function mb(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function wb(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}xu(t,e,s,{once:!0}),e!=="error"&&Eb(t,i,{once:!0})})}function Eb(t,e,r){typeof t.on=="function"&&xu(t,"error",e,r)}function xu(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}function Db(t){return typeof t<"u"&&typeof t.context<"u"}const Nt={init:"signer_init",uri:"signer_uri",created:"signer_created",updated:"signer_updated",deleted:"signer_deleted",event:"signer_event"};class xb extends xf{constructor(e){super(),this.events=new ls.exports.EventEmitter,this.pending=!1,this.initializing=!1,this.requiredNamespaces=e?.requiredNamespaces||{},this.opts=e?.client}get connected(){return typeof this.session<"u"}get connecting(){return this.pending}get chains(){return this.session?Li(this.session.namespaces):Xd(this.requiredNamespaces)}get accounts(){return this.session?Oi(this.session.namespaces):[]}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(){if(this.pending)return new Promise((e,r)=>{this.events.once("open",()=>{if(this.events.once("open_error",n=>{r(n)}),typeof this.client>"u")return r(new Error("Sign Client not initialized"));e()})});try{this.pending=!0;const e=await this.register(),r=e.find({requiredNamespaces:this.requiredNamespaces});if(r.length)return this.onOpen(r[0]);const{uri:n,approval:i}=await e.connect({requiredNamespaces:this.requiredNamespaces});this.events.emit(Nt.uri,{uri:n}),this.session=await i(),this.events.emit(Nt.created,this.session),this.onOpen()}catch(e){throw this.events.emit("open_error",e),e}}async close(){typeof this.session>"u"||(await(await this.register()).disconnect({topic:this.session.topic,reason:Ge("USER_DISCONNECTED")}),this.onClose())}async send(e,r){if(typeof this.client>"u"&&(this.client=await this.register(),this.connected||await this.open()),typeof this.session>"u")throw new Error("Signer connection is missing session");this.client.request({topic:this.session.topic,request:e,chainId:r?.chainId}).then(n=>this.events.emit("payload",on(e.id,n))).catch(n=>this.events.emit("payload",Lr(e.id,n.message)))}async register(e=this.opts){if(typeof this.client<"u")return this.client;if(this.initializing)return new Promise((r,n)=>{this.events.once("register_error",i=>{n(i)}),this.events.once(Nt.init,()=>{if(typeof this.client>"u")return n(new Error("Sign Client not initialized"));r(this.client)})});if(Db(e))return this.client=e,this.registerEventListeners(),this.client;try{return this.initializing=!0,this.client=await hs.init(e),this.initializing=!1,this.registerEventListeners(),this.events.emit(Nt.init),this.client}catch(r){throw this.events.emit("register_error",r),r}}onOpen(e){this.pending=!1,e&&(this.session=e),this.events.emit("open")}onClose(){this.pending=!1,this.client&&(this.client=void 0),this.events.emit("close")}registerEventListeners(){typeof this.client<"u"&&(this.client.on("session_event",e=>{var r;this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||this.events.emit(Nt.event,e.params)}),this.client.on("session_update",e=>{var r;typeof this.client<"u"&&(this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.session=this.client.session.get(e.topic),this.events.emit(Nt.updated,this.session)))}),this.client.on("session_delete",e=>{var r;!this.session||this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.onClose(),this.events.emit(Nt.deleted,this.session),this.session=void 0)}))}}const Sb=["eth_requestAccounts","eth_accounts","eth_chainId","eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","personal_sign"],Ob=["chainChanged","accountsChanged"];function Su(t){return{chains:t!=null&&t.chainId?[`eip155:${t.chainId}`]:[],methods:t?.methods||[],events:t?.events||[],rpcMap:t?.rpcMap||void 0}}function Ou(t,e){let r;return e.rpcMap&&(r=e.rpcMap[ds([t])]),r}function ds(t){return Number(t[0].split(":")[1])}class Lb{constructor(e){this.events=new Wn.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.rpc=Su(e),this.signer=this.setSignerProvider(e?.client),this.chainId=ds(this.rpc.chains),this.http=this.setHttpProvider(this.chainId),this.registerEventListeners()}async request(e){switch(e.method){case"eth_requestAccounts":return await this.connect(),this.accounts;case"eth_accounts":return this.accounts;case"eth_chainId":return this.chainId}if(e.method.startsWith("eth_signTypedData")||this.rpc.methods.includes(e.method))return this.signer.request(e,{chainId:this.formatChainId(this.chainId)});if(typeof this.http>"u")throw new Error(`Cannot request JSON-RPC method (${e.method}) without provided rpc url`);return this.http.request(e)}sendAsync(e,r){this.request(e).then(n=>r(null,n)).catch(n=>r(n,void 0))}get connected(){return this.signer.connection.connected}get connecting(){return this.signer.connection.connecting}async enable(){return await this.request({method:"eth_requestAccounts"})}async connect(){await this.signer.connect()}async disconnect(){await this.signer.disconnect()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}registerEventListeners(){this.signer.on("connect",()=>{const e=this.signer.connection.chains;e&&e.length&&this.setChainIds(e);const r=this.signer.connection.accounts;r&&r.length&&this.setAccounts(r)}),this.signer.connection.on(Nt.created,e=>{const r=Li(e.namespaces,[this.namespace]);this.setChainIds(r);const n=Oi(e.namespaces,[this.namespace]);this.setAccounts(n)}),this.signer.connection.on(Nt.updated,e=>{const r=Li(e.namespaces,[this.namespace]);this.setChainIds(r);const n=Oi(e.namespaces,[this.namespace]);n!==this.accounts&&this.setAccounts(n)}),this.signer.connection.on(Nt.event,e=>{if(!this.rpc.chains.includes(e.chainId))return;const{event:r}=e;r.name==="accountsChanged"?(this.accounts=r.data,this.events.emit("accountsChanged",this.accounts)):r.name==="chainChanged"?this.setChainId(r.data):this.events.emit(r.name,r.data)}),this.signer.on("disconnect",()=>{this.events.emit("disconnect")}),this.events.on("chainChanged",e=>this.setHttpProvider(e))}setSignerProvider(e){const r=new xb({requiredNamespaces:{[this.namespace]:{chains:this.rpc.chains,methods:this.rpc.methods,events:this.rpc.events}},client:e});return new ti(r)}setHttpProvider(e){const r=Ou(`${this.namespace}:${e}`,this.rpc);return typeof r>"u"?void 0:new ti(new Cf(r))}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n)).filter(n=>n!==this.chainId);r.length&&(this.chainId=r[0],this.events.emit("chainChanged",this.chainId))}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.events.emit("chainChanged",this.chainId)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}}St.default=Lb,St.getEthereumChainId=ds,St.getRpcConfig=Su,St.getRpcUrl=Ou,St.signerEvents=Ob,St.signerMethods=Sb,Object.defineProperty(St,"__esModule",{value:!0})});
|
|
66
|
+
***************************************************************************** */var Xi=function(t,e){return Xi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Xi(t,e)};function Ey(t,e){Xi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Zi=function(){return Zi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Zi.apply(this,arguments)};function Dy(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function xy(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Sy(t,e){return function(r,n){e(r,n,t)}}function Oy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Ly(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{h(n.next(l))}catch(D){o(D)}}function f(l){try{h(n.throw(l))}catch(D){o(D)}}function h(l){l.done?s(l.value):i(l.value).then(a,f)}h((n=n.apply(t,e||[])).next())})}function Iy(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(l){return f([h,l])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(l){h=[6,l],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Ay(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Ty(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Qi(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Va(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Cy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Va(arguments[e]));return t}function Ry(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Yr(t){return this instanceof Yr?(this.v=t,this):new Yr(t)}function Ny(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(v){n[v]&&(i[v]=function(m){return new Promise(function(w,P){s.push([v,m,w,P])>1||a(v,m)})})}function a(v,m){try{f(n[v](m))}catch(w){D(s[0][3],w)}}function f(v){v.value instanceof Yr?Promise.resolve(v.value.v).then(h,l):D(s[0][2],v)}function h(v){a("next",v)}function l(v){a("throw",v)}function D(v,m){v(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Py(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Yr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function $y(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Qi=="function"?Qi(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,f){o=t[s](o),i(a,f,o.done,o.value)})}}function i(s,o,a,f){Promise.resolve(f).then(function(h){s({value:h,done:a})},o)}}function Fy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function My(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function Uy(t){return t&&t.__esModule?t:{default:t}}function jy(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function By(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var zy=Object.freeze({__proto__:null,__extends:Ey,get __assign(){return Zi},__rest:Dy,__decorate:xy,__param:Sy,__metadata:Oy,__awaiter:Ly,__generator:Iy,__createBinding:Ay,__exportStar:Ty,__values:Qi,__read:Va,__spread:Cy,__spreadArrays:Ry,__await:Yr,__asyncGenerator:Ny,__asyncDelegator:Py,__asyncValues:$y,__makeTemplateObject:Fy,__importStar:My,__importDefault:Uy,__classPrivateFieldGet:jy,__classPrivateFieldSet:By}),Ky=Zt(zy),or={},Ga;function Wa(){return Ga||(Ga=1,Object.defineProperty(or,"__esModule",{value:!0}),or.PINO_CUSTOM_CONTEXT_KEY=or.PINO_LOGGER_DEFAULTS=void 0,or.PINO_LOGGER_DEFAULTS={level:"info"},or.PINO_CUSTOM_CONTEXT_KEY="custom_context"),or}var ft={},ka;function qy(){if(ka)return ft;ka=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.generateChildLogger=ft.formatChildLoggerContext=ft.getLoggerContext=ft.setBrowserLoggerContext=ft.getBrowserLoggerContext=ft.getDefaultLoggerOptions=void 0;const t=Wa();function e(a){return Object.assign(Object.assign({},a),{level:a?.level||t.PINO_LOGGER_DEFAULTS.level})}ft.getDefaultLoggerOptions=e;function r(a,f=t.PINO_CUSTOM_CONTEXT_KEY){return a[f]||""}ft.getBrowserLoggerContext=r;function n(a,f,h=t.PINO_CUSTOM_CONTEXT_KEY){return a[h]=f,a}ft.setBrowserLoggerContext=n;function i(a,f=t.PINO_CUSTOM_CONTEXT_KEY){let h="";return typeof a.bindings>"u"?h=r(a,f):h=a.bindings().context||"",h}ft.getLoggerContext=i;function s(a,f,h=t.PINO_CUSTOM_CONTEXT_KEY){const l=i(a,h);return l.trim()?`${l}/${f}`:f}ft.formatChildLoggerContext=s;function o(a,f,h=t.PINO_CUSTOM_CONTEXT_KEY){const l=s(a,f,h),D=a.child({context:l});return n(D,l,h)}return ft.generateChildLogger=o,ft}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const e=Ky,r=e.__importDefault(_n);Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return r.default}}),e.__exportStar(Wa(),t),e.__exportStar(qy(),t)})(Oe);var Ya={exports:{}},br=typeof Reflect=="object"?Reflect:null,Ja=br&&typeof br.apply=="function"?br.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Sn;br&&typeof br.ownKeys=="function"?Sn=br.ownKeys:Object.getOwnPropertySymbols?Sn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sn=function(e){return Object.getOwnPropertyNames(e)};function Hy(t){console&&console.warn&&console.warn(t)}var Xa=Number.isNaN||function(e){return e!==e};function Le(){Le.init.call(this)}Ya.exports=Le,Ya.exports.once=ky,Le.EventEmitter=Le,Le.prototype._events=void 0,Le.prototype._eventsCount=0,Le.prototype._maxListeners=void 0;var Za=10;function On(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Le,"defaultMaxListeners",{enumerable:!0,get:function(){return Za},set:function(t){if(typeof t!="number"||t<0||Xa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Za=t}}),Le.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Le.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Xa(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};function Qa(t){return t._maxListeners===void 0?Le.defaultMaxListeners:t._maxListeners}Le.prototype.getMaxListeners=function(){return Qa(this)},Le.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")Ja(f,this,r);else for(var h=f.length,l=ic(f,h),n=0;n<h;++n)Ja(l[n],this,r);return!0};function ec(t,e,r,n){var i,s,o;if(On(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Qa(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Hy(a)}return t}Le.prototype.addListener=function(e,r){return ec(this,e,r,!1)},Le.prototype.on=Le.prototype.addListener,Le.prototype.prependListener=function(e,r){return ec(this,e,r,!0)};function Vy(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function tc(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Vy.bind(n);return i.listener=r,n.wrapFn=i,i}Le.prototype.once=function(e,r){return On(r),this.on(e,tc(this,e,r)),this},Le.prototype.prependOnceListener=function(e,r){return On(r),this.prependListener(e,tc(this,e,r)),this},Le.prototype.removeListener=function(e,r){var n,i,s,o,a;if(On(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Gy(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Le.prototype.off=Le.prototype.removeListener,Le.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function rc(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Wy(i):ic(i,i.length)}Le.prototype.listeners=function(e){return rc(this,e,!0)},Le.prototype.rawListeners=function(e){return rc(this,e,!1)},Le.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):nc.call(t,e)},Le.prototype.listenerCount=nc;function nc(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Le.prototype.eventNames=function(){return this._eventsCount>0?Sn(this._events):[]};function ic(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Gy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Wy(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function ky(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}sc(t,e,s,{once:!0}),e!=="error"&&Yy(t,i,{once:!0})})}function Yy(t,e,r){typeof t.on=="function"&&sc(t,"error",e,r)}function sc(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}class Jy extends ir{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Xy extends ir{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class Zy{constructor(e,r){this.logger=e,this.core=r}}class Qy extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class ev extends ir{constructor(e){super()}}class tv{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class rv extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class nv extends ir{constructor(e,r){super(),this.core=e,this.logger=r}}class iv{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class sv{constructor(e){this.client=e}}var es={},oc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=_t;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},a.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var l=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=f[l++],h--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(l=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,l,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[l++],h--;return this},a.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,l=this._bufferLength,D=h/536870912|0,v=h<<3,m=h%128<112?128:256;this._buffer[l]=128;for(var w=l+1;w<m-8;w++)this._buffer[w]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(v,this._buffer,m-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,m),this._finished=!0}for(var w=0;w<this.digestLength/8;w++)e.writeUint32BE(this._stateHi[w],f,w*8),e.writeUint32BE(this._stateLo[w],f,w*8+4);return this},a.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},a.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}},a.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(f){r.wipe(f.stateHi),r.wipe(f.stateLo),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},a}();t.SHA512=n;var i=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 s(a,f,h,l,D,v,m){for(var w=h[0],P=h[1],R=h[2],B=h[3],S=h[4],I=h[5],y=h[6],x=h[7],E=l[0],c=l[1],d=l[2],U=l[3],K=l[4],G=l[5],J=l[6],X=l[7],g,_,F,M,N,C,j,z;m>=128;){for(var Q=0;Q<16;Q++){var q=8*Q+v;a[Q]=e.readUint32BE(D,q),f[Q]=e.readUint32BE(D,q+4)}for(var Q=0;Q<80;Q++){var ee=w,Y=P,ae=R,T=B,A=S,O=I,u=y,b=x,H=E,W=c,he=d,ve=U,de=K,me=G,Be=J,$e=X;if(g=x,_=X,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=(S>>>14|K<<32-14)^(S>>>18|K<<32-18)^(K>>>41-32|S<<32-(41-32)),_=(K>>>14|S<<32-14)^(K>>>18|S<<32-18)^(S>>>41-32|K<<32-(41-32)),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=S&I^~S&y,_=K&G^~K&J,N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=i[Q*2],_=i[Q*2+1],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=a[Q%16],_=f[Q%16],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,F=j&65535|z<<16,M=N&65535|C<<16,g=F,_=M,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=(w>>>28|E<<32-28)^(E>>>34-32|w<<32-(34-32))^(E>>>39-32|w<<32-(39-32)),_=(E>>>28|w<<32-28)^(w>>>34-32|E<<32-(34-32))^(w>>>39-32|E<<32-(39-32)),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=w&P^w&R^P&R,_=E&c^E&d^c&d,N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,b=j&65535|z<<16,$e=N&65535|C<<16,g=T,_=ve,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=F,_=M,N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,T=j&65535|z<<16,ve=N&65535|C<<16,P=ee,R=Y,B=ae,S=T,I=A,y=O,x=u,w=b,c=H,d=W,U=he,K=ve,G=de,J=me,X=Be,E=$e,Q%16===15)for(var q=0;q<16;q++)g=a[q],_=f[q],N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=a[(q+9)%16],_=f[(q+9)%16],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,F=a[(q+1)%16],M=f[(q+1)%16],g=(F>>>1|M<<32-1)^(F>>>8|M<<32-8)^F>>>7,_=(M>>>1|F<<32-1)^(M>>>8|F<<32-8)^(M>>>7|F<<32-7),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,F=a[(q+14)%16],M=f[(q+14)%16],g=(F>>>19|M<<32-19)^(M>>>61-32|F<<32-(61-32))^F>>>6,_=(M>>>19|F<<32-19)^(F>>>61-32|M<<32-(61-32))^(M>>>6|F<<32-6),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,a[q]=j&65535|z<<16,f[q]=N&65535|C<<16}g=w,_=E,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[0],_=l[0],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[0]=w=j&65535|z<<16,l[0]=E=N&65535|C<<16,g=P,_=c,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[1],_=l[1],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[1]=P=j&65535|z<<16,l[1]=c=N&65535|C<<16,g=R,_=d,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[2],_=l[2],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[2]=R=j&65535|z<<16,l[2]=d=N&65535|C<<16,g=B,_=U,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[3],_=l[3],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[3]=B=j&65535|z<<16,l[3]=U=N&65535|C<<16,g=S,_=K,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[4],_=l[4],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[4]=S=j&65535|z<<16,l[4]=K=N&65535|C<<16,g=I,_=G,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[5],_=l[5],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[5]=I=j&65535|z<<16,l[5]=G=N&65535|C<<16,g=y,_=J,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[6],_=l[6],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[6]=y=j&65535|z<<16,l[6]=J=N&65535|C<<16,g=x,_=X,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=h[7],_=l[7],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,h[7]=x=j&65535|z<<16,l[7]=X=N&65535|C<<16,v+=128,m-=128}return v}function o(a){var f=new n;f.update(a);var h=f.digest();return f.clean(),h}t.hash=o})(oc),function(t){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 e=lr,r=oc,n=_t;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(T){const A=new Float64Array(16);if(T)for(let O=0;O<T.length;O++)A[O]=T[O];return A}const s=new Uint8Array(32);s[0]=9;const o=i(),a=i([1]),f=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),D=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(T,A){for(let O=0;O<16;O++)T[O]=A[O]|0}function w(T){let A=1;for(let O=0;O<16;O++){let u=T[O]+A+65535;A=Math.floor(u/65536),T[O]=u-A*65536}T[0]+=A-1+37*(A-1)}function P(T,A,O){const u=~(O-1);for(let b=0;b<16;b++){const H=u&(T[b]^A[b]);T[b]^=H,A[b]^=H}}function R(T,A){const O=i(),u=i();for(let b=0;b<16;b++)u[b]=A[b];w(u),w(u),w(u);for(let b=0;b<2;b++){O[0]=u[0]-65517;for(let W=1;W<15;W++)O[W]=u[W]-65535-(O[W-1]>>16&1),O[W-1]&=65535;O[15]=u[15]-32767-(O[14]>>16&1);const H=O[15]>>16&1;O[14]&=65535,P(u,O,1-H)}for(let b=0;b<16;b++)T[2*b]=u[b]&255,T[2*b+1]=u[b]>>8}function B(T,A){let O=0;for(let u=0;u<32;u++)O|=T[u]^A[u];return(1&O-1>>>8)-1}function S(T,A){const O=new Uint8Array(32),u=new Uint8Array(32);return R(O,T),R(u,A),B(O,u)}function I(T){const A=new Uint8Array(32);return R(A,T),A[0]&1}function y(T,A){for(let O=0;O<16;O++)T[O]=A[2*O]+(A[2*O+1]<<8);T[15]&=32767}function x(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]+O[u]}function E(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]-O[u]}function c(T,A,O){let u,b,H=0,W=0,he=0,ve=0,de=0,me=0,Be=0,$e=0,ye=0,pe=0,le=0,ue=0,ce=0,oe=0,se=0,te=0,fe=0,ge=0,ne=0,_e=0,be=0,Ee=0,De=0,we=0,Lt=0,Ft=0,kt=0,mt=0,ar=0,Qr=0,Bn=0,ze=O[0],Fe=O[1],Ke=O[2],qe=O[3],He=O[4],Me=O[5],Je=O[6],Xe=O[7],Ze=O[8],Qe=O[9],et=O[10],We=O[11],Ve=O[12],Ne=O[13],tt=O[14],rt=O[15];u=A[0],H+=u*ze,W+=u*Fe,he+=u*Ke,ve+=u*qe,de+=u*He,me+=u*Me,Be+=u*Je,$e+=u*Xe,ye+=u*Ze,pe+=u*Qe,le+=u*et,ue+=u*We,ce+=u*Ve,oe+=u*Ne,se+=u*tt,te+=u*rt,u=A[1],W+=u*ze,he+=u*Fe,ve+=u*Ke,de+=u*qe,me+=u*He,Be+=u*Me,$e+=u*Je,ye+=u*Xe,pe+=u*Ze,le+=u*Qe,ue+=u*et,ce+=u*We,oe+=u*Ve,se+=u*Ne,te+=u*tt,fe+=u*rt,u=A[2],he+=u*ze,ve+=u*Fe,de+=u*Ke,me+=u*qe,Be+=u*He,$e+=u*Me,ye+=u*Je,pe+=u*Xe,le+=u*Ze,ue+=u*Qe,ce+=u*et,oe+=u*We,se+=u*Ve,te+=u*Ne,fe+=u*tt,ge+=u*rt,u=A[3],ve+=u*ze,de+=u*Fe,me+=u*Ke,Be+=u*qe,$e+=u*He,ye+=u*Me,pe+=u*Je,le+=u*Xe,ue+=u*Ze,ce+=u*Qe,oe+=u*et,se+=u*We,te+=u*Ve,fe+=u*Ne,ge+=u*tt,ne+=u*rt,u=A[4],de+=u*ze,me+=u*Fe,Be+=u*Ke,$e+=u*qe,ye+=u*He,pe+=u*Me,le+=u*Je,ue+=u*Xe,ce+=u*Ze,oe+=u*Qe,se+=u*et,te+=u*We,fe+=u*Ve,ge+=u*Ne,ne+=u*tt,_e+=u*rt,u=A[5],me+=u*ze,Be+=u*Fe,$e+=u*Ke,ye+=u*qe,pe+=u*He,le+=u*Me,ue+=u*Je,ce+=u*Xe,oe+=u*Ze,se+=u*Qe,te+=u*et,fe+=u*We,ge+=u*Ve,ne+=u*Ne,_e+=u*tt,be+=u*rt,u=A[6],Be+=u*ze,$e+=u*Fe,ye+=u*Ke,pe+=u*qe,le+=u*He,ue+=u*Me,ce+=u*Je,oe+=u*Xe,se+=u*Ze,te+=u*Qe,fe+=u*et,ge+=u*We,ne+=u*Ve,_e+=u*Ne,be+=u*tt,Ee+=u*rt,u=A[7],$e+=u*ze,ye+=u*Fe,pe+=u*Ke,le+=u*qe,ue+=u*He,ce+=u*Me,oe+=u*Je,se+=u*Xe,te+=u*Ze,fe+=u*Qe,ge+=u*et,ne+=u*We,_e+=u*Ve,be+=u*Ne,Ee+=u*tt,De+=u*rt,u=A[8],ye+=u*ze,pe+=u*Fe,le+=u*Ke,ue+=u*qe,ce+=u*He,oe+=u*Me,se+=u*Je,te+=u*Xe,fe+=u*Ze,ge+=u*Qe,ne+=u*et,_e+=u*We,be+=u*Ve,Ee+=u*Ne,De+=u*tt,we+=u*rt,u=A[9],pe+=u*ze,le+=u*Fe,ue+=u*Ke,ce+=u*qe,oe+=u*He,se+=u*Me,te+=u*Je,fe+=u*Xe,ge+=u*Ze,ne+=u*Qe,_e+=u*et,be+=u*We,Ee+=u*Ve,De+=u*Ne,we+=u*tt,Lt+=u*rt,u=A[10],le+=u*ze,ue+=u*Fe,ce+=u*Ke,oe+=u*qe,se+=u*He,te+=u*Me,fe+=u*Je,ge+=u*Xe,ne+=u*Ze,_e+=u*Qe,be+=u*et,Ee+=u*We,De+=u*Ve,we+=u*Ne,Lt+=u*tt,Ft+=u*rt,u=A[11],ue+=u*ze,ce+=u*Fe,oe+=u*Ke,se+=u*qe,te+=u*He,fe+=u*Me,ge+=u*Je,ne+=u*Xe,_e+=u*Ze,be+=u*Qe,Ee+=u*et,De+=u*We,we+=u*Ve,Lt+=u*Ne,Ft+=u*tt,kt+=u*rt,u=A[12],ce+=u*ze,oe+=u*Fe,se+=u*Ke,te+=u*qe,fe+=u*He,ge+=u*Me,ne+=u*Je,_e+=u*Xe,be+=u*Ze,Ee+=u*Qe,De+=u*et,we+=u*We,Lt+=u*Ve,Ft+=u*Ne,kt+=u*tt,mt+=u*rt,u=A[13],oe+=u*ze,se+=u*Fe,te+=u*Ke,fe+=u*qe,ge+=u*He,ne+=u*Me,_e+=u*Je,be+=u*Xe,Ee+=u*Ze,De+=u*Qe,we+=u*et,Lt+=u*We,Ft+=u*Ve,kt+=u*Ne,mt+=u*tt,ar+=u*rt,u=A[14],se+=u*ze,te+=u*Fe,fe+=u*Ke,ge+=u*qe,ne+=u*He,_e+=u*Me,be+=u*Je,Ee+=u*Xe,De+=u*Ze,we+=u*Qe,Lt+=u*et,Ft+=u*We,kt+=u*Ve,mt+=u*Ne,ar+=u*tt,Qr+=u*rt,u=A[15],te+=u*ze,fe+=u*Fe,ge+=u*Ke,ne+=u*qe,_e+=u*He,be+=u*Me,Ee+=u*Je,De+=u*Xe,we+=u*Ze,Lt+=u*Qe,Ft+=u*et,kt+=u*We,mt+=u*Ve,ar+=u*Ne,Qr+=u*tt,Bn+=u*rt,H+=38*fe,W+=38*ge,he+=38*ne,ve+=38*_e,de+=38*be,me+=38*Ee,Be+=38*De,$e+=38*we,ye+=38*Lt,pe+=38*Ft,le+=38*kt,ue+=38*mt,ce+=38*ar,oe+=38*Qr,se+=38*Bn,b=1,u=H+b+65535,b=Math.floor(u/65536),H=u-b*65536,u=W+b+65535,b=Math.floor(u/65536),W=u-b*65536,u=he+b+65535,b=Math.floor(u/65536),he=u-b*65536,u=ve+b+65535,b=Math.floor(u/65536),ve=u-b*65536,u=de+b+65535,b=Math.floor(u/65536),de=u-b*65536,u=me+b+65535,b=Math.floor(u/65536),me=u-b*65536,u=Be+b+65535,b=Math.floor(u/65536),Be=u-b*65536,u=$e+b+65535,b=Math.floor(u/65536),$e=u-b*65536,u=ye+b+65535,b=Math.floor(u/65536),ye=u-b*65536,u=pe+b+65535,b=Math.floor(u/65536),pe=u-b*65536,u=le+b+65535,b=Math.floor(u/65536),le=u-b*65536,u=ue+b+65535,b=Math.floor(u/65536),ue=u-b*65536,u=ce+b+65535,b=Math.floor(u/65536),ce=u-b*65536,u=oe+b+65535,b=Math.floor(u/65536),oe=u-b*65536,u=se+b+65535,b=Math.floor(u/65536),se=u-b*65536,u=te+b+65535,b=Math.floor(u/65536),te=u-b*65536,H+=b-1+37*(b-1),b=1,u=H+b+65535,b=Math.floor(u/65536),H=u-b*65536,u=W+b+65535,b=Math.floor(u/65536),W=u-b*65536,u=he+b+65535,b=Math.floor(u/65536),he=u-b*65536,u=ve+b+65535,b=Math.floor(u/65536),ve=u-b*65536,u=de+b+65535,b=Math.floor(u/65536),de=u-b*65536,u=me+b+65535,b=Math.floor(u/65536),me=u-b*65536,u=Be+b+65535,b=Math.floor(u/65536),Be=u-b*65536,u=$e+b+65535,b=Math.floor(u/65536),$e=u-b*65536,u=ye+b+65535,b=Math.floor(u/65536),ye=u-b*65536,u=pe+b+65535,b=Math.floor(u/65536),pe=u-b*65536,u=le+b+65535,b=Math.floor(u/65536),le=u-b*65536,u=ue+b+65535,b=Math.floor(u/65536),ue=u-b*65536,u=ce+b+65535,b=Math.floor(u/65536),ce=u-b*65536,u=oe+b+65535,b=Math.floor(u/65536),oe=u-b*65536,u=se+b+65535,b=Math.floor(u/65536),se=u-b*65536,u=te+b+65535,b=Math.floor(u/65536),te=u-b*65536,H+=b-1+37*(b-1),T[0]=H,T[1]=W,T[2]=he,T[3]=ve,T[4]=de,T[5]=me,T[6]=Be,T[7]=$e,T[8]=ye,T[9]=pe,T[10]=le,T[11]=ue,T[12]=ce,T[13]=oe,T[14]=se,T[15]=te}function d(T,A){c(T,A,A)}function U(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=253;u>=0;u--)d(O,O),u!==2&&u!==4&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function K(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=250;u>=0;u--)d(O,O),u!==1&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function G(T,A){const O=i(),u=i(),b=i(),H=i(),W=i(),he=i(),ve=i(),de=i(),me=i();E(O,T[1],T[0]),E(me,A[1],A[0]),c(O,O,me),x(u,T[0],T[1]),x(me,A[0],A[1]),c(u,u,me),c(b,T[3],A[3]),c(b,b,h),c(H,T[2],A[2]),x(H,H,H),E(W,u,O),E(he,H,b),x(ve,H,b),x(de,u,O),c(T[0],W,he),c(T[1],de,ve),c(T[2],ve,he),c(T[3],W,de)}function J(T,A,O){for(let u=0;u<4;u++)P(T[u],A[u],O)}function X(T,A){const O=i(),u=i(),b=i();U(b,A[2]),c(O,A[0],b),c(u,A[1],b),R(T,u),T[31]^=I(O)<<7}function g(T,A,O){m(T[0],o),m(T[1],a),m(T[2],a),m(T[3],o);for(let u=255;u>=0;--u){const b=O[u/8|0]>>(u&7)&1;J(T,A,b),G(A,T),G(T,T),J(T,A,b)}}function _(T,A){const O=[i(),i(),i(),i()];m(O[0],l),m(O[1],D),m(O[2],a),c(O[3],l,D),g(T,O,A)}function F(T){if(T.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const A=(0,r.hash)(T);A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(32),u=[i(),i(),i(),i()];_(u,A),X(O,u);const b=new Uint8Array(64);return b.set(T),b.set(O,32),{publicKey:O,secretKey:b}}t.generateKeyPairFromSeed=F;function M(T){const A=(0,e.randomBytes)(32,T),O=F(A);return(0,n.wipe)(A),O}t.generateKeyPair=M;function N(T){if(T.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(T.subarray(32))}t.extractPublicKeyFromSecretKey=N;const C=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 j(T,A){let O,u,b,H;for(u=63;u>=32;--u){for(O=0,b=u-32,H=u-12;b<H;++b)A[b]+=O-16*A[u]*C[b-(u-32)],O=Math.floor((A[b]+128)/256),A[b]-=O*256;A[b]+=O,A[u]=0}for(O=0,b=0;b<32;b++)A[b]+=O-(A[31]>>4)*C[b],O=A[b]>>8,A[b]&=255;for(b=0;b<32;b++)A[b]-=O*C[b];for(u=0;u<32;u++)A[u+1]+=A[u]>>8,T[u]=A[u]&255}function z(T){const A=new Float64Array(64);for(let O=0;O<64;O++)A[O]=T[O];for(let O=0;O<64;O++)T[O]=0;j(T,A)}function Q(T,A){const O=new Float64Array(64),u=[i(),i(),i(),i()],b=(0,r.hash)(T.subarray(0,32));b[0]&=248,b[31]&=127,b[31]|=64;const H=new Uint8Array(64);H.set(b.subarray(32),32);const W=new r.SHA512;W.update(H.subarray(32)),W.update(A);const he=W.digest();W.clean(),z(he),_(u,he),X(H,u),W.reset(),W.update(H.subarray(0,32)),W.update(T.subarray(32)),W.update(A);const ve=W.digest();z(ve);for(let de=0;de<32;de++)O[de]=he[de];for(let de=0;de<32;de++)for(let me=0;me<32;me++)O[de+me]+=ve[de]*b[me];return j(H.subarray(32),O),H}t.sign=Q;function q(T,A){const O=i(),u=i(),b=i(),H=i(),W=i(),he=i(),ve=i();return m(T[2],a),y(T[1],A),d(b,T[1]),c(H,b,f),E(b,b,T[2]),x(H,T[2],H),d(W,H),d(he,W),c(ve,he,W),c(O,ve,b),c(O,O,H),K(O,O),c(O,O,b),c(O,O,H),c(O,O,H),c(T[0],O,H),d(u,T[0]),c(u,u,H),S(u,b)&&c(T[0],T[0],v),d(u,T[0]),c(u,u,H),S(u,b)?-1:(I(T[0])===A[31]>>7&&E(T[0],o,T[0]),c(T[3],T[0],T[1]),0)}function ee(T,A,O){const u=new Uint8Array(32),b=[i(),i(),i(),i()],H=[i(),i(),i(),i()];if(O.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(q(H,T))return!1;const W=new r.SHA512;W.update(O.subarray(0,32)),W.update(T),W.update(A);const he=W.digest();return z(he),g(b,H,he),_(H,O.subarray(32)),G(b,H),X(u,b),!B(O,u)}t.verify=ee;function Y(T){let A=[i(),i(),i(),i()];if(q(A,T))throw new Error("Ed25519: invalid public key");let O=i(),u=i(),b=A[1];x(O,a,b),E(u,a,b),U(u,u),c(O,O,u);let H=new Uint8Array(32);return R(H,O),H}t.convertPublicKeyToX25519=Y;function ae(T){const A=(0,r.hash)(T.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(A.subarray(0,32));return(0,n.wipe)(A),O}t.convertSecretKeyToX25519=ae}(es);const ov="EdDSA",av="JWT",ac=".",cc="base64url",cv="utf8",uv="utf8",fv=":",hv="did",lv="key",uc="base58btc",dv="z",pv="K36",gv=32;function Ln(t){return pt(dt(Ir(t),cv),cc)}function fc(t){const e=dt(pv,uc),r=dv+pt(li([e,t]),uc);return[hv,lv,r].join(fv)}function yv(t){return pt(t,cc)}function vv(t){return dt([Ln(t.header),Ln(t.payload)].join(ac),uv)}function _v(t){return[Ln(t.header),Ln(t.payload),yv(t.signature)].join(ac)}function hc(t=lr.randomBytes(gv)){return es.generateKeyPairFromSeed(t)}async function bv(t,e,r,n,i=Z.fromMiliseconds(Date.now())){const s={alg:ov,typ:av},o=fc(n.publicKey),a=i+r,f={iss:o,sub:t,aud:e,iat:i,exp:a},h=vv({header:s,payload:f}),l=es.sign(n.secretKey,h);return _v({header:s,payload:f,signature:l})}var ts={exports:{}},mr=typeof Reflect=="object"?Reflect:null,lc=mr&&typeof mr.apply=="function"?mr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},In;mr&&typeof mr.ownKeys=="function"?In=mr.ownKeys:Object.getOwnPropertySymbols?In=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:In=function(e){return Object.getOwnPropertyNames(e)};function mv(t){console&&console.warn&&console.warn(t)}var dc=Number.isNaN||function(e){return e!==e};function Ie(){Ie.init.call(this)}ts.exports=Ie,ts.exports.once=xv,Ie.EventEmitter=Ie,Ie.prototype._events=void 0,Ie.prototype._eventsCount=0,Ie.prototype._maxListeners=void 0;var pc=10;function An(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ie,"defaultMaxListeners",{enumerable:!0,get:function(){return pc},set:function(t){if(typeof t!="number"||t<0||dc(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");pc=t}}),Ie.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ie.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dc(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};function gc(t){return t._maxListeners===void 0?Ie.defaultMaxListeners:t._maxListeners}Ie.prototype.getMaxListeners=function(){return gc(this)},Ie.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")lc(f,this,r);else for(var h=f.length,l=mc(f,h),n=0;n<h;++n)lc(l[n],this,r);return!0};function yc(t,e,r,n){var i,s,o;if(An(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=gc(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,mv(a)}return t}Ie.prototype.addListener=function(e,r){return yc(this,e,r,!1)},Ie.prototype.on=Ie.prototype.addListener,Ie.prototype.prependListener=function(e,r){return yc(this,e,r,!0)};function wv(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function vc(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=wv.bind(n);return i.listener=r,n.wrapFn=i,i}Ie.prototype.once=function(e,r){return An(r),this.on(e,vc(this,e,r)),this},Ie.prototype.prependOnceListener=function(e,r){return An(r),this.prependListener(e,vc(this,e,r)),this},Ie.prototype.removeListener=function(e,r){var n,i,s,o,a;if(An(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Ev(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ie.prototype.off=Ie.prototype.removeListener,Ie.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function _c(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Dv(i):mc(i,i.length)}Ie.prototype.listeners=function(e){return _c(this,e,!0)},Ie.prototype.rawListeners=function(e){return _c(this,e,!1)},Ie.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):bc.call(t,e)},Ie.prototype.listenerCount=bc;function bc(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ie.prototype.eventNames=function(){return this._eventsCount>0?In(this._events):[]};function mc(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Ev(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Dv(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function xv(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}wc(t,e,s,{once:!0}),e!=="error"&&Sv(t,i,{once:!0})})}function Sv(t,e,r){typeof t.on=="function"&&wc(t,"error",e,r)}function wc(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}const Ec=10,Ov=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:require("ws"),Lv=()=>typeof window<"u",Iv=Ov();class Av{constructor(e){if(this.url=e,this.events=new ts.exports.EventEmitter,this.registering=!1,!js(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(typeof this.socket>"u")throw new Error("Connection already closed");this.socket.close(),this.onClose()}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ir(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!js(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=Rs.isReactNative()?void 0:{rejectUnauthorized:!Cf(e)},s=new Iv(e,[],i);Lv()?s.onerror=o=>{const a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),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(typeof e.data>"u")return;const r=typeof e.data=="string"?ni(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Lr(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Cs(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>Ec&&this.events.setMaxListeners(Ec)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}}var rs={exports:{}};(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",f="[object Array]",h="[object AsyncFunction]",l="[object Boolean]",D="[object Date]",v="[object Error]",m="[object Function]",w="[object GeneratorFunction]",P="[object Map]",R="[object Number]",B="[object Null]",S="[object Object]",I="[object Promise]",y="[object Proxy]",x="[object RegExp]",E="[object Set]",c="[object String]",d="[object Symbol]",U="[object Undefined]",K="[object WeakMap]",G="[object ArrayBuffer]",J="[object DataView]",X="[object Float32Array]",g="[object Float64Array]",_="[object Int8Array]",F="[object Int16Array]",M="[object Int32Array]",N="[object Uint8Array]",C="[object Uint8ClampedArray]",j="[object Uint16Array]",z="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,q=/^\[object .+?Constructor\]$/,ee=/^(?:0|[1-9]\d*)$/,Y={};Y[X]=Y[g]=Y[_]=Y[F]=Y[M]=Y[N]=Y[C]=Y[j]=Y[z]=!0,Y[a]=Y[f]=Y[G]=Y[l]=Y[J]=Y[D]=Y[v]=Y[m]=Y[P]=Y[R]=Y[S]=Y[x]=Y[E]=Y[c]=Y[K]=!1;var ae=typeof ke=="object"&&ke&&ke.Object===Object&&ke,T=typeof self=="object"&&self&&self.Object===Object&&self,A=ae||T||Function("return this")(),O=e&&!e.nodeType&&e,u=O&&!0&&t&&!t.nodeType&&t,b=u&&u.exports===O,H=b&&ae.process,W=function(){try{return H&&H.binding&&H.binding("util")}catch{}}(),he=W&&W.isTypedArray;function ve(p,L){for(var $=-1,k=p==null?0:p.length,Re=0,ie=[];++$<k;){var Ue=p[$];L(Ue,$,p)&&(ie[Re++]=Ue)}return ie}function de(p,L){for(var $=-1,k=L.length,Re=p.length;++$<k;)p[Re+$]=L[$];return p}function me(p,L){for(var $=-1,k=p==null?0:p.length;++$<k;)if(L(p[$],$,p))return!0;return!1}function Be(p,L){for(var $=-1,k=Array(p);++$<p;)k[$]=L($);return k}function $e(p){return function(L){return p(L)}}function ye(p,L){return p.has(L)}function pe(p,L){return p?.[L]}function le(p){var L=-1,$=Array(p.size);return p.forEach(function(k,Re){$[++L]=[Re,k]}),$}function ue(p,L){return function($){return p(L($))}}function ce(p){var L=-1,$=Array(p.size);return p.forEach(function(k){$[++L]=k}),$}var oe=Array.prototype,se=Function.prototype,te=Object.prototype,fe=A["__core-js_shared__"],ge=se.toString,ne=te.hasOwnProperty,_e=function(){var p=/[^.]+$/.exec(fe&&fe.keys&&fe.keys.IE_PROTO||"");return p?"Symbol(src)_1."+p:""}(),be=te.toString,Ee=RegExp("^"+ge.call(ne).replace(Q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=b?A.Buffer:void 0,we=A.Symbol,Lt=A.Uint8Array,Ft=te.propertyIsEnumerable,kt=oe.splice,mt=we?we.toStringTag:void 0,ar=Object.getOwnPropertySymbols,Qr=De?De.isBuffer:void 0,Bn=ue(Object.keys,Object),ze=Dr(A,"DataView"),Fe=Dr(A,"Map"),Ke=Dr(A,"Promise"),qe=Dr(A,"Set"),He=Dr(A,"WeakMap"),Me=Dr(Object,"create"),Je=ur(ze),Xe=ur(Fe),Ze=ur(Ke),Qe=ur(qe),et=ur(He),We=we?we.prototype:void 0,Ve=We?We.valueOf:void 0;function Ne(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function tt(){this.__data__=Me?Me(null):{},this.size=0}function rt(p){var L=this.has(p)&&delete this.__data__[p];return this.size-=L?1:0,L}function Tb(p){var L=this.__data__;if(Me){var $=L[p];return $===n?void 0:$}return ne.call(L,p)?L[p]:void 0}function Cb(p){var L=this.__data__;return Me?L[p]!==void 0:ne.call(L,p)}function Rb(p,L){var $=this.__data__;return this.size+=this.has(p)?0:1,$[p]=Me&&L===void 0?n:L,this}Ne.prototype.clear=tt,Ne.prototype.delete=rt,Ne.prototype.get=Tb,Ne.prototype.has=Cb,Ne.prototype.set=Rb;function qt(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function Nb(){this.__data__=[],this.size=0}function Pb(p){var L=this.__data__,$=Kn(L,p);if($<0)return!1;var k=L.length-1;return $==k?L.pop():kt.call(L,$,1),--this.size,!0}function $b(p){var L=this.__data__,$=Kn(L,p);return $<0?void 0:L[$][1]}function Fb(p){return Kn(this.__data__,p)>-1}function Mb(p,L){var $=this.__data__,k=Kn($,p);return k<0?(++this.size,$.push([p,L])):$[k][1]=L,this}qt.prototype.clear=Nb,qt.prototype.delete=Pb,qt.prototype.get=$b,qt.prototype.has=Fb,qt.prototype.set=Mb;function cr(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function Ub(){this.size=0,this.__data__={hash:new Ne,map:new(Fe||qt),string:new Ne}}function jb(p){var L=qn(this,p).delete(p);return this.size-=L?1:0,L}function Bb(p){return qn(this,p).get(p)}function zb(p){return qn(this,p).has(p)}function Kb(p,L){var $=qn(this,p),k=$.size;return $.set(p,L),this.size+=$.size==k?0:1,this}cr.prototype.clear=Ub,cr.prototype.delete=jb,cr.prototype.get=Bb,cr.prototype.has=zb,cr.prototype.set=Kb;function zn(p){var L=-1,$=p==null?0:p.length;for(this.__data__=new cr;++L<$;)this.add(p[L])}function qb(p){return this.__data__.set(p,n),this}function Hb(p){return this.__data__.has(p)}zn.prototype.add=zn.prototype.push=qb,zn.prototype.has=Hb;function Yt(p){var L=this.__data__=new qt(p);this.size=L.size}function Vb(){this.__data__=new qt,this.size=0}function Gb(p){var L=this.__data__,$=L.delete(p);return this.size=L.size,$}function Wb(p){return this.__data__.get(p)}function kb(p){return this.__data__.has(p)}function Yb(p,L){var $=this.__data__;if($ instanceof qt){var k=$.__data__;if(!Fe||k.length<r-1)return k.push([p,L]),this.size=++$.size,this;$=this.__data__=new cr(k)}return $.set(p,L),this.size=$.size,this}Yt.prototype.clear=Vb,Yt.prototype.delete=Gb,Yt.prototype.get=Wb,Yt.prototype.has=kb,Yt.prototype.set=Yb;function Jb(p,L){var $=Hn(p),k=!$&&h1(p),Re=!$&&!k&&ys(p),ie=!$&&!k&&!Re&&Fu(p),Ue=$||k||Re||ie,nt=Ue?Be(p.length,String):[],at=nt.length;for(var Pe in p)(L||ne.call(p,Pe))&&!(Ue&&(Pe=="length"||Re&&(Pe=="offset"||Pe=="parent")||ie&&(Pe=="buffer"||Pe=="byteLength"||Pe=="byteOffset")||o1(Pe,at)))&&nt.push(Pe);return nt}function Kn(p,L){for(var $=p.length;$--;)if(Ru(p[$][0],L))return $;return-1}function Xb(p,L,$){var k=L(p);return Hn(p)?k:de(k,$(p))}function en(p){return p==null?p===void 0?U:B:mt&&mt in Object(p)?i1(p):f1(p)}function Iu(p){return tn(p)&&en(p)==a}function Au(p,L,$,k,Re){return p===L?!0:p==null||L==null||!tn(p)&&!tn(L)?p!==p&&L!==L:Zb(p,L,$,k,Au,Re)}function Zb(p,L,$,k,Re,ie){var Ue=Hn(p),nt=Hn(L),at=Ue?f:Jt(p),Pe=nt?f:Jt(L);at=at==a?S:at,Pe=Pe==a?S:Pe;var wt=at==S,It=Pe==S,ut=at==Pe;if(ut&&ys(p)){if(!ys(L))return!1;Ue=!0,wt=!1}if(ut&&!wt)return ie||(ie=new Yt),Ue||Fu(p)?Tu(p,L,$,k,Re,ie):r1(p,L,at,$,k,Re,ie);if(!($&i)){var Dt=wt&&ne.call(p,"__wrapped__"),xt=It&&ne.call(L,"__wrapped__");if(Dt||xt){var Xt=Dt?p.value():p,Ht=xt?L.value():L;return ie||(ie=new Yt),Re(Xt,Ht,$,k,ie)}}return ut?(ie||(ie=new Yt),n1(p,L,$,k,Re,ie)):!1}function Qb(p){if(!$u(p)||c1(p))return!1;var L=Nu(p)?Ee:q;return L.test(ur(p))}function e1(p){return tn(p)&&Pu(p.length)&&!!Y[en(p)]}function t1(p){if(!u1(p))return Bn(p);var L=[];for(var $ in Object(p))ne.call(p,$)&&$!="constructor"&&L.push($);return L}function Tu(p,L,$,k,Re,ie){var Ue=$&i,nt=p.length,at=L.length;if(nt!=at&&!(Ue&&at>nt))return!1;var Pe=ie.get(p);if(Pe&&ie.get(L))return Pe==L;var wt=-1,It=!0,ut=$&s?new zn:void 0;for(ie.set(p,L),ie.set(L,p);++wt<nt;){var Dt=p[wt],xt=L[wt];if(k)var Xt=Ue?k(xt,Dt,wt,L,p,ie):k(Dt,xt,wt,p,L,ie);if(Xt!==void 0){if(Xt)continue;It=!1;break}if(ut){if(!me(L,function(Ht,fr){if(!ye(ut,fr)&&(Dt===Ht||Re(Dt,Ht,$,k,ie)))return ut.push(fr)})){It=!1;break}}else if(!(Dt===xt||Re(Dt,xt,$,k,ie))){It=!1;break}}return ie.delete(p),ie.delete(L),It}function r1(p,L,$,k,Re,ie,Ue){switch($){case J:if(p.byteLength!=L.byteLength||p.byteOffset!=L.byteOffset)return!1;p=p.buffer,L=L.buffer;case G:return!(p.byteLength!=L.byteLength||!ie(new Lt(p),new Lt(L)));case l:case D:case R:return Ru(+p,+L);case v:return p.name==L.name&&p.message==L.message;case x:case c:return p==L+"";case P:var nt=le;case E:var at=k&i;if(nt||(nt=ce),p.size!=L.size&&!at)return!1;var Pe=Ue.get(p);if(Pe)return Pe==L;k|=s,Ue.set(p,L);var wt=Tu(nt(p),nt(L),k,Re,ie,Ue);return Ue.delete(p),wt;case d:if(Ve)return Ve.call(p)==Ve.call(L)}return!1}function n1(p,L,$,k,Re,ie){var Ue=$&i,nt=Cu(p),at=nt.length,Pe=Cu(L),wt=Pe.length;if(at!=wt&&!Ue)return!1;for(var It=at;It--;){var ut=nt[It];if(!(Ue?ut in L:ne.call(L,ut)))return!1}var Dt=ie.get(p);if(Dt&&ie.get(L))return Dt==L;var xt=!0;ie.set(p,L),ie.set(L,p);for(var Xt=Ue;++It<at;){ut=nt[It];var Ht=p[ut],fr=L[ut];if(k)var Mu=Ue?k(fr,Ht,ut,L,p,ie):k(Ht,fr,ut,p,L,ie);if(!(Mu===void 0?Ht===fr||Re(Ht,fr,$,k,ie):Mu)){xt=!1;break}Xt||(Xt=ut=="constructor")}if(xt&&!Xt){var Vn=p.constructor,Gn=L.constructor;Vn!=Gn&&"constructor"in p&&"constructor"in L&&!(typeof Vn=="function"&&Vn instanceof Vn&&typeof Gn=="function"&&Gn instanceof Gn)&&(xt=!1)}return ie.delete(p),ie.delete(L),xt}function Cu(p){return Xb(p,p1,s1)}function qn(p,L){var $=p.__data__;return a1(L)?$[typeof L=="string"?"string":"hash"]:$.map}function Dr(p,L){var $=pe(p,L);return Qb($)?$:void 0}function i1(p){var L=ne.call(p,mt),$=p[mt];try{p[mt]=void 0;var k=!0}catch{}var Re=be.call(p);return k&&(L?p[mt]=$:delete p[mt]),Re}var s1=ar?function(p){return p==null?[]:(p=Object(p),ve(ar(p),function(L){return Ft.call(p,L)}))}:g1,Jt=en;(ze&&Jt(new ze(new ArrayBuffer(1)))!=J||Fe&&Jt(new Fe)!=P||Ke&&Jt(Ke.resolve())!=I||qe&&Jt(new qe)!=E||He&&Jt(new He)!=K)&&(Jt=function(p){var L=en(p),$=L==S?p.constructor:void 0,k=$?ur($):"";if(k)switch(k){case Je:return J;case Xe:return P;case Ze:return I;case Qe:return E;case et:return K}return L});function o1(p,L){return L=L??o,!!L&&(typeof p=="number"||ee.test(p))&&p>-1&&p%1==0&&p<L}function a1(p){var L=typeof p;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?p!=="__proto__":p===null}function c1(p){return!!_e&&_e in p}function u1(p){var L=p&&p.constructor,$=typeof L=="function"&&L.prototype||te;return p===$}function f1(p){return be.call(p)}function ur(p){if(p!=null){try{return ge.call(p)}catch{}try{return p+""}catch{}}return""}function Ru(p,L){return p===L||p!==p&&L!==L}var h1=Iu(function(){return arguments}())?Iu:function(p){return tn(p)&&ne.call(p,"callee")&&!Ft.call(p,"callee")},Hn=Array.isArray;function l1(p){return p!=null&&Pu(p.length)&&!Nu(p)}var ys=Qr||y1;function d1(p,L){return Au(p,L)}function Nu(p){if(!$u(p))return!1;var L=en(p);return L==m||L==w||L==h||L==y}function Pu(p){return typeof p=="number"&&p>-1&&p%1==0&&p<=o}function $u(p){var L=typeof p;return p!=null&&(L=="object"||L=="function")}function tn(p){return p!=null&&typeof p=="object"}var Fu=he?$e(he):e1;function p1(p){return l1(p)?Jb(p):t1(p)}function g1(){return[]}function y1(){return!1}t.exports=d1})(rs,rs.exports);var Tv=rs.exports,Cv=Object.defineProperty,Dc=Object.getOwnPropertySymbols,Rv=Object.prototype.hasOwnProperty,Nv=Object.prototype.propertyIsEnumerable,xc=(t,e,r)=>e in t?Cv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ht=(t,e)=>{for(var r in e||(e={}))Rv.call(e,r)&&xc(t,r,e[r]);if(Dc)for(var r of Dc(e))Nv.call(e,r)&&xc(t,r,e[r]);return t};function Pv(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,f=t.charAt(0),h=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var P=0,R=0,B=0,S=w.length;B!==S&&w[B]===0;)B++,P++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=w[B],E=0,c=I-1;(x!==0||E<R)&&c!==-1;c--,E++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=E,B++}for(var d=I-R;d!==I&&y[d]===0;)d++;for(var U=f.repeat(P);d<I;++d)U+=t.charAt(y[d]);return U}function v(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var P=0;if(w[P]!==" "){for(var R=0,B=0;w[P]===f;)R++,P++;for(var S=(w.length-P)*h+1>>>0,I=new Uint8Array(S);w[P];){var y=r[w.charCodeAt(P)];if(y===255)return;for(var x=0,E=S-1;(y!==0||x<B)&&E!==-1;E--,x++)y+=a*I[E]>>>0,I[E]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,P++}if(w[P]!==" "){for(var c=S-B;c!==S&&I[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=I[c++];return d}}}function m(w){var P=v(w);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:v,decode:m}}var $v=Pv,Fv=$v;const Sc=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Mv=t=>new TextEncoder().encode(t),Uv=t=>new TextDecoder().decode(t);class jv{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Bv{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return Oc(this,e)}}class zv{constructor(e){this.decoders=e}or(e){return Oc(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Oc=(t,e)=>new zv(ht(ht({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class Kv{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new jv(e,r,n),this.decoder=new Bv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Tn=({name:t,prefix:e,encode:r,decode:n})=>new Kv(t,e,r,n),Jr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Fv(r,e);return Tn({prefix:t,name:e,encode:n,decode:s=>Sc(i(s))})},qv=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,f=0,h=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|D,a+=r,a>=8&&(a-=8,o[h++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return o},Hv=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},ot=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Tn({prefix:e,name:t,encode(i){return Hv(i,n,r)},decode(i){return qv(i,n,r,t)}}),Vv=Tn({prefix:"\0",name:"identity",encode:t=>Uv(t),decode:t=>Mv(t)});var Gv=Object.freeze({__proto__:null,identity:Vv});const Wv=ot({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var kv=Object.freeze({__proto__:null,base2:Wv});const Yv=ot({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Jv=Object.freeze({__proto__:null,base8:Yv});const Xv=Jr({prefix:"9",name:"base10",alphabet:"0123456789"});var Zv=Object.freeze({__proto__:null,base10:Xv});const Qv=ot({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),e_=ot({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var t_=Object.freeze({__proto__:null,base16:Qv,base16upper:e_});const r_=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),n_=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),i_=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),s_=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),o_=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),a_=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),c_=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),u_=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),f_=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var h_=Object.freeze({__proto__:null,base32:r_,base32upper:n_,base32pad:i_,base32padupper:s_,base32hex:o_,base32hexupper:a_,base32hexpad:c_,base32hexpadupper:u_,base32z:f_});const l_=Jr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),d_=Jr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var p_=Object.freeze({__proto__:null,base36:l_,base36upper:d_});const g_=Jr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),y_=Jr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var v_=Object.freeze({__proto__:null,base58btc:g_,base58flickr:y_});const __=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),b_=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),m_=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),w_=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var E_=Object.freeze({__proto__:null,base64:__,base64pad:b_,base64url:m_,base64urlpad:w_});const Lc=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),D_=Lc.reduce((t,e,r)=>(t[r]=e,t),[]),x_=Lc.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function S_(t){return t.reduce((e,r)=>(e+=D_[r],e),"")}function O_(t){const e=[];for(const r of t){const n=x_[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const L_=Tn({prefix:"\u{1F680}",name:"base256emoji",encode:S_,decode:O_});var I_=Object.freeze({__proto__:null,base256emoji:L_}),A_=Ac,Ic=128,T_=127,C_=~T_,R_=Math.pow(2,31);function Ac(t,e,r){e=e||[],r=r||0;for(var n=r;t>=R_;)e[r++]=t&255|Ic,t/=128;for(;t&C_;)e[r++]=t&255|Ic,t>>>=7;return e[r]=t|0,Ac.bytes=r-n+1,e}var N_=ns,P_=128,Tc=127;function ns(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw ns.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Tc)<<i:(o&Tc)*Math.pow(2,i),i+=7}while(o>=P_);return ns.bytes=s-n,r}var $_=Math.pow(2,7),F_=Math.pow(2,14),M_=Math.pow(2,21),U_=Math.pow(2,28),j_=Math.pow(2,35),B_=Math.pow(2,42),z_=Math.pow(2,49),K_=Math.pow(2,56),q_=Math.pow(2,63),H_=function(t){return t<$_?1:t<F_?2:t<M_?3:t<U_?4:t<j_?5:t<B_?6:t<z_?7:t<K_?8:t<q_?9:10},V_={encode:A_,decode:N_,encodingLength:H_},Cc=V_;const Rc=(t,e,r=0)=>(Cc.encode(t,e,r),e),Nc=t=>Cc.encodingLength(t),is=(t,e)=>{const r=e.byteLength,n=Nc(t),i=n+Nc(r),s=new Uint8Array(i+r);return Rc(t,s,0),Rc(r,s,n),s.set(e,i),new G_(t,r,e,s)};class G_{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Pc=({name:t,code:e,encode:r})=>new W_(t,e,r);class W_{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?is(this.code,r):r.then(n=>is(this.code,n))}else throw Error("Unknown type, must be binary type")}}const $c=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),k_=Pc({name:"sha2-256",code:18,encode:$c("SHA-256")}),Y_=Pc({name:"sha2-512",code:19,encode:$c("SHA-512")});var J_=Object.freeze({__proto__:null,sha256:k_,sha512:Y_});const Fc=0,X_="identity",Mc=Sc;var Z_=Object.freeze({__proto__:null,identity:{code:Fc,name:X_,encode:Mc,digest:t=>is(Fc,Mc(t))}});new TextEncoder,new TextDecoder;const Uc=ht(ht(ht(ht(ht(ht(ht(ht(ht(ht({},Gv),kv),Jv),Zv),t_),h_),p_),v_),E_),I_);ht(ht({},J_),Z_);function Q_(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function jc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Bc=jc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ss=jc("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=Q_(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),e0=ht({utf8:Bc,"utf-8":Bc,hex:Uc.base16,latin1:ss,ascii:ss,binary:ss},Uc);function t0(t,e="utf8"){const r=e0[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}const zc="wc",r0=2,os="core",Wt=`${zc}@${2}:${os}:`,n0={name:os,logger:"error"},i0={database:":memory:"},s0="crypto",Kc="client_ed25519_seed",o0=Z.ONE_DAY,a0="keychain",c0="0.3",u0="messages",f0="0.3",h0=Z.SIX_HOURS,l0="publisher",qc="irn",d0="error",p0="wss://relay.walletconnect.com",g0="relayer",lt={message:"relayer_message",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},y0="_subscription",Cn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Hc=Z.ONE_SECOND,v0="2.2.1",_0="0.3",Nt={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},b0="subscription",m0="0.3",w0=Z.FIVE_SECONDS*1e3,E0="pairing",D0="0.3",Xr={wc_pairingDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:0},res:{ttl:Z.ONE_DAY,prompt:!1,tag:0}}},Pt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},x0="history",S0="0.3",O0="expirer",Et={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},L0="0.3";class I0{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=a0,this.version=c0,this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=V("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ta(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ra(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class A0{constructor(e,r,n){this.core=e,this.logger=r,this.name=s0,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=hc(i);return fc(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=ep();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=hc(s),a=Ri();return await bv(a,i,o0,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),f=tp(a,s);return this.setSymKey(f,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||rp(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=Yo(o),f=Ir(s);if(Jo(a)){const v=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(v,m)}const h=this.getSymKey(i),{type:l,senderPublicKey:D}=a;return ip({type:l,symKey:h,message:f,senderPublicKey:D})},this.decode=async(i,s,o)=>{this.isInitialized();const a=ap(s,o);if(Jo(a)){const l=a.receiverPublicKey,D=a.senderPublicKey;i=await this.generateSharedKey(l,D)}const f=this.getSymKey(i),h=sp({symKey:f,encoded:s});return ni(h)},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.keychain=n||new I0(this.core,this.logger)}get context(){return Oe.getLoggerContext(this.logger)}getPayloadType(e){const r=Pi(e);return $r(r.type)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Kc)}catch{e=Ri(),await this.keychain.set(Kc,e)}return t0(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class T0 extends Zy{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=u0,this.version=f0,this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Ni(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Ni(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Oe.generateChildLogger(e,this.name),this.core=r}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ta(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ra(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class C0 extends Qy{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new zt.exports.EventEmitter,this.name=l0,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{const o=s?.ttl||h0,a=$i(s),f=s?.prompt||!1,h=s?.tag||0,l={topic:n,message:i,opts:{ttl:o,relay:a,prompt:f,tag:h}},D=Ni(i);this.queue.set(D,l);try{await await na(this.rpcPublish(n,i,o,a,f,h),this.publishTimeout),this.relayer.events.emit(lt.publish,l)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(lt.connection_stalled);return}this.onPublish(D,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Oe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Oe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,f,h,l;const D={method:Fi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return bt((a=D.params)==null?void 0:a.prompt)&&((f=D.params)==null||delete f.prompt),bt((h=D.params)==null?void 0:h.tag)&&((l=D.params)==null||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:D}),this.relayer.provider.request(D)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}}class R0{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var N0=Object.defineProperty,P0=Object.defineProperties,$0=Object.getOwnPropertyDescriptors,Vc=Object.getOwnPropertySymbols,F0=Object.prototype.hasOwnProperty,M0=Object.prototype.propertyIsEnumerable,Gc=(t,e,r)=>e in t?N0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rn=(t,e)=>{for(var r in e||(e={}))F0.call(e,r)&&Gc(t,r,e[r]);if(Vc)for(var r of Vc(e))M0.call(e,r)&&Gc(t,r,e[r]);return t},as=(t,e)=>P0(t,$0(e));class U0 extends rv{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new R0,this.events=new zt.exports.EventEmitter,this.name=b0,this.version=m0,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=Wt,this.subscribeTimeout=1e4,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable())},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=$i(i),o={topic:n,relay:s};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{const o=new Z.Watch;o.start(this.pendingSubscriptionWatchLabel);const a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=w0&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pendingSubInterval)}),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{await this.restore(),await this.reset()},this.relayer=e,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.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,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=$i(n);await this.rpcUnsubscribe(e,r,i);const s=Ge("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){const n={method:Fi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await na(this.relayer.provider.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(lt.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:Fi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.provider.request(i)}onSubscribe(e,r){this.setSubscription(e,as(Rn({},r),{id:e})),this.pending.delete(r.topic)}onResubscribe(e,r){this.addSubscription(e,as(Rn({},r),{id:e})),this.pending.delete(r.topic)}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,Rn({},r)),this.topicMap.set(r.topic,e),this.events.emit(Nt.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Nt.deleted,as(Rn({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Nt.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(Nt.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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)}}async resubscribe(e){if(!this.ids.includes(e.id)){const{topic:r,relay:n}=e,i={topic:r,relay:n};this.pending.set(i.topic,i);const s=await this.rpcSubscribe(i.topic,i.relay);this.onResubscribe(s,i)}}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{const r=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(r,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.on(lt.connect,async()=>{await this.onConnect()}),this.relayer.on(lt.disconnect,()=>{this.onDisconnect()}),this.events.on(Nt.created,async e=>{const r=Nt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Nt.deleted,async e=>{const r=Nt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var j0=Object.defineProperty,Wc=Object.getOwnPropertySymbols,B0=Object.prototype.hasOwnProperty,z0=Object.prototype.propertyIsEnumerable,kc=(t,e,r)=>e in t?j0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K0=(t,e)=>{for(var r in e||(e={}))B0.call(e,r)&&kc(t,r,e[r]);if(Wc)for(var r of Wc(e))z0.call(e,r)&&kc(t,r,e[r]);return t};class q0 extends ev{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zt.exports.EventEmitter,this.name=g0,this.transportExplicitlyClosed=!1,this.initialized=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Oe.generateChildLogger(e.logger,this.name):_n(Oe.getDefaultLoggerOptions({level:e.logger||d0})),this.messages=new T0(this.logger,e.core),this.subscriber=new U0(this,this.logger),this.publisher=new C0(this,this.logger),this.relayUrl=e?.relayUrl||p0,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return Oe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Nt.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&await this.provider.disconnect(),this.events.emit(lt.transport_closed)}async transportOpen(e){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Nt.resubscribed,()=>{r()})}),await Promise.race([this.provider.connect(),new Promise((r,n)=>this.once(lt.transport_closed,()=>{n()}))])])}catch(r){const n=r;if(!/socket hang up/i.test(n.message))throw new Error(n.message);this.logger.error(n),this.events.emit(lt.transport_closed)}}async restartTransport(e){await this.transportClose(),await new Promise(r=>setTimeout(r,Hc)),await this.transportOpen(e)}async createProvider(){const e=await this.core.crypto.signJWT(this.relayUrl);return new ti(new Av(wp({sdkVersion:v0,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Qn(e)){if(!e.method.endsWith(y0))return;const r=e.params,{topic:n,message:i}=r.data,s={topic:n,message:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(K0({type:"event",event:r.id},s)),this.events.emit(r.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(lt.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=on(e.id,!0);await this.provider.connection.send(r)}registerEventListeners(){this.provider.on(Cn.payload,e=>this.onProviderPayload(e)),this.provider.on(Cn.connect,()=>{this.events.emit(lt.connect)}),this.provider.on(Cn.disconnect,()=>{this.events.emit(lt.disconnect),this.attemptToReconnect()}),this.provider.on(Cn.error,e=>this.events.emit(lt.error,e)),this.events.on(lt.connection_stalled,async()=>{await this.restartTransport()})}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.transportOpen()},Z.toMiliseconds(Hc))}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var H0=Object.defineProperty,Yc=Object.getOwnPropertySymbols,V0=Object.prototype.hasOwnProperty,G0=Object.prototype.propertyIsEnumerable,Jc=(t,e,r)=>e in t?H0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xc=(t,e)=>{for(var r in e||(e={}))V0.call(e,r)&&Jc(t,r,e[r]);if(Yc)for(var r of Yc(e))G0.call(e,r)&&Jc(t,r,e[r]);return t};class Nn extends tv{constructor(e,r,n,i=Wt,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=_0,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{Kp(o)?this.map.set(o.id,o):qp(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!bt(o)&&this.map.set(this.getKey(o),o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(f=>Tv(a[f],o[f]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const f=Xc(Xc({},this.getData(o)),a);this.map.set(o,f),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Oe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Oe.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())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class W0{constructor(e,r){this.core=e,this.logger=r,this.name=E0,this.version=D0,this.events=new zt.exports,this.initialized=!1,this.storagePrefix=Wt,this.ignoredPayloadTypes=[rr],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=Ri(),i=await this.core.crypto.setSymKey(n),s=Tt(Z.FIVE_MINUTES),o={protocol:qc},a={topic:i,expiry:s,relay:o,active:!1},f=Rp({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:f}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:s,relay:o}=Tp(n.uri),a=Tt(Z.FIVE_MINUTES),f={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,f),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),f},this.activate=async({topic:n})=>{this.isInitialized();const i=Tt(Z.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:f}=nr();this.events.once(je("pairing_ping",s),({error:h})=>{h?f(h):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Ge("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{const o=sn(i,s),a=await this.core.crypto.encode(n,o),f=Xr[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,f),o.id},this.sendResult=async(n,i,s)=>{const o=on(n,s),a=await this.core.crypto.encode(i,o),f=await this.core.history.get(i,n),h=Xr[f.request.method].res;await this.core.relayer.publish(i,a,h),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Lr(n,s),a=await this.core.crypto.encode(i,o),f=await this.core.history.get(i,n),h=Xr[f.request.method]?Xr[f.request.method].res:Xr.unregistered_method.res;await this.core.relayer.publish(i,a,h),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Ge("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>Gt(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n,o=s.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;if(this.pairings.keys.includes(i))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{Bt(i)?this.events.emit(je("pairing_ping",s),{}):Ot(i)&&this.events.emit(je("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.sendResult(s,n,!0),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Ge("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Ge("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!vt(n)){const{message:i}=V("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!zp(n.uri)){const{message:i}=V("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!vt(n)){const{message:s}=V("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!vt(n)){const{message:s}=V("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!st(n,!1)){const{message:i}=V("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Gt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=V("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.pairings=new Nn(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Oe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(lt.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(r,n);Qn(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):ei(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Et.expired,async e=>{const{topic:r}=sa(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}}class k0 extends Xy{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new zt.exports.EventEmitter,this.name=x0,this.version=S0,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Pt.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ot(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Pt.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Pt.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.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(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:sn(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Pt.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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(Pt.created,e=>{const r=Pt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Pt.updated,e=>{const r=Pt.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Pt.deleted,e=>{const r=Pt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Y0 extends nv{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new zt.exports.EventEmitter,this.name=O0,this.version=L0,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Et.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Et.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.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(typeof e=="string")return Ep(e);if(typeof e=="number")return Dp(e);const{message:r}=V("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Et.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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 r=this.expirations.get(e);if(!r){const{message:n}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;Z.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Et.expired,{target:e,expiration:r})}checkExpirations(){this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Et.created,e=>{const r=Et.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Et.expired,e=>{const r=Et.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Et.deleted,e=>{const r=Et.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var J0=Object.defineProperty,Zc=Object.getOwnPropertySymbols,X0=Object.prototype.hasOwnProperty,Z0=Object.prototype.propertyIsEnumerable,Qc=(t,e,r)=>e in t?J0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eu=(t,e)=>{for(var r in e||(e={}))X0.call(e,r)&&Qc(t,r,e[r]);if(Zc)for(var r of Zc(e))Z0.call(e,r)&&Qc(t,r,e[r]);return t};class cs extends Jy{constructor(e){super(e),this.protocol=zc,this.version=r0,this.name=os,this.events=new zt.exports.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:_n(Oe.getDefaultLoggerOptions({level:e?.logger||n0.logger}));this.logger=Oe.generateChildLogger(r,this.name),this.heartbeat=new Vr.HeartBeat,this.crypto=new A0(this,this.logger,e?.keychain),this.history=new k0(this,this.logger),this.expirer=new Y0(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Jg(eu(eu({},i0),e?.storageOptions)),this.relayer=new q0({core:this,logger:this.logger,relayUrl:e?.relayUrl,projectId:this.projectId}),this.pairing=new W0(this,this.logger)}static async init(e){const r=new cs(e);return await r.initialize(),r}get context(){return Oe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await 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 Q0=cs;var Pn={exports:{}},wr=typeof Reflect=="object"?Reflect:null,tu=wr&&typeof wr.apply=="function"?wr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},$n;wr&&typeof wr.ownKeys=="function"?$n=wr.ownKeys:Object.getOwnPropertySymbols?$n=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:$n=function(e){return Object.getOwnPropertyNames(e)};function eb(t){console&&console.warn&&console.warn(t)}var ru=Number.isNaN||function(e){return e!==e};function Ae(){Ae.init.call(this)}Pn.exports=Ae,Pn.exports.once=ib,Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;var nu=10;function Fn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return nu},set:function(t){if(typeof t!="number"||t<0||ru(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");nu=t}}),Ae.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ae.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ru(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};function iu(t){return t._maxListeners===void 0?Ae.defaultMaxListeners:t._maxListeners}Ae.prototype.getMaxListeners=function(){return iu(this)},Ae.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")tu(f,this,r);else for(var h=f.length,l=uu(f,h),n=0;n<h;++n)tu(l[n],this,r);return!0};function su(t,e,r,n){var i,s,o;if(Fn(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=iu(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,eb(a)}return t}Ae.prototype.addListener=function(e,r){return su(this,e,r,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(e,r){return su(this,e,r,!0)};function tb(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ou(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=tb.bind(n);return i.listener=r,n.wrapFn=i,i}Ae.prototype.once=function(e,r){return Fn(r),this.on(e,ou(this,e,r)),this},Ae.prototype.prependOnceListener=function(e,r){return Fn(r),this.prependListener(e,ou(this,e,r)),this},Ae.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Fn(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():rb(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ae.prototype.off=Ae.prototype.removeListener,Ae.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function au(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?nb(i):uu(i,i.length)}Ae.prototype.listeners=function(e){return au(this,e,!0)},Ae.prototype.rawListeners=function(e){return au(this,e,!1)},Ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):cu.call(t,e)},Ae.prototype.listenerCount=cu;function cu(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ae.prototype.eventNames=function(){return this._eventsCount>0?$n(this._events):[]};function uu(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function rb(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function nb(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function ib(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}fu(t,e,s,{once:!0}),e!=="error"&&sb(t,i,{once:!0})})}function sb(t,e,r){typeof t.on=="function"&&fu(t,"error",e,r)}function fu(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}const hu="wc",lu=2,du="client",us=`${hu}@${lu}:${du}:`,fs={name:du,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},ob="proposal",ab="session",Mn=Z.SEVEN_DAYS,cb="engine",Zr={wc_sessionPropose:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1115}}},hs={min:Z.FIVE_MINUTES,max:Z.SEVEN_DAYS},ub="request";var fb=Object.defineProperty,hb=Object.defineProperties,lb=Object.getOwnPropertyDescriptors,pu=Object.getOwnPropertySymbols,db=Object.prototype.hasOwnProperty,pb=Object.prototype.propertyIsEnumerable,gu=(t,e,r)=>e in t?fb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kt=(t,e)=>{for(var r in e||(e={}))db.call(e,r)&&gu(t,r,e[r]);if(pu)for(var r of pu(e))pb.call(e,r)&&gu(t,r,e[r]);return t},ls=(t,e)=>hb(t,lb(e));class gb extends sv{constructor(e){super(e),this.name=cb,this.events=new Pn.exports,this.initialized=!1,this.ignoredPayloadTypes=[rr],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Zr)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized(),await this.isValidConnect(r);const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;let o=n,a,f=!1;if(o&&(f=this.client.core.pairing.pairings.get(o).active),!o||!f){const{topic:R,uri:B}=await this.client.core.pairing.create();o=R,a=B}const h=await this.client.core.crypto.generateKeyPair(),l={requiredNamespaces:i,relays:s??[{protocol:qc}],proposer:{publicKey:h,metadata:this.client.metadata}},{reject:D,resolve:v,done:m}=nr();if(this.events.once(je("session_connect"),async({error:R,session:B})=>{if(R)D(R);else if(B){B.self.publicKey=h;const S=ls(Kt({},B),{requiredNamespaces:B.requiredNamespaces});await this.client.session.set(B.topic,S),await this.setExpiry(B.topic,B.expiry),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:B.peer.metadata}),v(S)}}),!o){const{message:R}=V("NO_MATCHING_KEY",`connect() pairing topic: ${o}`);throw new Error(R)}const w=await this.sendRequest(o,"wc_sessionPropose",l),P=Tt(Z.FIVE_MINUTES);return await this.setProposal(w,Kt({id:w,expiry:P},l)),{uri:a,approval:m}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);const{id:n,relayProtocol:i,namespaces:s}=r,o=this.client.proposal.get(n);let{pairingTopic:a,proposer:f,requiredNamespaces:h}=o;yn(h)||(h=Fp(s,"approve()"),this.client.proposal.set(n,ls(Kt({},o),{requiredNamespaces:h})));const l=await this.client.core.crypto.generateKeyPair(),D=f.publicKey,v=await this.client.core.crypto.generateSharedKey(l,D),m={relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:h,controller:{publicKey:l,metadata:this.client.metadata},expiry:Tt(Mn)};await this.client.core.relayer.subscribe(v);const w=await this.sendRequest(v,"wc_sessionSettle",m),{done:P,resolve:R,reject:B}=nr();this.events.once(je("session_approve",w),({error:I})=>{I?B(I):R(this.client.session.get(v))});const S=ls(Kt({},m),{topic:v,acknowledged:!1,self:m.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:l});return await this.client.session.set(v,S),await this.setExpiry(v,Tt(Mn)),a&&await this.client.core.pairing.updateMetadata({topic:a,metadata:S.peer.metadata}),a&&n&&(await this.sendResult(n,a,{relay:{protocol:i??"irn"},responderPublicKey:l}),await this.client.proposal.delete(n,Ge("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:a})),{topic:v,acknowledged:P}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);const{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,Ge("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);const{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:f}=nr();return this.events.once(je("session_update",s),({error:h})=>{h?f(h):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);const{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=nr();return this.events.once(je("session_extend",i),({error:f})=>{f?a(f):o()}),await this.setExpiry(n,Tt(Mn)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);const{chainId:n,request:i,topic:s,expiry:o}=r,a=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n},o),{done:f,resolve:h,reject:l}=nr(o);return this.events.once(je("session_request",a),({error:D,result:v})=>{D?l(D):h(v)}),await f()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i;Bt(i)?await this.sendResult(s,n,i.result):Ot(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=nr();this.events.once(je("session_ping",i),({error:f})=>{f?a(f):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",Ge("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>jp(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{const{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,Ge("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ge("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{const n=Zr.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,Tt(n))},this.sendRequest=async(r,n,i,s)=>{const o=sn(n,i),a=await this.client.core.crypto.encode(r,o),f=Zr[n].req;return s&&(f.ttl=s),this.client.core.history.set(r,o),this.client.core.relayer.publish(r,a,f),o.id},this.sendResult=async(r,n,i)=>{const s=on(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),f=Zr[a.request.method].res;this.client.core.relayer.publish(n,o,f),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{const s=Lr(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),f=Zr[a.request.method].res;this.client.core.relayer.publish(n,o,f),await this.client.core.history.resolve(s)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{Gt(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Gt(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{const{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidConnect(Kt({},n.params));const o=Tt(Z.FIVE_MINUTES),a=Kt({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{const{id:i}=n;if(Bt(n)){const{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});const o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});const f=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const h=await this.client.core.crypto.generateSharedKey(a,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const l=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:r})}else Ot(n)&&(await this.client.proposal.delete(i,Ge("USER_DISCONNECTED")),this.events.emit(je("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:f,namespaces:h,requiredNamespaces:l}=n.params,D={topic:r,relay:o,expiry:f,namespaces:h,acknowledged:!0,requiredNamespaces:l,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}};await this.sendResult(n.id,r,!0),this.events.emit(je("session_connect"),{session:D})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;Bt(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(je("session_approve",i),{})):Ot(n)&&(await this.client.session.delete(r,Ge("USER_DISCONNECTED")),this.events.emit(je("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidUpdate(Kt({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n;Bt(n)?this.events.emit(je("session_update",i),{}):Ot(n)&&this.events.emit(je("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Tt(Mn)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n;Bt(n)?this.events.emit(je("session_extend",i),{}):Ot(n)&&this.events.emit(je("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n;setTimeout(()=>{Bt(n)?this.events.emit(je("session_ping",i),{}):Ot(n)&&this.events.emit(je("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await this.sendResult(i,r,!0),await this.deleteSession(r),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidRequest(Kt({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n;Bt(n)?this.events.emit(je("session_request",i),{result:n.result}):Ot(n)&&this.events.emit(je("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidEmit(Kt({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!vt(r)){const{message:a}=V("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;if(bt(n)||await this.isValidPairingTopic(n),!bt(i)&&yn(i)===0)return;const o=Wp(i,"connect()");if(o)throw new Error(o.message);if(!kp(s,!0)){const{message:a}=V("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(a)}},this.isValidApprove=async r=>{if(!vt(r))throw new Error(V("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s}=r;await this.isValidProposalId(n);const o=this.client.proposal.get(n),a=vn(i,"approve()");if(a)throw new Error(a.message);const f=ga(o.requiredNamespaces,i,"update()");if(f)throw new Error(f.message);if(!st(s,!0)){const{message:h}=V("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}},this.isValidReject=async r=>{if(!vt(r)){const{message:s}=V("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(await this.isValidProposalId(n),!Jp(i)){const{message:s}=V("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!vt(r)){const{message:h}=V("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(h)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!da(n)){const{message:h}=V("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const a=Hp(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const f=vn(s,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(Gt(o)){const{message:h}=V("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async r=>{if(!vt(r)){const{message:f}=V("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(f)}const{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=vn(i,"update()");if(o)throw new Error(o.message);const a=ga(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!vt(r)){const{message:i}=V("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!vt(r)){const{message:f}=V("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(f)}const{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!pa(a,s)){const{message:f}=V("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(f)}if(!Xp(i)){const{message:f}=V("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!eg(a,s,i.method)){const{message:f}=V("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(o&&!rg(o,hs)){const{message:f}=V("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${hs.min} and ${hs.max}`);throw new Error(f)}},this.isValidRespond=async r=>{if(!vt(r)){const{message:s}=V("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}const{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!Zp(i)){const{message:s}=V("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!vt(r)){const{message:i}=V("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!vt(r)){const{message:a}=V("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!pa(o,s)){const{message:a}=V("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!Qp(i)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!tg(o,s,i.name)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!vt(r)){const{message:i}=V("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(lt.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const i=await this.client.core.crypto.decode(r,n);Qn(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):ei(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(Et.expired,async e=>{const{topic:r,id:n}=sa(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,V("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&await this.deleteProposal(n,!0)})}isValidPairingTopic(e){if(!st(e,!1)){const{message:r}=V("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=V("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!st(e,!1)){const{message:r}=V("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:r}=V("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(st(e,!1)){const{message:r}=V("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=V("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!Yp(e)){const{message:r}=V("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:r}=V("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class yb extends Nn{constructor(e,r){super(e,r,ob,us),this.core=e,this.logger=r}}class vb extends Nn{constructor(e,r){super(e,r,ab,us),this.core=e,this.logger=r}}class _b extends Nn{constructor(e,r){super(e,r,ub,us),this.core=e,this.logger=r}}class ds extends iv{constructor(e){super(e),this.protocol=hu,this.version=lu,this.name=fs.name,this.events=new Pn.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||fs.name,this.metadata=e?.metadata||vp();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:_n(Oe.getDefaultLoggerOptions({level:e?.logger||fs.logger}));this.core=e?.core||new Q0(e),this.logger=Oe.generateChildLogger(r,this.name),this.session=new vb(this.core,this.logger),this.proposal=new yb(this.core,this.logger),this.pendingRequest=new _b(this.core,this.logger),this.engine=new gb(this)}static async init(e){const r=new ds(e);return await r.initialize(),r}get context(){return Oe.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var ps={exports:{}},Er=typeof Reflect=="object"?Reflect:null,yu=Er&&typeof Er.apply=="function"?Er.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Un;Er&&typeof Er.ownKeys=="function"?Un=Er.ownKeys:Object.getOwnPropertySymbols?Un=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Un=function(e){return Object.getOwnPropertyNames(e)};function bb(t){console&&console.warn&&console.warn(t)}var vu=Number.isNaN||function(e){return e!==e};function Te(){Te.init.call(this)}ps.exports=Te,ps.exports.once=Db,Te.EventEmitter=Te,Te.prototype._events=void 0,Te.prototype._eventsCount=0,Te.prototype._maxListeners=void 0;var _u=10;function jn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Te,"defaultMaxListeners",{enumerable:!0,get:function(){return _u},set:function(t){if(typeof t!="number"||t<0||vu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");_u=t}}),Te.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||vu(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};function bu(t){return t._maxListeners===void 0?Te.defaultMaxListeners:t._maxListeners}Te.prototype.getMaxListeners=function(){return bu(this)},Te.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")yu(f,this,r);else for(var h=f.length,l=xu(f,h),n=0;n<h;++n)yu(l[n],this,r);return!0};function mu(t,e,r,n){var i,s,o;if(jn(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=bu(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,bb(a)}return t}Te.prototype.addListener=function(e,r){return mu(this,e,r,!1)},Te.prototype.on=Te.prototype.addListener,Te.prototype.prependListener=function(e,r){return mu(this,e,r,!0)};function mb(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function wu(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=mb.bind(n);return i.listener=r,n.wrapFn=i,i}Te.prototype.once=function(e,r){return jn(r),this.on(e,wu(this,e,r)),this},Te.prototype.prependOnceListener=function(e,r){return jn(r),this.prependListener(e,wu(this,e,r)),this},Te.prototype.removeListener=function(e,r){var n,i,s,o,a;if(jn(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():wb(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Te.prototype.off=Te.prototype.removeListener,Te.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Eu(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Eb(i):xu(i,i.length)}Te.prototype.listeners=function(e){return Eu(this,e,!0)},Te.prototype.rawListeners=function(e){return Eu(this,e,!1)},Te.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Du.call(t,e)},Te.prototype.listenerCount=Du;function Du(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Te.prototype.eventNames=function(){return this._eventsCount>0?Un(this._events):[]};function xu(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function wb(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Eb(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Db(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Su(t,e,s,{once:!0}),e!=="error"&&xb(t,i,{once:!0})})}function xb(t,e,r){typeof t.on=="function"&&Su(t,"error",e,r)}function Su(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}function Sb(t){return typeof t<"u"&&typeof t.context<"u"}const $t={init:"signer_init",uri:"signer_uri",created:"signer_created",updated:"signer_updated",deleted:"signer_deleted",event:"signer_event"};class Ob extends Sf{constructor(e){super(),this.events=new ps.exports.EventEmitter,this.pending=!1,this.initializing=!1,this.requiredNamespaces=e?.requiredNamespaces||{},this.opts=e?.client}get connected(){return typeof this.session<"u"}get connecting(){return this.pending}get chains(){return this.session?Li(this.session.namespaces):Zd(this.requiredNamespaces)}get accounts(){return this.session?Oi(this.session.namespaces):[]}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(){if(this.pending)return new Promise((e,r)=>{this.events.once("open",()=>{if(this.events.once("open_error",n=>{r(n)}),typeof this.client>"u")return r(new Error("Sign Client not initialized"));e()})});try{this.pending=!0;const e=await this.register(),r=e.find({requiredNamespaces:this.requiredNamespaces});if(r.length)return this.onOpen(r[0]);const{uri:n,approval:i}=await e.connect({requiredNamespaces:this.requiredNamespaces});this.events.emit($t.uri,{uri:n}),this.session=await i(),this.events.emit($t.created,this.session),this.onOpen()}catch(e){throw this.events.emit("open_error",e),e}}async close(){typeof this.session>"u"||(await(await this.register()).disconnect({topic:this.session.topic,reason:Ge("USER_DISCONNECTED")}),this.onClose())}async send(e,r){if(typeof this.client>"u"&&(this.client=await this.register(),this.connected||await this.open()),typeof this.session>"u")throw new Error("Signer connection is missing session");this.client.request({topic:this.session.topic,request:e,chainId:r?.chainId}).then(n=>this.events.emit("payload",on(e.id,n))).catch(n=>this.events.emit("payload",Lr(e.id,n.message)))}async register(e=this.opts){if(typeof this.client<"u")return this.client;if(this.initializing)return new Promise((r,n)=>{this.events.once("register_error",i=>{n(i)}),this.events.once($t.init,()=>{if(typeof this.client>"u")return n(new Error("Sign Client not initialized"));r(this.client)})});if(Sb(e))return this.client=e,this.registerEventListeners(),this.client;try{return this.initializing=!0,this.client=await ds.init(e),this.initializing=!1,this.registerEventListeners(),this.events.emit($t.init),this.client}catch(r){throw this.events.emit("register_error",r),r}}onOpen(e){this.pending=!1,e&&(this.session=e),this.events.emit("open")}onClose(){this.pending=!1,this.client&&(this.client=void 0),this.events.emit("close")}registerEventListeners(){typeof this.client<"u"&&(this.client.on("session_event",e=>{var r;this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||this.events.emit($t.event,e.params)}),this.client.on("session_update",e=>{var r;typeof this.client<"u"&&(this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.session=this.client.session.get(e.topic),this.events.emit($t.updated,this.session)))}),this.client.on("session_delete",e=>{var r;!this.session||this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.onClose(),this.events.emit($t.deleted,this.session),this.session=void 0)}))}}const Lb=["eth_requestAccounts","eth_accounts","eth_chainId","eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","personal_sign"],Ib=["chainChanged","accountsChanged"];function Ou(t){return{chains:t!=null&&t.chainId?[`eip155:${t.chainId}`]:[],methods:t?.methods||[],events:t?.events||[],rpcMap:t?.rpcMap||void 0}}function Lu(t,e){let r;return e.rpcMap&&(r=e.rpcMap[gs([t])]),r}function gs(t){return Number(t[0].split(":")[1])}class Ab{constructor(e){this.events=new Wn.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.rpc=Ou(e),this.signer=this.setSignerProvider(e?.client),this.chainId=gs(this.rpc.chains),this.http=this.setHttpProvider(this.chainId),this.registerEventListeners()}async request(e){switch(e.method){case"eth_requestAccounts":return await this.connect(),this.accounts;case"eth_accounts":return this.accounts;case"eth_chainId":return this.chainId}if(e.method.startsWith("eth_signTypedData")||this.rpc.methods.includes(e.method))return this.signer.request(e,{chainId:this.formatChainId(this.chainId)});if(typeof this.http>"u")throw new Error(`Cannot request JSON-RPC method (${e.method}) without provided rpc url`);return this.http.request(e)}sendAsync(e,r){this.request(e).then(n=>r(null,n)).catch(n=>r(n,void 0))}get connected(){return this.signer.connection.connected}get connecting(){return this.signer.connection.connecting}async enable(){return await this.request({method:"eth_requestAccounts"})}async connect(){await this.signer.connect()}async disconnect(){await this.signer.disconnect()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}registerEventListeners(){this.signer.on("connect",()=>{const e=this.signer.connection.chains;e&&e.length&&this.setChainIds(e);const r=this.signer.connection.accounts;r&&r.length&&this.setAccounts(r)}),this.signer.connection.on($t.created,e=>{const r=Li(e.namespaces,[this.namespace]);this.setChainIds(r);const n=Oi(e.namespaces,[this.namespace]);this.setAccounts(n)}),this.signer.connection.on($t.updated,e=>{const r=Li(e.namespaces,[this.namespace]);this.setChainIds(r);const n=Oi(e.namespaces,[this.namespace]);n!==this.accounts&&this.setAccounts(n)}),this.signer.connection.on($t.event,e=>{if(!this.rpc.chains.includes(e.chainId))return;const{event:r}=e;r.name==="accountsChanged"?(this.accounts=r.data,this.events.emit("accountsChanged",this.accounts)):r.name==="chainChanged"?this.setChainId(r.data):this.events.emit(r.name,r.data)}),this.signer.on("disconnect",()=>{this.events.emit("disconnect")}),this.events.on("chainChanged",e=>this.setHttpProvider(e))}setSignerProvider(e){const r=new Ob({requiredNamespaces:{[this.namespace]:{chains:this.rpc.chains,methods:this.rpc.methods,events:this.rpc.events}},client:e});return new ti(r)}setHttpProvider(e){const r=Lu(`${this.namespace}:${e}`,this.rpc);return typeof r>"u"?void 0:new ti(new Rf(r))}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n)).filter(n=>n!==this.chainId);r.length&&(this.chainId=r[0],this.events.emit("chainChanged",this.chainId))}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.events.emit("chainChanged",this.chainId)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}}St.default=Ab,St.getEthereumChainId=gs,St.getRpcConfig=Ou,St.getRpcUrl=Lu,St.signerEvents=Ib,St.signerMethods=Lb,Object.defineProperty(St,"__esModule",{value:!0})});
|
|
67
67
|
//# sourceMappingURL=index.umd.js.map
|