@walletconnect/ethereum-provider 2.1.5 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 Vn={exports:{}},hr=typeof Reflect=="object"?Reflect:null,ds=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 ps=Number.isNaN||function(e){return e!==e};function xe(){xe.init.call(this)}Vn.exports=xe,Vn.exports.once=Ku,xe.EventEmitter=xe,xe.prototype._events=void 0,xe.prototype._eventsCount=0,xe.prototype._maxListeners=void 0;var gs=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 gs},set:function(t){if(typeof t!="number"||t<0||ps(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");gs=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||ps(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 ys(t){return t._maxListeners===void 0?xe.defaultMaxListeners:t._maxListeners}xe.prototype.getMaxListeners=function(){return ys(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")ds(h,this,r);else for(var f=h.length,l=ws(h,f),n=0;n<f;++n)ds(l[n],this,r);return!0};function vs(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=ys(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 vs(this,e,r,!1)},xe.prototype.on=xe.prototype.addListener,xe.prototype.prependListener=function(e,r){return vs(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 _s(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,_s(this,e,r)),this},xe.prototype.prependOnceListener=function(e,r){return nn(r),this.prependListener(e,_s(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 bs(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):ws(i,i.length)}xe.prototype.listeners=function(e){return bs(this,e,!0)},xe.prototype.rawListeners=function(e){return bs(this,e,!1)},xe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ms.call(t,e)},xe.prototype.listenerCount=ms;function ms(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 ws(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))}Es(t,e,s,{once:!0}),e!=="error"&&qu(t,i,{once:!0})})}function qu(t,e,r){typeof t.on=="function"&&Es(t,"error",e,r)}function Es(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 Gn=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],Ds(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&&(Ds(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 Ds(t){return t===void 0}const Vu="PARSE_ERROR",Gu="INVALID_REQUEST",Wu="METHOD_NOT_FOUND",ku="INVALID_PARAMS",xs="INTERNAL_ERROR",Wn="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"},[xs]:{code:-32603,message:"Internal error"},[Wn]:{code:-32e3,message:"Server error"}},Ss=Wn;function Ju(t){return Yu.includes(t)}function Os(t){return Object.keys(Sr).includes(t)?Sr[t]:Sr[Ss]}function Xu(t){const e=Object.values(Sr).find(r=>r.code===t);return e||Sr[Ss]}function Ls(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Is={};/*! *****************************************************************************
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={};/*! *****************************************************************************
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 kn=function(t,e){return kn=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])},kn(t,e)};function Zu(t,e){kn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Yn=function(){return Yn=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},Yn.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 Jn(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 As(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(As(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(E){n[E]&&(i[E]=function(m){return new Promise(function(b,N){s.push([E,m,b,N])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof Or?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(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 Jn=="function"?Jn(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 Yn},__rest:Qu,__decorate:ef,__param:tf,__metadata:rf,__awaiter:nf,__generator:sf,__createBinding:of,__exportStar:af,__values:Jn,__read:As,__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={},Ts;function mf(){if(Ts)return Mt;Ts=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={},Cs;function wf(){if(Cs)return Ut;Cs=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)})(Is);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"?Os(xs):(typeof t=="string"&&(t=Object.assign(Object.assign({},Os(Wn)),{message:t})),typeof e<"u"&&(t.data=e),Ju(t.code)&&(t=Xu(t.code)),t)}class Rs{}class xf extends Rs{constructor(e){super()}}class Sf extends Rs{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 Ps(t,e){const r=Af(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Ns(t){return Ps(t,Lf)}function $s(t){return Ps(t,If)}function Tf(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Fs(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Xn(t){return Fs(t)&&"method"in t}function Zn(t){return Fs(t)&&(jt(t)||Ot(t))}function jt(t){return"result"in t}function Ot(t){return"error"in t}class Qn extends Of{constructor(e){super(e),this.events=new Gn.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),Zn(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 ei={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 E(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 b(g){this.map={},g instanceof b?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)}b.prototype.append=function(g,v){g=D(g),v=E(v);var F=this.map[g];this.map[g]=F?F+", "+v:v},b.prototype.delete=function(g){delete this.map[D(g)]},b.prototype.get=function(g){return g=D(g),this.has(g)?this.map[g]:null},b.prototype.has=function(g){return this.map.hasOwnProperty(D(g))},b.prototype.set=function(g,v){this.map[D(g)]=E(v)},b.prototype.forEach=function(g,v){for(var F in this.map)this.map.hasOwnProperty(F)&&g.call(v,this.map[F],F,this)},b.prototype.keys=function(){var g=[];return this.forEach(function(v,F){g.push(F)}),m(g)},b.prototype.values=function(){var g=[];return this.forEach(function(v){g.push(v)}),m(g)},b.prototype.entries=function(){var g=[];return this.forEach(function(v,F){g.push([F,v])}),m(g)},a.iterable&&(b.prototype[Symbol.iterator]=b.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 w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function c(g){var v=g.toUpperCase();return w.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 b(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 b(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 b,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 b(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 b(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=b,s.Request=d,s.Response=G),o.Headers=b,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})(ei,ei.exports);var Ms=Mu(ei.exports);function ti(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 Us={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},js=10;class Cf{constructor(e){if(this.url=e,this.events=new Gn.EventEmitter,this.isAvailable=!1,this.registering=!1,!Ns(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 Ms(this.url,Object.assign(Object.assign({},Us),{body:n}))).json();this.onPayload({data:s})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!Ns(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 Ms(e,Object.assign(Object.assign({},Us),{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"?ti(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 Ls(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>js&&this.events.setMaxListeners(js)}}var ri={},an={},re={},Bs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,h){var f=a>>>16&65535,l=a&65535,D=h>>>16&65535,E=h&65535;return l*E+(f*E+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}})(Bs),Object.defineProperty(re,"__esModule",{value:!0});var zs=Bs;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 Ks(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=Ks,re.writeInt16BE=Ks;function qs(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=qs,re.writeInt16LE=qs;function ni(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}re.readInt32BE=ni;function ii(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=ii;function si(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}re.readInt32LE=si;function oi(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=oi;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=ni(t,e),n=ni(t,e+4);return r*4294967296+n-(n>>31)*4294967296}re.readInt64BE=Ff;function Mf(t,e){e===void 0&&(e=0);var r=ii(t,e),n=ii(t,e+4);return r*4294967296+n}re.readUint64BE=Mf;function Uf(t,e){e===void 0&&(e=0);var r=si(t,e),n=si(t,e+4);return n*4294967296+r-(r>>31)*4294967296}re.readInt64LE=Uf;function jf(t,e){e===void 0&&(e=0);var r=oi(t,e),n=oi(t,e+4);return n*4294967296+r}re.readUint64LE=jf;function Hs(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=Hs,re.writeInt64BE=Hs;function Vs(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=Vs,re.writeInt64LE=Vs;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(!zs.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(!zs.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,ai=_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],E=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],b=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,w=o,c=a,d=h,U=f,K=l,G=D,J=E,X=m,g=b,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,w=w+K|0,P^=w,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,w=w+K|0,P^=w,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,w=w+c|0,M^=w,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,w=w+c|0,M^=w,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(w+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+E|0,t,36),ct.writeUint32LE(X+m|0,t,40),ct.writeUint32LE(g+b|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 Gs(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 ai.wipe(a),i===0&&ai.wipe(s),n}an.streamXOR=Gs;function th(t,e,r,n){return n===void 0&&(n=0),ai.wipe(r),Gs(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 Ws={},Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});function nh(t,e,r){return~(t-1)&e|t-1&r}Ht.select=nh;function ih(t,e){return(t|0)-(e|0)-1>>>31&1}Ht.lessOrEqual=ih;function ks(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}Ht.compare=ks;function sh(t,e){return t.length===0||e.length===0?!1:ks(t,e)!==0}Ht.equal=sh,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Ht,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 E=a[8]|a[9]<<8;this._r[4]=(D>>>4|E<<12)&255,this._r[5]=E>>>1&8190;var m=a[10]|a[11]<<8;this._r[6]=(E>>>14|m<<2)&8191;var b=a[12]|a[13]<<8;this._r[7]=(m>>>11|b<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(b>>>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],E=this._h[1],m=this._h[2],b=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],w=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;E+=(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;b+=(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+=E*(5*g),ee+=m*(5*X),ee+=b*(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*w),q+=ee>>>13,ee&=8191;var Y=q;Y+=D*w,Y+=E*x,Y+=m*(5*g),Y+=b*(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+=E*w,ae+=m*x,ae+=b*(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+=E*c,T+=m*w,T+=b*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+=E*d,A+=m*c,A+=b*w,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+=E*U,O+=m*d,O+=b*c,O+=N*w,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+=E*K,u+=m*U,u+=b*d,u+=N*c,q=u>>>13,u&=8191,u+=R*w,u+=B*x,u+=S*(5*g),u+=I*(5*X),u+=y*(5*J),q+=u>>>13,u&=8191;var _=q;_+=D*J,_+=E*G,_+=m*K,_+=b*U,_+=N*d,q=_>>>13,_&=8191,_+=R*c,_+=B*w,_+=S*x,_+=I*(5*g),_+=y*(5*X),q+=_>>>13,_&=8191;var H=q;H+=D*X,H+=E*J,H+=m*G,H+=b*K,H+=N*U,q=H>>>13,H&=8191,H+=R*d,H+=B*c,H+=S*w,H+=I*x,H+=y*(5*g),q+=H>>>13,H&=8191;var W=q;W+=D*g,W+=E*X,W+=m*J,W+=b*G,W+=N*K,q=W>>>13,W&=8191,W+=R*U,W+=B*d,W+=S*c,W+=I*w,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,E=Y,m=ae,b=T,N=A,R=O,B=u,S=_,I=H,y=W,h+=16,f-=16}this._h[0]=D,this._h[1]=E,this._h[2]=m,this._h[3]=b,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,E,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,E=this._h[0]+this._pad[0],this._h[0]=E&65535,m=1;m<8;m++)E=(this._h[m]+this._pad[m]|0)+(E>>>16)|0,this._h[m]=E&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}(Ws),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=an,r=Ws,n=_t,i=re,s=Ht;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,E){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var m=new Uint8Array(16);m.set(f,m.length-f.length);var b=new Uint8Array(32);e.stream(this._key,m,b,4);var N=l.length+this.tagLength,R;if(E){if(E.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");R=E}else R=new Uint8Array(N);return e.streamXOR(this._key,m,l,R,4),this._authenticate(R.subarray(R.length-this.tagLength,R.length),b,R.subarray(0,R.length-this.tagLength),D),n.wipe(m),R},h.prototype.open=function(f,l,D,E){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 b=new Uint8Array(32);e.stream(this._key,m,b,4);var N=new Uint8Array(this.tagLength);if(this._authenticate(N,b,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(E){if(E.length!==R)throw new Error("ChaCha20Poly1305: incorrect destination length");B=E}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,E){var m=new r.Poly1305(l);E&&(m.update(E),E.length%16>0&&m.update(o.subarray(E.length%16))),m.update(D),D.length%16>0&&m.update(o.subarray(D.length%16));var b=new Uint8Array(8);E&&i.writeUint64LE(E.length,b),m.update(b),i.writeUint64LE(D.length,b),m.update(b);for(var N=m.digest(),R=0;R<N.length;R++)f[R]=N[R];m.clean(),n.wipe(N),n.wipe(b)},h}();t.ChaCha20Poly1305=a}(ri);var Ys={},Ar={},ci={};Object.defineProperty(ci,"__esModule",{value:!0});function oh(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}ci.isSerializableHash=oh,Object.defineProperty(Ar,"__esModule",{value:!0});var At=ci,ah=Ht,ch=_t,Js=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=Js;function uh(t,e,r){var n=new Js(t,e);n.update(r);var i=n.digest();return n.clean(),i}Ar.hmac=uh,Ar.equal=ah.equal,Object.defineProperty(Ys,"__esModule",{value:!0});var Xs=Ar,Zs=_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=Xs.hmac(this._hash,n,r);this._hmac=new Xs.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(),Zs.wipe(this._buffer),Zs.wipe(this._counter),this._bufpos=0},t}(),hh=Ys.HKDF=fh,lr={},fn={},hn={};Object.defineProperty(hn,"__esModule",{value:!0}),hn.BrowserRandomSource=void 0;const Qs=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+=Qs)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,Qs)));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 E="";const m=l.length,b=256-256%m;for(;f>0;){const N=i(Math.ceil(f*256/b),D);for(let R=0;R<N.length&&f>0;R++){const B=N[R];B<b&&(E+=l.charAt(B%m),f--)}(0,n.wipe)(N)}return E}t.randomString=a;function h(f,l=o,D=t.defaultRandomSource){const E=Math.ceil(f/(Math.log(l.length)/Math.LN2));return a(E,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,E=f<<3,m=f%64<56?64:128;this._buffer[l]=128;for(var b=l+1;b<m-8;b++)this._buffer[b]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(E,this._buffer,m-4),s(this._temp,this._state,this._buffer,0,m),this._finished=!0}for(var b=0;b<this.digestLength/4;b++)e.writeUint32BE(this._state[b],h,b*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 E=h[0],m=h[1],b=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 w=a[y-2],c=(w>>>17|w<<32-17)^(w>>>19|w<<32-19)^w>>>10;w=a[y-15];var d=(w>>>7|w<<32-7)^(w>>>18|w<<32-18)^w>>>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=((E>>>2|E<<32-2)^(E>>>13|E<<32-13)^(E>>>22|E<<32-22))+(E&m^E&b^m&b)|0;I=S,S=B,B=R,R=N+c|0,N=b,b=m,m=E,E=c+d|0}h[0]+=E,h[1]+=m,h[2]+=b,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 ui={};(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 w=0;w<y.length;w++)x[w]=y[w];return x}const i=new Uint8Array(32);i[0]=9;const s=n([56129,1]);function o(y){let x=1;for(let w=0;w<16;w++){let c=y[w]+x+65535;x=Math.floor(c/65536),y[w]=c-x*65536}y[0]+=x-1+37*(x-1)}function a(y,x,w){const c=~(w-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 w=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++){w[0]=c[0]-65517;for(let K=1;K<15;K++)w[K]=c[K]-65535-(w[K-1]>>16&1),w[K-1]&=65535;w[15]=c[15]-32767-(w[14]>>16&1);const U=w[15]>>16&1;w[14]&=65535,a(c,w,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 w=0;w<16;w++)y[w]=x[2*w]+(x[2*w+1]<<8);y[15]&=32767}function l(y,x,w){for(let c=0;c<16;c++)y[c]=x[c]+w[c]}function D(y,x,w){for(let c=0;c<16;c++)y[c]=x[c]-w[c]}function E(y,x,w){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=w[0],pe=w[1],le=w[2],ue=w[3],ce=w[4],oe=w[5],se=w[6],te=w[7],fe=w[8],ge=w[9],ne=w[10],_e=w[11],be=w[12],Ee=w[13],De=w[14],we=w[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){E(y,x,x)}function b(y,x){const w=n();for(let c=0;c<16;c++)w[c]=x[c];for(let c=253;c>=0;c--)m(w,w),c!==2&&c!==4&&E(w,w,x);for(let c=0;c<16;c++)y[c]=w[c]}function N(y,x){const w=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++)w[M]=y[M];w[31]=y[31]&127|64,w[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=w[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),E(d,K,d),E(K,U,J),l(J,d,K),D(d,d,K),m(U,d),D(K,G,X),E(d,K,s),l(d,d,G),E(K,K,d),E(d,G,X),E(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);b(g,g),E(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),w=B(x);return(0,r.wipe)(x),w}t.generateKeyPair=S;function I(y,x,w=!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(w){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})(ui);function eo(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function fi(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=eo(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(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var N=0,R=0,B=0,S=b.length;B!==S&&b[B]===0;)B++,N++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=b[B],w=0,c=I-1;(x!==0||w<R)&&c!==-1;c--,w++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=w,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 E(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var N=0;if(b[N]!==" "){for(var R=0,B=0;b[N]===h;)R++,N++;for(var S=(b.length-N)*f+1>>>0,I=new Uint8Array(S);b[N];){var y=r[b.charCodeAt(N)];if(y===255)return;for(var x=0,w=S-1;(y!==0||x<B)&&w!==-1;w--,x++)y+=a*I[w]>>>0,I[w]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,N++}if(b[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(b){var N=E(b);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:E,decode:m}}var Dh=Eh,xh=Dh;const to=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 ro(this,e)}}class Ah{constructor(e){this.decoders=e}or(e){return ro(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 ro=(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=>to(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 no=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=no.reduce((t,e,r)=>(t[r]=e,t),[]),ll=no.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=so,io=128,_l=127,bl=~_l,ml=Math.pow(2,31);function so(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ml;)e[r++]=t&255|io,t/=128;for(;t&bl;)e[r++]=t&255|io,t>>>=7;return e[r]=t|0,so.bytes=r-n+1,e}var wl=hi,El=128,oo=127;function hi(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw hi.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&oo)<<i:(o&oo)*Math.pow(2,i),i+=7}while(o>=El);return hi.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},ao=Pl;const co=(t,e,r=0)=>(ao.encode(t,e,r),e),uo=t=>ao.encodingLength(t),li=(t,e)=>{const r=e.byteLength,n=uo(t),i=n+uo(r),s=new Uint8Array(i+r);return co(t,s,0),co(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 fo=({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?li(this.code,r):r.then(n=>li(this.code,n))}else throw Error("Unknown type, must be binary type")}}const ho=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Fl=fo({name:"sha2-256",code:18,encode:ho("SHA-256")}),Ml=fo({name:"sha2-512",code:19,encode:ho("SHA-512")});var Ul=Object.freeze({__proto__:null,sha256:Fl,sha512:Ml});const lo=0,jl="identity",po=to;var Bl=Object.freeze({__proto__:null,identity:{code:lo,name:jl,encode:po,digest:t=>li(lo,po(t))}});new TextEncoder,new TextDecoder;const go={...Nh,...Fh,...Uh,...Bh,...qh,...Qh,...rl,...sl,...fl,...yl};({...Ul,...Bl});function yo(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const vo=yo("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),di=yo("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=eo(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),_o={utf8:vo,"utf-8":vo,hex:go.base16,latin1:di,ascii:di,binary:di,...go};function lt(t,e="utf8"){const r=_o[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=_o[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 bo=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)/,mo=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]],wo=[["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?Eo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Vl:typeof navigator<"u"?Eo(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 Eo(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<mo&&(i=bo(bo([],i,!0),Ql(mo-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=wo.length;e<r;e++){var n=wo[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 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={};/*! *****************************************************************************
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 pi=function(t,e){return pi=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])},pi(t,e)};function ed(t,e){pi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var gi=function(){return gi=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},gi.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 yi(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 Do(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(Do(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(E){n[E]&&(i[E]=function(m){return new Promise(function(b,N){s.push([E,m,b,N])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof Cr?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(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 yi=="function"?yi(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 gi},__rest:td,__decorate:rd,__param:nd,__metadata:id,__awaiter:sd,__generator:od,__createBinding:ad,__exportStar:cd,__values:yi,__read:Do,__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),vi={},Rr={},xo;function md(){if(xo)return Rr;xo=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={},_i={},er={},So;function wd(){return So||(So=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 bi={},Oo;function Ed(){return Oo||(Oo=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}(bi)),bi}var Lo;function Io(){return Lo||(Lo=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(wd(),t),e.__exportStar(Ed(),t)}(_i)),_i}var Ao;function Dd(){if(Ao)return Qt;Ao=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.fromMiliseconds=Qt.toMiliseconds=void 0;const t=Io();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 To;function xd(){return To||(To=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(md(),t),e.__exportStar(Dd(),t)}(vi)),vi}var dr={},Co;function Sd(){if(Co)return dr;Co=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 mi={},Pr={},Ro;function Od(){if(Ro)return Pr;Ro=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.IWatch=void 0;class t{}return Pr.IWatch=t,Pr}var Po;function Ld(){return Po||(Po=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),gn.__exportStar(Od(),t)}(mi)),mi}(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(Io(),t)})(Z);var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.getLocalStorage=Ce.getLocalStorageOrThrow=Ce.getCrypto=Ce.getCryptoOrThrow=$o=Ce.getLocation=Ce.getLocationOrThrow=wi=Ce.getNavigator=Ce.getNavigatorOrThrow=No=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 No=Ce.getDocument=Ad;function Td(){return pr("navigator")}Ce.getNavigatorOrThrow=Td;function Cd(){return tr("navigator")}var wi=Ce.getNavigator=Cd;function Rd(){return pr("location")}Ce.getLocationOrThrow=Rd;function Pd(){return tr("location")}var $o=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 Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});var Fo=Ei.getWindowMetadata=void 0;const Mo=Ce;function Ud(){let t,e;try{t=Mo.getDocumentOrThrow(),e=Mo.getLocationOrThrow()}catch{return null}function r(){const D=t.getElementsByTagName("link"),E=[];for(let m=0;m<D.length;m++){const b=D[m],N=b.getAttribute("rel");if(N&&N.toLowerCase().indexOf("icon")>-1){const R=b.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}E.push(B)}else if(R.indexOf("//")===0){const B=e.protocol+R;E.push(B)}else E.push(R)}}return E}function n(...D){const E=t.getElementsByTagName("meta");for(let m=0;m<E.length;m++){const b=E[m],N=["itemprop","property","name"].map(R=>b.getAttribute(R)).filter(R=>R?D.includes(R):!1);if(N.length&&N){const R=b.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}}Fo=Ei.getWindowMetadata=Ud;var Nr={},jd=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Uo="%[a-f0-9]{2}",jo=new RegExp(Uo,"gi"),Bo=new RegExp("("+Uo+")+","gi");function Di(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([],Di(r),Di(n))}function Bd(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(jo),r=1;r<e.length;r++)t=Di(e,r).join(""),e=t.match(jo);return t}}function zd(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Bo.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=Bd(r[0]);n!==r[0]&&(e[r[0]]=n)}r=Bo.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 w=y.length;return x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),"[",w,"]"].join("")]:[...y,[l(I,S),"[",l(w,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,w)=>w===void 0||S.skipNull&&w===null||S.skipEmptyString&&w===""?x:(w=w===null?"":w,x.length===0?[[l(y,S),I,l(w,S)].join("")]:[[x,l(w,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,w)=>{if(I=/\[(\d*)\]$/.exec(y),y=y.replace(/\[\d*\]$/,""),!I){w[y]=x;return}w[y]===void 0&&(w[y]={}),w[y][I[1]]=x};case"bracket":return(y,x,w)=>{if(I=/(\[\])$/.exec(y),y=y.replace(/\[\]$/,""),!I){w[y]=x;return}if(w[y]===void 0){w[y]=[x];return}w[y]=[].concat(w[y],x)};case"colon-list-separator":return(y,x,w)=>{if(I=/(:list)$/.exec(y),y=y.replace(/:list$/,""),!I){w[y]=x;return}if(w[y]===void 0){w[y]=[x];return}w[y]=[].concat(w[y],x)};case"comma":case"separator":return(y,x,w)=>{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);w[y]=U};case"bracket-separator":return(y,x,w)=>{const c=/(\[\])$/.test(y);if(y=y.replace(/\[\]$/,""),!c){w[y]=x&&D(x,S);return}const d=x===null?[]:x.split(S.arrayFormatSeparator).map(U=>D(U,S));if(w[y]===void 0){w[y]=d;return}w[y]=[].concat(w[y],d)};default:return(y,x,w)=>{if(w[y]===void 0){w[y]=x;return}w[y]=[].concat(w[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 E(S){return Array.isArray(S)?S.sort():typeof S=="object"?E(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 b(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 w of S.split("&")){if(w==="")continue;let[c,d]=n(I.decode?w.replace(/\+/g," "):w,"=");d=d===void 0?null:["comma","separator","bracket-separator"].includes(I.arrayFormat)?d:D(d,I),y(D(c,I),d,x)}for(const w of Object.keys(x)){const c=x[w];if(typeof c=="object"&&c!==null)for(const d of Object.keys(c))c[d]=R(c[d],I);else x[w]=R(c,I)}return I.sort===!1?x:(I.sort===!0?Object.keys(x).sort():Object.keys(x).sort(I.sort)).reduce((w,c)=>{const d=x[c];return Boolean(d)&&typeof d=="object"&&!Array.isArray(d)?w[c]=E(d):w[c]=d,w},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),w={};for(const d of Object.keys(S))y(d)||(w[d]=S[d]);const c=Object.keys(w);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),w=t.parse(x,{sort:!1}),c=Object.assign(w,S.query);let d=t.stringify(c,I);d&&(d=`?${d}`);let U=b(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:w,fragmentIdentifier:c}=t.parseUrl(S,y);return t.stringifyUrl({url:x,query:i(w,I),fragmentIdentifier:c},y)},t.exclude=(S,I,y)=>{const x=Array.isArray(I)?w=>!I.includes(w):(w,c)=>!I(w,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"}},zo=":";function Gd(t){const{namespace:e,reference:r}=t;return[e,r].join(zo)}function Wd(t){const[e,r,n]=t.split(zo);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 xi(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 Si(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 Ko="base10",pt="base16",Oi="base64pad",Li="utf8",qo=0,rr=1,Zd=0,Ho=1,Ii=12,Ai=32;function Qd(){const t=ui.generateKeyPair();return{privateKey:dt(t.secretKey,pt),publicKey:dt(t.publicKey,pt)}}function Ti(){const t=lr.randomBytes(Ai);return dt(t,pt)}function ep(t,e){const r=ui.sharedKey(lt(t,pt),lt(e,pt)),n=new hh(dn.SHA256,r).expand(Ai);return dt(n,pt)}function tp(t){const e=dn.hash(lt(t,pt));return dt(e,pt)}function Ci(t){const e=dn.hash(lt(t,Li));return dt(e,pt)}function rp(t){return lt(`${t}`,Ko)}function $r(t){return Number(dt(t,Ko))}function np(t){const e=rp(typeof t.type<"u"?t.type:qo);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(Ii),i=new ri.ChaCha20Poly1305(lt(t.symKey,pt)).seal(n,lt(t.message,Li));return sp({type:e,sealed:i,iv:n,senderPublicKey:r})}function ip(t){const e=new ri.ChaCha20Poly1305(lt(t.symKey,pt)),{sealed:r,iv:n}=Ri(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return dt(i,Li)}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(fi([t.type,t.senderPublicKey,t.iv,t.sealed]),Oi)}return dt(fi([t.type,t.iv,t.sealed]),Oi)}function Ri(t){const e=lt(t,Oi),r=e.slice(Zd,Ho),n=Ho;if($r(r)===rr){const a=n+Ai,h=a+Ii,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+Ii,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function op(t,e){const r=Ri(t);return Vo({type:$r(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?dt(r.senderPublicKey,pt):void 0,receiverPublicKey:e?.receiverPublicKey})}function Vo(t){const e=t?.type||qo;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 Go(t){return t.type===rr&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var ap=Object.defineProperty,Wo=Object.getOwnPropertySymbols,cp=Object.prototype.hasOwnProperty,up=Object.prototype.propertyIsEnumerable,ko=(t,e,r)=>e in t?ap(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Yo=(t,e)=>{for(var r in e||(e={}))cp.call(e,r)&&ko(t,r,e[r]);if(Wo)for(var r of Wo(e))up.call(e,r)&&ko(t,r,e[r]);return t};const fp="ReactNative",Fr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},hp="js";function Jo(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function lp(){return!No()&&!!wi()&&navigator.product===fp}function dp(){return!Jo()&&!!wi()}function pp(){return lp()?Fr.reactNative:Jo()?Fr.node:dp()?Fr.browser:Fr.unknown}function gp(t,e){let r=Nr.parse(t);return r=Yo(Yo({},r),e),t=Nr.stringify(r),t}function yp(){return Fo()||{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=$o())==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 Xo(t){return Object.fromEntries(t.entries())}function Zo(t){return new Map(Object.entries(t))}function Bt(t,e){return Z.fromMiliseconds((e||Date.now())+Z.toMiliseconds(t))}function Vt(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 Qo(t,e){return new Promise(async(r,n)=>{const i=setTimeout(()=>n(),e),s=await t;clearTimeout(i),r(s)})}function ea(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 ea("topic",t)}function Ep(t){return ea("id",t)}function ta(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 Pi(t){return t?.relay||{protocol:Dp}}function Ni(t){const e=Vd[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var xp=Object.defineProperty,ra=Object.getOwnPropertySymbols,Sp=Object.prototype.hasOwnProperty,Op=Object.prototype.propertyIsEnumerable,na=(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)&&na(t,r,e[r]);if(ra)for(var r of ra(e))Op.call(e,r)&&na(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}const $p={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}},Fp={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}=Fp[t];return{message:e?`${r} ${e}`:r,code:n}}function Ge(t,e){const{message:r,code:n}=$p[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 ia(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function wt(t){return typeof t>"u"}function st(t,e){return e&&wt(t)?!0:typeof t=="string"&&Boolean(t.trim().length)}function sa(t,e){return e&&wt(t)?!0:typeof t=="number"&&!isNaN(t)}function Mp(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),E=r[o];(!gt(E.chains,D)||!gt(E.methods,h)||!gt(E.events,f))&&(s=!1),s&&l&&l.forEach(m=>{var b;const{accounts:N,methods:R,events:B}=m,S=Tt(N);(b=E.extension)!=null&&b.find(I=>gt(I.chains,S)&&gt(I.methods,R)&&gt(I.events,B))||(s=!1)})}),s):!1}function $i(t){return st(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function Up(t){if(st(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&$i(r)}}return!1}function jp(t){if(st(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Bp(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function zp(t){return t?.topic}function Kp(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 Fi(t,e){let r=null;return wt(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 oa(t){let e=!0;return Mr(t)?t.length&&(e=t.every(r=>st(r,!1))):e=!1,e}function aa(t,e,r){let n=null;return Mr(e)?e.forEach(i=>{n||(!$i(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 qp(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;const s=aa(n,i?.chains,`${e} requiredNamespace`),o=Fi(i,e);s?r=s:o?r=o:i.extension&&i.extension.forEach(a=>{if(r)return;const h=aa(n,a.chains,`${e} extension`);h&&(r=h)})}),r}function ca(t,e){let r=null;return Mr(t)?t.forEach(n=>{r||Up(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 Hp(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=ca(n?.accounts,`${e} namespace`),s=Fi(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=ca(o.accounts,`${e} extension`);a&&(r=a)})}),r}function ua(t,e){let r=null;return oa(t?.methods)?oa(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 fa(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=ua(n,`${e}, namespace`),s=Fi(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=ua(o,`${e}, extension`);a&&(r=a)})}),r}function Vp(t,e){let r=null;if(t&&ia(t)){const n=fa(t,e);n&&(r=n);const i=qp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, requiredNamespaces should be an object with data`);return r}function Mi(t,e){let r=null;if(t&&ia(t)){const n=fa(t,e);n&&(r=n);const i=Hp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function ha(t){return st(t.protocol,!0)}function Gp(t,e){let r=!1;return e&&!t?r=!0:t&&Mr(t)&&t.length&&t.forEach(n=>{r=ha(n)}),r}function Wp(t){return typeof t=="number"}function yt(t){return typeof t<"u"&&typeof t!==null}function kp(t){return!(!t||typeof t!="object"||!t.code||!sa(t.code,!1)||!t.message||!st(t.message,!1))}function Yp(t){return!(wt(t)||!st(t.method,!1))}function Jp(t){return!(wt(t)||wt(t.result)&&wt(t.error)||!sa(t.id,!1)||!st(t.jsonrpc,!1))}function Xp(t){return!(wt(t)||!st(t.name,!1))}function la(t,e){return!(!$i(e)||!Rp(t).includes(e))}function Zp(t,e,r){return st(r,!1)?Pp(t,e).includes(r):!1}function Qp(t,e,r){return st(r,!1)?Np(t,e).includes(r):!1}function da(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:E})=>{var m;n||(m=e[o].extension)!=null&&m.find(b=>{const N=Tt(b.accounts);return gt(E,N)&&gt(D,b.events)&&gt(l,b.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 eg(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var tg=rg;function rg(t,e,r){var n=r&&r.stringify||eg,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,E=t&&t.length||0,m=0;m<E;){if(t.charCodeAt(m)===37&&m+1<E){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 b=typeof e[l];if(b==="string"){f+="'"+e[l]+"'",D=m+2,m++;break}if(b==="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<E&&(f+=t.slice(D)),f)}const pa=tg;var yn=Ct;const Ur=lg().console||{},ng={mapHttpRequest:_n,mapHttpResponse:_n,wrapRequestSerializer:ji,wrapResponseSerializer:ji,wrapErrorSerializer:ji,req:_n,res:_n,err:cg};function ig(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=ig(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:E});const f={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:ug(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=Ui());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function D(){return this._level}function E(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,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(b,N){if(!b)throw new Error("missing bindings for child Pino");N=N||{},i&&b.serializers&&(N.serializers=b.serializers);const R=N.serializers;if(i&&R){var B=Object.assign({},n,R),S=t.browser.serialize===!0?Object.keys(B):i;delete b.serializers,vn([b],S,B,this._stdErrSerialize)}function I(y){this._childLevel=(y._childLevel|0)+1,this.error=yr(y,b,"error"),this.fatal=yr(y,b,"fatal"),this.warn=yr(y,b,"warn"),this.info=yr(y,b,"info"),this.debug=yr(y,b,"debug"),this.trace=yr(y,b,"trace"),B&&(this.serializers=B,this._serialize=S),e&&(this._logEvent=Ui([].concat(y._logEvent.bindings,b)))}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=ng,Ct.stdTimeFunctions=Object.assign({},{nullTime:ga,epochTime:ya,unixTime:fg,isoTime:hg});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,sg(t,e,r)}function sg(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&&vn(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,og(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;ag(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 og(t,e,r,n){t._serialize&&vn(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?pa(i.shift(),i):void 0}else typeof s=="string"&&(s=pa(i.shift(),i));return s!==void 0&&(o.msg=s),o}function vn(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 ag(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,h=t._logEvent.bindings;vn(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=Ui(h)}function Ui(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function cg(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 ug(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?ga:ya}function _n(){return{}}function ji(t){return t}function jr(){}function ga(){return!1}function ya(){return Date.now()}function fg(){return Math.round(Date.now()/1e3)}function hg(){return new Date(Date.now()).toISOString()}function lg(){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,va=vr&&typeof vr.apply=="function"?vr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},bn;vr&&typeof vr.ownKeys=="function"?bn=vr.ownKeys:Object.getOwnPropertySymbols?bn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:bn=function(e){return Object.getOwnPropertyNames(e)};function dg(t){console&&console.warn&&console.warn(t)}var _a=Number.isNaN||function(e){return e!==e};function Se(){Se.init.call(this)}zt.exports=Se,zt.exports.once=vg,Se.EventEmitter=Se,Se.prototype._events=void 0,Se.prototype._eventsCount=0,Se.prototype._maxListeners=void 0;var ba=10;function mn(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 ba},set:function(t){if(typeof t!="number"||t<0||_a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ba=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||_a(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 ma(t){return t._maxListeners===void 0?Se.defaultMaxListeners:t._maxListeners}Se.prototype.getMaxListeners=function(){return ma(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")va(h,this,r);else for(var f=h.length,l=Sa(h,f),n=0;n<f;++n)va(l[n],this,r);return!0};function wa(t,e,r,n){var i,s,o;if(mn(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=ma(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,dg(a)}return t}Se.prototype.addListener=function(e,r){return wa(this,e,r,!1)},Se.prototype.on=Se.prototype.addListener,Se.prototype.prependListener=function(e,r){return wa(this,e,r,!0)};function pg(){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 Ea(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=pg.bind(n);return i.listener=r,n.wrapFn=i,i}Se.prototype.once=function(e,r){return mn(r),this.on(e,Ea(this,e,r)),this},Se.prototype.prependOnceListener=function(e,r){return mn(r),this.prependListener(e,Ea(this,e,r)),this},Se.prototype.removeListener=function(e,r){var n,i,s,o,a;if(mn(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():gg(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 Da(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?yg(i):Sa(i,i.length)}Se.prototype.listeners=function(e){return Da(this,e,!0)},Se.prototype.rawListeners=function(e){return Da(this,e,!1)},Se.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):xa.call(t,e)},Se.prototype.listenerCount=xa;function xa(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?bn(this._events):[]};function Sa(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function gg(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function yg(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function vg(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))}Oa(t,e,s,{once:!0}),e!=="error"&&_g(t,i,{once:!0})})}function _g(t,e,r){typeof t.on=="function"&&Oa(t,"error",e,r)}function Oa(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 wn={};/*! *****************************************************************************
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)&&gt(I.methods,R)&&gt(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)&&gt(D,w.events)&&gt(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={};/*! *****************************************************************************
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 Bi=function(t,e){return Bi=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])},Bi(t,e)};function bg(t,e){Bi(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 mg(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 wg(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 Eg(t,e){return function(r,n){e(r,n,t)}}function Dg(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xg(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 Sg(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 Og(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Lg(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 La(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 Ig(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(La(arguments[e]));return t}function Ag(){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 Tg(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(E){n[E]&&(i[E]=function(m){return new Promise(function(b,N){s.push([E,m,b,N])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof Br?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Cg(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 Rg(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,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 Pg(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ng(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 $g(t){return t&&t.__esModule?t:{default:t}}function Fg(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Mg(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 Ug=Object.freeze({__proto__:null,__extends:bg,get __assign(){return zi},__rest:mg,__decorate:wg,__param:Eg,__metadata:Dg,__awaiter:xg,__generator:Sg,__createBinding:Og,__exportStar:Lg,__values:Ki,__read:La,__spread:Ig,__spreadArrays:Ag,__await:Br,__asyncGenerator:Tg,__asyncDelegator:Cg,__asyncValues:Rg,__makeTemplateObject:Pg,__importStar:Ng,__importDefault:$g,__classPrivateFieldGet:Fg,__classPrivateFieldSet:Mg}),Ia=Zt(Ug),zr={};Object.defineProperty(zr,"__esModule",{value:!0});function jg(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=jg;function Bg(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}zr.safeJsonStringify=Bg;var Kr={exports:{}},Aa;function zg(){return Aa||(Aa=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 qi={},qr={},Ta;function Kg(){if(Ta)return qr;Ta=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.IKeyValueStorage=void 0;class t{}return qr.IKeyValueStorage=t,qr}var Hr={},Ca;function qg(){if(Ca)return Hr;Ca=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 Ra;function Hg(){return Ra||(Ra=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Ia;e.__exportStar(Kg(),t),e.__exportStar(qg(),t)}(qi)),qi}Object.defineProperty(wn,"__esModule",{value:!0}),wn.KeyValueStorage=void 0;const _r=Ia,Pa=zr,Vg=_r.__importDefault(zg()),Gg=Hg();class Na{constructor(){this.localStorage=Vg.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(Gg.parseEntry)})}getItem(e){return _r.__awaiter(this,void 0,void 0,function*(){const r=this.localStorage.getItem(e);if(r!==null)return Pa.safeJsonParse(r)})}setItem(e,r){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,Pa.safeJsonStringify(r))})}removeItem(e){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}}wn.KeyValueStorage=Na;var Wg=wn.default=Na,Vr={};/*! *****************************************************************************
40
+ ***************************************************************************** */var zi=function(t,e){return zi=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])},zi(t,e)};function mg(t,e){zi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Ki=function(){return Ki=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},Ki.apply(this,arguments)};function wg(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 Eg(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 Dg(t,e){return function(r,n){e(r,n,t)}}function xg(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Sg(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 Og(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 Lg(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Ig(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 Ia(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 Ag(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ia(arguments[e]));return t}function Tg(){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 Cg(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 Br?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 Rg(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 Pg(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,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 Ng(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function $g(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 Fg(t){return t&&t.__esModule?t:{default:t}}function Mg(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Ug(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 jg=Object.freeze({__proto__:null,__extends:mg,get __assign(){return Ki},__rest:wg,__decorate:Eg,__param:Dg,__metadata:xg,__awaiter:Sg,__generator:Og,__createBinding:Lg,__exportStar:Ig,__values:qi,__read:Ia,__spread:Ag,__spreadArrays:Tg,__await:Br,__asyncGenerator:Cg,__asyncDelegator:Rg,__asyncValues:Pg,__makeTemplateObject:Ng,__importStar:$g,__importDefault:Fg,__classPrivateFieldGet:Mg,__classPrivateFieldSet:Ug}),Aa=Zt(jg),zr={};Object.defineProperty(zr,"__esModule",{value:!0});function Bg(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=Bg;function zg(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}zr.safeJsonStringify=zg;var Kr={exports:{}},Ta;function Kg(){return Ta||(Ta=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 Hi={},qr={},Ca;function qg(){if(Ca)return qr;Ca=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.IKeyValueStorage=void 0;class t{}return qr.IKeyValueStorage=t,qr}var Hr={},Ra;function Hg(){if(Ra)return Hr;Ra=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 Vg(){return Pa||(Pa=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Aa;e.__exportStar(qg(),t),e.__exportStar(Hg(),t)}(Hi)),Hi}Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.KeyValueStorage=void 0;const _r=Aa,Na=zr,Gg=_r.__importDefault(Kg()),Wg=Vg();class $a{constructor(){this.localStorage=Gg.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(Wg.parseEntry)})}getItem(e){return _r.__awaiter(this,void 0,void 0,function*(){const r=this.localStorage.getItem(e);if(r!==null)return Na.safeJsonParse(r)})}setItem(e,r){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,Na.safeJsonStringify(r))})}removeItem(e){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}}Dn.KeyValueStorage=$a;var kg=Dn.default=$a,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 Hi=function(t,e){return Hi=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])},Hi(t,e)};function kg(t,e){Hi(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 Yg(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 Jg(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 Xg(t,e){return function(r,n){e(r,n,t)}}function Zg(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Qg(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 ey(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 ty(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function ry(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Gi(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 $a(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 ny(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat($a(arguments[e]));return t}function iy(){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 sy(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(E){n[E]&&(i[E]=function(m){return new Promise(function(b,N){s.push([E,m,b,N])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof Gr?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function oy(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 ay(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 Gi=="function"?Gi(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 cy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function uy(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 hy(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function ly(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 dy=Object.freeze({__proto__:null,__extends:kg,get __assign(){return Vi},__rest:Yg,__decorate:Jg,__param:Xg,__metadata:Zg,__awaiter:Qg,__generator:ey,__createBinding:ty,__exportStar:ry,__values:Gi,__read:$a,__spread:ny,__spreadArrays:iy,__await:Gr,__asyncGenerator:sy,__asyncDelegator:oy,__asyncValues:ay,__makeTemplateObject:cy,__importStar:uy,__importDefault:fy,__classPrivateFieldGet:hy,__classPrivateFieldSet:ly}),En=Zt(dy),Wr={},Wi={},kr={};class ir{}var py=Object.freeze({__proto__:null,IEvents:ir}),gy=Zt(py),Fa;function yy(){if(Fa)return kr;Fa=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.IHeartBeat=void 0;const t=gy;class e extends t.IEvents{constructor(n){super()}}return kr.IHeartBeat=e,kr}var Ma;function Ua(){return Ma||(Ma=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),En.__exportStar(yy(),t)}(Wi)),Wi}var ki={},sr={},ja;function vy(){if(ja)return sr;ja=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 Ba;function za(){return Ba||(Ba=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),En.__exportStar(vy(),t)}(ki)),ki}var Ka;function _y(){if(Ka)return Wr;Ka=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.HeartBeat=void 0;const t=En,e=Gn,r=Z,n=Ua(),i=za();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 h=new s(a);return yield h.init(),h})}init(){return t.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}on(a,h){this.events.on(a,h)}once(a,h){this.events.once(a,h)}off(a,h){this.events.off(a,h)}removeListener(a,h){this.events.removeListener(a,h)}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=En;e.__exportStar(_y(),t),e.__exportStar(Ua(),t),e.__exportStar(za(),t)})(Vr);var Oe={};/*! *****************************************************************************
53
+ ***************************************************************************** */var Vi=function(t,e){return Vi=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])},Vi(t,e)};function Yg(t,e){Vi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Gi=function(){return Gi=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},Gi.apply(this,arguments)};function Jg(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 Zg(t,e){return function(r,n){e(r,n,t)}}function Qg(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ey(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 ty(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 ry(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function ny(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Wi(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 Fa(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 iy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Fa(arguments[e]));return t}function sy(){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 oy(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 Gr?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 ay(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 cy(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 Wi=="function"?Wi(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 uy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fy(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 hy(t){return t&&t.__esModule?t:{default:t}}function ly(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function dy(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 py=Object.freeze({__proto__:null,__extends:Yg,get __assign(){return Gi},__rest:Jg,__decorate:Xg,__param:Zg,__metadata:Qg,__awaiter:ey,__generator:ty,__createBinding:ry,__exportStar:ny,__values:Wi,__read:Fa,__spread:iy,__spreadArrays:sy,__await:Gr,__asyncGenerator:oy,__asyncDelegator:ay,__asyncValues:cy,__makeTemplateObject:uy,__importStar:fy,__importDefault:hy,__classPrivateFieldGet:ly,__classPrivateFieldSet:dy}),xn=Zt(py),Wr={},ki={},kr={};class ir{}var gy=Object.freeze({__proto__:null,IEvents:ir}),yy=Zt(gy),Ma;function vy(){if(Ma)return kr;Ma=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.IHeartBeat=void 0;const t=yy;class e extends t.IEvents{constructor(n){super()}}return kr.IHeartBeat=e,kr}var Ua;function ja(){return Ua||(Ua=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),xn.__exportStar(vy(),t)}(ki)),ki}var Yi={},sr={},Ba;function _y(){if(Ba)return sr;Ba=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 za;function Ka(){return za||(za=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),xn.__exportStar(_y(),t)}(Yi)),Yi}var qa;function by(){if(qa)return Wr;qa=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.HeartBeat=void 0;const t=xn,e=kn,r=Z,n=ja(),i=Ka();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 h=new s(a);return yield h.init(),h})}init(){return t.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}on(a,h){this.events.on(a,h)}once(a,h){this.events.once(a,h)}off(a,h){this.events.off(a,h)}removeListener(a,h){this.events.removeListener(a,h)}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(by(),t),e.__exportStar(ja(),t),e.__exportStar(Ka(),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 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 by(t,e){Yi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Ji=function(){return Ji=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},Ji.apply(this,arguments)};function my(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 wy(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 Dy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xy(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 Sy(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 Oy(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Ly(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Xi(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 qa(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 Iy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(qa(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 Yr(t){return this instanceof Yr?(this.v=t,this):new Yr(t)}function Ty(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(E){n[E]&&(i[E]=function(m){return new Promise(function(b,N){s.push([E,m,b,N])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof Yr?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Cy(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 Ry(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 Xi=="function"?Xi(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 Py(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ny(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 $y(t){return t&&t.__esModule?t:{default:t}}function Fy(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function My(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 Uy=Object.freeze({__proto__:null,__extends:by,get __assign(){return Ji},__rest:my,__decorate:wy,__param:Ey,__metadata:Dy,__awaiter:xy,__generator:Sy,__createBinding:Oy,__exportStar:Ly,__values:Xi,__read:qa,__spread:Iy,__spreadArrays:Ay,__await:Yr,__asyncGenerator:Ty,__asyncDelegator:Cy,__asyncValues:Ry,__makeTemplateObject:Py,__importStar:Ny,__importDefault:$y,__classPrivateFieldGet:Fy,__classPrivateFieldSet:My}),jy=Zt(Uy),or={},Ha;function Va(){return Ha||(Ha=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={},Ga;function By(){if(Ga)return ft;Ga=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.generateChildLogger=ft.formatChildLoggerContext=ft.getLoggerContext=ft.setBrowserLoggerContext=ft.getBrowserLoggerContext=ft.getDefaultLoggerOptions=void 0;const t=Va();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=jy,r=e.__importDefault(yn);Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return r.default}}),e.__exportStar(Va(),t),e.__exportStar(By(),t)})(Oe);var Wa={exports:{}},br=typeof Reflect=="object"?Reflect:null,ka=br&&typeof br.apply=="function"?br.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Dn;br&&typeof br.ownKeys=="function"?Dn=br.ownKeys:Object.getOwnPropertySymbols?Dn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Dn=function(e){return Object.getOwnPropertyNames(e)};function zy(t){console&&console.warn&&console.warn(t)}var Ya=Number.isNaN||function(e){return e!==e};function Le(){Le.init.call(this)}Wa.exports=Le,Wa.exports.once=Vy,Le.EventEmitter=Le,Le.prototype._events=void 0,Le.prototype._eventsCount=0,Le.prototype._maxListeners=void 0;var Ja=10;function xn(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 Ja},set:function(t){if(typeof t!="number"||t<0||Ya(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ja=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||Ya(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 Xa(t){return t._maxListeners===void 0?Le.defaultMaxListeners:t._maxListeners}Le.prototype.getMaxListeners=function(){return Xa(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")ka(h,this,r);else for(var f=h.length,l=rc(h,f),n=0;n<f;++n)ka(l[n],this,r);return!0};function Za(t,e,r,n){var i,s,o;if(xn(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=Xa(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,zy(a)}return t}Le.prototype.addListener=function(e,r){return Za(this,e,r,!1)},Le.prototype.on=Le.prototype.addListener,Le.prototype.prependListener=function(e,r){return Za(this,e,r,!0)};function Ky(){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 Qa(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Ky.bind(n);return i.listener=r,n.wrapFn=i,i}Le.prototype.once=function(e,r){return xn(r),this.on(e,Qa(this,e,r)),this},Le.prototype.prependOnceListener=function(e,r){return xn(r),this.prependListener(e,Qa(this,e,r)),this},Le.prototype.removeListener=function(e,r){var n,i,s,o,a;if(xn(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():qy(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 ec(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?Hy(i):rc(i,i.length)}Le.prototype.listeners=function(e){return ec(this,e,!0)},Le.prototype.rawListeners=function(e){return ec(this,e,!1)},Le.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):tc.call(t,e)},Le.prototype.listenerCount=tc;function tc(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?Dn(this._events):[]};function rc(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function qy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Hy(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Vy(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))}nc(t,e,s,{once:!0}),e!=="error"&&Gy(t,i,{once:!0})})}function Gy(t,e,r){typeof t.on=="function"&&nc(t,"error",e,r)}function nc(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 Wy extends ir{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class ky extends ir{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class Yy{constructor(e,r){this.logger=e,this.core=r}}class Jy extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Xy extends ir{constructor(e){super()}}class Zy{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class Qy extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class ev extends ir{constructor(e,r){super(),this.core=e,this.logger=r}}class tv{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class rv{constructor(e){this.client=e}}var Zi={},ic={};(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,E=f<<3,m=f%128<112?128:256;this._buffer[l]=128;for(var b=l+1;b<m-8;b++)this._buffer[b]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(E,this._buffer,m-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,m),this._finished=!0}for(var b=0;b<this.digestLength/8;b++)e.writeUint32BE(this._stateHi[b],h,b*8),e.writeUint32BE(this._stateLo[b],h,b*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,E,m){for(var b=f[0],N=f[1],R=f[2],B=f[3],S=f[4],I=f[5],y=f[6],x=f[7],w=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+E;a[Q]=e.readUint32BE(D,q),h[Q]=e.readUint32BE(D,q+4)}for(var Q=0;Q<80;Q++){var ee=b,Y=N,ae=R,T=B,A=S,O=I,u=y,_=x,H=w,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=(b>>>28|w<<32-28)^(w>>>34-32|b<<32-(34-32))^(w>>>39-32|b<<32-(39-32)),v=(w>>>28|b<<32-28)^(b>>>34-32|w<<32-(34-32))^(b>>>39-32|w<<32-(39-32)),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=b&N^b&R^N&R,v=w&c^w&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,b=_,c=H,d=W,U=he,K=ve,G=de,J=me,X=Be,w=$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=b,v=w,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]=b=j&65535|z<<16,l[0]=w=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,E+=128,m-=128}return E}function o(a){var h=new n;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(ic),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=ic,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]),E=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 b(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[_];b(u),b(u),b(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 w(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,bt=0,ar=0,Qr=0,Un=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,bt+=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,bt+=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,bt+=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,bt+=u*Ve,ar+=u*Pe,Qr+=u*tt,Un+=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*bt,ce+=38*ar,oe+=38*Qr,se+=38*Un,_=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();w(O,T[1],T[0]),w(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),w(W,u,O),w(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),w(_,_,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],E),d(u,T[0]),c(u,u,H),S(u,_)?-1:(I(T[0])===A[31]>>7&&w(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,_),w(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}(Zi);const nv="EdDSA",iv="JWT",sc=".",oc="base64url",sv="utf8",ov="utf8",av=":",cv="did",uv="key",ac="base58btc",fv="z",hv="K36",lv=32;function Sn(t){return dt(lt(Ir(t),sv),oc)}function cc(t){const e=lt(hv,ac),r=fv+dt(fi([e,t]),ac);return[cv,uv,r].join(av)}function dv(t){return dt(t,oc)}function pv(t){return lt([Sn(t.header),Sn(t.payload)].join(sc),ov)}function gv(t){return[Sn(t.header),Sn(t.payload),dv(t.signature)].join(sc)}function uc(t=lr.randomBytes(lv)){return Zi.generateKeyPairFromSeed(t)}async function yv(t,e,r,n,i=Z.fromMiliseconds(Date.now())){const s={alg:nv,typ:iv},o=cc(n.publicKey),a=i+r,h={iss:o,sub:t,aud:e,iat:i,exp:a},f=pv({header:s,payload:h}),l=Zi.sign(n.secretKey,f);return gv({header:s,payload:h,signature:l})}var Qi={exports:{}},mr=typeof Reflect=="object"?Reflect:null,fc=mr&&typeof mr.apply=="function"?mr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},On;mr&&typeof mr.ownKeys=="function"?On=mr.ownKeys:Object.getOwnPropertySymbols?On=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:On=function(e){return Object.getOwnPropertyNames(e)};function vv(t){console&&console.warn&&console.warn(t)}var hc=Number.isNaN||function(e){return e!==e};function Ie(){Ie.init.call(this)}Qi.exports=Ie,Qi.exports.once=wv,Ie.EventEmitter=Ie,Ie.prototype._events=void 0,Ie.prototype._eventsCount=0,Ie.prototype._maxListeners=void 0;var lc=10;function Ln(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 lc},set:function(t){if(typeof t!="number"||t<0||hc(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");lc=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||hc(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 dc(t){return t._maxListeners===void 0?Ie.defaultMaxListeners:t._maxListeners}Ie.prototype.getMaxListeners=function(){return dc(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")fc(h,this,r);else for(var f=h.length,l=_c(h,f),n=0;n<f;++n)fc(l[n],this,r);return!0};function pc(t,e,r,n){var i,s,o;if(Ln(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=dc(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,vv(a)}return t}Ie.prototype.addListener=function(e,r){return pc(this,e,r,!1)},Ie.prototype.on=Ie.prototype.addListener,Ie.prototype.prependListener=function(e,r){return pc(this,e,r,!0)};function _v(){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 gc(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=_v.bind(n);return i.listener=r,n.wrapFn=i,i}Ie.prototype.once=function(e,r){return Ln(r),this.on(e,gc(this,e,r)),this},Ie.prototype.prependOnceListener=function(e,r){return Ln(r),this.prependListener(e,gc(this,e,r)),this},Ie.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Ln(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():bv(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 yc(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?mv(i):_c(i,i.length)}Ie.prototype.listeners=function(e){return yc(this,e,!0)},Ie.prototype.rawListeners=function(e){return yc(this,e,!1)},Ie.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):vc.call(t,e)},Ie.prototype.listenerCount=vc;function vc(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?On(this._events):[]};function _c(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function bv(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function mv(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function wv(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))}bc(t,e,s,{once:!0}),e!=="error"&&Ev(t,i,{once:!0})})}function Ev(t,e,r){typeof t.on=="function"&&bc(t,"error",e,r)}function bc(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 mc=10,Dv=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:require("ws"),xv=()=>typeof window<"u",Sv=Dv();class Ov{constructor(e){if(this.url=e,this.events=new Qi.exports.EventEmitter,this.registering=!1,!$s(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(!$s(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=Is.isReactNative()?void 0:{rejectUnauthorized:!Tf(e)},s=new Sv(e,[],i);xv()?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"?ti(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 Ls(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>mc&&this.events.setMaxListeners(mc)}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 es={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]",E="[object Error]",m="[object Function]",b="[object GeneratorFunction]",N="[object Map]",R="[object Number]",B="[object Null]",S="[object Object]",I="[object Promise]",y="[object Proxy]",x="[object RegExp]",w="[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[E]=Y[m]=Y[N]=Y[R]=Y[S]=Y[x]=Y[w]=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,bt=we?we.toStringTag:void 0,ar=Object.getOwnPropertySymbols,Qr=De?De.isBuffer:void 0,Un=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 Lb(p){var L=this.__data__;if(Me){var $=L[p];return $===n?void 0:$}return ne.call(L,p)?L[p]:void 0}function Ib(p){var L=this.__data__;return Me?L[p]!==void 0:ne.call(L,p)}function Ab(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=Lb,Pe.prototype.has=Ib,Pe.prototype.set=Ab;function Kt(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function Tb(){this.__data__=[],this.size=0}function Cb(p){var L=this.__data__,$=Bn(L,p);if($<0)return!1;var k=L.length-1;return $==k?L.pop():kt.call(L,$,1),--this.size,!0}function Rb(p){var L=this.__data__,$=Bn(L,p);return $<0?void 0:L[$][1]}function Pb(p){return Bn(this.__data__,p)>-1}function Nb(p,L){var $=this.__data__,k=Bn($,p);return k<0?(++this.size,$.push([p,L])):$[k][1]=L,this}Kt.prototype.clear=Tb,Kt.prototype.delete=Cb,Kt.prototype.get=Rb,Kt.prototype.has=Pb,Kt.prototype.set=Nb;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 $b(){this.size=0,this.__data__={hash:new Pe,map:new(Fe||Kt),string:new Pe}}function Fb(p){var L=zn(this,p).delete(p);return this.size-=L?1:0,L}function Mb(p){return zn(this,p).get(p)}function Ub(p){return zn(this,p).has(p)}function jb(p,L){var $=zn(this,p),k=$.size;return $.set(p,L),this.size+=$.size==k?0:1,this}cr.prototype.clear=$b,cr.prototype.delete=Fb,cr.prototype.get=Mb,cr.prototype.has=Ub,cr.prototype.set=jb;function jn(p){var L=-1,$=p==null?0:p.length;for(this.__data__=new cr;++L<$;)this.add(p[L])}function Bb(p){return this.__data__.set(p,n),this}function zb(p){return this.__data__.has(p)}jn.prototype.add=jn.prototype.push=Bb,jn.prototype.has=zb;function Yt(p){var L=this.__data__=new Kt(p);this.size=L.size}function Kb(){this.__data__=new Kt,this.size=0}function qb(p){var L=this.__data__,$=L.delete(p);return this.size=L.size,$}function Hb(p){return this.__data__.get(p)}function Vb(p){return this.__data__.has(p)}function Gb(p,L){var $=this.__data__;if($ instanceof Kt){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=Kb,Yt.prototype.delete=qb,Yt.prototype.get=Hb,Yt.prototype.has=Vb,Yt.prototype.set=Gb;function Wb(p,L){var $=Kn(p),k=!$&&c1(p),Re=!$&&!k&&ls(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")||n1(Ne,at)))&&nt.push(Ne);return nt}function Bn(p,L){for(var $=p.length;$--;)if(Cu(p[$][0],L))return $;return-1}function kb(p,L,$){var k=L(p);return Kn(p)?k:de(k,$(p))}function en(p){return p==null?p===void 0?U:B:bt&&bt in Object(p)?t1(p):a1(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:Yb(p,L,$,k,Iu,Re)}function Yb(p,L,$,k,Re,ie){var Ue=Kn(p),nt=Kn(L),at=Ue?h:Jt(p),Ne=nt?h:Jt(L);at=at==a?S:at,Ne=Ne==a?S:Ne;var mt=at==S,It=Ne==S,ut=at==Ne;if(ut&&ls(p)){if(!ls(L))return!1;Ue=!0,mt=!1}if(ut&&!mt)return ie||(ie=new Yt),Ue||$u(p)?Au(p,L,$,k,Re,ie):Qb(p,L,at,$,k,Re,ie);if(!($&i)){var Dt=mt&&ne.call(p,"__wrapped__"),xt=It&&ne.call(L,"__wrapped__");if(Dt||xt){var Xt=Dt?p.value():p,qt=xt?L.value():L;return ie||(ie=new Yt),Re(Xt,qt,$,k,ie)}}return ut?(ie||(ie=new Yt),e1(p,L,$,k,Re,ie)):!1}function Jb(p){if(!Nu(p)||s1(p))return!1;var L=Ru(p)?Ee:q;return L.test(ur(p))}function Xb(p){return tn(p)&&Pu(p.length)&&!!Y[en(p)]}function Zb(p){if(!o1(p))return Un(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 mt=-1,It=!0,ut=$&s?new jn:void 0;for(ie.set(p,L),ie.set(L,p);++mt<nt;){var Dt=p[mt],xt=L[mt];if(k)var Xt=Ue?k(xt,Dt,mt,L,p,ie):k(Dt,xt,mt,p,L,ie);if(Xt!==void 0){if(Xt)continue;It=!1;break}if(ut){if(!me(L,function(qt,fr){if(!ye(ut,fr)&&(Dt===qt||Re(Dt,qt,$,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 Qb(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 E:return p.name==L.name&&p.message==L.message;case x:case c:return p==L+"";case N:var nt=le;case w: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 mt=Au(nt(p),nt(L),k,Re,ie,Ue);return Ue.delete(p),mt;case d:if(Ve)return Ve.call(p)==Ve.call(L)}return!1}function e1(p,L,$,k,Re,ie){var Ue=$&i,nt=Tu(p),at=nt.length,Ne=Tu(L),mt=Ne.length;if(at!=mt&&!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 qt=p[ut],fr=L[ut];if(k)var Fu=Ue?k(fr,qt,ut,L,p,ie):k(qt,fr,ut,p,L,ie);if(!(Fu===void 0?qt===fr||Re(qt,fr,$,k,ie):Fu)){xt=!1;break}Xt||(Xt=ut=="constructor")}if(xt&&!Xt){var qn=p.constructor,Hn=L.constructor;qn!=Hn&&"constructor"in p&&"constructor"in L&&!(typeof qn=="function"&&qn instanceof qn&&typeof Hn=="function"&&Hn instanceof Hn)&&(xt=!1)}return ie.delete(p),ie.delete(L),xt}function Tu(p){return kb(p,h1,r1)}function zn(p,L){var $=p.__data__;return i1(L)?$[typeof L=="string"?"string":"hash"]:$.map}function Dr(p,L){var $=pe(p,L);return Jb($)?$:void 0}function t1(p){var L=ne.call(p,bt),$=p[bt];try{p[bt]=void 0;var k=!0}catch{}var Re=be.call(p);return k&&(L?p[bt]=$:delete p[bt]),Re}var r1=ar?function(p){return p==null?[]:(p=Object(p),ve(ar(p),function(L){return $t.call(p,L)}))}:l1,Jt=en;(ze&&Jt(new ze(new ArrayBuffer(1)))!=J||Fe&&Jt(new Fe)!=N||Ke&&Jt(Ke.resolve())!=I||qe&&Jt(new qe)!=w||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 w;case et:return K}return L});function n1(p,L){return L=L??o,!!L&&(typeof p=="number"||ee.test(p))&&p>-1&&p%1==0&&p<L}function i1(p){var L=typeof p;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?p!=="__proto__":p===null}function s1(p){return!!_e&&_e in p}function o1(p){var L=p&&p.constructor,$=typeof L=="function"&&L.prototype||te;return p===$}function a1(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 c1=Lu(function(){return arguments}())?Lu:function(p){return tn(p)&&ne.call(p,"callee")&&!$t.call(p,"callee")},Kn=Array.isArray;function u1(p){return p!=null&&Pu(p.length)&&!Ru(p)}var ls=Qr||d1;function f1(p,L){return Iu(p,L)}function Ru(p){if(!Nu(p))return!1;var L=en(p);return L==m||L==b||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):Xb;function h1(p){return u1(p)?Wb(p):Zb(p)}function l1(){return[]}function d1(){return!1}t.exports=f1})(es,es.exports);var Lv=es.exports,Iv=Object.defineProperty,wc=Object.getOwnPropertySymbols,Av=Object.prototype.hasOwnProperty,Tv=Object.prototype.propertyIsEnumerable,Ec=(t,e,r)=>e in t?Iv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ht=(t,e)=>{for(var r in e||(e={}))Av.call(e,r)&&Ec(t,r,e[r]);if(wc)for(var r of wc(e))Tv.call(e,r)&&Ec(t,r,e[r]);return t};function Cv(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(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var N=0,R=0,B=0,S=b.length;B!==S&&b[B]===0;)B++,N++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=b[B],w=0,c=I-1;(x!==0||w<R)&&c!==-1;c--,w++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=w,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 E(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var N=0;if(b[N]!==" "){for(var R=0,B=0;b[N]===h;)R++,N++;for(var S=(b.length-N)*f+1>>>0,I=new Uint8Array(S);b[N];){var y=r[b.charCodeAt(N)];if(y===255)return;for(var x=0,w=S-1;(y!==0||x<B)&&w!==-1;w--,x++)y+=a*I[w]>>>0,I[w]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,N++}if(b[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(b){var N=E(b);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:E,decode:m}}var Rv=Cv,Pv=Rv;const Dc=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")},Nv=t=>new TextEncoder().encode(t),$v=t=>new TextDecoder().decode(t);class Fv{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 Mv{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 xc(this,e)}}class Uv{constructor(e){this.decoders=e}or(e){return xc(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 xc=(t,e)=>new Uv(ht(ht({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class jv{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Fv(e,r,n),this.decoder=new Mv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const In=({name:t,prefix:e,encode:r,decode:n})=>new jv(t,e,r,n),Jr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Pv(r,e);return In({prefix:t,name:e,encode:n,decode:s=>Dc(i(s))})},Bv=(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},zv=(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})=>In({prefix:e,name:t,encode(i){return zv(i,n,r)},decode(i){return Bv(i,n,r,t)}}),Kv=In({prefix:"\0",name:"identity",encode:t=>$v(t),decode:t=>Nv(t)});var qv=Object.freeze({__proto__:null,identity:Kv});const Hv=ot({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Vv=Object.freeze({__proto__:null,base2:Hv});const Gv=ot({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Wv=Object.freeze({__proto__:null,base8:Gv});const kv=Jr({prefix:"9",name:"base10",alphabet:"0123456789"});var Yv=Object.freeze({__proto__:null,base10:kv});const Jv=ot({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xv=ot({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Zv=Object.freeze({__proto__:null,base16:Jv,base16upper:Xv});const Qv=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),e_=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),t_=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),r_=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),n_=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),i_=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),s_=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),o_=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),a_=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var c_=Object.freeze({__proto__:null,base32:Qv,base32upper:e_,base32pad:t_,base32padupper:r_,base32hex:n_,base32hexupper:i_,base32hexpad:s_,base32hexpadupper:o_,base32z:a_});const u_=Jr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),f_=Jr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var h_=Object.freeze({__proto__:null,base36:u_,base36upper:f_});const l_=Jr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),d_=Jr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var p_=Object.freeze({__proto__:null,base58btc:l_,base58flickr:d_});const g_=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),y_=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),v_=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),__=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var b_=Object.freeze({__proto__:null,base64:g_,base64pad:y_,base64url:v_,base64urlpad:__});const Sc=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}"),m_=Sc.reduce((t,e,r)=>(t[r]=e,t),[]),w_=Sc.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function E_(t){return t.reduce((e,r)=>(e+=m_[r],e),"")}function D_(t){const e=[];for(const r of t){const n=w_[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const x_=In({prefix:"\u{1F680}",name:"base256emoji",encode:E_,decode:D_});var S_=Object.freeze({__proto__:null,base256emoji:x_}),O_=Lc,Oc=128,L_=127,I_=~L_,A_=Math.pow(2,31);function Lc(t,e,r){e=e||[],r=r||0;for(var n=r;t>=A_;)e[r++]=t&255|Oc,t/=128;for(;t&I_;)e[r++]=t&255|Oc,t>>>=7;return e[r]=t|0,Lc.bytes=r-n+1,e}var T_=ts,C_=128,Ic=127;function ts(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw ts.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Ic)<<i:(o&Ic)*Math.pow(2,i),i+=7}while(o>=C_);return ts.bytes=s-n,r}var R_=Math.pow(2,7),P_=Math.pow(2,14),N_=Math.pow(2,21),$_=Math.pow(2,28),F_=Math.pow(2,35),M_=Math.pow(2,42),U_=Math.pow(2,49),j_=Math.pow(2,56),B_=Math.pow(2,63),z_=function(t){return t<R_?1:t<P_?2:t<N_?3:t<$_?4:t<F_?5:t<M_?6:t<U_?7:t<j_?8:t<B_?9:10},K_={encode:O_,decode:T_,encodingLength:z_},Ac=K_;const Tc=(t,e,r=0)=>(Ac.encode(t,e,r),e),Cc=t=>Ac.encodingLength(t),rs=(t,e)=>{const r=e.byteLength,n=Cc(t),i=n+Cc(r),s=new Uint8Array(i+r);return Tc(t,s,0),Tc(r,s,n),s.set(e,i),new q_(t,r,e,s)};class q_{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Rc=({name:t,code:e,encode:r})=>new H_(t,e,r);class H_{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?rs(this.code,r):r.then(n=>rs(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Pc=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),V_=Rc({name:"sha2-256",code:18,encode:Pc("SHA-256")}),G_=Rc({name:"sha2-512",code:19,encode:Pc("SHA-512")});var W_=Object.freeze({__proto__:null,sha256:V_,sha512:G_});const Nc=0,k_="identity",$c=Dc;var Y_=Object.freeze({__proto__:null,identity:{code:Nc,name:k_,encode:$c,digest:t=>rs(Nc,$c(t))}});new TextEncoder,new TextDecoder;const Fc=ht(ht(ht(ht(ht(ht(ht(ht(ht(ht({},qv),Vv),Wv),Yv),Zv),c_),h_),p_),b_),S_);ht(ht({},W_),Y_);function J_(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Mc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Uc=Mc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ns=Mc("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=J_(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),X_=ht({utf8:Uc,"utf-8":Uc,hex:Fc.base16,latin1:ns,ascii:ns,binary:ns},Fc);function Z_(t,e="utf8"){const r=X_[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 jc="wc",Q_=2,is="core",Gt=`${jc}@${2}:${is}:`,e0={name:is,logger:"error"},t0={database:":memory:"},r0="crypto",Bc="client_ed25519_seed",n0=Z.ONE_DAY,i0="keychain",s0="0.3",o0="messages",a0="0.3",c0=Z.SIX_HOURS,u0="publisher",zc="irn",f0="error",h0="wss://relay.walletconnect.com",l0="relayer",vt={message:"relayer_message",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed"},d0="_subscription",An={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Kc=Z.ONE_SECOND,p0="2.1.3",g0="0.3",Rt={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},y0="subscription",v0="0.3",_0=Z.FIVE_SECONDS*1e3,b0="pairing",m0="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"},w0="history",E0="0.3",D0="expirer",Et={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},x0="0.3";class S0{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=i0,this.version=s0,this.initialized=!1,this.storagePrefix=Gt,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,Xo(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Zo(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 O0{constructor(e,r,n){this.core=e,this.logger=r,this.name=r0,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=uc(i);return cc(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=uc(s),a=Ti();return await yv(a,i,n0,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=Vo(o),h=Ir(s);if(Go(a)){const E=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(E,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(Go(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 ti(f)},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.keychain=n||new S0(this.core,this.logger)}get context(){return Oe.getLoggerContext(this.logger)}getPayloadType(e){const r=Ri(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(Bc)}catch{e=Ti(),await this.keychain.set(Bc,e)}return Z_(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 L0 extends Yy{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=o0,this.version=a0,this.initialized=!1,this.storagePrefix=Gt,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=Ci(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=Ci(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,Xo(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Zo(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 I0 extends Jy{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new zt.exports.EventEmitter,this.name=u0,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||c0,a=Pi(s),h=s?.prompt||!1,f=s?.tag||0,l={topic:n,message:i,opts:{ttl:o,relay:a,prompt:h,tag:f}},D=Ci(i);this.queue.set(D,l);try{await await Qo(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:Ni(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return wt((a=D.params)==null?void 0:a.prompt)&&((h=D.params)==null||delete h.prompt),wt((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 A0{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 T0=Object.defineProperty,C0=Object.defineProperties,R0=Object.getOwnPropertyDescriptors,qc=Object.getOwnPropertySymbols,P0=Object.prototype.hasOwnProperty,N0=Object.prototype.propertyIsEnumerable,Hc=(t,e,r)=>e in t?T0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tn=(t,e)=>{for(var r in e||(e={}))P0.call(e,r)&&Hc(t,r,e[r]);if(qc)for(var r of qc(e))N0.call(e,r)&&Hc(t,r,e[r]);return t},ss=(t,e)=>C0(t,R0(e));class $0 extends Qy{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new A0,this.events=new zt.exports.EventEmitter,this.name=y0,this.version=v0,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=Gt,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=Pi(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)>=_0&&(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=Pi(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:Ni(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 Qo(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:Ni(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,ss(Tn({},r),{id:e})),this.pending.delete(r.topic)}onResubscribe(e,r){this.addSubscription(e,ss(Tn({},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,Tn({},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,ss(Tn({},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 F0=Object.defineProperty,Vc=Object.getOwnPropertySymbols,M0=Object.prototype.hasOwnProperty,U0=Object.prototype.propertyIsEnumerable,Gc=(t,e,r)=>e in t?F0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j0=(t,e)=>{for(var r in e||(e={}))M0.call(e,r)&&Gc(t,r,e[r]);if(Vc)for(var r of Vc(e))U0.call(e,r)&&Gc(t,r,e[r]);return t};class B0 extends Xy{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zt.exports.EventEmitter,this.name=l0,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):yn(Oe.getDefaultLoggerOptions({level:e.logger||f0})),this.messages=new L0(this.logger,e.core),this.subscriber=new $0(this,this.logger),this.publisher=new I0(this,this.logger),this.relayUrl=e?.relayUrl||h0,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,Kc)),await this.transportOpen(e)}async createProvider(){const e=await this.core.crypto.signJWT(this.relayUrl);return new Qn(new Ov(mp({sdkVersion:p0,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}),Xn(e)){if(!e.method.endsWith(d0))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(j0({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(An.payload,e=>this.onProviderPayload(e)),this.provider.on(An.connect,()=>{this.events.emit(vt.connect)}),this.provider.on(An.disconnect,()=>{this.events.emit(vt.disconnect),this.attemptToReconnect()}),this.provider.on(An.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(Kc))}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var z0=Object.defineProperty,Wc=Object.getOwnPropertySymbols,K0=Object.prototype.hasOwnProperty,q0=Object.prototype.propertyIsEnumerable,kc=(t,e,r)=>e in t?z0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Yc=(t,e)=>{for(var r in e||(e={}))K0.call(e,r)&&kc(t,r,e[r]);if(Wc)for(var r of Wc(e))q0.call(e,r)&&kc(t,r,e[r]);return t};class Cn extends Zy{constructor(e,r,n,i=Gt,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=g0,this.cached=[],this.initialized=!1,this.storagePrefix=Gt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{Bp(o)?this.map.set(o.id,o):zp(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!wt(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=>Lv(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=Yc(Yc({},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 H0{constructor(e,r){this.core=e,this.logger=r,this.name=b0,this.version=m0,this.events=new zt.exports,this.initialized=!1,this.storagePrefix=Gt,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=Ti(),i=await this.core.crypto.setSymKey(n),s=Bt(Z.FIVE_MINUTES),o={protocol:zc},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=>Vt(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(!jp(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(Vt(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 Cn(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);Xn(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Zn(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}=ta(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}}class V0 extends ky{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new zt.exports.EventEmitter,this.name=w0,this.version=E0,this.cached=[],this.initialized=!1,this.storagePrefix=Gt,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 G0 extends ev{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new zt.exports.EventEmitter,this.name=D0,this.version=x0,this.cached=[],this.initialized=!1,this.storagePrefix=Gt,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 W0=Object.defineProperty,Jc=Object.getOwnPropertySymbols,k0=Object.prototype.hasOwnProperty,Y0=Object.prototype.propertyIsEnumerable,Xc=(t,e,r)=>e in t?W0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zc=(t,e)=>{for(var r in e||(e={}))k0.call(e,r)&&Xc(t,r,e[r]);if(Jc)for(var r of Jc(e))Y0.call(e,r)&&Xc(t,r,e[r]);return t};class os extends Wy{constructor(e){super(e),this.protocol=jc,this.version=Q_,this.name=is,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:yn(Oe.getDefaultLoggerOptions({level:e?.logger||e0.logger}));this.logger=Oe.generateChildLogger(r,this.name),this.heartbeat=new Vr.HeartBeat,this.crypto=new O0(this,this.logger,e?.keychain),this.history=new V0(this,this.logger),this.expirer=new G0(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Wg(Zc(Zc({},t0),e?.storageOptions)),this.relayer=new B0({core:this,logger:this.logger,relayUrl:e?.relayUrl,projectId:this.projectId}),this.pairing=new H0(this,this.logger)}static async init(e){const r=new os(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 J0=os;var Rn={exports:{}},wr=typeof Reflect=="object"?Reflect:null,Qc=wr&&typeof wr.apply=="function"?wr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Pn;wr&&typeof wr.ownKeys=="function"?Pn=wr.ownKeys:Object.getOwnPropertySymbols?Pn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Pn=function(e){return Object.getOwnPropertyNames(e)};function X0(t){console&&console.warn&&console.warn(t)}var eu=Number.isNaN||function(e){return e!==e};function Ae(){Ae.init.call(this)}Rn.exports=Ae,Rn.exports.once=tb,Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;var tu=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(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return tu},set:function(t){if(typeof t!="number"||t<0||eu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");tu=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||eu(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 ru(t){return t._maxListeners===void 0?Ae.defaultMaxListeners:t._maxListeners}Ae.prototype.getMaxListeners=function(){return ru(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")Qc(h,this,r);else for(var f=h.length,l=au(h,f),n=0;n<f;++n)Qc(l[n],this,r);return!0};function nu(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=ru(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,X0(a)}return t}Ae.prototype.addListener=function(e,r){return nu(this,e,r,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(e,r){return nu(this,e,r,!0)};function Z0(){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 iu(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Z0.bind(n);return i.listener=r,n.wrapFn=i,i}Ae.prototype.once=function(e,r){return Nn(r),this.on(e,iu(this,e,r)),this},Ae.prototype.prependOnceListener=function(e,r){return Nn(r),this.prependListener(e,iu(this,e,r)),this},Ae.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():Q0(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 su(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):au(i,i.length)}Ae.prototype.listeners=function(e){return su(this,e,!0)},Ae.prototype.rawListeners=function(e){return su(this,e,!1)},Ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ou.call(t,e)},Ae.prototype.listenerCount=ou;function ou(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?Pn(this._events):[]};function au(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Q0(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 tb(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))}cu(t,e,s,{once:!0}),e!=="error"&&rb(t,i,{once:!0})})}function rb(t,e,r){typeof t.on=="function"&&cu(t,"error",e,r)}function cu(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 uu="wc",fu=2,hu="client",as=`${uu}@${fu}:${hu}:`,cs={name:hu,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},nb="proposal",ib="session",$n=Z.SEVEN_DAYS,sb="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}}},ob="request";var ab=Object.defineProperty,cb=Object.defineProperties,ub=Object.getOwnPropertyDescriptors,lu=Object.getOwnPropertySymbols,fb=Object.prototype.hasOwnProperty,hb=Object.prototype.propertyIsEnumerable,du=(t,e,r)=>e in t?ab(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wt=(t,e)=>{for(var r in e||(e={}))fb.call(e,r)&&du(t,r,e[r]);if(lu)for(var r of lu(e))hb.call(e,r)&&du(t,r,e[r]);return t},pu=(t,e)=>cb(t,ub(e));class lb extends rv{constructor(e){super(e),this.name=sb,this.events=new Rn.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:zc}],proposer:{publicKey:f,metadata:this.client.metadata}},{reject:D,resolve:E,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=pu(Wt({},B),{requiredNamespaces:i});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}),E(S)}}),!o){const{message:R}=V("NO_MATCHING_KEY",`connect() pairing topic: ${o}`);throw new Error(R)}const b=await this.sendRequest(o,"wc_sessionPropose",l),N=Bt(Z.FIVE_MINUTES);return await this.setProposal(b,Wt({id:b,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,{pairingTopic:o,proposer:a,requiredNamespaces:h}=this.client.proposal.get(n),f=await this.client.core.crypto.generateKeyPair(),l=a.publicKey,D=await this.client.core.crypto.generateSharedKey(f,l),E={relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:h,controller:{publicKey:f,metadata:this.client.metadata},expiry:Bt($n)};await this.client.core.relayer.subscribe(D);const m=await this.sendRequest(D,"wc_sessionSettle",E),{done:b,resolve:N,reject:R}=nr();this.events.once(je("session_approve",m),({error:S})=>{S?R(S):N(this.client.session.get(D))});const B=pu(Wt({},E),{topic:D,acknowledged:!1,self:E.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:f});return await this.client.session.set(D,B),await this.setExpiry(D,Bt($n)),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:B.peer.metadata}),o&&n&&(await this.sendResult(n,o,{relay:{protocol:i??"irn"},responderPublicKey:f}),await this.client.proposal.delete(n,Ge("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:o})),{topic:D,acknowledged:b}},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($n)),{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=>Mp(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=>{Vt(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Vt(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(Wt({},n.params));const o=Bt(Z.FIVE_MINUTES),a=Wt({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}=n.params,l={topic:r,relay:o,expiry:h,namespaces:f,acknowledged:!0,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:l})}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(Wt({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($n)),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(Wt({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(Wt({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;wt(n)||await this.isValidPairingTopic(n);const o=Vp(i,"connect()");if(o)throw new Error(o.message);if(!Gp(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=Mi(i,"approve()");if(a)throw new Error(a.message);const h=da(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),!kp(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(!ha(n)){const{message:f}=V("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(f)}const a=Kp(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const h=Mi(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Vt(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=Mi(i,"update()");if(o)throw new Error(o.message);const a=da(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(!la(o,s)){const{message:a}=V("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!Yp(i)){const{message:a}=V("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!Zp(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),!Jp(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(!la(o,s)){const{message:a}=V("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!Xp(i)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!Qp(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);Xn(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Zn(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}=ta(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(Vt(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(Vt(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(!Wp(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(Vt(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:r}=V("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class db extends Cn{constructor(e,r){super(e,r,nb,as),this.core=e,this.logger=r}}class pb extends Cn{constructor(e,r){super(e,r,ib,as),this.core=e,this.logger=r}}class gb extends Cn{constructor(e,r){super(e,r,ob,as),this.core=e,this.logger=r}}class us extends tv{constructor(e){super(e),this.protocol=uu,this.version=fu,this.name=cs.name,this.events=new Rn.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||cs.name,this.metadata=e?.metadata||yp();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:yn(Oe.getDefaultLoggerOptions({level:e?.logger||cs.logger}));this.core=e?.core||new J0(e),this.logger=Oe.generateChildLogger(r,this.name),this.session=new pb(this.core,this.logger),this.proposal=new db(this.core,this.logger),this.pendingRequest=new gb(this.core,this.logger),this.engine=new lb(this)}static async init(e){const r=new us(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 fs={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)},Fn;Er&&typeof Er.ownKeys=="function"?Fn=Er.ownKeys:Object.getOwnPropertySymbols?Fn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Fn=function(e){return Object.getOwnPropertyNames(e)};function yb(t){console&&console.warn&&console.warn(t)}var yu=Number.isNaN||function(e){return e!==e};function Te(){Te.init.call(this)}fs.exports=Te,fs.exports.once=mb,Te.EventEmitter=Te,Te.prototype._events=void 0,Te.prototype._eventsCount=0,Te.prototype._maxListeners=void 0;var vu=10;function Mn(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(Mn(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,yb(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 vb(){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=vb.bind(n);return i.listener=r,n.wrapFn=i,i}Te.prototype.once=function(e,r){return Mn(r),this.on(e,mu(this,e,r)),this},Te.prototype.prependOnceListener=function(e,r){return Mn(r),this.prependListener(e,mu(this,e,r)),this},Te.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Mn(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():_b(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?bb(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?Fn(this._events):[]};function Du(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function _b(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function bb(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function mb(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"&&wb(t,i,{once:!0})})}function wb(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 Eb(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 Db extends xf{constructor(e){super(),this.events=new fs.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?Si(this.session.namespaces):Xd(this.requiredNamespaces)}get accounts(){return this.session?xi(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(Eb(e))return this.client=e,this.registerEventListeners(),this.client;try{return this.initializing=!0,this.client=await us.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 xb=["eth_requestAccounts","eth_accounts","eth_chainId","eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","personal_sign"],Sb=["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[hs([t])]),r}function hs(t){return Number(t[0].split(":")[1])}class Ob{constructor(e){this.events=new Vn.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.rpc=Su(e),this.signer=this.setSignerProvider(e?.client),this.chainId=hs(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=Si(e.namespaces,[this.namespace]);this.setChainIds(r);const n=xi(e.namespaces,[this.namespace]);this.setAccounts(n)}),this.signer.connection.on(Nt.updated,e=>{const r=Si(e.namespaces,[this.namespace]);this.setChainIds(r);const n=xi(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 Db({requiredNamespaces:{[this.namespace]:{chains:this.rpc.chains,methods:this.rpc.methods,events:this.rpc.events}},client:e});return new Qn(r)}setHttpProvider(e){const r=Ou(`${this.namespace}:${e}`,this.rpc);return typeof r>"u"?void 0:new Qn(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=Ob,St.getEthereumChainId=hs,St.getRpcConfig=Su,St.getRpcUrl=Ou,St.signerEvents=Sb,St.signerMethods=xb,Object.defineProperty(St,"__esModule",{value:!0})});
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})});
67
67
  //# sourceMappingURL=index.umd.js.map